Skip to main content

sum_axis_keepdims

Function sum_axis_keepdims 

Source
pub fn sum_axis_keepdims<T>(
    a: &Array<T, IxDyn>,
    axis: Axis,
) -> FerrayResult<Array<T, IxDyn>>
where T: Element + Copy + Zero + Add<Output = T>,
Expand description

Helper: sum along an axis with keepdims semantics (keeps the axis as size 1).

This is useful as a func argument for apply_over_axes. Generic over any T: Element + Copy + Zero + Add so it works for any addable numeric type (#182).

ยงErrors

Returns FerrayError::AxisOutOfBounds if axis >= ndim.