I'm having a problem when trying to perform an arithmetic operation on two Array1
s of the ndarray crate.
I have tried to reduce my problem to a the following reprex:
#[macro_use(array)]
extern crate ndarray;
use ndarray::Array1;
fn main() {
let a: Array1<i8> = array![1, 2, 3];
let baz = &a - array![1, 2, 3];
println!("{:#?}", baz);
}
It fails with:
|
8 | let baz = &a - array![1, 2, 3];
| ^ expected struct `ndarray::ArrayBase`, found i8
|
According to the documentation I should be able to subtract two Array1
s and array!
creates an Array1
.
What I am doing wrong?