I am attempting to multiply an arrayfire Matrix by a matrix of closures. Is there anyway to achieve this without using for loops?
My current code is as follows:
//Initialize the closures and assign to an arry
let a = |x| {x*2.0};
let b = |x| {x*3.0};
let c = |x| {x*4.0};
let values: [fn(f64) -> f64; 3] = [a,b,c];
//Create an arrayfire Matrix
let dims = Dim4::new(&[3, 1, 1, 1]);
let v = randu::<f64>(dims);
//Printing out the original arrayfire matrix
arrayfire::print(&v);
//A failed attempt to apply the closures to the matrix
let v = &v * values;
//The desired output
arrayfire::print(&v);