Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue 73 #74

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/SSparseMatrixCSC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,7 @@ end
SparseArrays.dropzeros!(M::SSparseMatrixCSC; trim::Bool = false) = M
SparseArrays.SparseMatrixCSC(sm::SSparseMatrixCSC) = dynamicize(sm)
Base.Matrix(sm::SSparseMatrixCSC) = Matrix(SparseMatrixCSC(sm))

# fix issue #73 - show fail
SparseArrays._checkbuffers(S::SSparseMatrixCSC) = (@assert SparseArrays._goodbuffers(S); S)
SparseArrays._goodbuffers(S::SSparseMatrixCSC) = SparseArrays._goodbuffers(size(S)..., SparseArrays.getcolptr(S), SparseArrays.getrowval(S), SparseArrays.nonzeros(S))
4 changes: 2 additions & 2 deletions src/arraymath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ end
for func in (:adjoint!, :transpose!)
@eval (LinearAlgebra.$func)(M::IMatrix) = M
end
Base.imag(M::IMatrix{T}) where {N,T} = Diagonal(zeros(T, M.n))
Base.imag(M::IMatrix{T}) where {T} = Diagonal(zeros(T, M.n))

# PermMatrix
for func in (:conj, :real, :imag)
Expand Down Expand Up @@ -77,4 +77,4 @@ for MT in [:IMatrix, :PermMatrix]
@eval Base.isapprox(d1::Diagonal, d2::$MT; kwargs...) = isapprox(d1.diag, diag(d2))
end
Base.isapprox(A::IMatrix, B::PermMatrix; kwargs...) = isapprox(SparseMatrixCSC(A), SparseMatrixCSC(B); kwargs...)
Base.isapprox(A::PermMatrix, B::IMatrix; kwargs...) = isapprox(SparseMatrixCSC(A), SparseMatrixCSC(B); kwargs...)
Base.isapprox(A::PermMatrix, B::IMatrix; kwargs...) = isapprox(SparseMatrixCSC(A), SparseMatrixCSC(B); kwargs...)
4 changes: 2 additions & 2 deletions src/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Broadcast.broadcasted(
::typeof(*),
a::Number,
b::IMatrix,
) where {S} = Diagonal(fill(a, b.n))
) = Diagonal(fill(a, b.n))

# specialize perm matrix
function _broadcast_perm_prod(A::PermMatrix, B::AbstractMatrix)
Expand Down Expand Up @@ -119,4 +119,4 @@ Broadcast.broadcasted(
::typeof(*),
a::Number,
b::PermMatrix,
) = PermMatrix(b.perm, a .* b.vals)
) = PermMatrix(b.perm, a .* b.vals)
4 changes: 3 additions & 1 deletion test/SSparseMatrixCSC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ using Test, LuxurySparse
@test issparse(sm)
@test LuxurySparse.dropzeros!(sm) == sm
@test sm == m
end
@test print(sm) === nothing
@test display(sm) === nothing
end