Polynomial Matrix API¶
Functions for matrices whose entries are polynomials over a finite field F_p[x].
Polynomials are represented as coefficient lists [c_0, c_1, ..., c_d] (constant term first), with coefficients in [0, p-1]. The zero polynomial is []. No trailing zeros are permitted.
All invariant factors and HNF pivots are returned as monic polynomials.
Functions¶
snforacle.poly_interface.poly_smith_normal_form ¶
Compute the Smith normal form of a polynomial matrix over F_p[x].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
Any
|
The input matrix as a |
required |
backend
|
_PolyBackendName | None
|
Name of the backend to use. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
PolySNFResult
|
A Pydantic model with fields:
|
snforacle.poly_interface.poly_smith_normal_form_with_transforms ¶
poly_smith_normal_form_with_transforms(
matrix: Any, backend: _PolyBackendName | None = None
) -> PolySNFWithTransformsResult
Compute the SNF together with invertible left and right transforms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
Any
|
The input matrix (same accepted types as :func: |
required |
backend
|
_PolyBackendName | None
|
Name of the backend to use. |
None
|
Returns:
| Type | Description |
|---|---|
PolySNFWithTransformsResult
|
A Pydantic model with fields:
Satisfies: |
snforacle.poly_interface.poly_hermite_normal_form ¶
Compute the row Hermite Normal Form of a polynomial matrix over F_p[x].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
Any
|
The input matrix (same accepted types as :func: |
required |
backend
|
_PolyBackendName | None
|
Name of the backend to use. |
None
|
Returns:
| Type | Description |
|---|---|
PolyHNFResult
|
A Pydantic model with field:
|
snforacle.poly_interface.poly_hermite_normal_form_with_transform ¶
poly_hermite_normal_form_with_transform(
matrix: Any, backend: _PolyBackendName | None = None
) -> PolyHNFWithTransformResult
Compute the row HNF together with the left invertible transform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
Any
|
The input matrix (same accepted types as :func: |
required |
backend
|
_PolyBackendName | None
|
Name of the backend to use. |
None
|
Returns:
| Type | Description |
|---|---|
PolyHNFWithTransformResult
|
A Pydantic model with fields:
Satisfies: |
snforacle.poly_interface.poly_elementary_divisors ¶
poly_elementary_divisors(
matrix: Any, backend: _PolyBackendName | None = None
) -> PolyElementaryDivisorsResult
Compute the non-zero invariant factors (elementary divisors) over F_p[x].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
Any
|
The input matrix (same accepted types as :func: |
required |
backend
|
_PolyBackendName | None
|
Name of the backend to use. |
None
|
Returns:
| Type | Description |
|---|---|
PolyElementaryDivisorsResult
|
A Pydantic model with field:
|
Input models¶
snforacle.poly_schema.DensePolyMatrix ¶
Bases: BaseModel
A matrix over F_p[x] stored as a full list of rows.
Each entry is a coefficient list [c_0, ..., c_d] with all
coefficients in [0, p-1]. Trailing zeros are not allowed
(use [] for the zero polynomial).
snforacle.poly_schema.SparsePolyMatrix ¶
Bases: BaseModel
A matrix over F_p[x] stored as (row, col, coeffs) triples.
Entries not listed are implicitly the zero polynomial.
Output models¶
snforacle.poly_schema.PolySNFResult ¶
Bases: BaseModel
The Smith normal form of a polynomial matrix over F_p[x].
Invariant factors are monic polynomials d_1 | d_2 | ... | d_r satisfying the divisibility chain, sorted by degree (ascending) then lexicographically. The SNF matrix has these on its diagonal; all other entries are zero.
snforacle.poly_schema.PolySNFWithTransformsResult ¶
Bases: BaseModel
SNF of a polynomial matrix together with invertible transforms.
Satisfies: left_transform @ M @ right_transform = smith_normal_form. The transforms are invertible matrices over F_p[x] (not necessarily unimodular in the polynomial sense, but with nonzero constant determinant).
snforacle.poly_schema.PolyHNFResult ¶
Bases: BaseModel
Row Hermite Normal Form of a polynomial matrix over F_p[x].
The HNF is the unique upper-triangular matrix H = U @ M where U is invertible over F_p[x], the pivots are monic, and entries above each pivot have strictly smaller degree than the pivot.
snforacle.poly_schema.PolyHNFWithTransformResult ¶
Bases: BaseModel
Row HNF together with the left invertible transform.
Satisfies: left_transform @ M = hermite_normal_form.
snforacle.poly_schema.PolyElementaryDivisorsResult ¶
Bases: BaseModel
Non-zero invariant factors (elementary divisors) of a polynomial matrix.
These are the same monic polynomials as the diagonal of the SNF, returned in ascending-degree order.