Rust Arrayfire闭包乘法

问题描述

我正在尝试将arrayfire矩阵乘以闭包矩阵。无论如何,不​​使用for循环就可以实现这一目标?

我当前的代码如下:

//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]);
    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);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)