rust-ndarray / ndarray-linalg

Linear algebra package for rust-ndarray using LAPACK binding
Other
376 stars 77 forks source link

Version conflict with ndarray 0.16.0 #380

Open Silzinc opened 3 months ago

Silzinc commented 3 months ago

Hello. As it seems, using ndarray 0.16.0 (latest now) breaks some implementations in ndarray-linalg, such as ndarray_linalg::solve::Inverse (see picture below using rust-analyzer diagnostic). I don't know if it was planned to solve it already but I put it here. Thank you in advance for solving this !

image

Dependencies :

[dependencies]
nalgebra = "0.33.0"
ndarray = "0.16.0"
ndarray-linalg = "0.16.0"
num-traits = "0.2.19"
rand = "0.8.5"
shigedangao commented 2 months ago

@termoshtt it seems that you are the owner of the crate. Would it be possible to take a bit of time to bump the crate ? :smile:

akrutsinger commented 1 month ago

For what it's worth, just ran into the same kind of incompatibility with my library. In my library, I'm also using ndarray-stats which requires ndarray v0.16. Below is simple example showing the method that can't be found for ArrayBase.

Code

use ndarray::array;
use ndarray_linalg::svd::SVD;

fn main() {
    let a = array![[4.20, 6.9], [6.9, -4.20],];
    let (u, s, vt) = a.svd(true, true).unwrap();
}

Visual Studio Code Error

image

cargo build error

error[E0599]: no method named `svd` found for struct `ArrayBase` in the current scope
   --> src/main.rs:6:24
    |
6   |     let (u, s, vt) = a.svd(true, true).unwrap();
    |                        ^^^
    |
help: there is a method `std` with a similar name, but with different arguments
   --> /home/austyn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ndarray-0.16.1/src/numeric/impl_numeric.rs:207:5
    |
207 | /     pub fn std(&self, ddof: A) -> A
208 | |     where A: Float + FromPrimitive
    | |__________________________________^

Cargo.toml

[package]
name = "svd"
version = "0.1.0"
edition = "2021"

[dependencies]
ndarray = "0.16"
ndarray-linalg = "0.16.0"