Skip to content

Commit

Permalink
Merge pull request #276 from rust-ndarray/pr/273
Browse files Browse the repository at this point in the history
Upgrade ndarray 0.15, cauchy 0.4 (num-complex 0.4, rand 0.8), lapack 0.18
  • Loading branch information
termoshtt authored Apr 11, 2021
2 parents 28c7860 + fbac1a9 commit 8c216e0
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/intel-mkl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
linux-container:
runs-on: ubuntu-18.04
container: rustmath/mkl-rust:1.43.0
container: ghcr.io/rust-math/intel-mkl-src/mkl-rust:1.49.0
steps:
- uses: actions/checkout@v1
- uses: actions-rs/cargo@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
coverage:
runs-on: ubuntu-18.04
container:
image: rustmath/mkl-rust:1.43.0
image: ghcr.io/rust-math/intel-mkl-src/mkl-rust:1.49.0
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions lax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ intel-mkl-static = ["intel-mkl-src/mkl-static-lp64-seq", "intel-mkl-src/download
intel-mkl-system = ["intel-mkl-src/mkl-dynamic-lp64-seq"]

[dependencies]
thiserror = "1.0.23"
cauchy = "0.3.0"
thiserror = "1.0.24"
cauchy = "0.4.0"
num-traits = "0.2.14"
lapack = "0.17.0"
lapack = "0.18.0"

[dependencies.intel-mkl-src]
version = "0.6.0"
Expand All @@ -46,7 +46,7 @@ features = ["cblas"]
default-features = false

[dependencies.openblas-src]
version = "0.10.2"
version = "0.10.4"
optional = true
default-features = false
features = ["cblas"]
Expand Down
20 changes: 10 additions & 10 deletions ndarray-linalg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ intel-mkl-static = ["lax/intel-mkl-static"]
intel-mkl-system = ["lax/intel-mkl-system"]

[dependencies]
cauchy = "0.3.0"
num-complex = "0.3.1"
num-traits = "0.2.11"
rand = "0.7.3"
thiserror = "1.0.20"
cauchy = "0.4.0"
num-complex = "0.4.0"
num-traits = "0.2.14"
rand = "0.8.3"
thiserror = "1.0.24"

[dependencies.ndarray]
version = "0.14"
features = ["blas", "approx"]
version = "0.15.1"
features = ["blas", "approx", "std"]
default-features = false

[dependencies.lax]
Expand All @@ -46,10 +46,10 @@ path = "../lax"
default-features = false

[dev-dependencies]
paste = "1.0"
criterion = "0.3"
paste = "1.0.5"
criterion = "0.3.4"
# Keep the same version as ndarray's dependency!
approx = { version = "0.4", features = ["num-complex"] }
approx = { version = "0.4.0", features = ["num-complex"] }

[[bench]]
name = "truncated_eig"
Expand Down
4 changes: 2 additions & 2 deletions ndarray-linalg/src/cholesky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//!
//! // Obtain `L`
//! let lower = a.cholesky(UPLO::Lower).unwrap();
//! assert!(lower.all_close(&array![
//! assert!(lower.abs_diff_eq(&array![
//! [ 2., 0., 0.],
//! [ 6., 1., 0.],
//! [-8., 5., 3.]
Expand All @@ -39,7 +39,7 @@
//! // Solve `A * x = b`
//! let b = array![4., 13., -11.];
//! let x = a.solvec(&b).unwrap();
//! assert!(x.all_close(&array![-2., 1., 0.], 1e-9));
//! assert!(x.abs_diff_eq(&array![-2., 1., 0.], 1e-9));
//! # }
//! ```
Expand Down
1 change: 0 additions & 1 deletion ndarray-linalg/src/eigh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::layout::*;
use crate::operator::LinearOperator;
use crate::types::*;
use crate::UPLO;
use std::iter::FromIterator;

/// Eigenvalue decomposition of Hermite matrix reference
pub trait Eigh {
Expand Down
4 changes: 2 additions & 2 deletions ndarray-linalg/src/lobpcg/eig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ impl<A: Float + Scalar + ScalarOperand + Lapack + PartialOrd + Default> Iterator
// add the new eigenvector to the internal constrain matrix
let new_constraints = if let Some(ref constraints) = self.eig.constraints {
let eigvecs_arr: Vec<_> = constraints
.gencolumns()
.columns()
.into_iter()
.chain(vecs.gencolumns().into_iter())
.chain(vecs.columns().into_iter())
.collect();

stack(Axis(1), &eigvecs_arr).unwrap()
Expand Down
4 changes: 2 additions & 2 deletions ndarray-linalg/src/lobpcg/lobpcg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn apply_constraints<A: Scalar + Lapack>(
let gram_yv = y.t().dot(&v);

let u = gram_yv
.gencolumns()
.columns()
.into_iter()
.map(|x| {
let res = cholesky_yy.solvec(&x).unwrap();
Expand Down Expand Up @@ -222,7 +222,7 @@ pub fn lobpcg<

// calculate L2 norm of error for every eigenvalue
let residual_norms = r
.gencolumns()
.columns()
.into_iter()
.map(|x| x.norm())
.collect::<Vec<A::Real>>();
Expand Down
4 changes: 2 additions & 2 deletions ndarray-linalg/src/lobpcg/svd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<A: Float + PartialOrd + DivAssign<A> + 'static + MagnitudeCorrection> Trunc
let mut ularge = self.problem.dot(&vlarge);

ularge
.gencolumns_mut()
.columns_mut()
.into_iter()
.zip(values.iter())
.for_each(|(mut a, b)| a.mapv_inplace(|x| x / *b));
Expand All @@ -75,7 +75,7 @@ impl<A: Float + PartialOrd + DivAssign<A> + 'static + MagnitudeCorrection> Trunc

let mut vlarge = self.problem.t().dot(&ularge);
vlarge
.gencolumns_mut()
.columns_mut()
.into_iter()
.zip(values.iter())
.for_each(|(mut a, b)| a.mapv_inplace(|x| x / *b));
Expand Down
2 changes: 1 addition & 1 deletion ndarray-linalg/src/solve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! let a: Array2<f64> = array![[3., 2., -1.], [2., -2., 4.], [-2., 1., -2.]];
//! let b: Array1<f64> = array![1., -2., 0.];
//! let x = a.solve_into(b).unwrap();
//! assert!(x.all_close(&array![1., -2., -2.], 1e-9));
//! assert!(x.abs_diff_eq(&array![1., -2., -2.], 1e-9));
//!
//! # }
//! ```
Expand Down
2 changes: 1 addition & 1 deletion ndarray-linalg/src/solveh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! ];
//! let b: Array1<f64> = array![11., -12., 1.];
//! let x = a.solveh_into(b).unwrap();
//! assert!(x.all_close(&array![1., 3., -2.], 1e-9));
//! assert!(x.abs_diff_eq(&array![1., 3., -2.], 1e-9));
//!
//! # }
//! ```
Expand Down
2 changes: 1 addition & 1 deletion ndarray-linalg/tests/cholesky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ macro_rules! cholesky_det {
.eigvalsh(UPLO::Upper)
.unwrap()
.mapv(|elem| elem.ln())
.scalar_sum();
.sum();
let det = ln_det.exp();
assert_aclose!(a.factorizec(UPLO::Upper).unwrap().detc(), det, $atol);
assert_aclose!(a.factorizec(UPLO::Upper).unwrap().ln_detc(), ln_det, $atol);
Expand Down

0 comments on commit 8c216e0

Please sign in to comment.