Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Favor the invariant over a convenient edit or faster implementation.
## Rust and API Design

- Keep the MSRV and contributor/CI toolchain aligned across `Cargo.toml`,
`rust-toolchain.toml`, and `clippy.toml`; the current baseline is 1.99.1.
`rust-toolchain.toml`, and `clippy.toml`; the current baseline is 1.100.0.
- Rust's `f64::algebraic_*` operations are forbidden in all repository-owned
Rust, including tests, examples, and benchmarks, except intentional
Semgrep fixtures under `tests/semgrep/` whose `f64::algebraic_*` usage is
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Any future approximate or fast-math API requires a separate design issue, an
explicit public contract, independent correctness analysis, and representative
benchmarks. It must remain opt-in and must not change existing APIs.

The current MSRV and contributor toolchain are Rust 1.99.1. Both workspace
The current MSRV and contributor toolchain are Rust 1.100.0. Both workspace
manifests and `clippy.toml` match `rust-toolchain.toml`; CI, coverage, and release
setup consume that declaration. Run `just setup-tools` after changing it:
managed Cargo tools are installed separately for each compiler version.
Expand Down
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
name = "la-stack"
version = "0.5.3"
edition = "2024"
rust-version = "1.99.1"
rust-version = "1.100.0"
autobenches = false
license = "BSD-3-Clause"
description = "Fast, stack-allocated linear algebra for fixed dimensions"
readme = "README.md"
documentation = "https://docs.rs/la-stack"
repository = "https://github.com/acgetchell/la-stack"
homepage = "https://github.com/acgetchell/la-stack"
categories = [ "mathematics", "science" ]
keywords = [ "linear-algebra", "geometry", "const-generics", "exact-arithmetic", "robust-predicates" ]
include = [
Expand Down Expand Up @@ -146,6 +145,14 @@ resolver = "3"
[lints]
workspace = true

[workspace.lints.cargo]
missing_lints_inheritance = "deny"
redundant_homepage = "deny"
unknown_lints = "deny"
unused_dependencies = "deny"
unused_workspace_dependencies = "deny"
unused_workspace_package_fields = "deny"

[workspace.lints.rust]
warnings = { level = "deny", priority = -1 }
unsafe_code = "forbid"
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ values and sparse polynomials use heap allocation.

## 🚀 Quickstart

The minimum supported Rust version (MSRV) is 1.99.1.
The minimum supported Rust version (MSRV) is 1.100.0.

Add this to your `Cargo.toml`:

Expand Down Expand Up @@ -578,10 +578,12 @@ For the current release-to-release performance snapshot, see
[docs/performance.md](https://github.com/acgetchell/la-stack/blob/main/docs/performance.md).
The exact release selection includes rational-input groups for D=2 through D=8,
covering `RationalMatrix::det_sign`, `det`, and `solve` with Criterion point
estimates and confidence intervals. Comparisons against a pre-API baseline retain
supported new workloads as explicit current-only measurements. The benchmark
target also provides `BigRational` Gaussian references for optional diagnostics;
those reference timings are excluded from required release acquisition.
estimates and confidence intervals. New exact comparisons require these groups
in both baseline and current phases. Only frozen historical reports whose
baseline predates the rational-input API may retain current-only rows, with a
coverage note and no cross-release ratio. The benchmark target also provides
`BigRational` Gaussian references for optional diagnostics; those reference
timings are excluded from required release acquisition.

The focused `interval` Criterion suite covers conclusive and inconclusive
relative-coordinate lifted determinant signs at D=4 and the maximum supported
Expand Down
2 changes: 1 addition & 1 deletion benches/common/exact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl SplitMix64 {
clippy::cast_possible_truncation,
reason = "an inclusive i16 range has width at most 65,536, so its modulo offset fits i32"
)]
let offset = (self.next_u64() % range.width.get()) as i32;
let offset = (self.next_u64() % range.width) as i32;
let value_i32 = i32::from(range.min) + offset;
#[expect(
clippy::cast_possible_truncation,
Expand Down
4 changes: 0 additions & 4 deletions benches/common/rational_solve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,6 @@ pub fn solve_input<const D: usize>(structure: Structure, dyadic: bool) -> Valida
/// `src/geometry/matrix.rs`, lines 215–256. Arithmetic, cloning, and zero skips
/// are retained; only the function name and visibility differ.
#[must_use]
#[expect(
clippy::needless_range_loop,
reason = "preserve the captured legacy control"
)]
pub fn legacy_solve(
mut matrix: Vec<Vec<BigRational>>,
mut rhs: Vec<BigRational>,
Expand Down
2 changes: 1 addition & 1 deletion benches/comparison/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "la-stack-comparison"
version = "0.0.0"
edition = "2024"
rust-version = "1.99.1"
rust-version = "1.100.0"
publish = false
autobenches = false

Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Clippy configuration for the la-stack crate.

# Keep lint behavior aligned with Cargo.toml and rust-toolchain.toml.
msrv = "1.99.1"
msrv = "1.100.0"

# Lint levels are owned by Cargo.toml.
35 changes: 15 additions & 20 deletions docs/BENCHMARKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For a release comparison, `just performance-release` fetches tags and prepares
independent source assertions before measurement. For preparation alone,
`just performance-prepare` uses local tags; add `--fetch-tags --allow-git-mutations`
to fetch them. Fetching and measurement recipes' temporary worktrees require
authorization. Both labels of new measurements must be v0.5.0 or newer.
authorization. Both labels of new measurements must be v0.5.2 or newer.
Preparation also saves independent release tags and commits for a later
`just performance-readme` invocation in ignored
`target/bench-reports/release-inputs.json`. For an explicit prepared pair, set
Expand Down Expand Up @@ -114,14 +114,11 @@ The `public-release-and-paired-lu-peers-v4` policy includes column bases,
interval division/solves, rational dot products, and polynomial determinants.
The full la-stack selection has 736 default-feature and 667 exact-feature cases.
Local `performance-release`, `performance-local`, and full `performance-measure`
measure all 1,403 cases at the current revision under one captured harness.
Baselines before v0.5.2 measure 1,254 shared library cases: 646 default-feature
and 608 exact-feature cases. Column bases, interval division/solves, rational dot
products and polynomial determinants were introduced in v0.5.2. Their 149 cases
are required on each supported revision and unavailable on older revisions.
The independent catalog's `[availability]` table and the schema-6 suite bounds
declare this boundary. Resolution uses the original source receipt before
overlaying the current harness; a supported compile failure remains an error.
measure all 1,403 cases on both revisions under one captured harness.
Every supported release provides column bases, interval division/solves, rational
dot products and polynomial determinants. The full and non-exact declarations
reject releases before v0.5.2 before native compilation. Every suite is required
on both phases; discovery or compilation failures remain errors.
Both phases also measure the 16 native nalgebra/faer LU factorization-plus-one-solve
cases at D=2, 3, 4, 5, 8, 16, 32 and 64. Each phase's eight matching la-stack
cases and 16 peers share one `lu-solve` acquisition unit. The README uses
Expand All @@ -138,7 +135,7 @@ retains the observed inventory and rejects missing required cases.
The installed engine rejects duplicate semantic IDs and incomplete raw samples.

The full plan uses one sequential trial; README and LU plots explicitly select
trial 1. Baseline selectors include README because historical compilers read it.
trial 1. Baseline selectors include README because v0.5.2 compilation reads it.
Current source includes README only during rustdoc; current native gates verify
that both debug and release dependency files exclude it before timing. Full
comparison with an older current revision that still compiles README is rejected.
Expand Down Expand Up @@ -185,10 +182,8 @@ The paired-suite migration implements that decision within the current schema-6
schedule; historical acquisitions retain their original policy and bytes.

The shared reporter prints the discovered case count and nominal timing budget
before samples are acquired. With a pre-v0.5.2 baseline, the plan has 2,689
measurements and a nominal 358.5-minute warmup-plus-measurement budget. A baseline
at v0.5.2 or later requires 2,838 measurements and 378.4 nominal minutes.
Both budgets exclude compilation, gates and analysis.
before samples are acquired. The plan requires 2,838 measurements and a nominal
378.4-minute warmup-plus-measurement budget, excluding compilation, gates and analysis.
`performance-release` records preparation, measurement and promotion elapsed seconds and exit
status in ignored `target/bench-reports/full/runtime.txt`, including failures.
The timer starts after Just's prerequisite checks. Use `time just performance-release`
Expand Down Expand Up @@ -219,10 +214,10 @@ diagnosing failure.
Retry a failed report promotion with `just performance-promote`, or README
publication with `just performance-readme`. Neither reacquires samples.

Each suite compares revisions only when both implement its API. Earlier baselines
retain explicit unavailable cells for new APIs; supported discovery failures
remain errors. Existing retained reports remain historical and do not satisfy
the expanded inventory; changing this plan does not rewrite them.
Every suite compares the same required APIs on both revisions. Existing retained
reports may contain unavailable cells from earlier release comparisons; they
remain historical and do not satisfy the current inventory. Changing this plan
does not rewrite them.

**`public_api`** (`benches/public_api.rs`) owns construction, access, mutation,
symmetry, direct determinant certificates, interval determinant queries, and
Expand Down Expand Up @@ -869,7 +864,7 @@ that the D=2–4 headline fixtures resolve through the floating-point filter, so
those rows continue to measure the intended common path. Use a current
shared-harness comparison between supported releases before attributing timing
changes to the library implementation. v0.4.3 and older cannot be rerun with the
current workflow.
current workflow, which requires v0.5.2 or newer.

Archived reports may show rows such as `det_exact_rounded_f64 (vs det_exact_f64)`
or `det_exact_f64_result (vs det_exact_f64)`. Those used the historical lossy
Expand Down Expand Up @@ -932,7 +927,7 @@ release state stop publication.

There is no hosted measurement budget. Local sampling remains 100 samples,
100,000 resamples, 95% confidence, 3-second warmup and 5-second measurement.
With v0.5.2-or-later baseline availability, 2,838 case observations imply 378.4
The 2,838 case observations imply 378.4
minutes of nominal warmup/measurement plus setup; this is a planning estimate,
not measured runtime or an upper bound. Resume retains completed suite pairs
inside the single scheduled trial without discarding original provenance.
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ line-length = 160

[tool.uv]
package = false
required-version = "==0.13.7"
required-version = "==0.13.8"
# Semgrep stopped shipping Intel macOS wheels after 1.182.1.
constraint-dependencies = [
"semgrep==1.182.1; sys_platform == 'darwin' and platform_machine == 'x86_64'",
Expand Down Expand Up @@ -142,14 +142,14 @@ osv-scanner = "2.7.1"
cargo-edit = "0.13.14"
cargo-llvm-cov = "0.9.1"
cargo-machete = "0.9.2"
cargo-nextest = "0.9.151"
cargo-nextest = "0.9.152"
clippy-sarif = "0.8.0"
dprint = "0.64.3"
git-cliff = "2.14.2"
rumdl = "0.3.3"
rumdl = "0.3.4"
sarif-fmt = "0.8.0"
taplo-cli = "0.10.0"
typos-cli = "1.52.1"
typos-cli = "1.52.2"
zizmor = "1.32.0"

[tool.research-repo-tools.changelog]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[toolchain]
# Pin to MSRV as specified in Cargo.toml
channel = "1.99.1"
channel = "1.100.0"

# Components used by the shared development and CI toolchain.
components = [
Expand Down
2 changes: 1 addition & 1 deletion src/exact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ fn bareiss_forward_eliminate<const D: usize>(
if let Some(r) = &mut rhs {
r.swap(k, i);
}
odd_swaps = !odd_swaps;
odd_swaps.toggle();
found = true;
break;
}
Expand Down
8 changes: 0 additions & 8 deletions src/ldlt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ impl<const D: usize> Ldlt<D> {
let l_i = rows[i][j];
let l_i_d = l_i * d;

#[expect(
clippy::needless_range_loop,
reason = "the triangular column index coordinates multiplier reads with in-place trailing-row writes"
)]
for k in (j + 1)..=i {
let l_k = rows[k][j];
let new_val = (-l_i_d).mul_add(l_k, rows[i][k]);
Expand All @@ -165,10 +161,6 @@ impl<const D: usize> Ldlt<D> {

let l_i_d = l_i * d;

#[expect(
clippy::needless_range_loop,
reason = "the triangular column index coordinates normalized-column reads with the fused in-place update"
)]
for k in (j + 1)..=i {
let l_k = rows[k][j];
let new_val = (-l_i_d).mul_add(l_k, rows[i][k]);
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ const EPS: f64 = f64::EPSILON; // 2^-52
/// # Ok(())
/// # }
/// ```
pub const ERR_COEFF_2: f64 = 3.0 * EPS + 16.0 * EPS * EPS;
pub const ERR_COEFF_2: f64 = (16.0 * EPS).mul_add(EPS, 3.0 * EPS);

/// Absolute error coefficient for [`Matrix::<3>::det_direct`](crate::Matrix::det_direct).
///
Expand All @@ -1146,7 +1146,7 @@ pub const ERR_COEFF_2: f64 = 3.0 * EPS + 16.0 * EPS * EPS;
/// [`Matrix::det_direct_with_errbound`](crate::Matrix::det_direct_with_errbound)
/// over this constant for typical use; see [`ERR_COEFF_2`] for a worked
/// example.
pub const ERR_COEFF_3: f64 = 8.0 * EPS + 64.0 * EPS * EPS;
pub const ERR_COEFF_3: f64 = (64.0 * EPS).mul_add(EPS, 8.0 * EPS);

/// Absolute error coefficient for [`Matrix::<4>::det_direct`](crate::Matrix::det_direct).
///
Expand Down Expand Up @@ -1174,7 +1174,7 @@ pub const ERR_COEFF_3: f64 = 8.0 * EPS + 64.0 * EPS * EPS;
/// [`Matrix::det_direct_with_errbound`](crate::Matrix::det_direct_with_errbound)
/// over this constant for typical use; see [`ERR_COEFF_2`] for a worked
/// example.
pub const ERR_COEFF_4: f64 = 12.0 * EPS + 128.0 * EPS * EPS;
pub const ERR_COEFF_4: f64 = (128.0 * EPS).mul_add(EPS, 12.0 * EPS);

/// Largest dimension supported by [`try_with_stack_matrix!`].
///
Expand Down
10 changes: 2 additions & 8 deletions src/lu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,8 @@ impl<const D: usize> RowPermutation<D> {
/// Apply one row swap and update parity atomically.
const fn swap(&mut self, left: usize, right: usize) {
if left != right {
let source_row = self.source_rows[left];
self.source_rows[left] = self.source_rows[right];
self.source_rows[right] = source_row;
self.odd = !self.odd;
self.source_rows.swap(left, right);
self.odd.toggle();
}
}

Expand Down Expand Up @@ -197,10 +195,6 @@ impl<const D: usize> Lu<D> {
let mult = rows[r][k] / pivot;
rows[r][k] = mult;

#[expect(
clippy::needless_range_loop,
reason = "the column index pairs pivot-row reads with eliminated-row writes in the in-place update"
)]
for c in (k + 1)..D {
let updated = (-mult).mul_add(rows[k][c], rows[r][c]);
rows[r][c] = updated;
Expand Down
6 changes: 3 additions & 3 deletions src/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,10 +875,10 @@ impl<const D: usize> Matrix<D> {
// gradual-underflow discrepancy avoided by the direct path above.
let mut eps = rel_tol;

for r in 0..D {
for (r, row) in self.rows.iter().enumerate() {
let mut row_eps = 0.0;
for c in 0..D {
row_eps = rel_tol.mul_add(self.rows[r][c].abs(), row_eps);
for (c, value) in row.iter().enumerate() {
row_eps = rel_tol.mul_add(value.abs(), row_eps);
if !row_eps.is_finite() {
cold_path();
return Err(LaError::non_finite_computation_matrix(
Expand Down
Loading
Loading