pub fn sum_with<T, D>(
a: &Array<T, D>,
axis: Option<usize>,
initial: Option<T>,
where_mask: Option<&Array<bool, IxDyn>>,
) -> Result<Array<T, IxDyn>, FerrayError>Expand description
Sum reduction with initial and where parameters.
Equivalent to np.sum(a, axis=axis, initial=initial, where=where_mask).
initial defaults to T::zero() when None. where_mask, when
provided, must be broadcast-compatible with a.shape() (#565).
Callers with typed masks (e.g. Array<bool, Ix1>) should call
.to_dyn() before passing. Positions where the broadcast mask is
false are skipped.
§Errors
FerrayError::AxisOutOfBoundsifaxisis out of range.FerrayError::ShapeMismatchifwhere_maskis not broadcast-compatible witha.shape().