-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linalg
and stats
are incompatible with ndarray 0.16.0
#1425
Comments
linalg
and stats
are broken after 0.16.0linalg
and stats
are incompatible with ndarray 0.16.0
Hi, do you have an example of them breaking? They should still work if keeping the versions constant, i.e. using ndarray 0.15 until the relevant crates have been updated. |
Ndarray-stats is owned by the ndarray release team, so I could make releases there. For ndarray-linalg we need to involve the crate owners that can make a release. |
Example from ndarray_linalg docs no longer works. use approx::AbsDiffEq; // for abs_diff_eq
use ndarray::{array, Array1, Array2};
use ndarray_linalg::{LeastSquaresSvd, LeastSquaresSvdInto, LeastSquaresSvdInPlace};
let a: Array2<f64> = array![
[1., 1., 1.],
[2., 3., 4.],
[3., 5., 2.],
[4., 2., 5.],
[5., 4., 3.]
];
// solving for a single right-hand side
let b: Array1<f64> = array![-10., 12., 14., 16., 18.];
let expected: Array1<f64> = array![2., 1., 1.];
let result = a.least_squares(&b).unwrap();
assert!(result.solution.abs_diff_eq(&expected, 1e-12));
// solving for two right-hand sides at once
let b_2: Array2<f64> =
array![[-10., -3.], [12., 14.], [14., 12.], [16., 16.], [18., 16.]];
let expected_2: Array2<f64> = array![[2., 1.], [1., 1.], [1., 2.]];
let result_2 = a.least_squares(&b_2).unwrap();
assert!(result_2.solution.abs_diff_eq(&expected_2, 1e-12));
// using `least_squares_in_place` which overwrites its arguments
let mut a_3 = a.clone();
let mut b_3 = b.clone();
let result_3 = a_3.least_squares_in_place(&mut b_3).unwrap();
// using `least_squares_into` which consumes its arguments
let result_4 = a.least_squares_into(b).unwrap();
// `a` and `b` have been moved, no longer valid |
@VlaDexa I mean for examples, existing projects that stopped compiling or were broken by ndarray 0.16. That would be interesting. Any example requires a Cargo.toml or dependency information to be reproducible. |
I don't have a public example, but in a private project that updated to ndarray 0.16, all our linear algebra code broke because the ndarray 0.16 types don't implement the traits in ndarray-linalg. This was an especially confusing error to encounter because ndarray-linalg's version number is already 0.16, implying API compatibility. Of course, nothing is broken if we stay on 0.15. |
My project was broken by ndarray 0.16. When I tried to update to the new version it stopped compiling because of incompatible structs.
Three crates from the first three lines of my somewhat minimal example are all the dependencies you need. I don't know how you guys do stuff around here, but I was taught that a minimal example would be better than saying "oh my project doesn't work now" |
Ok, that's the line. I've been the person who has been reaching out across the team to try to get this to work, we solved one of the crates. Please refer to the |
Just linking the issues from the other repos for visibility:
ndarray
ndarray-stats#97This could be due to version mismatch in the dependencies.
Numerous third-party dependencies are also broken.
Things like
.inv()
(fromlinalg
) and.argmax()
fromstats
are essential for many applications. So, without these packages working it is not possible to take advantage of the improvements of ndarray 0.16, no matter how good they are.I believe that before releasing new versons of
ndarray
maintainers should take care that at least the packages in the same organization work correctly.I'd also consider to move the packages into a single workspace. This way it's easier to spot problems and to maintain them.
The text was updated successfully, but these errors were encountered: