File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1017,11 +1017,33 @@ function rmul!(A::SparseMatrixCSC, b::Number)
10171017 rmul! (A. nzval, b)
10181018 return A
10191019end
1020+
10201021function lmul! (b:: Number , A:: SparseMatrixCSC )
10211022 lmul! (b, A. nzval)
10221023 return A
10231024end
10241025
1026+ function rmul! (A:: SparseMatrixCSC , D:: Diagonal )
1027+ m, n = size (A)
1028+ (n == size (D, 1 )) || throw (DimensionMismatch ())
1029+ Anzval = A. nzval
1030+ @inbounds for col = 1 : n, p = A. colptr[col]: (A. colptr[col + 1 ] - 1 )
1031+ Anzval[p] *= D. diag[col]
1032+ end
1033+ return A
1034+ end
1035+
1036+ function lmul! (D:: Diagonal , A:: SparseMatrixCSC )
1037+ m, n = size (A)
1038+ (m == size (D, 2 )) || throw (DimensionMismatch ())
1039+ Anzval = A. nzval
1040+ Arowval = A. rowval
1041+ @inbounds for col = 1 : n, p = A. colptr[col]: (A. colptr[col + 1 ] - 1 )
1042+ Anzval[p] *= D. diag[Arowval[p]]
1043+ end
1044+ return A
1045+ end
1046+
10251047function \ (A:: SparseMatrixCSC , B:: AbstractVecOrMat )
10261048 @assert ! has_offset_axes (A, B)
10271049 m, n = size (A)
You can’t perform that action at this time.
0 commit comments