Skip to content

Commit 7a6870f

Browse files
Merge pull request #1067 from SciML/sparse
Move SparseArrays to Ext
2 parents 6c96daf + 3585f27 commit 7a6870f

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

Project.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
2828
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
2929
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
3030
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
31-
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
3231
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
3332
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3433
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
@@ -45,6 +44,7 @@ MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
4544
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
4645
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
4746
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
47+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
4848
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
4949
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
5050

@@ -58,6 +58,7 @@ DiffEqBaseMPIExt = "MPI"
5858
DiffEqBaseMeasurementsExt = "Measurements"
5959
DiffEqBaseMonteCarloMeasurementsExt = "MonteCarloMeasurements"
6060
DiffEqBaseReverseDiffExt = "ReverseDiff"
61+
DiffEqBaseSparseArraysExt = "SparseArrays"
6162
DiffEqBaseTrackerExt = "Tracker"
6263
DiffEqBaseUnitfulExt = "Unitful"
6364

@@ -121,11 +122,12 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
121122
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
122123
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
123124
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
125+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
124126
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
125127
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
126128
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
127129
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
128130
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
129131

130132
[targets]
131-
test = ["Distributed", "Measurements", "MonteCarloMeasurements", "Unitful", "LabelledArrays", "ForwardDiff", "InteractiveUtils", "Plots", "Pkg", "Random", "StaticArrays", "SafeTestsets", "Statistics", "Test", "Distributions", "Aqua", "BenchmarkTools"]
133+
test = ["Distributed", "Measurements", "MonteCarloMeasurements", "Unitful", "LabelledArrays", "ForwardDiff", "SparseArrays", "InteractiveUtils", "Plots", "Pkg", "Random", "StaticArrays", "SafeTestsets", "Statistics", "Test", "Distributions", "Aqua", "BenchmarkTools"]

ext/DiffEqBaseSparseArraysExt.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module DiffEqBaseSparseArraysExt
2+
3+
import SparseArrays
4+
import DiffEqBase: NAN_CHECK, INFINITE_OR_GIANT
5+
6+
function NAN_CHECK(x::SparseArrays.AbstractSparseMatrixCSC)
7+
any(NAN_CHECK, SparseArrays.nonzeros(x))
8+
end
9+
function INFINITE_OR_GIANT(x::SparseArrays.AbstractSparseMatrixCSC)
10+
any(INFINITE_OR_GIANT, SparseArrays.nonzeros(x))
11+
end
12+
13+
end

src/DiffEqBase.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ using FastBroadcast: @.., True, False
2525
using Static: reduce_tup
2626

2727
import RecursiveArrayTools
28-
import SparseArrays
2928
import TruncatedStacktraces
3029

3130
using Setfield

src/common_defaults.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ function NAN_CHECK(x::Union{AbstractArray, RecursiveArrayTools.AbstractVectorOfA
102102
NAN_CHECK, x)
103103
end
104104
NAN_CHECK(x::RecursiveArrayTools.ArrayPartition) = any(NAN_CHECK, x.x)
105-
function NAN_CHECK(x::SparseArrays.AbstractSparseMatrixCSC)
106-
any(NAN_CHECK, SparseArrays.nonzeros(x))
107-
end
108105

109106
INFINITE_OR_GIANT(x::Number) = !isfinite(x)
110107
function INFINITE_OR_GIANT(x::Union{
@@ -113,9 +110,6 @@ function INFINITE_OR_GIANT(x::Union{
113110
INFINITE_OR_GIANT, x)
114111
end
115112
INFINITE_OR_GIANT(x::RecursiveArrayTools.ArrayPartition) = any(INFINITE_OR_GIANT, x.x)
116-
function INFINITE_OR_GIANT(x::SparseArrays.AbstractSparseMatrixCSC)
117-
any(INFINITE_OR_GIANT, SparseArrays.nonzeros(x))
118-
end
119113
ODE_DEFAULT_UNSTABLE_CHECK(dt, u, p, t) = false
120114
function ODE_DEFAULT_UNSTABLE_CHECK(dt, u::Union{Number, AbstractArray{<:Number}}, p, t)
121115
INFINITE_OR_GIANT(u)

test/termination_conditions.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ u = rand(4)
55
uprev = rand(4)
66

77
const TERMINATION_CONDITIONS = [
8-
SimpleNonlinearSolveTerminationMode(),
98
RelTerminationMode(), NormTerminationMode(), RelNormTerminationMode(),
109
AbsTerminationMode(), AbsNormTerminationMode(), RelSafeTerminationMode(),
1110
AbsSafeTerminationMode(), RelSafeBestTerminationMode(), AbsSafeBestTerminationMode()

0 commit comments

Comments
 (0)