I am learning myself rust-ndarray and wrote this simple code.
use ndarray::prelude::*;
fn main() {
let mut a = Array2::<f64>::ones((3, 3));
let b = (a*(a-0.5))*(a+2.0);
println!("{:?}",b);
}
I expected the output to be
[[ 1.5, 1.5, 1.5],
[ 1.5, 1.5, 1.5],
[ 1.5, 1.5, 1.5]]
But its giving this error
| let b = (a*(a-0.5))*(a+2.0);
| ------- ^ value used here after move
| |
| `a` moved due to usage in operator