Skip to main content

masked_binary

Function masked_binary 

Source
pub fn masked_binary<T, D, F>(
    a: &MaskedArray<T, D>,
    b: &MaskedArray<T, D>,
    f: F,
    op_name: &str,
) -> FerrayResult<MaskedArray<T, D>>
where T: Element + Copy, D: Dimension, F: Fn(T, T) -> T,
Expand description

Apply any binary function to two masked arrays, propagating the union of their masks.

Equivalent to numpy.ma.<binary>(a, b) for any binary (T, T) -> T closure. The result’s mask is the elementwise OR of the two inputs’ masks; masked positions in the result data carry the receiver’s fill_value. Both inputs are broadcast to a common shape via NumPy rules on the slow path — the same broadcast machinery the named add/multiply/etc. wrappers use.

§Errors

Returns FerrayError::ShapeMismatch if the shapes are not broadcast-compatible.