From 25d7dfbfe2f2675a301e2b19088f02b383366fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean=20Comm=C3=A8re?= Date: Mon, 17 Nov 2025 11:05:46 +0100 Subject: [PATCH 1/2] Dependencies update --- Cargo.toml | 12 ++++++------ src/lobpcg/algorithm.rs | 4 ++-- src/lobpcg/eig.rs | 5 ++++- src/lobpcg/mod.rs | 6 +++--- src/lobpcg/svd.rs | 4 ++-- src/triangular.rs | 2 +- 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 88654f2..05113ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,17 +13,17 @@ keywords = ["ndarray", "matrix", "linalg"] categories = ["algorithms", "mathematics", "science"] [dependencies] -ndarray = { version = "0.16", features = ["approx"] } +ndarray = { version = "0.17", features = ["approx"] } num-traits = "0.2.0" -thiserror = "1" -rand = { version = "0.8", optional=true } +thiserror = "2" +rand = { version = "0.9", optional=true } [dev-dependencies] approx = "0.5" proptest = "1.0" -proptest-derive = "0.5.0" -ndarray-rand = "0.15" -rand_xoshiro = { version = "0.6" } +proptest-derive = "0.7.0" +ndarray-rand = "0.16" +rand_xoshiro = { version = "0.7" } [features] default = ["iterative"] diff --git a/src/lobpcg/algorithm.rs b/src/lobpcg/algorithm.rs index 9bdce9e..f4b5179 100644 --- a/src/lobpcg/algorithm.rs +++ b/src/lobpcg/algorithm.rs @@ -440,7 +440,7 @@ mod tests { use crate::qr::*; use approx::assert_abs_diff_eq; use ndarray::prelude::*; - use rand::distributions::{Distribution, Standard}; + use rand::distr::{Distribution, StandardUniform}; use rand::SeedableRng; use rand_xoshiro::Xoshiro256Plus; @@ -448,7 +448,7 @@ mod tests { fn random(sh: (usize, usize)) -> Array2 where A: NdFloat, - Standard: Distribution, + StandardUniform: Distribution, { let rng = Xoshiro256Plus::seed_from_u64(3); crate::lobpcg::random(sh, rng) diff --git a/src/lobpcg/eig.rs b/src/lobpcg/eig.rs index 2cc15e6..a0b0f0a 100644 --- a/src/lobpcg/eig.rs +++ b/src/lobpcg/eig.rs @@ -152,7 +152,10 @@ impl TruncatedEig { lobpcg( |y| self.problem.dot(&y), x, - |mut y| y.assign(&preconditioner.dot(&y)), + |mut y| { + let tmp = preconditioner.dot(&y); + y.assign(&tmp) + }, self.constraints.as_ref().map(|x| x.view()), self.precision, self.maxiter, diff --git a/src/lobpcg/mod.rs b/src/lobpcg/mod.rs index 35028ce..8dccf0c 100644 --- a/src/lobpcg/mod.rs +++ b/src/lobpcg/mod.rs @@ -18,7 +18,7 @@ mod eig; mod svd; use ndarray::prelude::*; -use rand::distributions::Standard; +use rand::distr::StandardUniform; use rand::prelude::*; pub use crate::{LinalgError, Order}; @@ -32,9 +32,9 @@ where A: NdFloat, D: Dimension, Sh: ShapeBuilder, - Standard: Distribution, + StandardUniform: Distribution, { - ArrayBase::from_shape_fn(sh, |_| rng.gen::()) + ArrayBase::from_shape_fn(sh, |_| rng.random::()) } /// The result of the eigensolver diff --git a/src/lobpcg/svd.rs b/src/lobpcg/svd.rs index ac941af..1c085f6 100644 --- a/src/lobpcg/svd.rs +++ b/src/lobpcg/svd.rs @@ -270,7 +270,7 @@ mod tests { use approx::assert_abs_diff_eq; use ndarray::{arr1, arr2, s, Array1, Array2, NdFloat}; use ndarray_rand::{rand_distr::StandardNormal, RandomExt}; - use rand::distributions::{Distribution, Standard}; + use rand::distr::{Distribution, StandardUniform}; use rand::SeedableRng; use rand_xoshiro::Xoshiro256Plus; @@ -278,7 +278,7 @@ mod tests { fn random(sh: (usize, usize)) -> Array2 where A: NdFloat, - Standard: Distribution, + StandardUniform: Distribution, { let rng = Xoshiro256Plus::seed_from_u64(3); super::random(sh, rng) diff --git a/src/triangular.rs b/src/triangular.rs index 373e3ad..987db83 100644 --- a/src/triangular.rs +++ b/src/triangular.rs @@ -139,7 +139,7 @@ pub(crate) fn solve_triangular_system( if uplo == UPLO::Upper { solve_triangular_system_common(a, b, |rows| (0..rows).rev(), |r, c| s![..r, c], diag_fn) } else { - solve_triangular_system_common(a, b, |rows| (0..rows), |r, c| s![r + 1.., c], diag_fn) + solve_triangular_system_common(a, b, |rows| 0..rows, |r, c| s![r + 1.., c], diag_fn) } } From a9f51d7e7a0b286b4d9799dfbbb4db93cb53e3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean=20Comm=C3=A8re?= Date: Mon, 17 Nov 2025 11:22:11 +0100 Subject: [PATCH 2/2] Bump MSRV to 1.82 --- .github/workflows/checking.yml | 2 +- .github/workflows/codequality.yml | 2 +- .github/workflows/testing.yml | 2 +- Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checking.yml b/.github/workflows/checking.yml index de0787d..5366c6b 100644 --- a/.github/workflows/checking.yml +++ b/.github/workflows/checking.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: toolchain: - - 1.65.0 + - 1.82.0 - stable - nightly os: diff --git a/.github/workflows/codequality.yml b/.github/workflows/codequality.yml index 794c69f..d42998c 100644 --- a/.github/workflows/codequality.yml +++ b/.github/workflows/codequality.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: toolchain: - - 1.65.0 + - 1.82.0 - stable steps: diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 71779d4..88c34e5 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: toolchain: - - 1.65.0 + - 1.82.0 - stable os: - ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index 05113ef..a99b0db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT/Apache-2.0" readme = "README.md" description = "Pure-Rust implementation of linear algebra routines for ndarray" repository = "https://github.com/rust-ml/linfa-linalg" -rust-version = "1.65" +rust-version = "1.82" keywords = ["ndarray", "matrix", "linalg"] categories = ["algorithms", "mathematics", "science"]