Skip to content

Commit

Permalink
Change type signature of _checkbuffers and _goodbuffers (#77)
Browse files Browse the repository at this point in the history
These methods check the assumptions on colptr, rowval and nonzeros and thus should work for all AbstractSparseMatrixCSC. Changing the signature also removes the need for every subtype to implement it.

Fixes #9
  • Loading branch information
abraemer authored Feb 18, 2022
1 parent 119cd63 commit a5e9ac4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ end

size(S::SparseMatrixCSC) = (getfield(S, :m), getfield(S, :n))

_goodbuffers(S::SparseMatrixCSC) = _goodbuffers(size(S)..., getcolptr(S), getrowval(S), nonzeros(S))
_checkbuffers(S::SparseMatrixCSC) = (@assert _goodbuffers(S); S)
_goodbuffers(S::AbstractSparseMatrixCSC) = _goodbuffers(size(S)..., getcolptr(S), getrowval(S), nonzeros(S))
_checkbuffers(S::AbstractSparseMatrixCSC) = (@assert _goodbuffers(S); S)
_checkbuffers(S::Union{Adjoint, Transpose}) = (_checkbuffers(parent(S)); S)

function _goodbuffers(m, n, colptr, rowval, nzval)
Expand Down

0 comments on commit a5e9ac4

Please sign in to comment.