Skip to content

Commit 5d5404b

Browse files
AbstractSparseMatrix
1 parent 437d28b commit 5d5404b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/jacobians.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,14 +345,14 @@ function finite_difference_jacobian!(
345345
end
346346

347347
if sparsity !== nothing
348-
if J isa SparseMatrixCSC
348+
if J isa AbstractSparseMatrix
349349
fill!(nonzeros(J),false)
350350
else
351351
fill!(J,false)
352352
end
353353
end
354354

355-
# fast path if J and sparsity are both SparseMatrixCSC and have the same sparsity pattern
355+
# fast path if J and sparsity are both AbstractSparseMatrix and have the same sparsity pattern
356356
sparseCSC_common_sparsity = _use_sparseCSC_common_sparsity(J, sparsity)
357357

358358
if fdtype == Val(:forward)
@@ -397,7 +397,7 @@ function finite_difference_jacobian!(
397397
J[rows_index, cols_index] .+= (colorvec[cols_index] .== color_i) .* vfx1[rows_index]
398398
+= means requires a zero'd out start
399399
=#
400-
if J isa SparseMatrixCSC
400+
if J isa AbstractSparseMatrix
401401
@. void_setindex!((J.nzval,), getindex((J.nzval,), rows_index) + (getindex((_color,), cols_index) == color_i) * getindex((vfx1,), rows_index), rows_index)
402402
else
403403
@. void_setindex!((J,), getindex((J,), rows_index, cols_index) + (getindex((_color,), cols_index) == color_i) * getindex((vfx1,), rows_index), rows_index, cols_index)
@@ -435,7 +435,7 @@ function finite_difference_jacobian!(
435435
_colorediteration!(J,sparsity,rows_index,cols_index,vfx1,colorvec,color_i,n)
436436
end
437437
else
438-
if J isa SparseMatrixCSC
438+
if J isa AbstractSparseMatrix
439439
@. void_setindex!((J.nzval,), getindex((J.nzval,), rows_index) + (getindex((_color,), cols_index) == color_i) * getindex((vfx1,), rows_index), rows_index)
440440
else
441441
@. void_setindex!((J,), getindex((J,), rows_index, cols_index) + (getindex((_color,), cols_index) == color_i) * getindex((vfx1,), rows_index), rows_index, cols_index)
@@ -465,7 +465,7 @@ function finite_difference_jacobian!(
465465
_colorediteration!(J,sparsity,rows_index,cols_index,vfx,colorvec,color_i,n)
466466
end
467467
else
468-
if J isa SparseMatrixCSC
468+
if J isa AbstractSparseMatrix
469469
@. void_setindex!((J.nzval,), getindex((J.nzval,), rows_index) + (getindex((_color,), cols_index) == color_i) * getindex((vfx,),rows_index), rows_index)
470470
else
471471
@. void_setindex!((J,), getindex((J,), rows_index, cols_index) + (getindex((_color,), cols_index) == color_i) * getindex((vfx,), rows_index), rows_index, cols_index)

0 commit comments

Comments
 (0)