diff --git a/Project.toml b/Project.toml index 045414e..299e975 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MultiScaleArrays" uuid = "f9640e96-87f6-5992-9c3b-0743c6a49ffa" authors = ["Chris Rackauckas "] -version = "1.13.0" +version = "1.14.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" @@ -11,10 +11,15 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -SparseDiffTools = "47a9eef4-7e08-11e9-0b38-333d64bd3804" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0" +[weakdeps] +SparseDiffTools = "47a9eef4-7e08-11e9-0b38-333d64bd3804" + +[extensions] +MultiScaleArraysSparseDiffToolsExt = "SparseDiffTools" + [compat] DiffEqBase = "6.5" FiniteDiff = "2.3" @@ -24,7 +29,7 @@ RecursiveArrayTools = "1,2,3" SparseDiffTools = "1.6, 2" Statistics = "1" StochasticDiffEq = "6.13" -julia = "1.6" +julia = "1.10" [extras] OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" diff --git a/ext/MultiScaleArraysSparseDiffToolsExt.jl b/ext/MultiScaleArraysSparseDiffToolsExt.jl new file mode 100644 index 0000000..b3a17e2 --- /dev/null +++ b/ext/MultiScaleArraysSparseDiffToolsExt.jl @@ -0,0 +1,35 @@ +module MultiScaleArraysSparseDiffToolsExt + +using MultiScaleArrays, SparseDiffTools + +function MultiScaleArrays.add_node_jac_config!(cache, config::SparseDiffTools.ForwardColorJacCache, i, x, + node...) + @assert cache.jac_config.colorvec isa UnitRange + cache.jac_config = SparseDiffTools.ForwardColorJacCache(cache.uf, cache.uprev, + config.chunksize) + nothing +end + +function MultiScaleArrays.add_node_jac_config!(cache, config::SparseDiffTools.ForwardColorJacCache, i, x) + @assert cache.jac_config.colorvec isa UnitRange + cache.jac_config = SparseDiffTools.ForwardColorJacCache(cache.uf, cache.uprev, + config.chunksize) + nothing +end + +function MultiScaleArrays.remove_node_jac_config!(cache, config::SparseDiffTools.ForwardColorJacCache, i, x, + node...) + @assert cache.jac_config.colorvec isa UnitRange + cache.jac_config = SparseDiffTools.ForwardColorJacCache(cache.uf, cache.uprev, + config.chunksize) + nothing +end + +function MultiScaleArrays.remove_node_jac_config!(cache, config::SparseDiffTools.ForwardColorJacCache, i, x) + @assert cache.jac_config.colorvec isa UnitRange + cache.jac_config = SparseDiffTools.ForwardColorJacCache(cache.uf, cache.uprev, + config.chunksize) + nothing +end + +end \ No newline at end of file diff --git a/src/MultiScaleArrays.jl b/src/MultiScaleArrays.jl index d206451..ec49735 100644 --- a/src/MultiScaleArrays.jl +++ b/src/MultiScaleArrays.jl @@ -172,7 +172,7 @@ abstract type AbstractMultiScaleArrayLeaf{B} <: AbstractMultiScaleArray{B} end abstract type AbstractMultiScaleArrayHead{B} <: AbstractMultiScaleArray{B} end using DiffEqBase, Statistics, LinearAlgebra, FiniteDiff -import OrdinaryDiffEq, StochasticDiffEq, ForwardDiff, SparseDiffTools +import OrdinaryDiffEq, StochasticDiffEq, ForwardDiff Base.show(io::IO, x::AbstractMultiScaleArray) = invoke(show, Tuple{IO, Any}, io, x) Base.show(io::IO, ::MIME"text/plain", x::AbstractMultiScaleArray) = show(io, x) diff --git a/src/diffeq.jl b/src/diffeq.jl index 1f4ecc4..76f69f0 100644 --- a/src/diffeq.jl +++ b/src/diffeq.jl @@ -113,36 +113,6 @@ function remove_node_non_user_cache!(integrator::DiffEqBase.AbstractODEIntegrato nothing end -function add_node_jac_config!(cache, config::SparseDiffTools.ForwardColorJacCache, i, x, - node...) - @assert cache.jac_config.colorvec isa UnitRange - cache.jac_config = SparseDiffTools.ForwardColorJacCache(cache.uf, cache.uprev, - config.chunksize) - nothing -end - -function add_node_jac_config!(cache, config::SparseDiffTools.ForwardColorJacCache, i, x) - @assert cache.jac_config.colorvec isa UnitRange - cache.jac_config = SparseDiffTools.ForwardColorJacCache(cache.uf, cache.uprev, - config.chunksize) - nothing -end - -function remove_node_jac_config!(cache, config::SparseDiffTools.ForwardColorJacCache, i, x, - node...) - @assert cache.jac_config.colorvec isa UnitRange - cache.jac_config = SparseDiffTools.ForwardColorJacCache(cache.uf, cache.uprev, - config.chunksize) - nothing -end - -function remove_node_jac_config!(cache, config::SparseDiffTools.ForwardColorJacCache, i, x) - @assert cache.jac_config.colorvec isa UnitRange - cache.jac_config = SparseDiffTools.ForwardColorJacCache(cache.uf, cache.uprev, - config.chunksize) - nothing -end - function add_node_jac_config!(cache, config::FiniteDiff.JacobianCache, i, x) #add_node!(cache.x1, fill!(similar(x, eltype(cache.x1)),0)) add_node!(config.fx, recursivecopy(x))