Skip to content

Commit

Permalink
remove type piracy methods (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Dec 15, 2022
1 parent 401ba18 commit caf50a2
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,30 +173,6 @@ function Base.:*(X::SparseMatrixCSC, A::PermMatrix)
SparseMatrixCSC(mX, nX, colptr, rowval, nzval)
end

############ SparseMatrixCSC and Diagonal #############
function LinearAlgebra.mul!(Y::SparseMatrixCSC, X::SparseMatrixCSC, A::Diagonal{T,Vector{T}}) where {T}
nA = size(A, 1)
mX, nX = size(X)
nX == nA || throw(DimensionMismatch())
@inbounds for j = 1:nA
for k = X.colptr[j]:X.colptr[j+1]-1
Y.nzval[k] *= A.diag[j]
end
end
Y
end

function LinearAlgebra.mul!(Y::SparseMatrixCSC, A::Diagonal{T,Vector{T}}, X::SparseMatrixCSC) where {T}
nA = size(A, 2)
mX, nX = size(X)
mX == nA || throw(DimensionMismatch())
@inbounds @simd for i = 1:nnz(X)
Y.nzval[i] *= A.diag[X.rowval[i]]
end
Y
end


LinearAlgebra.rmul!(A::SparseMatrixCOO, B::Int) = (A.vs *= B; A)
LinearAlgebra.lmul!(B::Int, A::SparseMatrixCOO) = (A.vs *= B; A)
LinearAlgebra.rdiv!(A::SparseMatrixCOO, B::Int) = (A.vs /= B; A)
Expand Down

0 comments on commit caf50a2

Please sign in to comment.