-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
I am trying to convolve over the 2D arrays in an image cube and noticed the following mismatched types error.
pub fn denoise(hsi: &mut Array3<f32>) {
let corner_kernel = arr2(&[[0.25f32, 0., 0.25], [0., 0., 0.], [0.25, 0., 0.25]]);
hsi.outer_iter_mut().into_par_iter().for_each(|bnd| {
let corner_average =
ndarray_ndimage::convolve(&bnd, &corner_kernel.view(), BorderMode::Mirror, ORIGIN);
});
// --snip--
}Error:
error[E0308]: mismatched types
--> src/lib.rs:93:45
|
93 | ndarray_ndimage::convolve(&bnd, &corner_kernel.view(), BorderMode::Mirror, ORIGIN);
| ------------------------- ^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
| |
| arguments to this function are incorrect
|
= note: expected reference `&ArrayBase<ViewRepr<&mut f32>, Dim<[usize; 2]>>`
found reference `&ArrayBase<ViewRepr<&f32>, Dim<[usize; 2]>>`
I belive this is because of convolve's signature. Since both data and weights have the same generic parameters, the compiler expects them to both have the exact same types, which, I suspect, is probably not necessary?
pub fn convolve<S, A, D>(
data: &ArrayBase<S, D>,
weights: &ArrayBase<S, D>,
mode: BorderMode<A>,
origin: isize
) -> Array<A, D>Metadata
Metadata
Assignees
Labels
No labels