MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / array_helper

Function array_helper

ciphercore-base/src/ops/inverse_sqrt.rs:251–269  ·  view source on GitHub ↗
(divisor: Vec<u64>, st: ScalarType)

Source from the content-addressed store, hash-verified

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() {

Callers 1

test_inverse_sqrt_arrayFunction · 0.70

Calls 10

simple_contextFunction · 0.85
run_instantiation_passFunction · 0.85
random_evaluateFunction · 0.85
cloneMethod · 0.80
array_typeFunction · 0.50
inputMethod · 0.45
custom_opMethod · 0.45
get_main_graphMethod · 0.45
get_contextMethod · 0.45

Tested by 1

test_inverse_sqrt_arrayFunction · 0.56