arrayfire 3.8.0

ArrayFire is a high performance software library for parallel computing with an easy-to-use API. Its array based function set makes parallel programming simple. ArrayFire's multiple backends (CUDA, OpenCL and native CPU) make it platform independent and highly portable. A few lines of code in ArrayFire can replace dozens of lines of parallel computing code, saving you valuable time and lowering development costs. This crate provides Rust bindings for ArrayFire library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use ::arrayfire::*;

#[test]
fn check_scalar_arith() {
    let dims = Dim4::new(&[5, 5, 1, 1]);
    let a = randu::<f32>(dims);
    let s: f32 = 2.0;
    let scalar_as_lhs = s * &a;
    let scalar_as_rhs = &a * s;
    let c = constant(s, dims);
    let no_scalars = a * c;
    let scalar_res_comp = eq(&scalar_as_lhs, &scalar_as_rhs, false);
    let res_comp = eq(&scalar_as_lhs, &no_scalars, false);
    let scalar_res = all_true_all(&scalar_res_comp);
    let res = all_true_all(&res_comp);

    assert!(scalar_res.0 == res.0);
}