Skip to content

Commit 5199ac0

Browse files
committed
Update to ndarray 1.15
1 parent 8ca690b commit 5199ac0

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ categories = ["science", "science::robotics", "multimedia", "multimedia::images"
1111
edition = "2018"
1212

1313
[dependencies]
14-
ndarray = { version = "0.13", default-features = false }
15-
ndarray-stats = { version = "0.3", default-features = false }
16-
ndarray-linalg = { version = "0.12", default-features = false }
17-
noisy_float = { version = "0.1", default-features = false }
14+
ndarray = { version = "0.15", default-features = false }
15+
ndarray-stats = { version = "0.5", default-features = false }
16+
ndarray-linalg = { version = "0.13", default-features = false }
17+
noisy_float = { version = "0.2", default-features = false }
1818
num-traits = { version = "0.2", default-features = false }
1919

2020
[dev-dependencies]
21-
ndarray-rand = "0.11.0"
21+
ndarray-rand = "0.14.0"
2222
rand = "0.7"
2323
assert_approx_eq = "1.1.0"
24-
noisy_float = "0.1.11"
24+
noisy_float = "0.2"
2525
png = "0.16"
26-
ndarray-linalg = { version = "0.12", features = ["intel-mkl"] }
26+
ndarray-linalg = { version = "0.13", features = ["intel-mkl"] }

src/core/colour_models.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ where
199199
let mut res = Array3::<_>::zeros((image.rows(), image.cols(), HSV::channels()));
200200
let window = image.data.windows((1, 1, image.channels()));
201201

202-
Zip::indexed(window).apply(|(i, j, _), pix| {
202+
Zip::indexed(window).for_each(|(i, j, _), pix| {
203203
let red = pix[[0, 0, 0]];
204204
let green = pix[[0, 0, 1]];
205205
let blue = pix[[0, 0, 2]];
@@ -228,7 +228,7 @@ where
228228
let mut res = Array3::<T>::zeros((image.rows(), image.cols(), RGB::channels()));
229229
let window = image.data.windows((1, 1, image.channels()));
230230

231-
Zip::indexed(window).apply(|(i, j, _), pix| {
231+
Zip::indexed(window).for_each(|(i, j, _), pix| {
232232
let h = pix[[0, 0, 0]];
233233
let s = pix[[0, 0, 1]];
234234
let v = pix[[0, 0, 2]];
@@ -257,7 +257,7 @@ where
257257
let mut res = Array3::<T>::zeros((image.rows(), image.cols(), Gray::channels()));
258258
let window = image.data.windows((1, 1, image.channels()));
259259

260-
Zip::indexed(window).apply(|(i, j, _), pix| {
260+
Zip::indexed(window).for_each(|(i, j, _), pix| {
261261
let r = normalise_pixel_value(pix[[0, 0, 0]]);
262262
let g = normalise_pixel_value(pix[[0, 0, 1]]);
263263
let b = normalise_pixel_value(pix[[0, 0, 2]]);
@@ -288,7 +288,7 @@ where
288288
let mut res = Array3::<T>::zeros((image.rows(), image.cols(), RGB::channels()));
289289
let window = image.data.windows((1, 1, image.channels()));
290290

291-
Zip::indexed(window).apply(|(i, j, _), pix| {
291+
Zip::indexed(window).for_each(|(i, j, _), pix| {
292292
let gray = pix[[0, 0, 0]];
293293

294294
res.slice_mut(s![i, j, ..])
@@ -321,7 +321,7 @@ where
321321
[0.0139322, 0.0971045, 0.7141733],
322322
]);
323323

324-
Zip::indexed(window).apply(|(i, j, _), pix| {
324+
Zip::indexed(window).for_each(|(i, j, _), pix| {
325325
let pixel = pix
326326
.index_axis(Axis(0), 0)
327327
.index_axis(Axis(0), 0)
@@ -360,7 +360,7 @@ where
360360
[0.0719453, -0.2289914, 1.4052427],
361361
]);
362362

363-
Zip::indexed(window).apply(|(i, j, _), pix| {
363+
Zip::indexed(window).for_each(|(i, j, _), pix| {
364364
let pixel = pix
365365
.index_axis(Axis(0), 0)
366366
.index_axis(Axis(0), 0)

src/morphology/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ where
3232
let (ro, co) = kernel_centre(sh[0], sh[1]);
3333
let mut result = Self::Output::from_elem(self.dim(), false);
3434
if self.shape()[0] >= sh[0] && self.shape()[1] >= sh[1] {
35-
Zip::indexed(self.slice(s![.., .., 0]).windows(kernel.dim())).apply(
35+
Zip::indexed(self.slice(s![.., .., 0]).windows(kernel.dim())).for_each(
3636
|(i, j), window| {
3737
result[[i + ro, j + co, 0]] = (&kernel & &window) == kernel;
3838
},
@@ -50,7 +50,7 @@ where
5050
let (ro, co) = kernel_centre(sh[0], sh[1]);
5151
let mut result = Self::Output::from_elem(self.dim(), false);
5252
if self.shape()[0] >= sh[0] && self.shape()[1] >= sh[1] {
53-
Zip::indexed(self.slice(s![.., .., 0]).windows(kernel.dim())).apply(
53+
Zip::indexed(self.slice(s![.., .., 0]).windows(kernel.dim())).for_each(
5454
|(i, j), window| {
5555
result[[i + ro, j + co, 0]] = (&kernel & &window).iter().any(|x| *x);
5656
},

src/processing/conv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ where
120120
if shape.0 > 0 && shape.1 > 0 {
121121
let mut result = unsafe { Self::Output::uninitialized(shape) };
122122

123-
Zip::indexed(self.windows(kernel.dim())).apply(|(i, j, _), window| {
123+
Zip::indexed(self.windows(kernel.dim())).for_each(|(i, j, _), window| {
124124
let mut temp;
125125
for channel in 0..k_s[2] {
126126
temp = T::zero();

src/processing/filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ where
3535
let c_offset = shape[1] / 2;
3636
let region = (shape[0], shape[1], 1);
3737
let mut result = Array3::<T>::zeros(self.dim());
38-
Zip::indexed(self.windows(region)).apply(|(i, j, k), window| {
38+
Zip::indexed(self.windows(region)).for_each(|(i, j, k), window| {
3939
let mut flat_window = Array::from_iter(window.iter()).mapv(|x| *x);
4040
if let Ok(v) = flat_window.quantile_mut(n64(0.5f64), &Linear {}) {
4141
result

src/transform/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::core::{ColourModel, Image, ImageBase};
22
use crate::transform::affine::translation;
33
use ndarray::{array, prelude::*, s, Data};
4-
use ndarray_linalg::solve::Inverse;
4+
use ndarray_linalg::*;
55
use num_traits::{Num, NumAssignOps};
66
use std::cmp::{max, min};
77

0 commit comments

Comments
 (0)