Skip to content

commalg · GradedGenerator

4 accepted declarations. Python and Rust forms, contracts, evidence, failure boundaries, and checked usages are kept together below.

Worked example

The complete checked program Decompose a polynomial by a nonstandard positive grading uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Decompose a polynomial by a nonstandard positive grading."""

from noether import Z
from noether.commalg import PolynomialRing, WeightedGrading


def main() -> None:
    ring = PolynomialRing(Z, ["x", "y", "z"], grading=WeightedGrading([1, 2, 3]))
    x, y, z = ring.generators()
    sparse = ring.from_terms([([0, 0, 0], 1), ([2, 0, 0], 1), ([0, 1, 0], 1)])
    polynomial = sparse + z
    assert sparse * (x + y) == (1 + x**2 + y) * (x + y)
    components = polynomial.homogeneous_components()
    assert [degree for degree, _ in components] == [0, 2, 3]
    assert x**2 + y == components[1][1]
    print(f"weighted homogeneous degrees: {[degree for degree, _ in components]}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/14_weighted_polynomials.py.

commalg.GradedGenerator

A stable named homogeneous generator.

GradedGenerator(name: str, degree: int)

noether::commalg::GradedGenerator · Direct Rust declaration

pub struct GradedGenerator { /* private fields */ }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded

Executable usage: validation/unit/commalg/test_graded_commutative_facade.py:17 · validation/unit/commalg/test_graded_commutative_facade.py:36 · validation/unit/commalg/test_graded_commutative_facade.py:8

commalg.GradedGenerator.degree

Return the degree recorded by this GradedGenerator.

Detailed contract

Cohomological degree.

(self) -> int

noether::commalg::GradedGenerator::degree · Direct Rust declaration

pub fn degree(&self) -> u32
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded

Executable usage: examples/14_weighted_polynomials.py:16 · examples/14_weighted_polynomials.py:18 · examples/15_groebner_twisted_cubic.py:15 · examples/15_groebner_twisted_cubic.py:28 · examples/31_local_fields_and_precision.py:37 · examples/33_simplicial_cohomology_operations.py:26

commalg.GradedGenerator.is_odd

Test whether this GradedGenerator is odd.

Detailed contract

Degree parity.

(self) -> bool

noether::commalg::GradedGenerator::is_odd · Direct Rust declaration

pub fn is_odd(&self) -> bool
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded

commalg.GradedGenerator.name

Return the name recorded by this GradedGenerator.

Detailed contract

Stable generator name.

(self) -> str

noether::commalg::GradedGenerator::name · Direct Rust declaration

pub fn name(&self) -> &str
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded

Executable usage: examples/12_number_field_ideals.py:12 · validation/unit/commalg/test_polynomial_facade.py:345 · validation/unit/commalg/test_polynomial_facade.py:44 · validation/unit/commalg/test_polynomial_facade.py:61 · validation/unit/commalg/test_polynomial_facade.py:65 · validation/unit/commalg/test_polynomial_facade.py:72