Ticket #9934: trac_9934_class_group_fixes.patch

File trac_9934_class_group_fixes.patch, 4.1 KB (added by vbraun, 3 years ago)

Initial patch

  • sage/geometry/fan.py

    # HG changeset patch
    # User Volker Braun <vbraun@stp.dias.ie>
    # Date 1284732094 -3600
    # Node ID d074078642def17598298c7d0c44bcaab9f5b5db
    # Parent  35ed7697767b0fa3b070a1d0c61b0f9df06e24b3
    Trac #9934: Toric divisor class -> divisor lift should be integral
    
    diff -r 35ed7697767b -r d074078642de sage/geometry/fan.py
    a b  
    16801680 
    16811681        OUTPUT: 
    16821682 
    1683         - matrix. 
     1683        A matrix over `ZZ`. 
    16841684 
    16851685        EXAMPLES:: 
    16861686 
     
    16881688            sage: fan.Gale_transform() 
    16891689            [ 1  0  1  0 -2] 
    16901690            [ 0  1  0  1 -2] 
     1691            sage: _.base_ring() 
     1692            Integer Ring 
    16911693        """ 
    16921694        if "_Gale_transform" not in self.__dict__: 
    16931695            m = self.ray_matrix().augment(matrix(self.lattice_dim(), 1)) 
    16941696            m = m.stack(matrix([1]*m.ncols())) 
    1695             self._Gale_transform = m.transpose().integer_kernel().matrix() 
     1697            self._Gale_transform = matrix(ZZ, m.transpose().integer_kernel().matrix()) 
    16961698        return self._Gale_transform 
    16971699 
    16981700    def generating_cone(self, n): 
  • sage/schemes/generic/toric_divisor.py

    diff -r 35ed7697767b -r d074078642de sage/schemes/generic/toric_divisor.py
    a b  
    18011801        sage: P2.rational_class_group() 
    18021802        The toric rational divisor class group of a 2-d CPR-Fano  
    18031803        toric variety covered by 3 affine patches 
    1804         sage: D = P2.divisor(1); D 
    1805         V(y) 
     1804        sage: D = P2.divisor(0); D 
     1805        V(x) 
    18061806        sage: Dclass = D.divisor_class(); Dclass 
    18071807        Divisor class [1] 
    18081808        sage: Dclass.lift() 
    1809         V(x) 
     1809        V(y) 
    18101810        sage: Dclass.parent() 
    18111811        The toric rational divisor class group of a 2-d CPR-Fano  
    18121812        toric variety covered by 3 affine patches 
     
    18231823            sage: ToricRationalDivisorClassGroup(P2) 
    18241824            The toric rational divisor class group of a 2-d CPR-Fano  
    18251825            toric variety covered by 3 affine patches 
     1826 
     1827        TESTS: 
     1828 
     1829        Make sure we lift integral classes to integral divisors:: 
     1830 
     1831            sage: rays = [(1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, 0, 1), (2, -1, -1)] 
     1832            sage: cones = [(0, 2, 3), (0, 2, 4), (0, 3, 4), (1, 2, 3), (1, 2, 4), (1, 3, 4)] 
     1833            sage: X = ToricVariety(Fan(cones=cones, rays=rays)) 
     1834            sage: Cl = X.rational_class_group() 
     1835            sage: Cl._projection_matrix 
     1836            [1 1 0 0 0] 
     1837            [0 2 1 1 1] 
     1838            sage: Cl._lift_matrix 
     1839            [1 0] 
     1840            [0 0] 
     1841            [0 0] 
     1842            [0 1] 
     1843            [0 0] 
     1844            sage: Cl._lift_matrix.base_ring() 
     1845            Integer Ring 
    18261846        """ 
    18271847        self._variety = toric_variety 
    18281848        fan = toric_variety.fan() 
     
    18321852                                                dimension=rk, sparse=False) 
    18331853        gale = fan.Gale_transform() 
    18341854        self._projection_matrix = gale.matrix_from_columns(range(nrays)) 
    1835         self._lift_matrix = self._projection_matrix.solve_right( identity_matrix(rk) ) 
     1855        D, U, V = self._projection_matrix.transpose().smith_form() 
     1856        assert all( D[i,i]==1 for i in range(0,D.ncols()) ), \ 
     1857            'This is a property of the Gale transform.' 
     1858        self._lift_matrix = (V*D.transpose()*U).transpose() 
    18361859 
    18371860    def _repr_(self): 
    18381861        r""" 
  • sage/schemes/generic/toric_divisor_class.pyx

    diff -r 35ed7697767b -r d074078642de sage/schemes/generic/toric_divisor_class.pyx
    a b  
    286286            sage: D.divisor_class() 
    287287            Divisor class [29, 6, 8, 10, 0] 
    288288            sage: Dequiv = D.divisor_class().lift(); Dequiv 
    289             29/2*V(z0) + 6*V(z1) + 8*V(z2) + 10*V(z3) 
     289            6*V(z1) - 17*V(z2) - 22*V(z3) - 7*V(z4) + 25*V(z6) + 32*V(z7) 
    290290            sage: Dequiv == D 
    291291            False 
    292292            sage: Dequiv.divisor_class() == D.divisor_class()