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

Function meanvar

src/statistics/mod.rs:516–541  ·  view source on GitHub ↗

Calculate mean and variance in single API call Parameters - `input` is the input Array - `weights` Array has the weights to be used during the stat computation - `bias` is type of bias used for variance calculation - `dim` is dimension along which the current stat has to be computed Return Values A tuple of Arrays, whose size is equal to input except along the dimension which the stat operatio

(
    input: &Array<T>,
    weights: &Array<W>,
    bias: VarianceBias,
    dim: i64,
)

Source from the content-addressed store, hash-verified

514/// - First Array contains mean values
515/// - Second Array contains variance values
516pub fn meanvar<T, W>(
517 input: &Array<T>,
518 weights: &Array<W>,
519 bias: VarianceBias,
520 dim: i64,
521) -> (Array<T::MeanOutType>, Array<T::MeanOutType>)
522where
523 T: HasAfEnum,
524 T::MeanOutType: HasAfEnum,
525 W: HasAfEnum + RealFloating,
526{
527 unsafe {
528 let mut mean: af_array = std::ptr::null_mut();
529 let mut var: af_array = std::ptr::null_mut();
530 let err_val = af_meanvar(
531 &mut mean as *mut af_array,
532 &mut var as *mut af_array,
533 input.get(),
534 weights.get(),
535 bias as c_uint,
536 dim,
537 );
538 HANDLE_ERROR(AfError::from(err_val));
539 (mean.into(), var.into())
540 }
541}
542
543/// Standard deviation along given axis
544///

Callers

nothing calls this directly

Calls 3

HANDLE_ERRORFunction · 0.85
intoMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected