Skip to content
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

Upgrade ndarray and other deps #379

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ndarray-linalg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rand = "0.8.3"
thiserror = "1.0.24"

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

Expand All @@ -48,9 +48,9 @@ default-features = false

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

[[bench]]
Expand Down
10 changes: 5 additions & 5 deletions ndarray-linalg/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ where
S: Data,
{
let n = a.len();
a.into_shape((n, 1)).unwrap()
a.into_shape_with_order((n, 1)).unwrap()
}

pub fn into_row<S>(a: ArrayBase<S, Ix1>) -> ArrayBase<S, Ix2>
where
S: Data,
{
let n = a.len();
a.into_shape((1, n)).unwrap()
a.into_shape_with_order((1, n)).unwrap()
}

pub fn flatten<S>(a: ArrayBase<S, Ix2>) -> ArrayBase<S, Ix1>
where
S: Data,
{
let n = a.len();
a.into_shape(n).unwrap()
a.into_shape_with_order(n).unwrap()
}

pub fn into_matrix<A, S>(l: MatrixLayout, a: Vec<A>) -> Result<ArrayBase<S, Ix2>>
Expand Down Expand Up @@ -99,9 +99,9 @@ where
// https://github.com/bluss/rust-ndarray/issues/325
let strides: Vec<isize> = a.strides().to_vec();
let new = if a.is_standard_layout() {
ArrayBase::from_shape_vec(a.dim(), a.into_raw_vec()).unwrap()
ArrayBase::from_shape_vec(a.dim(), a.into_raw_vec_and_offset().0).unwrap()
} else {
ArrayBase::from_shape_vec(a.dim().f(), a.into_raw_vec()).unwrap()
ArrayBase::from_shape_vec(a.dim().f(), a.into_raw_vec_and_offset().0).unwrap()
};
assert_eq!(
new.strides(),
Expand Down
4 changes: 2 additions & 2 deletions ndarray-linalg/tests/det.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn det_zero_nonsquare() {
assert!(a.sln_det_into().is_err());
};
}
for &shape in &[(1, 2).into_shape(), (1, 2).f()] {
for &shape in &[(1, 2).into_shape_with_order(), (1, 2).f()] {
det_zero_nonsquare!(f64, shape);
det_zero_nonsquare!(f32, shape);
det_zero_nonsquare!(c64, shape);
Expand Down Expand Up @@ -186,7 +186,7 @@ fn det_nonsquare() {
};
}
for &dims in &[(1, 0), (1, 2), (2, 1), (2, 3)] {
for &shape in &[dims.into_shape(), dims.f()] {
for &shape in &[dims.into_shape_with_order(), dims.f()] {
det_nonsquare!(f64, shape);
det_nonsquare!(f32, shape);
det_nonsquare!(c64, shape);
Expand Down
4 changes: 2 additions & 2 deletions ndarray-linalg/tests/deth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn deth_zero_nonsquare() {
assert!(a.sln_deth_into().is_err());
};
}
for &shape in &[(1, 2).into_shape(), (1, 2).f()] {
for &shape in &[(1, 2).into_shape_with_order(), (1, 2).f()] {
deth_zero_nonsquare!(f64, shape);
deth_zero_nonsquare!(f32, shape);
deth_zero_nonsquare!(c64, shape);
Expand Down Expand Up @@ -138,7 +138,7 @@ fn deth_nonsquare() {
};
}
for &dims in &[(1, 0), (1, 2), (2, 1), (2, 3)] {
for &shape in &[dims.into_shape(), dims.f()] {
for &shape in &[dims.into_shape_with_order(), dims.f()] {
deth_nonsquare!(f64, shape);
deth_nonsquare!(f32, shape);
deth_nonsquare!(c64, shape);
Expand Down
2 changes: 1 addition & 1 deletion ndarray-linalg/tests/inv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn inv_into_random_complex() {
#[should_panic]
fn inv_error() {
// do not have inverse
let a = Array::<f64, _>::zeros(9).into_shape((3, 3)).unwrap();
let a = Array::<f64, _>::zeros(9).into_shape_with_order((3, 3)).unwrap();
let a_inv = a.inv().unwrap();
println!("{:?}", a_inv);
}
Expand Down
4 changes: 2 additions & 2 deletions ndarray-linalg/tests/opnorm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ fn gen(i: usize, j: usize, rev: bool) -> Array2<f64> {
let n = (i * j + 1) as f64;
if rev {
Array::range(1., n, 1.)
.into_shape((j, i))
.into_shape_with_order((j, i))
.unwrap()
.reversed_axes()
} else {
Array::range(1., n, 1.).into_shape((i, j)).unwrap()
Array::range(1., n, 1.).into_shape_with_order((i, j)).unwrap()
}
}

Expand Down
Loading