File tree Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Expand file tree Collapse file tree 2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change 32
32
_use_findstructralnz (sparsity) = ArrayInterface. has_sparsestruct (sparsity)
33
33
_use_findstructralnz (:: SparseMatrixCSC ) = false
34
34
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))
49
39
50
40
function __init__ ()
51
41
@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!(
348
348
fill! (J,false )
349
349
end
350
350
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)
353
353
354
354
if fdtype == Val (:forward )
355
355
vfx1 = _vec (fx1)
You can’t perform that action at this time.
0 commit comments