pub fn mul_acc_mat_vec_csc<N, I>(mat: CsMatViewI<N, I>,
                                 in_vec: &[N],
                                 res_vec: &mut[N])
where N: Num + Copy,
      I: SpIndex,
{
    let mat = mat.view();
    if mat.cols() != in_vec.len() || mat.rows() != res_vec.len() {
        panic!("Dimension mismatch");
    }
    if !mat.is_csc() {
        panic!("Storage mismatch");
    }

    for (col_ind, vec) in mat.outer_iterator().enumerate() {
        let multiplier = &in_vec[col_ind];
        for (row_ind, &value) in vec.iter() {
            // TODO: unsafe access to value? needs bench
            res_vec[row_ind] =
                res_vec[row_ind] + *multiplier * value;
        }
    }
}
/// Multiply a sparse CSC matrix with a dense vector and accumulate the result
/// into another dense vector
Multiply a sparse CSC matrix with a dense vector and accumulate the result
into another dense vector
Multiply a sparse CSC matrix with a dense vector and accumulate the result into another dense vector
pub fn mul_acc_mat_vec_csc<N, I>(mat: CsMatViewI<N, I>,
                                 in_vec: &[N],
                                 res_vec: &mut[N])
where N: Num + Copy,
      I: SpIndex,
{
    let mat = mat.view();
    if mat.cols() != in_vec.len() || mat.rows() != res_vec.len() {
        panic!("Dimension mismatch");
    }
    if !mat.is_csc() {
        panic!("Storage mismatch");
    }
    for (col_ind, vec) in mat.outer_iterator().enumerate() {
        let multiplier = &in_vec[col_ind];
        for (row_ind, &value) in vec.iter() {
            // TODO: unsafe access to value? needs bench
            res_vec[row_ind] =
                res_vec[row_ind] + *multiplier * value;
        }
    }
}
pub fn mul_acc_mat_vec_csc < N , I > ( mat : CsMatViewI < N , I > , in_vec : & [ N ] , res_vec : & mut [ N ] ) where N : Num + Copy , I : SpIndex , { let mat = mat . view ( ) ; if mat . cols ( ) != in_vec . len ( ) || mat . rows ( ) != res_vec . len ( ) { panic ! ( " " ) ; } if ! mat . is_csc ( ) { panic ! ( " " ) ; } for ( col_ind , vec ) in mat . outer_iterator ( ) . enumerate ( ) { let multiplier = & in_vec [ col_ind ] ; for ( row_ind , & value ) in vec . iter ( ) { // TODO: unsafe access to value? needs bench res_vec [ row_ind ] = res_vec [ row_ind ] + * multiplier * value ; } } }
Multiply a sparse CSC matrix with a dense vector and accumulate the result
into another dense vector
Multiply a sparse CSC matrix with a dense vector and accumulate the result into another dense vector
mat
CsMatViewI<N, I>
in_vec
&[N]
res_vec
&mut[N]
mat
CsMatViewI<N, I>
in_vec
&[N]
res_vec
&mut[N]