Function sprs::binop::csmat_binop

source ·
pub fn csmat_binop<Lhs, Rhs, Res, I, Iptr, F>(
    lhs: CsMatViewI<'_, Lhs, I, Iptr>,
    rhs: CsMatViewI<'_, Rhs, I, Iptr>,
    binop: F
) -> CsMatI<Res, I, Iptr>where
    Lhs: Zero,
    Rhs: Zero,
    Res: Zero + Clone,
    I: SpIndex,
    Iptr: SpIndex,
    F: Fn(&Lhs, &Rhs) -> Res,
Expand description

Applies a binary operation to matching non-zero elements of two sparse matrices. When e.g. only the lhs has a non-zero at a given location, 0 is inferred for the non-zero value of the other matrix. Both matrices should have the same storage.

Thus the behaviour is correct iff binop(N::zero(), N::zero()) == N::zero()

Panics

  • on incompatible dimensions
  • on incomatible storage