MCPcopy Index your code
hub / github.com/arrayfire/arrayfire-rust / check_scalar_arith

Function check_scalar_arith

tests/scalar_arith.rs:4–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3#[test]
4fn check_scalar_arith() {
5 let dims = Dim4::new(&[5, 5, 1, 1]);
6 let a = randu::<f32>(dims);
7 let s: f32 = 2.0;
8 let scalar_as_lhs = s * &a;
9 let scalar_as_rhs = &a * s;
10 let c = constant(s, dims);
11 let no_scalars = a * c;
12 let scalar_res_comp = eq(&scalar_as_lhs, &scalar_as_rhs, false);
13 let res_comp = eq(&scalar_as_lhs, &no_scalars, false);
14 let scalar_res = all_true_all(&scalar_res_comp);
15 let res = all_true_all(&res_comp);
16
17 assert!(scalar_res.0 == res.0);
18}

Callers

nothing calls this directly

Calls 1

constantFunction · 0.85

Tested by

no test coverage detected