From b9a724669b6e403f972ba4830b03a1c75a6cf49e Mon Sep 17 00:00:00 2001 From: gaumut Date: Wed, 28 Aug 2024 23:28:11 +0200 Subject: [PATCH] Dependencies update (#15) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Dependencies update * Update MSRV to 1.64 and fix some lint * Allow clippy result_large_err & update CI MSRV * Bump MSRV to 1.65 for proptest --------- Co-authored-by: Jean Commère --- .github/workflows/checking.yml | 2 +- .github/workflows/codequality.yml | 2 +- .github/workflows/testing.yml | 2 +- Cargo.toml | 9 +++++---- src/lib.rs | 1 + src/lobpcg/algorithm.rs | 18 +++++++++--------- src/lobpcg/eig.rs | 2 +- src/lobpcg/mod.rs | 2 +- src/lobpcg/svd.rs | 6 +++--- 9 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.github/workflows/checking.yml b/.github/workflows/checking.yml index c19a273..de0787d 100644 --- a/.github/workflows/checking.yml +++ b/.github/workflows/checking.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: toolchain: - - 1.54.0 + - 1.65.0 - stable - nightly os: diff --git a/.github/workflows/codequality.yml b/.github/workflows/codequality.yml index 93aa803..794c69f 100644 --- a/.github/workflows/codequality.yml +++ b/.github/workflows/codequality.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: toolchain: - - 1.54.0 + - 1.65.0 - stable steps: diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a1ccefa..6e0da18 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: toolchain: - - 1.54.0 + - 1.65.0 - stable os: - ubuntu-18.04 diff --git a/Cargo.toml b/Cargo.toml index 2131918..4fc54b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,21 +7,22 @@ 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" keywords = ["ndarray", "matrix", "linalg"] categories = ["algorithms", "mathematics", "science"] [dependencies] -ndarray = { version = "0.15", features = ["approx"] } +ndarray = { version = "0.16", features = ["approx"] } num-traits = "0.2.0" thiserror = "1" rand = { version = "0.8", optional=true } [dev-dependencies] -approx = "0.4" +approx = "0.5" proptest = "1.0" -proptest-derive = "0.2.0" -ndarray-rand = "0.14" +proptest-derive = "0.5.0" +ndarray-rand = "0.15" rand_xoshiro = { version = "0.6" } [features] diff --git a/src/lib.rs b/src/lib.rs index 660937a..05187cf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,6 +10,7 @@ //! linker errors if no BLAS backend is specified. #![allow(clippy::many_single_char_names)] +#![allow(clippy::result_large_err)] pub mod bidiagonal; pub mod cholesky; diff --git a/src/lobpcg/algorithm.rs b/src/lobpcg/algorithm.rs index e07e4f1..4989c4e 100644 --- a/src/lobpcg/algorithm.rs +++ b/src/lobpcg/algorithm.rs @@ -1,10 +1,10 @@ +//! Locally Optimal Block Preconditioned Conjugated +//! +//! This module implements the Locally Optimal Block Preconditioned Conjugated (LOBPCG) algorithm, +//! which can be used as a solver for large symmetric eigenproblems. use ndarray::concatenate; use ndarray::prelude::*; use num_traits::NumCast; -///! Locally Optimal Block Preconditioned Conjugated -///! -///! This module implements the Locally Optimal Block Preconditioned Conjugated (LOBPCG) algorithm, -///which can be used as a solver for large symmetric eigenproblems. use std::iter::Sum; use crate::{cholesky::*, eigh::*, norm::*, triangular::*}; @@ -100,15 +100,15 @@ fn orthonormalize(v: Array2) -> Result<(Array2, Array2)> { /// /// # Arguments /// * `a` - An operator defining the problem, usually a sparse (sometimes also dense) matrix -/// multiplication. Also called the "stiffness matrix". +/// multiplication. Also called the "stiffness matrix". /// * `x` - Initial approximation of the k eigenvectors. If `a` has shape=(n,n), then `x` should -/// have shape=(n,k). +/// have shape=(n,k). /// * `m` - Preconditioner to `a`, by default the identity matrix. Should approximate the inverse -/// of `a`. +/// of `a`. /// * `y` - Constraints of (n,size_y), iterations are performed in the orthogonal complement of the -/// column-space of `y`. It must be full rank. +/// column-space of `y`. It must be full rank. /// * `tol` - The tolerance values defines at which point the solver stops the optimization. The approximation -/// of a eigenvalue stops when then l2-norm of the residual is below this threshold. +/// of a eigenvalue stops when then l2-norm of the residual is below this threshold. /// * `maxiter` - The maximal number of iterations /// * `order` - Whether to solve for the largest or lowest eigenvalues /// diff --git a/src/lobpcg/eig.rs b/src/lobpcg/eig.rs index 2ae8237..2cc15e6 100644 --- a/src/lobpcg/eig.rs +++ b/src/lobpcg/eig.rs @@ -274,7 +274,7 @@ impl Iterator for TruncatedEigIterator { let eigvecs_arr: Vec<_> = constraints .columns() .into_iter() - .chain(eigvecs.columns().into_iter()) + .chain(eigvecs.columns()) .collect(); stack(Axis(1), &eigvecs_arr).unwrap() diff --git a/src/lobpcg/mod.rs b/src/lobpcg/mod.rs index 0c14b1d..35028ce 100644 --- a/src/lobpcg/mod.rs +++ b/src/lobpcg/mod.rs @@ -7,7 +7,7 @@ //! ``` //! where A is symmetric and (x, lambda) the solution. It has the following advantages: //! * matrix free: does not require storing the coefficient matrix explicitely and only evaluates -//! matrix-vector products. +//! matrix-vector products. //! * factorization-free: does not require any matrix decomposition //! * linear-convergence: theoretically guaranteed and practically observed //! diff --git a/src/lobpcg/svd.rs b/src/lobpcg/svd.rs index bb2cc0b..ac941af 100644 --- a/src/lobpcg/svd.rs +++ b/src/lobpcg/svd.rs @@ -1,6 +1,6 @@ -///! Truncated singular value decomposition -///! -///! This module computes the k largest/smallest singular values/vectors for a dense matrix. +//! Truncated singular value decomposition +//! +//! This module computes the k largest/smallest singular values/vectors for a dense matrix. use crate::{ lobpcg::{lobpcg, random, Lobpcg}, Order, Result,