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)
1017
1017
rmul! (A. nzval, b)
1018
1018
return A
1019
1019
end
1020
+
1020
1021
function lmul! (b:: Number , A:: SparseMatrixCSC )
1021
1022
lmul! (b, A. nzval)
1022
1023
return A
1023
1024
end
1024
1025
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
+
1025
1047
function \ (A:: SparseMatrixCSC , B:: AbstractVecOrMat )
1026
1048
@assert ! has_offset_axes (A, B)
1027
1049
m, n = size (A)
You can’t perform that action at this time.
0 commit comments