File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232_use_findstructralnz (sparsity) = ArrayInterface. has_sparsestruct (sparsity)
3333_use_findstructralnz (:: SparseMatrixCSC ) = false
3434
35- # test if J, sparsity are both SparseMatrixCSC and have the same size storage arrays,
36- # if so, update J so they can share the same sparsity pattern
37- _use_sparseCSC_common_sparsity! (J, sparsity) = false
38- function _use_sparseCSC_common_sparsity! (J:: SparseMatrixCSC , sparsity:: SparseMatrixCSC )
39- common_sparsity = (length (J. colptr) == length (sparsity. colptr) &&
40- length (J. nzval) == length (sparsity. nzval))
41-
42- if common_sparsity
43- J. colptr .= sparsity. colptr
44- J. rowval .= sparsity. rowval
45- end
46-
47- return common_sparsity
48- end
35+ # test if J, sparsity are both SparseMatrixCSC and have the same sparsity pattern of stored values
36+ _use_sparseCSC_common_sparsity (J, sparsity) = false
37+ _use_sparseCSC_common_sparsity (J:: SparseMatrixCSC , sparsity:: SparseMatrixCSC ) =
38+ ((J. colptr == sparsity. colptr) && (J. rowval == sparsity. rowval))
4939
5040function __init__ ()
5141 @require BlockBandedMatrices= " ffab5731-97b5-5995-9138-79e8c1846df0" begin
Original file line number Diff line number Diff line change @@ -348,8 +348,8 @@ function finite_difference_jacobian!(
348348 fill! (J,false )
349349 end
350350
351- # fast path if J and sparsity are both SparseMatrixCSC and have the same number of columns and stored values
352- sparseCSC_common_sparsity = _use_sparseCSC_common_sparsity! (J, sparsity)
351+ # fast path if J and sparsity are both SparseMatrixCSC and have the same sparsity pattern
352+ sparseCSC_common_sparsity = _use_sparseCSC_common_sparsity (J, sparsity)
353353
354354 if fdtype == Val (:forward )
355355 vfx1 = _vec (fx1)
You can’t perform that action at this time.
0 commit comments