Skip to content

Commit 9d1e3cb

Browse files
committed
count_nonzeros should be specialized on CLILVector
1 parent c0ba097 commit 9d1e3cb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/systems/alias_elimination.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ count_nonzeros(a::AbstractArray) = count(!iszero, a)
468468

469469
# N.B.: Ordinarily sparse vectors allow zero stored elements.
470470
# Here we have a guarantee that they won't, so we can make this identification
471-
count_nonzeros(a::SparseVector) = nnz(a)
471+
count_nonzeros(a::CLILVector) = nnz(a)
472472

473473
# Linear variables are highest order differentiated variables that only appear
474474
# in linear equations with only linear variables. Also, if a variable's any

src/systems/sparsematrixclil.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function Base.view(a::SparseMatrixCLIL, i::Integer, ::Colon)
5353
end
5454
SparseArrays.nonzeroinds(a::CLILVector) = SparseArrays.nonzeroinds(a.vec)
5555
SparseArrays.nonzeros(a::CLILVector) = SparseArrays.nonzeros(a.vec)
56+
SparseArrays.nnz(a::CLILVector) = nnz(a.vec)
5657

5758
function Base.setindex!(S::SparseMatrixCLIL, v::CLILVector, i::Integer, c::Colon)
5859
if v.vec.n != S.ncols

0 commit comments

Comments
 (0)