-
-
Notifications
You must be signed in to change notification settings - Fork 712
Addition of Chow ring ideal and Chow ring classes #38281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 175 commits
Commits
Show all changes
178 commits
Select commit
Hold shift + click to select a range
d038b95
Created Chow Ring Ideal Class
25shriya 1685022
Created class and defined groebner_basis() method
25shriya 0ab73bb
Modified groebner_basis() method
25shriya 237fdad
Added Augmented Chow Ring Ideal Class
25shriya d51bd1d
Modified ChowRingIdeal class
25shriya 462ce6c
Created Chow Ring class
25shriya ad4c43c
Created Augmented Chow Ring class
25shriya cbf6db4
Edited __init__ and _repr_short funcs
25shriya 873d9a7
Modified __init__() functions for both classes
25shriya 529bb10
Debugged __init__() function of Chow ring class
25shriya 6079e3d
Modified groebner_basis() method for both classes
25shriya 3f466b9
Added Documentation to both classes
25shriya 980c63f
Added Documentation to Chow ring class
25shriya ca4bdc4
Added Chow rings section in documentation
25shriya 7953806
Split Augmented Chow ring ideal class into 3 classes
25shriya 1d9210a
Edited Documentation
25shriya fb7c7ef
Merge branch 'sagemath:develop' into chow_ring
25shriya 8073820
Edited Documentation
25shriya b3f9e31
Created a documentation block for chow rings
25shriya b867da5
Edited latex() method
25shriya cba41ab
Corrected Doctests
25shriya c90fe5b
Edited Doctests
25shriya cf83d97
Corrected Doctests
25shriya d892cdb
Edited abstract class - AugmentedChowRingIdeal
25shriya fdd0444
Split ChowRingIdeal into 4 classes
25shriya 1d42f3a
Edited documentation
25shriya 20fa80f
Debugged groebner_basis() method for ChowRingIdeal_nonaug
25shriya 0ee932f
Added TestSuite.run() doctest to ChowRing class
25shriya 470d69b
Added basis() method
25shriya a724173
Edited attribute names
25shriya 7ab59ad
Modified chow_ring() method
25shriya 92e6f41
Merge branch 'develop' into chow_ring
25shriya 2ec5329
Modified basis() method
25shriya d9271fd
Debugged AugmentedChowRingIdeal_atom_free.__init__()
25shriya 9ad2a0a
Merge branch 'sagemath:develop' into chow_ring
25shriya 4d1097d
Added Element() class
25shriya d03c0e0
Written doctests for every method
25shriya c9a138f
Corrected Doctests for Element class
25shriya 72a160d
Edited _repr_() method
25shriya 4da26f3
Edited chow_ring() doctest
25shriya ca5ec9a
Wrote doctests for Element class
25shriya a90f02f
Edited chow_ring() doctest
25shriya 9d6489a
Wrote doctests for _gens_constructor()
25shriya c7fa9ea
Changed ChowRing category
25shriya 33aa1c0
Edited groebner_basis() method
25shriya 8c71e82
Added references
25shriya 6b6d0e1
Wrote mathematical definition of Chow ring
25shriya 01ab04b
Wrote mathematical definition of Chow ring ideal
25shriya f7377c8
Modified chow_ring() doctest
25shriya e41edf8
Debugged basis() method
25shriya 367225a
Wrote doctests for groebner_basis() methods
25shriya 9ec9b18
Updated references
25shriya c63627a
Incorporated GitHub comments
25shriya 434c860
Incorporated GitHub comments for ideal file
25shriya 16ffe62
Modified basis() method
25shriya 4fc0ac0
Modified ChowRingIdeal_nonaug.groebner_basis()
25shriya 63a5e8d
Edited ChowRingIdeal_nonaug.groebner_basis() method
25shriya 3763e59
Edited groebner_basis() lattice
25shriya 73acafe
Edited basis() method
25shriya 32b88fb
Merge branch 'sagemath:develop' into chow_ring
25shriya b32359c
Edited basis() method
25shriya 1cede4b
Edited basis() method- added product func
25shriya dc8e380
Debugged groebner_basis() method
25shriya 2c53ea5
Merge branch 'sagemath:develop' into chow_ring
25shriya 5e6bf99
Debugged groebner_basis() method for ChowRingIdeal_nonaug
25shriya 4ed084f
Edited max_powers
25shriya 9e11b41
Debugged groebner_basis() method as per hand calculation
25shriya ec079dc
Added test case for empty subset
25shriya 9ad9145
Added comments and edited doctests
25shriya 86e2a9d
Merge branch 'sagemath:develop' into chow_ring
25shriya 8b8ab5d
Edited basis() method for augmented ChowRing (fy presentation)
25shriya 91a757a
Edited basis() method for augmented Chow Ring (atom-free presentation)
25shriya 12c0d5f
Added 'algorithm' parameter to all groebner_basis() methods
25shriya 4dd6155
Merge branch 'sagemath:develop' into chow_ring
25shriya 369db7f
Edited and formatted doctests
25shriya 5427630
Edited and formatted doctests for the Chow ring class
25shriya 53ea5fc
Edited suggested changes to chow_ring.py
25shriya d631779
Edited suggested changes to chow_ring_ideal.py
25shriya 6ddca26
Fixed doctest typos in chow_ring_ideal.py
25shriya 80a8892
Fixed doctest typos in chow_ring_ideal.py
25shriya 17b6287
Fixed doctest typos in chow_ring.py
25shriya 7439ab9
Debugged all 3 basis() method cases
25shriya 96a7dc8
Optimized groebner_basis() method
25shriya f01279a
Fixed typos in groebner_basis() method
25shriya d0fb2ba
Added LaTeX method for the ideals
25shriya 3ed13fa
Edited definintions for augmented Chow ring ideal
25shriya db165d7
Fixed definitions of augmented Chow ring ideals
25shriya 88b20fb
Edited groebner_basis() method for all 3 ideals
25shriya 4669fd6
Edited chow_ring() function examples
25shriya a84a41d
Edited Doctests
25shriya e45f4b9
Edited doctests for ideals
25shriya ffd3fef
Edited basis() method for all 3 cases
25shriya e2faf65
Added hyperlinks to ideals definitions in chow_ring.py
25shriya 8505fa7
Changed ChowRingIdeal_nonaug._gens_constructor()
25shriya 9c928e2
Changed definition of the non aug ideal
25shriya 03355c9
Edited documentation of ideals file
25shriya 484013c
Merge branch 'sagemath:develop' into chow_ring
25shriya 629baa2
Formatted doctests in chow_ring.py
25shriya cd3a3fc
Formatted doctests in the ideals file
25shriya bdfded8
Corrected doctest outputs
25shriya 91bc8e0
Corrected linting errors for ideals file
25shriya b9556d8
Corrected linting errors in ideals file
25shriya cfb1fbb
Corrected doctest output
25shriya 231cb1f
Corrected linting error
25shriya 7b60d51
Resolved linting errors
25shriya 12e8d93
Optimized basis() method for all 3 cases
25shriya 6a72bd3
Corrected doctests for Element() subclass
25shriya 31b7afb
Corrected linting errors in ideals file
25shriya e36e4ea
Corrected linting errors in chow_ring.py
25shriya 9221947
Corrected linting errors in ideals file
25shriya 4156022
Tested ideals file
25shriya 35fd32b
Corrected basis() method
25shriya 7710eb5
Fixed linting error in matroid.pyx
25shriya d15176e
Edited basis() method
25shriya 7614be8
Edited definition of augmented Chow ring ideal for both presentations
25shriya d54f0cb
Changed defn of augmented Chow ring ideal FY presentation
25shriya d2720e3
Debugged basis() method for atom-free case
25shriya f296378
Optimized definition of atom-free presentation
25shriya ab57cd9
Debugged groebner_basis()
25shriya 8b2d98f
Debugged basis()
25shriya 5fea8af
Debugged groebner_basis() for all 3 ideals
25shriya 283a45b
Corrected doctests
25shriya 058252f
Debugged basis() for FY presentation of the augmented Chow ring
25shriya 1922a1a
Debugged basis() for augmented Chow ring for both presentations
25shriya 1d2e204
Corrected linting errors
25shriya 49276c1
Corrected doctests
25shriya 37ce1ae
Merge branch 'sagemath:develop' into chow_ring
25shriya 94527d8
Corrected doctests in chow_ring() method
25shriya 8fdd625
Corrected Doctests for chow_ring() method
25shriya 193ca4e
Corrected doctests in chow_ring() method
25shriya 719d270
Formatted docstrings
25shriya 8caea48
Formatted docstrings
25shriya 2abf2cc
Edited docstrings
25shriya ef0e1d6
Edited doctests
25shriya c9d4553
Edited references formatting
25shriya 8f52723
Reformatted references file
25shriya cb6dcc6
Formatted definitions
25shriya 5b79644
Changed index.rst for matroids
25shriya 2a5f0ca
Changed Documentation for augmented Chow rings definition
25shriya 5b7a29f
Edited inputs for Chow ring class
25shriya 3c6a9e1
Edited _latex_() for ChowRing() class
25shriya c0ba0c6
Edited basis() method
25shriya aa11b06
Edited documentation
25shriya 9c93b84
Resolved suggested changes
25shriya 99d843f
Corrected linting errors in ideal file
25shriya 6ef419f
Corrected doctests
25shriya f423738
Added normal_basis() method for all 3 classes
25shriya e4031ad
Added normal_basis() method doctests for all 3 classes
25shriya 744fc93
Added input parameters for chow_ring() method
25shriya 8468ff1
Edited augmented chow ring ideal definition for atom-free presentation
25shriya 5070e36
Corrected linting errors
25shriya a022f89
Changed augmented chow ring ideal definition
25shriya 3abd400
Corrected doctests
25shriya a6ecb2d
Removed flats_generator() method
25shriya ad966f0
Renamed lattice_flats() method
25shriya 564ac20
Optimized PolynomialSequence returns
25shriya e91e600
Optimized groebner_basis() and _gens_constructor() for augmented chow…
25shriya 0611846
Edited basis() method
25shriya 77938e8
Corrected groebner_basis() for FY presentation
25shriya d85d312
Merge branch 'develop' into chow_ring
25shriya 00535fe
Resolved PEP8 changes
25shriya de683a8
added multiplication table
25shriya 0f85f74
Added computations
25shriya 19c94b5
Merge branch 'sagemath:develop' into chow_ring
25shriya 6ca02bb
Edited repr() doctests
25shriya a239339
Fixed linting error
25shriya 71e09d0
Edited doctest
25shriya 79f410b
Edited doctests
25shriya 9c9f804
Incorporated changes
25shriya 9abd55f
Corrected _latex_() doctest
25shriya ace86c1
Edited groebner_basis() for nonaug case
25shriya 73d6e59
Edited doctests
25shriya c8936d1
Edited doctests
25shriya d841b58
Resolved PEP8 changes and added matroid() method
25shriya 79d3371
Corrected doctests
25shriya eb20165
Edited matroid() method
25shriya 51f66dd
Corrected _gens_constructor() doctest
25shriya a7eec7b
Formatted doctests
25shriya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,340 @@ | ||
| r""" | ||
| Chow rings of matroids | ||
|
|
||
| AUTHORS: | ||
|
|
||
| - Shriya M | ||
| """ | ||
|
|
||
| from sage.matroids.chow_ring_ideal import ChowRingIdeal_nonaug, AugmentedChowRingIdeal_fy, AugmentedChowRingIdeal_atom_free | ||
| from sage.rings.quotient_ring import QuotientRing_generic | ||
| from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis | ||
| from sage.categories.commutative_rings import CommutativeRings | ||
|
|
||
| class ChowRing(QuotientRing_generic): | ||
| r""" | ||
| The Chow ring of a matroid. | ||
|
|
||
| The *Chow ring of the matroid* `M` is defined as the quotient ring | ||
|
|
||
| .. MATH:: | ||
|
|
||
| A^*(M)_R := R[x_{F_1}, \ldots, x_{F_k}] / (I_M + J_M), | ||
|
|
||
| where `(I_M + J_M)` is the :class:`Chow ring ideal | ||
| <sage.matroids.chow_ring_ideal.ChowRingIdeal_nonaug>` of matroid `M`. | ||
|
|
||
| The *augmented Chow ring of matroid* `M` has two different presentations | ||
| as quotient rings: | ||
|
|
||
| The *Feitchner-Yuzvinsky presentation* is the quotient ring | ||
|
|
||
| .. MATH:: | ||
|
|
||
| A(M)_R := R[y_{e_1}, \ldots, y_{e_n}, x_{F_1}, \ldots, x_{F_k}] / I_{FY}(M), | ||
|
|
||
| where `I_{FY}(M)` is the :class:`Feitchner-Yuzvinsky augmented Chow ring | ||
| ideal <sage.matroids.chow_ring_ideal.AugmentedChowRingIdeal_fy>` | ||
| of matroid `M`. | ||
|
|
||
| The *atom-free presentation* is the quotient ring | ||
|
|
||
| .. MATH:: | ||
|
|
||
| A(M)_R := R[x_{F_1}, \ldots, x_{F_k}] / I_{af}(M), | ||
|
|
||
| where `I_{af}(M)` is the :class:`atom-free augmented Chow ring ideal | ||
| <sage.matroids.chow_ring_ideal.AugmentedChowRingIdeal_atom_free>` | ||
| of matroid `M`. | ||
|
|
||
| .. SEEALSO:: | ||
|
|
||
| :mod:`sage.matroids.chow_ring_ideal` | ||
|
|
||
| INPUT: | ||
|
|
||
| - ``M`` -- matroid | ||
| - ``R`` -- commutative ring | ||
| - ``augmented`` -- boolean; when ``True``, this is the augmented | ||
| Chow ring and if ``False``, this is the non-augmented Chow ring | ||
| - ``presentation`` -- string (default: ``None``); one of the following | ||
| (ignored if ``augmented=False``) | ||
|
|
||
| * ``"fy"`` - the Feitchner-Yuzvinsky presentation | ||
| * ``"atom-free"`` - the atom-free presentation | ||
|
|
||
| REFERENCES: | ||
|
|
||
| - [FY2004]_ | ||
| - [AHK2015]_ | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: M1 = matroids.catalog.P8pp() | ||
| sage: ch = M1.chow_ring(QQ, False) | ||
| sage: ch | ||
| Chow ring of P8'': Matroid of rank 4 on 8 elements with 8 nonspanning circuits | ||
| over Rational Field | ||
| """ | ||
| def __init__(self, R, M, augmented, presentation=None): | ||
| r""" | ||
| Initialize ``self``. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: ch = matroids.Wheel(3).chow_ring(QQ, False) | ||
| sage: TestSuite(ch).run() | ||
| """ | ||
| self._matroid = M | ||
| self._augmented = augmented | ||
| self._presentation = presentation | ||
| if augmented is True: | ||
| if presentation == 'fy': | ||
| self._ideal = AugmentedChowRingIdeal_fy(M, R) | ||
| elif presentation == 'atom-free': | ||
| self._ideal = AugmentedChowRingIdeal_atom_free(M, R) | ||
| else: | ||
| self._ideal = ChowRingIdeal_nonaug(M, R) | ||
| C = CommutativeRings().Quotients() & GradedAlgebrasWithBasis(R).FiniteDimensional() | ||
| QuotientRing_generic.__init__(self, R=self._ideal.ring(), | ||
| I=self._ideal, | ||
| names=self._ideal.ring().variable_names(), | ||
| category=C) | ||
|
|
||
| def _repr_(self): | ||
| r""" | ||
| EXAMPLES:: | ||
|
|
||
| sage: M1 = matroids.catalog.Fano() | ||
| sage: ch = M1.chow_ring(QQ, False) | ||
| sage: ch | ||
| Chow ring of Fano: Binary matroid of rank 3 on 7 elements, type (3, 0) | ||
| over Rational Field | ||
| """ | ||
| output = "Chow ring of {}".format(self._matroid) | ||
| if self._augmented is True: | ||
| output = "Augmented " + output | ||
| if self._presentation == 'fy': | ||
| output += " in Feitchner-Yuzvinsky presentation" | ||
| elif self._presentation == 'atom-free': | ||
| output += " in atom-free presentation" | ||
| return output + " over " + repr(self.base_ring()) | ||
|
|
||
| def _latex_(self): | ||
| r""" | ||
| Return the LaTeX output of the polynomial ring and Chow ring ideal. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: M1 = matroids.Uniform(2,5) | ||
| sage: ch = M1.chow_ring(QQ, False) | ||
| sage: ch._latex_() | ||
| 'A(\\begin{array}{l}\n\\text{\\texttt{U(2,{ }5):{ }Matroid{ }of{ }rank{ }2{ }on{ }5{ }elements{ }with{ }circuit{-}closures}}\\\\\n\\text{\\texttt{{\\char`\\{}2:{ }{\\char`\\{}{\\char`\\{}0,{ }1,{ }2,{ }3,{ }4{\\char`\\}}{\\char`\\}}{\\char`\\}}}}\n\\end{array})_{\\Bold{Q}}' | ||
| """ | ||
| from sage.misc.latex import latex | ||
| base = "A({})_{{{}}}" | ||
| if self._augmented: | ||
| base += "^*" | ||
| return base.format(latex(self._matroid), latex(self.base_ring())) | ||
|
|
||
| def matroid(self): | ||
| r""" | ||
| Return the matroid of ``self``. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: ch = matroids.Uniform(3,6).chow_ring(QQ, True, 'fy') | ||
| sage: ch.matroid() | ||
| U(3, 6): Matroid of rank 3 on 6 elements with circuit-closures | ||
| {3: {{0, 1, 2, 3, 4, 5}}} | ||
| """ | ||
| M = self._matroid | ||
| return M | ||
|
|
||
| def _coerce_map_from_base_ring(self): | ||
| r""" | ||
| Disable the coercion from the base ring from the category. | ||
|
|
||
| TESTS:: | ||
|
|
||
| sage: ch = matroids.Wheel(3).chow_ring(QQ, False) | ||
| sage: ch._coerce_map_from_base_ring() is None | ||
| True | ||
| """ | ||
| return None # don't need anything special | ||
|
|
||
| def basis(self): | ||
| r""" | ||
| Return the monomial basis of the given Chow ring. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: ch = matroids.Uniform(3, 6).chow_ring(QQ, True, 'fy') | ||
| sage: ch.basis() | ||
| Family (1, B1, B1*B012345, B0, B0*B012345, B01, B01^2, B2, | ||
| B2*B012345, B02, B02^2, B12, B12^2, B3, B3*B012345, B03, B03^2, | ||
| B13, B13^2, B23, B23^2, B4, B4*B012345, B04, B04^2, B14, B14^2, | ||
| B24, B24^2, B34, B34^2, B5, B5*B012345, B05, B05^2, B15, B15^2, | ||
| B25, B25^2, B35, B35^2, B45, B45^2, B012345, B012345^2, B012345^3) | ||
| sage: set(ch.defining_ideal().normal_basis()) == set(ch.basis()) | ||
| True | ||
| sage: ch = matroids.catalog.Fano().chow_ring(QQ, False) | ||
| sage: ch.basis() | ||
| Family (1, Abcd, Aace, Aabf, Adef, Aadg, Abeg, Acfg, Aabcdefg, | ||
| Aabcdefg^2) | ||
| sage: set(ch.defining_ideal().normal_basis()) == set(ch.basis()) | ||
| True | ||
| sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') | ||
| sage: ch.basis() | ||
| Family (1, A0, A0*A012345, A2, A2*A012345, A3, A3*A012345, A23, | ||
| A23^2, A1, A1*A012345, A013, A013^2, A4, A4*A012345, A04, A04^2, | ||
| A124, A124^2, A5, A5*A012345, A025, A025^2, A15, A15^2, A345, | ||
| A345^2, A012345, A012345^2, A012345^3) | ||
| sage: set(ch.defining_ideal().normal_basis()) == set(ch.basis()) | ||
| True | ||
| """ | ||
| from sage.sets.family import Family | ||
| monomial_basis = self._ideal.normal_basis() | ||
| return Family([self.element_class(self, mon, reduce=False) for mon in monomial_basis]) | ||
|
|
||
| class Element(QuotientRing_generic.Element): | ||
| def to_vector(self, order=None): | ||
| r""" | ||
| Return ``self`` as a (dense) free module vector. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: ch = matroids.Uniform(3, 6).chow_ring(QQ, False) | ||
| sage: v = ch.an_element(); v | ||
| -A01 - A02 - A03 - A04 - A05 - A012345 | ||
| sage: v.to_vector() | ||
| (0, -1, -1, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0) | ||
| """ | ||
| P = self.parent() | ||
| B = P.basis() | ||
| FM = P._dense_free_module() | ||
| f = self.lift() | ||
| return FM([f.monomial_coefficient(b.lift()) for b in B]) | ||
|
|
||
| _vector_ = to_vector | ||
|
|
||
| def monomial_coefficients(self, copy=None): | ||
| r""" | ||
| Return the monomial coefficients of ``self``. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: ch = matroids.catalog.NonFano().chow_ring(QQ, True, 'atom-free') | ||
| sage: v = ch.an_element(); v | ||
| Aa | ||
| sage: v.monomial_coefficients() | ||
| {0: 0, 1: 1, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, | ||
| 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0, 17: 0, | ||
| 18: 0, 19: 0, 20: 0, 21: 0, 22: 0, 23: 0, 24: 0, 25: 0, | ||
| 26: 0, 27: 0, 28: 0, 29: 0, 30: 0, 31: 0, 32: 0, 33: 0, | ||
| 34: 0, 35: 0} | ||
| """ | ||
| B = self.parent().basis() | ||
| f = self.lift() | ||
| return {i: f.monomial_coefficient(b.lift()) for i, b in enumerate(B)} | ||
|
|
||
| def degree(self): | ||
| r""" | ||
| Return the degree of ``self``. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: ch = matroids.Uniform(3, 6).chow_ring(QQ, False) | ||
| sage: for b in ch.basis(): | ||
| ....: print(b, b.degree()) | ||
| 1 0 | ||
| A01 1 | ||
| A02 1 | ||
| A12 1 | ||
| A03 1 | ||
| A13 1 | ||
| A23 1 | ||
| A04 1 | ||
| A14 1 | ||
| A24 1 | ||
| A34 1 | ||
| A05 1 | ||
| A15 1 | ||
| A25 1 | ||
| A35 1 | ||
| A45 1 | ||
| A012345 1 | ||
| A012345^2 2 | ||
| sage: v = sum(ch.basis()) | ||
| sage: v.degree() | ||
| 2 | ||
| """ | ||
| return self.lift().degree() | ||
|
|
||
| def homogeneous_degree(self): | ||
| r""" | ||
| Return the (homogeneous) degree of ``self`` if homogeneous | ||
| otherwise raise an error. | ||
|
|
||
| EXAMPLES:: | ||
|
|
||
| sage: ch = matroids.catalog.Fano().chow_ring(QQ, True, 'fy') | ||
| sage: for b in ch.basis(): | ||
| ....: print(b, b.homogeneous_degree()) | ||
| 1 0 | ||
| Ba 1 | ||
| Ba*Babcdefg 2 | ||
| Bb 1 | ||
| Bb*Babcdefg 2 | ||
| Bc 1 | ||
| Bc*Babcdefg 2 | ||
| Bd 1 | ||
| Bd*Babcdefg 2 | ||
| Bbcd 1 | ||
| Bbcd^2 2 | ||
| Be 1 | ||
| Be*Babcdefg 2 | ||
| Bace 1 | ||
| Bace^2 2 | ||
| Bf 1 | ||
| Bf*Babcdefg 2 | ||
| Babf 1 | ||
| Babf^2 2 | ||
| Bdef 1 | ||
| Bdef^2 2 | ||
| Bg 1 | ||
| Bg*Babcdefg 2 | ||
| Badg 1 | ||
| Badg^2 2 | ||
| Bbeg 1 | ||
| Bbeg^2 2 | ||
| Bcfg 1 | ||
| Bcfg^2 2 | ||
| Babcdefg 1 | ||
| Babcdefg^2 2 | ||
| Babcdefg^3 3 | ||
| sage: v = sum(ch.basis()); v | ||
| Babcdefg^3 + Babf^2 + Bace^2 + Badg^2 + Bbcd^2 + Bbeg^2 + | ||
| Bcfg^2 + Bdef^2 + Ba*Babcdefg + Bb*Babcdefg + Bc*Babcdefg + | ||
| Bd*Babcdefg + Be*Babcdefg + Bf*Babcdefg + Bg*Babcdefg + | ||
| Babcdefg^2 + Ba + Bb + Bc + Bd + Be + Bf + Bg + Babf + Bace + | ||
| Badg + Bbcd + Bbeg + Bcfg + Bdef + Babcdefg + 1 | ||
| sage: v.homogeneous_degree() | ||
| Traceback (most recent call last): | ||
| ... | ||
| ValueError: element is not homogeneous | ||
|
|
||
| TESTS:: | ||
|
|
||
| sage: ch = matroids.Wheel(3).chow_ring(QQ, True, 'atom-free') | ||
| sage: ch.zero().homogeneous_degree() | ||
| Traceback (most recent call last): | ||
| ... | ||
| ValueError: the zero element does not have a well-defined degree | ||
| """ | ||
| if not self: | ||
| raise ValueError("the zero element does not have a well-defined degree") | ||
| f = self.lift() | ||
| if not f.is_homogeneous(): | ||
| raise ValueError("element is not homogeneous") | ||
| return f.degree() | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.