Skip to main content

extract

Function extract 

Source
pub fn extract<T, D>(
    condition: &Array<bool, D>,
    a: &Array<T, D>,
) -> Result<Array<T, Ix1>, FerrayError>
where T: Element + Copy, D: Dimension,
Expand description

Return the elements of a where condition is true, as a 1-D array.

Analogous to numpy.extract(condition, arr). Equivalent to arr.flatten()[condition.flatten()].

§Errors

Returns FerrayError::ShapeMismatch if condition does not have the same shape as a.