# 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
|
|
| 1680 | 1680 | |
| 1681 | 1681 | OUTPUT: |
| 1682 | 1682 | |
| 1683 | | - matrix. |
| | 1683 | A matrix over `ZZ`. |
| 1684 | 1684 | |
| 1685 | 1685 | EXAMPLES:: |
| 1686 | 1686 | |
| … |
… |
|
| 1688 | 1688 | sage: fan.Gale_transform() |
| 1689 | 1689 | [ 1 0 1 0 -2] |
| 1690 | 1690 | [ 0 1 0 1 -2] |
| | 1691 | sage: _.base_ring() |
| | 1692 | Integer Ring |
| 1691 | 1693 | """ |
| 1692 | 1694 | if "_Gale_transform" not in self.__dict__: |
| 1693 | 1695 | m = self.ray_matrix().augment(matrix(self.lattice_dim(), 1)) |
| 1694 | 1696 | 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()) |
| 1696 | 1698 | return self._Gale_transform |
| 1697 | 1699 | |
| 1698 | 1700 | def generating_cone(self, n): |
diff -r 35ed7697767b -r d074078642de sage/schemes/generic/toric_divisor.py
|
a
|
b
|
|
| 1801 | 1801 | sage: P2.rational_class_group() |
| 1802 | 1802 | The toric rational divisor class group of a 2-d CPR-Fano |
| 1803 | 1803 | 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) |
| 1806 | 1806 | sage: Dclass = D.divisor_class(); Dclass |
| 1807 | 1807 | Divisor class [1] |
| 1808 | 1808 | sage: Dclass.lift() |
| 1809 | | V(x) |
| | 1809 | V(y) |
| 1810 | 1810 | sage: Dclass.parent() |
| 1811 | 1811 | The toric rational divisor class group of a 2-d CPR-Fano |
| 1812 | 1812 | toric variety covered by 3 affine patches |
| … |
… |
|
| 1823 | 1823 | sage: ToricRationalDivisorClassGroup(P2) |
| 1824 | 1824 | The toric rational divisor class group of a 2-d CPR-Fano |
| 1825 | 1825 | 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 |
| 1826 | 1846 | """ |
| 1827 | 1847 | self._variety = toric_variety |
| 1828 | 1848 | fan = toric_variety.fan() |
| … |
… |
|
| 1832 | 1852 | dimension=rk, sparse=False) |
| 1833 | 1853 | gale = fan.Gale_transform() |
| 1834 | 1854 | 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() |
| 1836 | 1859 | |
| 1837 | 1860 | def _repr_(self): |
| 1838 | 1861 | r""" |
diff -r 35ed7697767b -r d074078642de sage/schemes/generic/toric_divisor_class.pyx
|
a
|
b
|
|
| 286 | 286 | sage: D.divisor_class() |
| 287 | 287 | Divisor class [29, 6, 8, 10, 0] |
| 288 | 288 | 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) |
| 290 | 290 | sage: Dequiv == D |
| 291 | 291 | False |
| 292 | 292 | sage: Dequiv.divisor_class() == D.divisor_class() |