| 249 | } |
| 250 | |
| 251 | fn array_helper(divisor: Vec<u64>, st: ScalarType) -> Result<Vec<u64>> { |
| 252 | let array_t = array_type(vec![divisor.len() as u64], st); |
| 253 | let c = simple_context(|g| { |
| 254 | let i = g.input(array_t.clone())?; |
| 255 | g.custom_op( |
| 256 | CustomOperation::new(InverseSqrt { |
| 257 | iterations: 5, |
| 258 | denominator_cap_2k: 10, |
| 259 | }), |
| 260 | vec![i], |
| 261 | ) |
| 262 | })?; |
| 263 | let mapped_c = run_instantiation_pass(c)?; |
| 264 | let result = random_evaluate( |
| 265 | mapped_c.get_context().get_main_graph()?, |
| 266 | vec![Value::from_flattened_array(&divisor, st)?], |
| 267 | )?; |
| 268 | result.to_flattened_array_u64(array_t) |
| 269 | } |
| 270 | |
| 271 | #[test] |
| 272 | fn test_inverse_sqrt_scalar() { |