Skip to content
Open
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 .github/workflows/checking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
toolchain:
- 1.65.0
- 1.82.0
- stable
- nightly
os:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codequality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
toolchain:
- 1.65.0
- 1.82.0
- stable

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
toolchain:
- 1.65.0
- 1.82.0
- stable
os:
- ubuntu-latest
Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ 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"]

[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"]
Expand Down
4 changes: 2 additions & 2 deletions src/lobpcg/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,15 @@ 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;

/// Generate random array
fn random<A>(sh: (usize, usize)) -> Array2<A>
where
A: NdFloat,
Standard: Distribution<A>,
StandardUniform: Distribution<A>,
{
let rng = Xoshiro256Plus::seed_from_u64(3);
crate::lobpcg::random(sh, rng)
Expand Down
5 changes: 4 additions & 1 deletion src/lobpcg/eig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ impl<A: NdFloat + Sum, R: Rng> TruncatedEig<A, R> {
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,
Expand Down
6 changes: 3 additions & 3 deletions src/lobpcg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -32,9 +32,9 @@ where
A: NdFloat,
D: Dimension,
Sh: ShapeBuilder<Dim = D>,
Standard: Distribution<A>,
StandardUniform: Distribution<A>,
{
ArrayBase::from_shape_fn(sh, |_| rng.gen::<A>())
ArrayBase::from_shape_fn(sh, |_| rng.random::<A>())
}

/// The result of the eigensolver
Expand Down
4 changes: 2 additions & 2 deletions src/lobpcg/svd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ 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;

/// Generate random array
fn random<A>(sh: (usize, usize)) -> Array2<A>
where
A: NdFloat,
Standard: Distribution<A>,
StandardUniform: Distribution<A>,
{
let rng = Xoshiro256Plus::seed_from_u64(3);
super::random(sh, rng)
Expand Down
2 changes: 1 addition & 1 deletion src/triangular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub(crate) fn solve_triangular_system<A: NdFloat>(
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)
}
}

Expand Down
Loading