From 65ce8c88ea0f9bc0a4c1006e58c515a794822950 Mon Sep 17 00:00:00 2001 From: Adrian Braemer <11058200+abraemer@users.noreply.github.com> Date: Mon, 14 Feb 2022 16:39:16 +0100 Subject: [PATCH] Change type signature of _checkbuffers and _goodbuffers 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 --- src/sparsematrix.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sparsematrix.jl b/src/sparsematrix.jl index e4547cc7..76d82ea2 100644 --- a/src/sparsematrix.jl +++ b/src/sparsematrix.jl @@ -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)