linalg · ClosestLatticeVectors¶
3 accepted declarations. Python and Rust forms, contracts, evidence, failure boundaries, and checked usages are kept together below.
Worked example¶
The complete checked program Enumerate and verify the six shortest vectors of the A2 lattice uses this API directly.
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Enumerate and verify the six shortest vectors of the A2 lattice."""
from noether import Z
from noether.linalg import Lattice, Matrix
def main() -> None:
lattice = Lattice(Matrix.from_rows(Z, [[2, -1], [-1, 2]]))
shortest = lattice.shortest_vectors()
shortest.verify(lattice)
assert shortest.signed_count == 6
assert shortest.max_norm == 2
print(f"A2 has {shortest.signed_count} shortest vectors of norm {shortest.max_norm}")
if __name__ == "__main__":
main()
Run it with .venv/bin/python examples/06_shortest_lattice_vectors.py.
linalg.ClosestLatticeVectors¶
Exact closest vectors and their common squared distance.
noether::linalg::ClosestLatticeVectors · Direct Rust declaration
| 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/ClosestLatticeVectors@1 |
Executable usage: validation/unit/linalg/test_lattice_facade.py:10 · validation/unit/linalg/test_lattice_facade.py:71
linalg.ClosestLatticeVectors.distance_squared¶
Return the distance squared recorded by this ClosestLatticeVectors.
Detailed contract
The exact squared distance to every returned closest vector.
noether::linalg::ClosestLatticeVectors::distance_squared · Direct Rust declaration
| 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/ClosestLatticeVectors@1 |
Executable usage: validation/unit/linalg/test_lattice_facade.py:72
linalg.ClosestLatticeVectors.vectors¶
Return the vectors recorded by this ClosestLatticeVectors.
Detailed contract
All closest integral coordinate vectors in deterministic order.
noether::linalg::ClosestLatticeVectors::vectors · Direct Rust declaration
| 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/ClosestLatticeVectors@1 |
Executable usage: examples/06_shortest_lattice_vectors.py:15 · examples/06_shortest_lattice_vectors.py:3 · examples/29_integral_line_configurations.py:29 · validation/unit/linalg/test_lattice_facade.py:110 · validation/unit/linalg/test_lattice_facade.py:112 · validation/unit/linalg/test_lattice_facade.py:116