Function sprs::binop::csvec_binop[][src]

pub fn csvec_binop<N, I, F>(
    lhs: CsVecViewI<'_, N, I>,
    rhs: CsVecViewI<'_, N, I>,
    binop: F
) -> Result<CsVecI<N, I>, StructureError> where
    N: Num,
    F: Fn(&N, &N) -> N,
    I: SpIndex

Binary operations for CsVec

This function iterates the non-zero locations of lhs and rhs and applies the function binop to the matching elements (defaulting to zero when e.g. only lhs has a non-zero at a given location).

The function thus has a correct behavior iff binop(0, 0) == 0.