Skip to content

linalg · SparseMatrix

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

Worked example

The complete checked program Apply and multiply canonical sparse exact operators uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Apply and multiply canonical sparse exact operators."""

from noether import Z
from noether.linalg import SparseMatrix, Vector


def main() -> None:
    operator = SparseMatrix.from_triplets(
        Z,
        (3, 3),
        [(0, 0, 2), (0, 2, -1), (1, 1, 3), (2, 0, 4)],
    )
    vector = Vector.from_values(Z, [5, 7, 11])
    image = operator.apply(vector)
    assert image.to_values() == [-1, 21, 20]
    assert (operator @ operator).nnz == 4
    print(f"A v = {image.to_values()}; nnz(A^2) = {(operator @ operator).nnz}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/05_sparse_exact_operators.py.

linalg.SparseMatrix

A canonical sparse matrix over one explicit coefficient context.

class SparseMatrix

noether::linalg::SparseMatrix · Direct Rust declaration

pub struct SparseMatrix<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/SparseMatrix@1

Executable usage: examples/05_sparse_exact_operators.py:10 · examples/05_sparse_exact_operators.py:6 · validation/unit/commalg/test_quotient_facade.py:179 · validation/unit/commalg/test_quotient_facade.py:18 · validation/unit/commalg/test_quotient_facade.py:191 · validation/unit/commalg/test_quotient_facade.py:192

linalg.SparseMatrix.__add__

Add another compatible value to this value.

Detailed contract

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

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

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

pub fn add(&self, rhs: &Self) -> Result<Self, LinalgError>
fn add(self, rhs: &SparseMatrix<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/SparseMatrix@1

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

linalg.SparseMatrix.__getitem__

Return the entry selected by the supplied index.

Detailed contract

Materialize one coefficient, failing when its index is outside the shape.

(self, index: tuple[int, int]) -> int | _Fraction | ResidueClass | FiniteFieldElement | PadicElement | PadicLocalFieldElement | QadicElement | RealBall | ComplexBall | PolynomialScalar | QuotientScalar

noether::linalg::SparseMatrix::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/SparseMatrix@1

linalg.SparseMatrix.__matmul__

Multiply this value by another compatible value.

Detailed contract

Compose two sparse matrices by exact sparse matrix multiplication.

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

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.__mul__

Multiply this value by another compatible value.

(self, scalar: int | _Fraction | ResidueClass | FiniteFieldElement | PadicElement | PadicLocalFieldElement | QadicElement | RealBall | ComplexBall | PolynomialScalar | QuotientScalar) -> SparseMatrix[R]

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

fn mul(self, scalar: &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/SparseMatrix@1

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

linalg.SparseMatrix.__neg__

Return the additive inverse of this value.

Detailed contract

Negate every stored coefficient.

(self) -> SparseMatrix[R]

noether::linalg::SparseMatrix::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/SparseMatrix@1

linalg.SparseMatrix.__rmul__

Multiply this value by a compatible value on its left.

(self, scalar: int | _Fraction | ResidueClass | FiniteFieldElement | PadicElement | PadicLocalFieldElement | QadicElement | RealBall | ComplexBall | PolynomialScalar | QuotientScalar) -> SparseMatrix[R]

noether::linalg::SparseMatrix · 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/SparseMatrix@1

linalg.SparseMatrix.__sub__

Subtract another compatible value from this value.

Detailed contract

Subtract sparse matrices with equal contexts and shapes.

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

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

pub fn sub(&self, rhs: &Self) -> Result<Self, LinalgError>
fn sub(self, rhs: &SparseMatrix<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/SparseMatrix@1

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

linalg.SparseMatrix.apply

Apply this sparse linear operator to a vector.

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

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.apply_block

Apply this sparse linear operator to a dense matrix block.

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

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.column_indices

Canonical CSR column indices.

(self) -> list[int]

noether::linalg::SparseMatrix::column_indices · Direct Rust declaration

pub fn column_indices(&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/SparseMatrix@1

Executable usage: validation/unit/linalg/test_sparse_matrix_facade.py:121 · validation/unit/linalg/test_sparse_matrix_facade.py:33

linalg.SparseMatrix.csr

Canonical (row_offsets, column_indices, values) arrays.

(self) -> tuple[list[int], list[int], list[int | _Fraction | ResidueClass | FiniteFieldElement | PadicElement | PadicLocalFieldElement | QadicElement | RealBall | ComplexBall | PolynomialScalar | QuotientScalar]]

noether::linalg::SparseMatrix · 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/SparseMatrix@1

Executable usage: validation/unit/linalg/test_sparse_matrix_facade.py:31 · validation/unit/linalg/test_sparse_matrix_facade.py:44

linalg.SparseMatrix.density

Fraction of cells stored explicitly.

Detailed contract

Fraction of matrix cells that are explicitly stored.

(self) -> float

noether::linalg::SparseMatrix::density · Direct Rust declaration

pub fn density(&self) -> f64
fn density(&self) -> f64
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/SparseMatrix@1

Executable usage: validation/unit/linalg/test_sparse_matrix_facade.py:30 · validation/corpus/numthy/diagonal-quadric-local-density-sums.py:96

linalg.SparseMatrix.from_csr

Construct from canonical CSR arrays.

Detailed contract

Construct a canonical CSR matrix from its component arrays. The arrays must already be canonical: row offsets are nondecreasing, columns are strictly increasing within each row, and no value is zero.

(cls, ring: _SparseContext, shape: tuple[int, int], row_offsets: Iterable[int], column_indices: Iterable[int], values: Iterable[int | _Fraction | ResidueClass | FiniteFieldElement | PadicElement | PadicLocalFieldElement | QadicElement | RealBall | ComplexBall | PolynomialScalar | QuotientScalar]) -> SparseMatrix[_SparseContext]

noether::linalg::SparseMatrix::from_csr · Direct Rust declaration

pub fn from_csr( ring: R, rows: usize, cols: usize, row_offsets: Vec<usize>, column_indices: Vec<usize>, values: Vec<R::Element>, ) -> 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 attached / bounded
Semantic ID noether/linalg/SparseMatrix@1

Executable usage: validation/unit/linalg/test_sparse_matrix_facade.py:117 · validation/unit/linalg/test_sparse_matrix_facade.py:163 · validation/unit/linalg/test_sparse_matrix_facade.py:53

linalg.SparseMatrix.from_dense

Losslessly convert a supported dense facade matrix.

Detailed contract

Losslessly convert a dense matrix into canonical sparse form.

(cls, matrix: Matrix[_SparseContext]) -> SparseMatrix[_SparseContext]

noether::linalg::SparseMatrix::from_dense · Direct Rust declaration

pub fn from_dense(matrix: &Matrix<R>) -> 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 attached / bounded
Semantic ID noether/linalg/SparseMatrix@1

Executable usage: validation/unit/commalg/test_quotient_facade.py:191 · validation/unit/linalg/test_sparse_matrix_facade.py:115 · validation/unit/linalg/test_sparse_matrix_facade.py:41 · validation/unit/numthy/test_padic_local_field_facade.py:206

linalg.SparseMatrix.from_json

Deserialize and revalidate a sparse matrix.

Detailed contract

Deserialize and revalidate a sparse matrix and its coefficient context.

(cls, value: str) -> SparseMatrix[_SparseContext]

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.from_triplets

Construct from (row, column, coefficient) triplets.

Detailed contract

Construct a canonical sparse matrix from coordinate triplets. Repeated coordinates are added in input order. Entries whose combined coefficient is exactly zero are omitted.

(cls, ring: IntegerRing, shape: tuple[int, int], entries: Iterable[tuple[int, int, int]]) -> SparseMatrix[IntegerRing]
(cls, ring: RationalField, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | _Fraction]]) -> SparseMatrix[RationalField]
(cls, ring: ResidueRing, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | ResidueClass]]) -> SparseMatrix[ResidueRing]
(cls, ring: FiniteField, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | FiniteFieldElement]]) -> SparseMatrix[FiniteField]
(cls, ring: PadicRing, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | PadicElement]]) -> SparseMatrix[PadicRing]
(cls, ring: PadicField, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | PadicElement]]) -> SparseMatrix[PadicField]
(cls, ring: QadicRing, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | QadicElement]]) -> SparseMatrix[QadicRing]
(cls, ring: QadicField, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | QadicElement]]) -> SparseMatrix[QadicField]
(cls, ring: PadicLocalField, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | PadicLocalFieldElement]]) -> SparseMatrix[PadicLocalField]
(cls, ring: PadicLocalFieldOrder, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | PadicLocalFieldElement]]) -> SparseMatrix[PadicLocalFieldOrder]
(cls, ring: RealBallField, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | _Fraction | RealBall]]) -> SparseMatrix[RealBallField]
(cls, ring: ComplexBallField, shape: tuple[int, int], entries: Iterable[tuple[int, int, int | _Fraction | ComplexBall]]) -> SparseMatrix[ComplexBallField]
(cls, ring: PolynomialRing[_PolynomialCoefficientContext], shape: tuple[int, int], entries: Iterable[tuple[int, int, Polynomial[_PolynomialCoefficientContext] | PolynomialScalar]]) -> SparseMatrix[PolynomialRing[_PolynomialCoefficientContext]]
(cls, ring: QuotientRing[C], shape: tuple[int, int], entries: Iterable[tuple[int, int, QuotientElement[C] | Polynomial[C]]]) -> SparseMatrix[QuotientRing[C]]

noether::linalg::SparseMatrix::from_triplets · Direct Rust declaration

pub fn from_triplets<I>( ring: R, rows: usize, cols: usize, entries: I, ) -> Result<Self, LinalgError>where I: IntoIterator<Item = (usize, usize, 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/SparseMatrix@1

Executable usage: examples/05_sparse_exact_operators.py:10 · validation/unit/commalg/test_quotient_facade.py:179 · validation/unit/homalg/test_chain_complex.py:185 · validation/unit/homalg/test_module_facade.py:221 · validation/unit/homalg/test_module_facade.py:628 · validation/unit/homalg/test_padic_homology_facade.py:192

linalg.SparseMatrix.input_dimension

Return the input dimension recorded by this SparseMatrix.

(self) -> int

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.nnz

Number of stored exact nonzeros.

Detailed contract

Number of explicitly stored nonzero entries.

(self) -> int

noether::linalg::SparseMatrix::nnz · Direct Rust declaration

pub fn nnz(&self) -> usize
fn nnz(&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/SparseMatrix@1

Executable usage: examples/05_sparse_exact_operators.py:18 · examples/05_sparse_exact_operators.py:19 · validation/unit/commalg/test_quotient_facade.py:185 · validation/unit/homalg/test_module_facade.py:222 · validation/unit/linalg/test_sparse_matrix_facade.py:29 · validation/unit/linalg/test_sparse_matrix_facade.py:68

linalg.SparseMatrix.output_dimension

Return the output dimension recorded by this SparseMatrix.

(self) -> int

noether::linalg::SparseMatrix::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/SparseMatrix@1

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

linalg.SparseMatrix.padic_smith_invariants

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

Detailed contract

Compute visible Smith valuations through a fill-aware sparse workspace. CSR remains the canonical external representation. Elimination uses a mutable row-and-column map, chooses unit pivots by predicted fill, and switches to the dense correctness floor once measured density reaches the benchmarked cutover.

(self: SparseMatrix[PadicRing]) -> PadicSmithInvariants

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.ring

Exact coefficient context.

Detailed contract

The exact coefficient context.

(self) -> R

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.row_offsets

Canonical CSR row offsets.

(self) -> list[int]

noether::linalg::SparseMatrix::row_offsets · Direct Rust declaration

pub fn row_offsets(&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/SparseMatrix@1

Executable usage: validation/unit/linalg/test_sparse_matrix_facade.py:120 · validation/unit/linalg/test_sparse_matrix_facade.py:32

linalg.SparseMatrix.shape

(rows, columns).

Detailed contract

(rows, columns).

(self) -> tuple[int, int]

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.to_dense

Losslessly materialize a dense matrix with the same context.

Detailed contract

Losslessly materialize the corresponding dense matrix.

(self) -> Matrix[R]

noether::linalg::SparseMatrix::to_dense · Direct Rust declaration

pub fn to_dense(&self) -> Matrix<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/SparseMatrix@1

Executable usage: validation/unit/commalg/test_quotient_facade.py:187 · validation/unit/commalg/test_quotient_facade.py:191 · validation/unit/homalg/test_module_facade.py:223 · validation/unit/homalg/test_padic_homology_facade.py:195 · validation/unit/homalg/test_padic_homology_facade.py:210 · validation/unit/linalg/test_acceptance_workload.py:115

linalg.SparseMatrix.to_json

Serialize the coefficient context and canonical CSR arrays.

Detailed contract

Serialize the complete coefficient context and canonical CSR arrays.

(self) -> str

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.transpose

Return the canonical sparse transpose.

(self) -> SparseMatrix[R]

noether::linalg::SparseMatrix::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/SparseMatrix@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.SparseMatrix.values

Canonical CSR nonzero coefficients.

(self) -> list[int | _Fraction | ResidueClass | FiniteFieldElement | PadicElement | PadicLocalFieldElement | QadicElement | RealBall | ComplexBall | PolynomialScalar | QuotientScalar]

noether::linalg::SparseMatrix::values · Direct Rust declaration

pub fn values(&self) -> &[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/SparseMatrix@1

Executable usage: validation/unit/combinatorics/test_partition_types.py:3 · validation/unit/commalg/test_context_tower_workload.py:70 · validation/unit/commalg/test_context_tower_workload.py:82 · validation/unit/homalg/test_exact_submodules.py:31 · validation/unit/homalg/test_exact_submodules.py:32 · validation/unit/homalg/test_exterior_algebra.py:382

linalg.SparseMatrix.zeros

Construct a sparse zero matrix.

Detailed contract

Construct the sparse zero matrix with the requested shape.

(cls, ring: _SparseContext, shape: tuple[int, int]) -> SparseMatrix[_SparseContext]

noether::linalg::SparseMatrix::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/SparseMatrix@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