You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My simple program main.rs try to resolve linear equations:
use ndarray::prelude::*;
use ndarray_linalg::*;
fn main() {
let a: Array2<f64> = array![[3.0, 2.0], [1.0, 2.0]];
let b: Array1<f64> = array![5.0, 5.0];
let x = a.solve(&b).unwrap(); // Solve the system A * x = B
println!("Solution: {:?}", x);
}
It works when I use ndarray 0.15 and ndarry_linalg 0.15:
[package]
name = "solve"version = "0.1.0"edition = "2021"
[dependencies]
ndarray = "0.15"# Or whichever version you're usingndarray-linalg = { version = "0.15", features = ["openblas-system"] }
pkg-config = "0.3"
When I try to use recent ndarray version 0.16, main.rs can't compile:
error[E0599]: no method named solve found for struct ArrayBase in the current scope
--> src/main.rs:7:15
|
7 | let x = a.solve(&b).unwrap(); // Solve the system A * x = B
| ^^^^^ method not found in ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>
The text was updated successfully, but these errors were encountered:
Unfortunately this is a version mismatch between ndarray and ndarray-linalg; you cannot use ndarray version 0.16 with ndarray-linag until linalg bumps its dependencies. See this issue on ndarray-linalg for more, and this issue on the maintainership discussion there.
Thanks for answering. Before committing this issue, I also tried using both "0.16" version of ndarray_linalg and ndarray together, the same compiler error, so I guess there's some interface changing that break old examples (ChatGPT told me the simple solve sample)
Ya it's because of the minor version change between 0.15 and 0.16, I believe. You can read more here about Rust's dependency resolution between versions.
My simple program main.rs try to resolve linear equations:
It works when I use ndarray 0.15 and ndarry_linalg 0.15:
When I try to use recent ndarray version 0.16, main.rs can't compile:
error[E0599]: no method named
solve
found for structArrayBase
in the current scope--> src/main.rs:7:15
|
7 | let x = a.solve(&b).unwrap(); // Solve the system A * x = B
| ^^^^^ method not found in
ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>
The text was updated successfully, but these errors were encountered: