Skip to content

linalg · Matrix

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

Worked example

The complete checked program Solve an underdetermined rational system and verify its affine space uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Solve an underdetermined rational system and verify its affine space."""

from noether import Q
from noether.linalg import Matrix, Vector


def main() -> None:
    matrix = Matrix.from_rows(Q, [[1, 2, 3], [2, 4, 6]])
    right_hand_side = Vector.from_values(Q, [1, 2])
    solutions = matrix.solve(right_hand_side)
    solutions.verify()
    assert matrix @ solutions.particular == right_hand_side
    assert solutions.dimension == 2
    print(f"particular={solutions.particular}; nullity={solutions.dimension}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/03_exact_linear_systems.py.

linalg.Matrix

A dense matrix over one explicit coefficient context.

class Matrix

noether::linalg::Matrix · Direct Rust declaration

pub struct Matrix<R: Ring> { /* private fields */ }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/03_exact_linear_systems.py:10 · examples/03_exact_linear_systems.py:6 · examples/04_smith_normal_form.py:10 · examples/04_smith_normal_form.py:6 · examples/06_shortest_lattice_vectors.py:10 · examples/06_shortest_lattice_vectors.py:6

linalg.Matrix.__add__

Add another compatible value to this value.

Detailed contract

Add matrices with equal contexts and shapes. Returns the argument unchanged.

(self, other: Matrix[R]) -> Matrix[R]

noether::linalg::Matrix::add · Direct Rust declaration

pub fn add(&self, rhs: &Self) -> Result<Self, LinalgError>
fn add(self, rhs: &Matrix<R>) -> Self::Output
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/infra/test_discovery.py:211 · validation/unit/infra/test_public_api_index.py:293

linalg.Matrix.__getitem__

Return the entry selected by the supplied index.

Detailed contract

Materialize one coefficient, failing when the index is out of bounds. Backend-native matrices materialize only the requested scalar.

(self: Matrix[IntegerRing], index: tuple[int, int]) -> int
(self: Matrix[RationalField], index: tuple[int, int]) -> _Fraction
(self: Matrix[ResidueRing], index: tuple[int, int]) -> ResidueClass
(self: Matrix[FiniteField], index: tuple[int, int]) -> FiniteFieldElement
(self: Matrix[RationalFunctionField[RationalField]], index: tuple[int, int]) -> RationalFunction[RationalField]
(self: Matrix[_NumberFieldContext], index: tuple[int, int]) -> NumberFieldElement
(self: Matrix[_PadicContext], index: tuple[int, int]) -> PadicElement
(self: Matrix[_QadicContext], index: tuple[int, int]) -> QadicElement
(self: Matrix[_PadicLocalIntegralContext], index: tuple[int, int]) -> PadicLocalFieldElement
(self: Matrix[RealBallField], index: tuple[int, int]) -> RealBall
(self: Matrix[ComplexBallField], index: tuple[int, int]) -> ComplexBall
(self: Matrix[PowerSeriesRing[C]], index: tuple[int, int]) -> PowerSeries[C]
(self: Matrix[PolynomialRing[_PolynomialCoefficientContext]], index: tuple[int, int]) -> Polynomial[_PolynomialCoefficientContext]
(self: Matrix[QuotientRing[C]], index: tuple[int, int]) -> QuotientElement[C]

noether::linalg::Matrix::get · Direct Rust declaration

pub fn get(&self, row: usize, col: usize) -> Result<R::Element, IndexError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

linalg.Matrix.__iter__

Iterate over the canonical finite contents of this object.

(self: Matrix[IntegerRing]) -> Iterator[list[int]]
(self: Matrix[RationalField]) -> Iterator[list[_Fraction]]
(self: Matrix[ResidueRing]) -> Iterator[list[ResidueClass]]
(self: Matrix[FiniteField]) -> Iterator[list[FiniteFieldElement]]
(self: Matrix[RationalFunctionField[RationalField]]) -> Iterator[list[RationalFunction[RationalField]]]
(self: Matrix[_NumberFieldContext]) -> Iterator[list[NumberFieldElement]]
(self: Matrix[_PadicContext]) -> Iterator[list[PadicElement]]
(self: Matrix[_QadicContext]) -> Iterator[list[QadicElement]]
(self: Matrix[_PadicLocalIntegralContext]) -> Iterator[list[PadicLocalFieldElement]]
(self: Matrix[RealBallField]) -> Iterator[list[RealBall]]
(self: Matrix[ComplexBallField]) -> Iterator[list[ComplexBall]]
(self: Matrix[PowerSeriesRing[C]]) -> Iterator[list[PowerSeries[C]]]
(self: Matrix[PolynomialRing[_PolynomialCoefficientContext]]) -> Iterator[list[Polynomial[_PolynomialCoefficientContext]]]
(self: Matrix[QuotientRing[C]]) -> Iterator[list[QuotientElement[C]]]

noether::linalg::Matrix · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

linalg.Matrix.__len__

Return the number of stored items in this object.

(self) -> int

noether::linalg::Matrix · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/topology/test_filtration_builders.py:109 · validation/unit/topology/test_filtration_builders.py:14

linalg.Matrix.__matmul__

Multiply this value by another compatible value.

Detailed contract

Compose matrices by exact matrix multiplication.

(self, other: Matrix[R]) -> Matrix[R]
(self, other: Vector[R]) -> Vector[R]

noether::linalg::Matrix::matmul · Direct Rust declaration

pub fn matmul(&self, rhs: &Self) -> Result<Self, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/infra/test_discovery.py:199 · validation/unit/infra/test_discovery.py:213 · validation/unit/infra/test_docs_site_generator.py:146 · validation/unit/infra/test_docs_site_generator.py:149 · validation/unit/infra/test_docs_site_generator.py:150 · validation/unit/infra/test_docs_site_generator.py:152

linalg.Matrix.__mul__

Multiply this value by another compatible value.

(self: Matrix[IntegerRing], scalar: int) -> Matrix[IntegerRing]
(self: Matrix[RationalField], scalar: int | _Fraction) -> Matrix[RationalField]
(self: Matrix[ResidueRing], scalar: int | ResidueClass) -> Matrix[ResidueRing]
(self: Matrix[FiniteField], scalar: int | FiniteFieldElement) -> Matrix[FiniteField]
(self: Matrix[RationalFunctionField[RationalField]], scalar: int | _Fraction | RationalFunction[RationalField]) -> Matrix[RationalFunctionField[RationalField]]
(self: Matrix[_NumberFieldContext], scalar: int | _Fraction | NumberFieldElement) -> Matrix[_NumberFieldContext]
(self: Matrix[_PadicContext], scalar: int | PadicElement) -> Matrix[_PadicContext]
(self: Matrix[_QadicContext], scalar: int | QadicElement) -> Matrix[_QadicContext]
(self: Matrix[_PadicLocalIntegralContext], scalar: int | PadicLocalFieldElement) -> Matrix[_PadicLocalIntegralContext]
(self: Matrix[RealBallField], scalar: int | _Fraction | RealBall) -> Matrix[RealBallField]
(self: Matrix[ComplexBallField], scalar: int | _Fraction | ComplexBall) -> Matrix[ComplexBallField]
(self: Matrix[PowerSeriesRing[C]], scalar: PowerSeries[C] | SeriesScalar) -> Matrix[PowerSeriesRing[C]]
(self: Matrix[PolynomialRing[_PolynomialCoefficientContext]], scalar: Polynomial[_PolynomialCoefficientContext] | PolynomialScalar) -> Matrix[PolynomialRing[_PolynomialCoefficientContext]]
(self: Matrix[QuotientRing[C]], scalar: QuotientElement[C] | Polynomial[C]) -> Matrix[QuotientRing[C]]

noether::linalg::Matrix::mul · Direct Rust declaration

fn mul(self, rhs: &R::Element) -> Self::Output
fn mul(self, rhs: R::Element) -> Self::Output
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/infra/test_public_api_index.py:214

linalg.Matrix.__neg__

Return the additive inverse of this value.

Detailed contract

Negate every coefficient.

(self) -> Matrix[R]

noether::linalg::Matrix::neg · Direct Rust declaration

pub fn neg(&self) -> Result<Self, LinalgError>
fn neg(self) -> Self::Output
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

linalg.Matrix.__rmul__

Multiply this value by a compatible value on its left.

(self: Matrix[IntegerRing], scalar: int) -> Matrix[IntegerRing]
(self: Matrix[RationalField], scalar: int | _Fraction) -> Matrix[RationalField]
(self: Matrix[ResidueRing], scalar: int | ResidueClass) -> Matrix[ResidueRing]
(self: Matrix[FiniteField], scalar: int | FiniteFieldElement) -> Matrix[FiniteField]
(self: Matrix[RationalFunctionField[RationalField]], scalar: int | _Fraction | RationalFunction[RationalField]) -> Matrix[RationalFunctionField[RationalField]]
(self: Matrix[_NumberFieldContext], scalar: int | _Fraction | NumberFieldElement) -> Matrix[_NumberFieldContext]
(self: Matrix[_PadicContext], scalar: int | PadicElement) -> Matrix[_PadicContext]
(self: Matrix[_QadicContext], scalar: int | QadicElement) -> Matrix[_QadicContext]
(self: Matrix[_PadicLocalIntegralContext], scalar: int | PadicLocalFieldElement) -> Matrix[_PadicLocalIntegralContext]
(self: Matrix[RealBallField], scalar: int | _Fraction | RealBall) -> Matrix[RealBallField]
(self: Matrix[ComplexBallField], scalar: int | _Fraction | ComplexBall) -> Matrix[ComplexBallField]
(self: Matrix[PowerSeriesRing[C]], scalar: PowerSeries[C] | SeriesScalar) -> Matrix[PowerSeriesRing[C]]
(self: Matrix[PolynomialRing[_PolynomialCoefficientContext]], scalar: Polynomial[_PolynomialCoefficientContext] | PolynomialScalar) -> Matrix[PolynomialRing[_PolynomialCoefficientContext]]
(self: Matrix[QuotientRing[C]], scalar: QuotientElement[C] | Polynomial[C]) -> Matrix[QuotientRing[C]]

noether::linalg::Matrix · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

linalg.Matrix.__sub__

Subtract another compatible value from this value.

Detailed contract

Subtract matrices with equal contexts and shapes.

(self, other: Matrix[R]) -> Matrix[R]

noether::linalg::Matrix::sub · Direct Rust declaration

pub fn sub(&self, rhs: &Self) -> Result<Self, LinalgError>
fn sub(self, rhs: &Matrix<R>) -> Self::Output
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/infra/test_discovery.py:212

linalg.Matrix.apply

Apply this Matrix to the supplied value.

(self, vector: Vector[R]) -> Vector[R]

noether::linalg::Matrix::apply · Direct Rust declaration

fn apply(&self, vector: &Vector<R>) -> Result<Vector<R>, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/05_sparse_exact_operators.py:16 · validation/unit/commalg/test_local_algebra.py:94 · validation/unit/commalg/test_local_algebra.py:97 · validation/unit/commalg/test_polynomial_facade.py:199 · validation/unit/commalg/test_quotient_facade.py:186 · validation/unit/groups/test_weight_characters.py:39

linalg.Matrix.apply_block

Compute apply block for this Matrix.

(self, block: Matrix[R]) -> Matrix[R]

noether::linalg::Matrix::apply_block · Direct Rust declaration

fn apply_block(&self, block: &Matrix<R>) -> Result<Matrix<R>, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/infra/test_discovery.py:198 · validation/unit/linalg/test_semilinear_facade.py:22 · validation/unit/linalg/test_sparse_matrix_facade.py:113 · validation/unit/linalg/test_sparse_matrix_facade.py:65 · validation/unit/linalg/test_vector_facade.py:54

linalg.Matrix.charpoly

Characteristic polynomial det(tI - self) over a supported exact commutative coefficient context.

Detailed contract

Characteristic polynomial det(tI - self) over a supported exact commutative coefficient context.

The characteristic polynomial det(tI - self) in the canonical univariate polynomial ring R[t]. Integer, rational, residue-ring, and finite-field matrices use their FLINT whole-matrix backends. Every other commutative ring uses the division-free Berkowitz algorithm, so the operation remains valid in positive characteristic and over rings with zero divisors.

(self: Matrix[IntegerRing]) -> Polynomial[IntegerRing]
(self: Matrix[RationalField]) -> Polynomial[RationalField]
(self: Matrix[ResidueRing]) -> Polynomial[ResidueRing]
(self: Matrix[FiniteField]) -> Polynomial[FiniteField]
(self: Matrix[RationalFunctionField[RationalField]]) -> Polynomial[RationalFunctionField[RationalField]]
(self: Matrix[PadicRing]) -> Polynomial[PadicRing]
(self: Matrix[PadicField]) -> Polynomial[PadicField]
(self: Matrix[QadicRing]) -> Polynomial[QadicRing]
(self: Matrix[QadicField]) -> Polynomial[QadicField]
(self: Matrix[PadicLocalField]) -> Polynomial[PadicLocalField]
(self: Matrix[NumberField]) -> Polynomial[NumberField]

noether::linalg::Matrix::charpoly · Direct Rust declaration

pub fn charpoly(&self) -> Result<Polynomial<R>, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/linalg/test_acceptance_workload.py:79 · validation/unit/linalg/test_acceptance_workload.py:98 · validation/unit/linalg/test_exact_linear_algebra_facade.py:129 · validation/unit/linalg/test_exact_linear_algebra_facade.py:281 · validation/unit/linalg/test_exact_linear_algebra_facade.py:297 · validation/unit/linalg/test_exact_linear_algebra_facade.py:357

linalg.Matrix.det

Determinant over a commutative coefficient context.

Detailed contract

Determinant over the coefficient ring. Integer, rational, residue-ring, and finite-field matrices use their FLINT whole-matrix backends. Every other commutative ring uses the division-free Berkowitz algorithm, so no field division is required.

(self: Matrix[IntegerRing]) -> int
(self: Matrix[RationalField]) -> _Fraction
(self: Matrix[ResidueRing]) -> ResidueClass
(self: Matrix[FiniteField]) -> FiniteFieldElement
(self: Matrix[RationalFunctionField[RationalField]]) -> RationalFunction[RationalField]
(self: Matrix[PadicRing]) -> PadicElement
(self: Matrix[PadicField]) -> PadicElement
(self: Matrix[QadicRing]) -> QadicElement
(self: Matrix[QadicField]) -> QadicElement
(self: Matrix[_PadicLocalIntegralContext]) -> PadicLocalFieldElement
(self: Matrix[NumberField]) -> NumberFieldElement
(self: Matrix[NumberFieldOrder]) -> NumberFieldElement
(self: Matrix[RealBallField]) -> RealBall
(self: Matrix[ComplexBallField]) -> ComplexBall
(self: Matrix[PowerSeriesRing[C]]) -> PowerSeries[C]
(self: Matrix[PolynomialRing[_PolynomialCoefficientContext]]) -> Polynomial[_PolynomialCoefficientContext]
(self: Matrix[QuotientRing[C]]) -> QuotientElement[C]

noether::linalg::Matrix::det · Direct Rust declaration

pub fn det(&self) -> Result<R::Element, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/commalg/test_quotient_facade.py:161 · validation/unit/homalg/test_module_facade.py:218 · validation/unit/infra/test_discovery.py:27 · validation/unit/infra/test_public_api_index.py:105 · validation/unit/linalg/test_acceptance_workload.py:32 · validation/unit/linalg/test_acceptance_workload.py:72

linalg.Matrix.from_json

Deserialize and revalidate a matrix and its complete coefficient context.

(cls, value: str) -> Matrix[R]

noether::linalg::Matrix::from_json · Direct Rust declaration

pub fn from_json(value: &str) -> Result<Self, NoetherError>where R: for<'de> Deserialize<'de>, R::Element: for<'de> Deserialize<'de>,
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/category/test_category.py:14 · validation/unit/combin/test_acceptance_workload.py:65 · validation/unit/combin/test_acceptance_workload.py:86 · validation/unit/combin/test_graph_facade.py:106 · validation/unit/combin/test_graph_facade.py:25 · validation/unit/combinatorics/test_kashiwara_crystal.py:32

linalg.Matrix.from_rows

Construct a Matrix using rows.

Detailed contract

Construct a matrix from row-major coefficients. An empty outer vector constructs the 0 x 0 matrix. Use zeros when a zero-row matrix with a nonzero column count is required.

(cls, ring: IntegerRing, rows: Iterable[Iterable[int]]) -> Matrix[IntegerRing]
(cls, ring: RationalField, rows: Iterable[Iterable[int | _Fraction]]) -> Matrix[RationalField]
(cls, ring: ResidueRing, rows: Iterable[Iterable[int | ResidueClass]]) -> Matrix[ResidueRing]
(cls, ring: FiniteField, rows: Iterable[Iterable[int | FiniteFieldElement]]) -> Matrix[FiniteField]
(cls, ring: RationalFunctionField[RationalField], rows: Iterable[Iterable[int | _Fraction | RationalFunction[RationalField]]]) -> Matrix[RationalFunctionField[RationalField]]
(cls, ring: _NumberFieldContext, rows: Iterable[Iterable[int | _Fraction | NumberFieldElement | Iterable[int | _Fraction]]]) -> Matrix[_NumberFieldContext]
(cls, ring: _PadicContext, rows: Iterable[Iterable[int | PadicElement]]) -> Matrix[_PadicContext]
(cls, ring: _QadicContext, rows: Iterable[Iterable[int | QadicElement]]) -> Matrix[_QadicContext]
(cls, ring: _PadicLocalIntegralContext, rows: Iterable[Iterable[int | PadicLocalFieldElement]]) -> Matrix[_PadicLocalIntegralContext]
(cls, ring: RealBallField, rows: Iterable[Iterable[int | _Fraction | RealBall]]) -> Matrix[RealBallField]
(cls, ring: ComplexBallField, rows: Iterable[Iterable[int | _Fraction | ComplexBall]]) -> Matrix[ComplexBallField]
(cls, ring: PowerSeriesRing[C], rows: Iterable[Iterable[PowerSeries[C] | SeriesScalar]]) -> Matrix[PowerSeriesRing[C]]
(cls, ring: PolynomialRing[_PolynomialCoefficientContext], rows: Iterable[Iterable[Polynomial[_PolynomialCoefficientContext] | PolynomialScalar]]) -> Matrix[PolynomialRing[_PolynomialCoefficientContext]]
(cls, ring: QuotientRing[C], rows: Iterable[Iterable[QuotientElement[C] | Polynomial[C]]]) -> Matrix[QuotientRing[C]]

noether::linalg::Matrix::from_rows · Direct Rust declaration

pub fn from_rows<I, J>(ring: R, rows: I) -> Result<Self, LinalgError>where I: IntoIterator<Item = J>, J: IntoIterator<Item = R::Element>,
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/03_exact_linear_systems.py:10 · examples/04_smith_normal_form.py:10 · examples/06_shortest_lattice_vectors.py:10 · examples/30_modules_and_resolutions.py:39 · examples/38_exact_linear_systems.py:12 · examples/38_exact_linear_systems.py:23

linalg.Matrix.hermite_normal_form

Canonical row Hermite normal form over the integers.

(self: Matrix[IntegerRing]) -> Matrix[IntegerRing]

noether::linalg::Matrix::hermite_normal_form · Direct Rust declaration

pub fn hermite_normal_form(&self) -> Self
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/linalg/test_exact_linear_algebra_facade.py:337 · validation/unit/linalg/test_exact_linear_algebra_facade.py:339 · validation/bench/magma_release.py:1851

linalg.Matrix.howell_normal_form

Canonical row Howell form over a word-modulus residue ring.

Detailed contract

Canonical row Howell form over Z/nZ. FLINT requires at least as many rows as columns, so a wide input is completed with zero rows. The returned matrix therefore has max(rows, columns) rows and generates exactly the same row submodule.

(self: Matrix[ResidueRing]) -> Matrix[ResidueRing]

noether::linalg::Matrix::howell_normal_form · Direct Rust declaration

pub fn howell_normal_form(&self) -> Result<Self, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/linalg/test_acceptance_workload.py:54 · validation/unit/linalg/test_exact_linear_algebra_facade.py:344 · validation/unit/linalg/test_exact_linear_algebra_facade.py:349 · validation/unit/linalg/test_exact_linear_algebra_facade.py:352

linalg.Matrix.identity

Construct a Matrix using identity.

Detailed contract

Construct the square identity matrix of the requested size.

(cls, ring: R, size: int) -> Matrix[R]

noether::linalg::Matrix::identity · Direct Rust declaration

pub fn identity(ring: R, size: usize) -> Self
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/01_bezout_certificates.py:10 · examples/01_bezout_certificates.py:12 · examples/01_bezout_certificates.py:14 · examples/01_bezout_certificates.py:9 · examples/02_ball_arithmetic.py:3 · examples/distributed/f2_linear_algebra.py:20

linalg.Matrix.image

Column image as a checked linear subspace.

Detailed contract

Column image as a checked linear subspace of the codomain.

(self: Matrix[_FieldContext]) -> SolutionSpace[_FieldContext]

noether::linalg::Matrix::image · Direct Rust declaration

pub fn image(&self) -> Result<SolutionSpace<R>, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/05_sparse_exact_operators.py:16 · examples/05_sparse_exact_operators.py:17 · examples/05_sparse_exact_operators.py:19 · examples/33_simplicial_cohomology_operations.py:30 · examples/33_simplicial_cohomology_operations.py:31 · examples/38_exact_linear_systems.py:69

linalg.Matrix.input_dimension

Return the input dimension recorded by this Matrix.

(self) -> int

noether::linalg::Matrix::input_dimension · Direct Rust declaration

fn input_dimension(&self) -> usize
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/linalg/test_vector_facade.py:50 · validation/parity/linalg/test_exact_solution_modules_parity.py:163 · validation/parity/linalg/test_exact_solution_modules_parity.py:177 · validation/parity/linalg/test_exact_solution_modules_parity.py:200 · validation/parity/linalg/test_exact_solution_modules_parity.py:210

linalg.Matrix.kernel

Complete right kernel as a checked linear subspace.

Detailed contract

The complete right kernel as a checked linear subspace.

(self: Matrix[_FieldContext]) -> SolutionSpace[_FieldContext]

noether::linalg::Matrix::kernel · Direct Rust declaration

pub fn kernel(&self) -> Result<SolutionSpace<R>, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/38_exact_linear_systems.py:68 · examples/38_exact_linear_systems.py:70 · examples/38_exact_linear_systems.py:72 · validation/unit/homalg/test_exact_submodules.py:78 · validation/unit/homalg/test_exact_submodules.py:93 · validation/unit/homalg/test_exact_submodules.py:95

linalg.Matrix.matmul

Compute matmul for this Matrix.

Detailed contract

Compose matrices by exact matrix multiplication.

(self, other: Matrix[R]) -> Matrix[R]

noether::linalg::Matrix::matmul · Direct Rust declaration

pub fn matmul(&self, rhs: &Self) -> Result<Self, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/infra/test_discovery.py:209 · validation/unit/infra/test_docs_site_generator.py:145 · validation/unit/infra/test_docs_site_generator.py:146 · validation/unit/infra/test_mpi_scale_report.py:168 · validation/unit/infra/test_mpi_scale_report.py:182 · validation/unit/infra/test_mpi_scale_report.py:192

linalg.Matrix.output_dimension

Return the output dimension recorded by this Matrix.

(self) -> int

noether::linalg::Matrix::output_dimension · Direct Rust declaration

fn output_dimension(&self) -> usize
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/linalg/test_vector_facade.py:51

linalg.Matrix.padic_smith_invariants

Smith invariant valuations visible below a p-adic ring's precision cap.

Detailed contract

Compute every Smith valuation visible below this matrix’s precision cap.

(self: Matrix[PadicRing]) -> PadicSmithInvariants

noether::linalg::Matrix::padic_smith_invariants · Direct Rust declaration

pub fn padic_smith_invariants( &self, ) -> Result<PadicSmithInvariants, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/linalg/test_padic_smith_facade.py:26 · validation/unit/linalg/test_padic_smith_facade.py:49 · validation/unit/linalg/test_padic_smith_facade.py:72 · validation/unit/linalg/test_padic_smith_facade.py:73 · validation/unit/linalg/test_padic_smith_facade.py:86

linalg.Matrix.pluq

Rank-revealing exact PLUQ factorization over a field context.

Detailed contract

Compute a deterministic, rank-revealing PLUQ factorization. The generic field algorithm is the correctness floor. Specialized storage backends may replace it without changing this result type or reconstruction convention.

(self: Matrix[_FieldContext]) -> PLUQFactorization[_FieldContext]

noether::linalg::Matrix::pluq · Direct Rust declaration

pub fn pluq(&self) -> Result<PLUQFactorization<R>, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/distributed/f2_linear_algebra.py:47 · validation/unit/infra/test_mpi_scale_report.py:150 · validation/unit/infra/test_mpi_scale_report.py:156 · validation/unit/linalg/test_acceptance_workload.py:35 · validation/unit/linalg/test_acceptance_workload.py:49 · validation/unit/linalg/test_acceptance_workload.py:78

linalg.Matrix.rank

Rank over a field context.

Detailed contract

Rank over the coefficient field.

(self: Matrix[_FieldContext]) -> int

noether::linalg::Matrix::rank · Direct Rust declaration

pub fn rank(&self) -> Result<usize, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/38_exact_linear_systems.py:78 · examples/distributed/f2_linear_algebra.py:34 · examples/distributed/f2_linear_algebra.py:54 · examples/distributed/f2_linear_algebra.py:55 · examples/distributed/f2_linear_algebra.py:60 · validation/unit/combin/test_acceptance_workload.py:74

linalg.Matrix.ring

Return the ring recorded by this Matrix.

Detailed contract

The exact coefficient context.

(self) -> R

noether::linalg::Matrix::ring · Direct Rust declaration

pub fn ring(&self) -> &R
fn ring(&self) -> &R
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/11_qadic_witt_vectors.py:3 · examples/13_chinese_remainder_theorem.py:10 · examples/13_chinese_remainder_theorem.py:12 · examples/13_chinese_remainder_theorem.py:9 · examples/14_weighted_polynomials.py:10 · examples/14_weighted_polynomials.py:11

linalg.Matrix.rref

Reduced row-echelon form over a field context.

Detailed contract

Reduced row-echelon form over the coefficient field.

(self: Matrix[_FieldContext]) -> Matrix[_FieldContext]

noether::linalg::Matrix::rref · Direct Rust declaration

pub fn rref(&self) -> Result<Self, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/distributed/f2_linear_algebra.py:50 · validation/unit/infra/test_mpi_scale_report.py:150 · validation/unit/infra/test_mpi_scale_report.py:156 · validation/unit/infra/test_mpi_scale_report.py:316 · validation/unit/infra/test_mpi_scale_report.py:328 · validation/unit/infra/test_mpi_scale_report.py:339

linalg.Matrix.shape

Return the shape recorded by this Matrix.

Detailed contract

(rows, columns).

(self) -> tuple[int, int]

noether::linalg::Matrix::shape · Direct Rust declaration

pub fn shape(&self) -> (usize, usize)
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/27_weight_characters.py:19 · examples/27_weight_characters.py:8 · examples/27_weight_characters.py:9 · examples/distributed/f2_linear_algebra.py:51 · examples/distributed/f2_linear_algebra.py:52 · validation/unit/combin/test_acceptance_workload.py:38

linalg.Matrix.smith_normal_form

Smith normal form over the integers, without transformation matrices.

Detailed contract

Smith normal form over the integers, without transformation matrices.

algorithm="auto" and "exact" use the unconditional fast exact route. algorithm="smooth" requires an inclusive smooth_bound and returns its exact smoothness assumption unless the recorded deterministic bound is fully covered.

Compute Smith normal form without transformation matrices. This dense exact route uses FLINT’s arbitrary-precision integer matrix implementation. It is distinct from the future explicit transform-producing operation and from mathematical playbooks that can prove a smooth-case answer from modular evidence.

(self: Matrix[IntegerRing], *, algorithm: Literal['auto', 'exact']='auto', smooth_bound: None=None) -> SmithNormalForm
(self: Matrix[IntegerRing], *, algorithm: Literal['smooth'], smooth_bound: int) -> SmithNormalForm

noether::linalg::Matrix::smith_normal_form · Direct Rust declaration

pub fn smith_normal_form(&self) -> SmithNormalForm
Contract Value
Guarantee unconditional, conditional:TorsionOrderIsSmooth
Determinism deterministic
Availability default CPU build
Dispatch / backing flint, native
GIL released
Semantic ID noether/linalg/Matrix@1
Contexts Z
Evidence SmithVerification
Failures invalid smooth bound, unsupported word precision

Executable usage: examples/04_smith_normal_form.py:11 · validation/unit/infra/test_discovery.py:12 · validation/unit/infra/test_discovery.py:13 · validation/unit/infra/test_discovery.py:16 · validation/unit/infra/test_discovery.py:241 · validation/unit/infra/test_discovery.py:61

Example

from noether import Z
from noether.linalg import Matrix
result = Matrix.from_rows(Z, [[2, 4], [6, 6]]).smith_normal_form()
assert result.invariant_factors == [2, 6]
result.verify()

linalg.Matrix.smith_normal_form_with_transforms

Smith normal form with explicit unimodular transformation matrices.

Detailed contract

Compute Smith normal form and both unimodular transformation matrices. This is an explicit, potentially much more expensive operation. The fast Self::smith_normal_form path never computes these witnesses.

(self: Matrix[IntegerRing]) -> SmithNormalFormWithTransforms

noether::linalg::Matrix::smith_normal_form_with_transforms · Direct Rust declaration

pub fn smith_normal_form_with_transforms( &self, ) -> Result<SmithNormalFormWithTransforms, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/infra/test_discovery.py:22 · validation/unit/linalg/test_acceptance_workload.py:129 · validation/unit/linalg/test_exact_linear_algebra_facade.py:408

linalg.Matrix.solve

Solve self @ x = rhs and return the complete affine solution set.

Detailed contract

Solve self * x = rhs, returning the complete affine solution space.

(self: Matrix[_FieldContext], rhs: Vector[_FieldContext]) -> SolutionSpace[_FieldContext]

noether::linalg::Matrix::solve · Direct Rust declaration

pub fn solve(&self, rhs: &Vector<R>) -> Result<SolutionSpace<R>, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/03_exact_linear_systems.py:12 · validation/unit/infra/test_mpi_scale_report.py:156 · validation/unit/infra/test_mpi_scale_report.py:186 · validation/unit/infra/test_mpi_scale_report.py:200 · validation/unit/infra/test_mpi_scale_report.py:212 · validation/unit/infra/test_mpi_scale_report.py:225

linalg.Matrix.solve_exact

Solve exactly over Z or arbitrary Z/nZ, retaining complete evidence.

Detailed contract

Solve selfx=rhs over the integers, including a complete kernel lattice. Solve selfx=rhs over this exact residue ring, including composite moduli. The implementation lifts A*x=b (mod n) to the integer system [A nI] (x,z)=b. This gives a correctness floor for every arbitrary-precision modulus without treating nonunits as field pivots.

(self: Matrix[IntegerRing], rhs: Vector[IntegerRing]) -> IntegerLinearSystemResult
(self: Matrix[ResidueRing], rhs: Vector[ResidueRing]) -> CongruenceSystemResult

noether::linalg::Matrix::solve_exact · Direct Rust declaration

pub fn solve_exact( &self, rhs: &Vector<IntegerRing>, ) -> Result<IntegerLinearSystemResult, LinalgError>
pub fn solve_exact( &self, rhs: &Vector<ResidueRing>, ) -> Result<CongruenceSystemResult, LinalgError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Dispatch / backing flint, pwvla
GIL released
Semantic ID noether/linalg/Matrix@1
Contexts Z, Z/nZ, including composite n
Evidence IntegerLinearSystemResult.verify, CongruenceSystemResult.verify
Failures dimension mismatch, incompatible coefficient context

Executable usage: examples/38_exact_linear_systems.py:14 · examples/38_exact_linear_systems.py:23 · examples/38_exact_linear_systems.py:33 · validation/unit/infra/test_public_api_index.py:191 · validation/unit/linalg/test_exact_solution_modules.py:30 · validation/unit/linalg/test_exact_solution_modules.py:49

linalg.Matrix.to_json

Serialize the matrix and its complete coefficient context.

Detailed contract

Serialize the complete coefficient context, shape, and row-major entries.

(self) -> str

noether::linalg::Matrix::to_json · Direct Rust declaration

pub fn to_json(&self) -> Result<String, NoetherError>where R: Serialize, R::Element: Serialize,
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/category/test_category.py:14 · validation/unit/category/test_category.py:15 · validation/unit/combin/test_acceptance_workload.py:30 · validation/unit/combin/test_acceptance_workload.py:65 · validation/unit/combin/test_acceptance_workload.py:86 · validation/unit/combin/test_graph_facade.py:106

linalg.Matrix.to_rows

Convert this Matrix to rows.

Detailed contract

Materialize all rows in deterministic order. Unlike rows, this is an eager terminal observation. Device-resident packed matrices download at most once before scalar conversion.

(self: Matrix[IntegerRing]) -> list[list[int]]
(self: Matrix[RationalField]) -> list[list[_Fraction]]
(self: Matrix[ResidueRing]) -> list[list[ResidueClass]]
(self: Matrix[FiniteField]) -> list[list[FiniteFieldElement]]
(self: Matrix[RationalFunctionField[RationalField]]) -> list[list[RationalFunction[RationalField]]]
(self: Matrix[_NumberFieldContext]) -> list[list[NumberFieldElement]]
(self: Matrix[_PadicContext]) -> list[list[PadicElement]]
(self: Matrix[_QadicContext]) -> list[list[QadicElement]]
(self: Matrix[_PadicLocalIntegralContext]) -> list[list[PadicLocalFieldElement]]
(self: Matrix[RealBallField]) -> list[list[RealBall]]
(self: Matrix[ComplexBallField]) -> list[list[ComplexBall]]
(self: Matrix[PowerSeriesRing[C]]) -> list[list[PowerSeries[C]]]
(self: Matrix[PolynomialRing[_PolynomialCoefficientContext]]) -> list[list[Polynomial[_PolynomialCoefficientContext]]]
(self: Matrix[QuotientRing[C]]) -> list[list[QuotientElement[C]]]

noether::linalg::Matrix::to_rows · Direct Rust declaration

pub fn to_rows(&self) -> Vec<Vec<R::Element>>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL released
Semantic ID noether/linalg/Matrix@1

Executable usage: validation/unit/commalg/test_kahler_differentials.py:114 · validation/unit/commalg/test_kahler_differentials.py:65 · validation/unit/commalg/test_kahler_differentials.py:70 · validation/unit/commalg/test_kahler_differentials.py:71 · validation/unit/commalg/test_kahler_differentials.py:85 · validation/unit/commalg/test_kahler_differentials.py:86

linalg.Matrix.transpose

Compute transpose for this Matrix.

Detailed contract

Return the transpose.

(self) -> Matrix[R]

noether::linalg::Matrix::transpose · Direct Rust declaration

pub fn transpose(&self) -> Self
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/39_kahler_differentials.py:26 · examples/distributed/f2_linear_algebra.py:31 · validation/unit/combin/test_graph_facade.py:51 · validation/unit/commalg/test_power_series_facade.py:347 · validation/unit/commalg/test_quotient_facade.py:162 · validation/unit/infra/test_boundary_properties.py:54

linalg.Matrix.zeros

Construct a Matrix using zeros.

Detailed contract

Construct the rows x cols zero matrix.

(cls, ring: R, shape: tuple[int, int]) -> Matrix[R]

noether::linalg::Matrix::zeros · Direct Rust declaration

pub fn zeros(ring: R, rows: usize, cols: usize) -> Self
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, m4rst, m4rst-distributed, m4rste, mzs, pwvla, spar-core, sparla, sparb, lattice-enum
GIL attached / bounded
Semantic ID noether/linalg/Matrix@1

Executable usage: examples/38_exact_linear_systems.py:19 · examples/distributed/f2_linear_algebra.py:28 · validation/unit/commalg/test_power_series_facade.py:388 · validation/unit/commalg/test_quotient_facade.py:164 · validation/unit/homalg/test_exact_submodules.py:56 · validation/unit/homalg/test_module_facade.py:633