diff --git a/ext/DiffEqCallbacksSundialsExt.jl b/ext/DiffEqCallbacksSundialsExt.jl index 1206b1ba..707faad3 100644 --- a/ext/DiffEqCallbacksSundialsExt.jl +++ b/ext/DiffEqCallbacksSundialsExt.jl @@ -3,7 +3,6 @@ module DiffEqCallbacksSundialsExt using Sundials: NVector, IDA import DiffEqCallbacks: solver_state_alloc, solver_state_type - # Allocator; `U` is typically something like `Vector{Float64}` solver_state_alloc(solver::IDA, U::DataType, num_us::Int) = () -> NVector(U(undef, num_us)) diff --git a/src/domain.jl b/src/domain.jl index 3df35e42..ab22714d 100644 --- a/src/domain.jl +++ b/src/domain.jl @@ -94,7 +94,7 @@ function affect!(integrator, f::AbstractDomainAffect{T, S, uType}) where {T, S, if dtcache == dt if integrator.opts.verbose @warn("Could not restrict values to domain. Iteration was canceled since ", - "proposed time step dt = ", dt," could not be reduced.") + "proposed time step dt = ", dt, " could not be reduced.") end break end diff --git a/src/independentlylinearizedutils.jl b/src/independentlylinearizedutils.jl index 1bdcb70b..c30ba3da 100644 --- a/src/independentlylinearizedutils.jl +++ b/src/independentlylinearizedutils.jl @@ -2,7 +2,6 @@ using SciMLBase export IndependentlyLinearizedSolution - """ CachePool(T, alloc; thread_safe = true) @@ -40,11 +39,11 @@ mutable struct CachePool{T, THREAD_SAFE} num_acquired::Int function CachePool(T, alloc::F; thread_safe::Bool = true) where {F} - return new{T,Val{thread_safe}}(T[], alloc, ReentrantLock(), 0, 0) + return new{T, Val{thread_safe}}(T[], alloc, ReentrantLock(), 0, 0) end end -const ThreadSafeCachePool{T} = CachePool{T,Val{true}} -const ThreadUnsafeCachePool{T} = CachePool{T,Val{false}} +const ThreadSafeCachePool{T} = CachePool{T, Val{true}} +const ThreadUnsafeCachePool{T} = CachePool{T, Val{false}} """ acquire!(cache::CachePool) @@ -78,7 +77,9 @@ end # Thread-safe versions just sub out to the other methods, using `_dummy` to force correct dispatch acquire!(cache::ThreadSafeCachePool) = @lock cache.lock acquire!(cache, nothing) release!(cache::ThreadSafeCachePool, val) = @lock cache.lock release!(cache, val, nothing) -is_fully_released(cache::ThreadSafeCachePool) = @lock cache.lock is_fully_released(cache, nothing) +function is_fully_released(cache::ThreadSafeCachePool) + @lock cache.lock is_fully_released(cache, nothing) +end macro with_cache(cache, name, body) return quote @@ -91,20 +92,20 @@ macro with_cache(cache, name, body) end end - -struct IndependentlyLinearizedSolutionChunksCache{T,S} +struct IndependentlyLinearizedSolutionChunksCache{T, S} t_chunks::ThreadUnsafeCachePool{Vector{T}} u_chunks::ThreadUnsafeCachePool{Matrix{S}} time_masks::ThreadUnsafeCachePool{BitMatrix} - function IndependentlyLinearizedSolutionChunksCache{T,S}(num_us::Int, num_derivatives::Int, chunk_size::Int) where {T,S} + function IndependentlyLinearizedSolutionChunksCache{T, S}( + num_us::Int, num_derivatives::Int, chunk_size::Int) where {T, S} t_chunks_alloc = () -> Vector{T}(undef, chunk_size) - u_chunks_alloc = () -> Matrix{S}(undef, num_derivatives+1, chunk_size) + u_chunks_alloc = () -> Matrix{S}(undef, num_derivatives + 1, chunk_size) time_masks_alloc = () -> BitMatrix(undef, num_us, chunk_size) return new( - CachePool(Vector{T}, t_chunks_alloc; thread_safe=false), - CachePool(Matrix{S}, u_chunks_alloc; thread_safe=false), - CachePool(BitMatrix, time_masks_alloc; thread_safe=false), + CachePool(Vector{T}, t_chunks_alloc; thread_safe = false), + CachePool(Matrix{S}, u_chunks_alloc; thread_safe = false), + CachePool(BitMatrix, time_masks_alloc; thread_safe = false) ) end end @@ -130,16 +131,19 @@ mutable struct IndependentlyLinearizedSolutionChunks{T, S, N} cache::IndependentlyLinearizedSolutionChunksCache - function IndependentlyLinearizedSolutionChunks{T, S}(num_us::Int, num_derivatives::Int = 0, + function IndependentlyLinearizedSolutionChunks{T, S}( + num_us::Int, num_derivatives::Int = 0, chunk_size::Int = 512, - cache::IndependentlyLinearizedSolutionChunksCache = IndependentlyLinearizedSolutionChunksCache{T,S}(num_us, num_derivatives, chunk_size)) where {T, S} + cache::IndependentlyLinearizedSolutionChunksCache = IndependentlyLinearizedSolutionChunksCache{ + T, S}(num_us, num_derivatives, chunk_size)) where {T, S} t_chunks = [acquire!(cache.t_chunks)] u_chunks = [[acquire!(cache.u_chunks)] for _ in 1:num_us] time_masks = [acquire!(cache.time_masks)] last_chunks = [u_chunks[u_idx][1] for u_idx in 1:num_us] u_offsets = [1 for _ in 1:num_us] t_offset = 1 - return new{T,S,num_derivatives}(t_chunks, u_chunks, time_masks, last_chunks, u_offsets, t_offset, cache) + return new{T, S, num_derivatives}( + t_chunks, u_chunks, time_masks, last_chunks, u_offsets, t_offset, cache) end end @@ -158,8 +162,7 @@ function num_us(ilsc::IndependentlyLinearizedSolutionChunks) end return length(ilsc.u_chunks) end -num_derivatives(ilsc::IndependentlyLinearizedSolutionChunks{T,S,N}) where {T,S,N} = N - +num_derivatives(ilsc::IndependentlyLinearizedSolutionChunks{T, S, N}) where {T, S, N} = N function Base.isempty(ilsc::IndependentlyLinearizedSolutionChunks) return length(ilsc.t_chunks) == 1 && ilsc.t_offset == 1 @@ -187,7 +190,7 @@ function get_chunks(ilsc::IndependentlyLinearizedSolutionChunks{T, S}) where {T, return ( ilsc.t_chunks[end], ilsc.time_masks[end], - ilsc.last_chunks, + ilsc.last_chunks ) end @@ -283,37 +286,43 @@ mutable struct IndependentlyLinearizedSolution{T, S, N} time_mask::BitMatrix # Temporary object used during construction, will be set to `nothing` at the end. - ilsc::Union{Nothing,IndependentlyLinearizedSolutionChunks{T,S,N}} - ilsc_cache_pool::Union{Nothing,ThreadSafeCachePool{IndependentlyLinearizedSolutionChunksCache{T,S}}} + ilsc::Union{Nothing, IndependentlyLinearizedSolutionChunks{T, S, N}} + ilsc_cache_pool::Union{ + Nothing, ThreadSafeCachePool{IndependentlyLinearizedSolutionChunksCache{T, S}}} end # Helper function to create an ILS wrapped around an in-progress ILSC -function IndependentlyLinearizedSolution(ilsc::IndependentlyLinearizedSolutionChunks{T,S,N}, cache_pool = nothing) where {T,S,N} - return IndependentlyLinearizedSolution{T,S,N}( +function IndependentlyLinearizedSolution( + ilsc::IndependentlyLinearizedSolutionChunks{T, S, N}, + cache_pool = nothing) where {T, S, N} + return IndependentlyLinearizedSolution{T, S, N}( T[], Matrix{S}[], - BitMatrix(undef, 0,0), + BitMatrix(undef, 0, 0), ilsc, - cache_pool, + cache_pool ) end # Automatically create an ILS wrapped around an ILSC from a `prob` -function IndependentlyLinearizedSolution(prob::SciMLBase.AbstractDEProblem, num_derivatives = 0; - cache_pool = nothing, - chunk_size::Int = 512) +function IndependentlyLinearizedSolution( + prob::SciMLBase.AbstractDEProblem, num_derivatives = 0; + cache_pool = nothing, + chunk_size::Int = 512) T = eltype(prob.tspan) S = eltype(prob.u0) U = isnothing(prob.u0) ? Float64 : eltype(prob.u0) num_us = isnothing(prob.u0) ? 0 : length(prob.u0) if cache_pool === nothing - cache = IndependentlyLinearizedSolutionChunksCache{T,S}(num_us, num_derivatives, chunk_size) + cache = IndependentlyLinearizedSolutionChunksCache{T, S}( + num_us, num_derivatives, chunk_size) else cache = acquire!(cache_pool) end - chunks = IndependentlyLinearizedSolutionChunks{T,U}(num_us, num_derivatives, chunk_size, cache) + chunks = IndependentlyLinearizedSolutionChunks{T, U}( + num_us, num_derivatives, chunk_size, cache) return IndependentlyLinearizedSolution(chunks, cache_pool) end -num_derivatives(::IndependentlyLinearizedSolution{T,S,N}) where {T,S,N} = N +num_derivatives(::IndependentlyLinearizedSolution{T, S, N}) where {T, S, N} = N num_us(ils::IndependentlyLinearizedSolution) = length(ils.us) Base.size(ils::IndependentlyLinearizedSolution) = size(ils.time_mask) Base.length(ils::IndependentlyLinearizedSolution) = length(ils.ts) @@ -344,33 +353,34 @@ function finish!(ils::IndependentlyLinearizedSolution{T, S}, return_code) where chunk_len(chunk) = size(chunk, ndims(chunk)) function chunks_len(chunks::Vector, offset) len = 0 - for chunk_idx in 1:length(chunks)-1 + for chunk_idx in 1:(length(chunks) - 1) len += chunk_len(chunks[chunk_idx]) end return len + offset - 1 end - function copy_chunk!(out::Vector, in::Vector, out_offset::Int, len=chunk_len(in)) + function copy_chunk!(out::Vector, in::Vector, out_offset::Int, len = chunk_len(in)) for idx in 1:len - out[idx+out_offset] = in[idx] + out[idx + out_offset] = in[idx] end end - function copy_chunk!(out::AbstractMatrix, in::AbstractMatrix, out_offset::Int, len=chunk_len(in)) + function copy_chunk!(out::AbstractMatrix, in::AbstractMatrix, + out_offset::Int, len = chunk_len(in)) for zdx in 1:size(in, 1) for idx in 1:len - out[zdx, idx+out_offset] = in[zdx, idx] + out[zdx, idx + out_offset] = in[zdx, idx] end end end function collapse_chunks!(out, chunks, offset::Int) write_offset = 0 - for chunk_idx in 1:(length(chunks)-1) + for chunk_idx in 1:(length(chunks) - 1) chunk = chunks[chunk_idx] copy_chunk!(out, chunk, write_offset) write_offset += chunk_len(chunk) end - copy_chunk!(out, chunks[end], write_offset, offset-1) + copy_chunk!(out, chunks[end], write_offset, offset - 1) end # Collapse t_chunks @@ -380,11 +390,13 @@ function finish!(ils::IndependentlyLinearizedSolution{T, S}, return_code) where # Collapse u_chunks us = Vector{Matrix{S}}(undef, length(ilsc.u_chunks)) for u_idx in 1:length(ilsc.u_chunks) - us[u_idx] = Matrix{S}(undef, size(ilsc.u_chunks[u_idx][1],1), chunks_len(ilsc.u_chunks[u_idx], ilsc.u_offsets[u_idx])) + us[u_idx] = Matrix{S}(undef, size(ilsc.u_chunks[u_idx][1], 1), + chunks_len(ilsc.u_chunks[u_idx], ilsc.u_offsets[u_idx])) collapse_chunks!(us[u_idx], ilsc.u_chunks[u_idx], ilsc.u_offsets[u_idx]) end - time_mask = BitMatrix(undef, size(ilsc.time_masks[1], 1), chunks_len(ilsc.time_masks, ilsc.t_offset)) + time_mask = BitMatrix( + undef, size(ilsc.time_masks[1], 1), chunks_len(ilsc.time_masks, ilsc.t_offset)) collapse_chunks!(time_mask, ilsc.time_masks, ilsc.t_offset) end diff --git a/src/saving.jl b/src/saving.jl index fc807a3c..164688f1 100644 --- a/src/saving.jl +++ b/src/saving.jl @@ -186,9 +186,9 @@ function is_linear_enough!(caches, is_linear, t₀, t₁, u₀, u₁, integ, abs tspread = t₁ - t₀ num_us = length(u₀) @inbounds for u_idx in 1:num_us - slopes[u_idx] = (u₁[u_idx] - u₀[u_idx])/tspread + slopes[u_idx] = (u₁[u_idx] - u₀[u_idx]) / tspread end - t_quartile(t_idx) = t₀ + tspread * t_idx/4.0 + t_quartile(t_idx) = t₀ + tspread * t_idx / 4.0 # Calculate interpolated and linear samplings in our three quartiles @inbounds for t_idx in 1:3 @@ -205,7 +205,7 @@ function is_linear_enough!(caches, is_linear, t₀, t₁, u₀, u₁, integ, abs # temporary array then copy it into `y_interp`, which loses very # little time and still prevents allocations from `integ(t)`. @with_cache caches.us u_interp begin - integ(u_interp, t, Val{0}; idxs=nothing) + integ(u_interp, t, Val{0}; idxs = nothing) for u_idx in 1:num_us y_interp[u_idx, t_idx] = u_interp[u_idx] end @@ -242,7 +242,7 @@ function linearize_period(t₀, t₁, u₀, u₁, integ, ilsc, caches, u_mask, # Sanity check that we don't accidentally infinitely recurse if t₁ - t₀ < dtmin @debug("Linearization failure", - t₁, t₀, string(u₀), string(u₁), string(u_mask),dtmin) + t₁, t₀, string(u₀), string(u₁), string(u_mask), dtmin) throw(ArgumentError("Linearization failed, fell below linearization subdivision threshold")) end @@ -265,7 +265,7 @@ function linearize_period(t₀, t₁, u₀, u₁, integ, ilsc, caches, u_mask, if any(is_nonlinear) # If it's not linear, split this period into two and recurse, altering our `u_mask`: @with_cache caches.us uᵦ begin - integ(uᵦ, tᵦ, Val{0}; idxs=nothing) + integ(uᵦ, tᵦ, Val{0}; idxs = nothing) linearize_period( t₀, tᵦ, u₀, uᵦ, @@ -300,22 +300,23 @@ function linearize_period(t₀, t₁, u₀, u₁, integ, ilsc, caches, u_mask, end end -function store_u_block!(ilsc, ::Val{num_derivatives}, integ, caches, t₁, u₁, u_mask) where {num_derivatives} +function store_u_block!( + ilsc, ::Val{num_derivatives}, integ, caches, t₁, u₁, u_mask) where {num_derivatives} @with_cache caches.us u begin for u_idx in 1:length(u) caches.u_block[1, u_idx] = u₁[u_idx] end for deriv_idx in 1:num_derivatives - integ(u, t₁, Val{deriv_idx}; idxs=nothing) + integ(u, t₁, Val{deriv_idx}; idxs = nothing) for u_idx in 1:length(u) - caches.u_block[deriv_idx+1, u_idx] = u[u_idx] + caches.u_block[deriv_idx + 1, u_idx] = u[u_idx] end end store!(ilsc, t₁, caches.u_block, u_mask) end end -struct LinearizingSavingCallbackCacheType{S,U} +struct LinearizingSavingCallbackCacheType{S, U} y_linear::Matrix{S} y_interp::Matrix{S} slopes::Vector{S} @@ -324,13 +325,14 @@ struct LinearizingSavingCallbackCacheType{S,U} u_block::Matrix{S} u_masks::ThreadUnsafeCachePool{BitVector} - function LinearizingSavingCallbackCacheType{S,U}(num_us::Int, num_derivatives::Int, U_alloc::Function) where {S,U} + function LinearizingSavingCallbackCacheType{S, U}( + num_us::Int, num_derivatives::Int, U_alloc::Function) where {S, U} y_linear = Matrix{S}(undef, (num_us, 3)) y_interp = Matrix{S}(undef, (num_us, 3)) slopes = Vector{S}(undef, num_us) - u_block = Matrix{S}(undef, (num_derivatives+1, num_us)) + u_block = Matrix{S}(undef, (num_derivatives + 1, num_us)) F_umasks = () -> BitVector(undef, num_us) - u_masks = CachePool(BitVector, F_umasks; thread_safe=false) + u_masks = CachePool(BitVector, F_umasks; thread_safe = false) # Workaround for Sundials allocations; conversion from `Vector{S}` # to `NVector()` allocates, so we require the caller to pass in a @@ -338,14 +340,14 @@ struct LinearizingSavingCallbackCacheType{S,U} # U_alloc = () -> Vector{S}(undef, num_us)` can be overridden. # This is automatically done by `DiffEqCallbacksSundialsExt`, via # the `solver_state_type()` and `solver_state_alloc()` hooks below. - us = CachePool(U, U_alloc; thread_safe=false) - return new{S,U}( + us = CachePool(U, U_alloc; thread_safe = false) + return new{S, U}( y_linear, y_interp, slopes, us, u_block, - u_masks, + u_masks ) end end @@ -354,7 +356,9 @@ end # type of the state vectors cached by the `LinearizingSavingCallbackCache`. # U is typically something like `Vector{Float64}`. solver_state_type(solver::AbstractSciMLAlgorithm, U::DataType) = U -solver_state_alloc(solver::AbstractSciMLAlgorithm, U::DataType, num_us::Int) = () -> U(undef, num_us) +function solver_state_alloc(solver::AbstractSciMLAlgorithm, U::DataType, num_us::Int) + () -> U(undef, num_us) +end """ LinearizingSavingCallbackCache(prob, solver; num_derivatives=0) @@ -399,24 +403,27 @@ ensembleprob = EnsembleProblem(prob; prob_func=linearizer_adding_remake) solve(ensembleprob, solver, EnsembleThreads(); ...) ``` """ -function LinearizingSavingCallbackCache(prob, solver; num_derivatives=0, chunk_size=512) +function LinearizingSavingCallbackCache(prob, solver; num_derivatives = 0, chunk_size = 512) T = eltype(prob.tspan) S = eltype(prob.u0) U = solver_state_type(solver, typeof(prob.u0)) num_us = length(prob.u0) U_alloc = solver_state_alloc(solver, typeof(prob.u0), num_us) - return LinearizingSavingCallbackCache(T, S, U, U_alloc, num_us; num_derivatives, chunk_size) + return LinearizingSavingCallbackCache( + T, S, U, U_alloc, num_us; num_derivatives, chunk_size) end -function make_lsc_cache(num_us, num_derivatives, S = Float64, U = Vector{S}, U_alloc = () -> U(undef, num_us)) +function make_lsc_cache(num_us, num_derivatives, S = Float64, + U = Vector{S}, U_alloc = () -> U(undef, num_us)) return CachePool( - LinearizingSavingCallbackCacheType{S,U}, - () -> LinearizingSavingCallbackCacheType{S,U}(num_us, num_derivatives, U_alloc); - thread_safe = true, + LinearizingSavingCallbackCacheType{S, U}, + () -> LinearizingSavingCallbackCacheType{S, U}(num_us, num_derivatives, U_alloc); + thread_safe = true ) end -function LinearizingSavingCallbackCache(T, S, U, U_alloc, num_us; num_derivatives=0, chunk_size=512) +function LinearizingSavingCallbackCache( + T, S, U, U_alloc, num_us; num_derivatives = 0, chunk_size = 512) return (; # This cache is used by the LinearizingSavingCallback, it creates `LinearizingSavingCallbackCacheType` # objects, which is quite a mouthful, but contains all the temporary values needed for a single @@ -428,26 +435,26 @@ function LinearizingSavingCallbackCache(T, S, U, U_alloc, num_us; num_derivative # This cache is used by the `IndependentlyLinearizedSolutionChunks` to do things like allocate `u`, # `t` and `time_mask` chunks. ils_cache = CachePool( - IndependentlyLinearizedSolutionChunksCache{T,S}, - () -> IndependentlyLinearizedSolutionChunksCache{T,S}( + IndependentlyLinearizedSolutionChunksCache{T, S}, + () -> IndependentlyLinearizedSolutionChunksCache{T, S}( num_us, num_derivatives, - chunk_size, + chunk_size ), - thread_safe = true, - ), + thread_safe = true + ) ) end -function default_lsc_cache(T,S,num_us,num_derivatives) +function default_lsc_cache(T, S, num_us, num_derivatives) return CachePool( - LinearizingSavingCallbackCacheType{S,Vector{S}}, - () -> LinearizingSavingCallbackCacheType{S,Vector{S}}(num_us, num_derivatives, () -> Vector{S}(undef, num_us)); - thread_safe = true, + LinearizingSavingCallbackCacheType{S, Vector{S}}, + () -> LinearizingSavingCallbackCacheType{S, Vector{S}}( + num_us, num_derivatives, () -> Vector{S}(undef, num_us)); + thread_safe = true ) end - """ LinearizingSavingCallback(ils::IndependentlyLinearizedSolution) LinearizingSavingCallback(ilss::Vector{IndependentlyLinearizedSolution}) @@ -483,10 +490,11 @@ solve(prob, solver; callback=LinearizingSavingCallback(ils)) """ function LinearizingSavingCallback(ils::IndependentlyLinearizedSolution{T, S}; interpolate_mask = BitVector(true for _ in 1:length(ils.ilsc.u_chunks)), - abstol::Union{S,Nothing} = nothing, - reltol::Union{S,Nothing} = nothing, - cache_pool::CachePool{C} = make_lsc_cache(length(ils.ilsc.u_chunks), num_derivatives(ils.ilsc), S), - ) where {T, S, C} + abstol::Union{S, Nothing} = nothing, + reltol::Union{S, Nothing} = nothing, + cache_pool::CachePool{C} = make_lsc_cache( + length(ils.ilsc.u_chunks), num_derivatives(ils.ilsc), S) +) where {T, S, C} ilsc = ils.ilsc full_mask = BitVector(true for _ in 1:length(ilsc.u_chunks)) num_derivatives_val = Val(num_derivatives(ilsc)) @@ -507,14 +515,15 @@ function LinearizingSavingCallback(ils::IndependentlyLinearizedSolution{T, S}; @with_cache caches.us u₀ begin @with_cache caches.us u₁ begin # Get `u₀` and `u₁` from the integrator - integ(u₀, t₀, Val{0}; idxs=nothing) - integ(u₁, t₁, Val{0}; idxs=nothing) + integ(u₀, t₀, Val{0}; idxs = nothing) + integ(u₁, t₁, Val{0}; idxs = nothing) # Store first timepoints. Usually we'd do this in `initialize` # but `integ(u, t, deriv)` doesn't work that early, and so we # must wait until we've taken at least a single step. if isempty(ilsc) - store_u_block!(ilsc, num_derivatives_val, integ, caches, t₀, u₀, full_mask) + store_u_block!( + ilsc, num_derivatives_val, integ, caches, t₀, u₀, full_mask) end dtmin = eps(t₁ - t₀) * 1000.0 @@ -546,4 +555,5 @@ function LinearizingSavingCallback(ils::IndependentlyLinearizedSolution{T, S}; save_positions = (false, false)) end -export SavingCallback, SavedValues, LinearizingSavingCallback, LinearizingSavingCallbackCache +export SavingCallback, SavedValues, LinearizingSavingCallback, + LinearizingSavingCallbackCache diff --git a/test/independentlylinearizedtests.jl b/test/independentlylinearizedtests.jl index a55c28dc..768674a0 100644 --- a/test/independentlylinearizedtests.jl +++ b/test/independentlylinearizedtests.jl @@ -38,7 +38,8 @@ using DiffEqCallbacks: CachePool, acquire!, release!, @with_cache end # Test the threadsafe versions actually lock - pool = CachePool(Vector{Float64}, () -> Vector{Float64}(undef, num_us); thread_safe=true) + pool = CachePool( + Vector{Float64}, () -> Vector{Float64}(undef, num_us); thread_safe = true) # elapsed acquire once to warm everything up @elapsed acquire!(pool) @test @elapsed(acquire!(pool)) < 0.001 @@ -52,9 +53,8 @@ using DiffEqCallbacks: CachePool, acquire!, release!, @with_cache @test @elapsed(acquire!(pool)) > 0.001 end - @testset "IndependentlyLinearizedSolution" begin - ils = IndependentlyLinearizedSolution{Float64,Float64,0}( + ils = IndependentlyLinearizedSolution{Float64, Float64, 0}( # t [0.0, 0.5, 0.75, 1.0], # us (primal only, no derivatives) @@ -72,7 +72,7 @@ end # ilsc nothing, # ilsc_cache_pool - nothing, + nothing ) # Test `iterate()` diff --git a/test/saving_tests.jl b/test/saving_tests.jl index 6bf6c80a..bc59cd32 100644 --- a/test/saving_tests.jl +++ b/test/saving_tests.jl @@ -160,7 +160,7 @@ cb = SavingCallback((u, t, integrator) -> integrator.EEst * integrator.dt, saved # respects our `abstol`/`reltol` versus the actual solution: using DataInterpolations import DiffEqCallbacks: as_array, finish!, - IndependentlyLinearizedSolution, LinearizingSavingCallbackCache + IndependentlyLinearizedSolution, LinearizingSavingCallbackCache as_array(T::Type{<:AbstractArray}) = T as_array(T::Type{<:Number}) = Vector{T} @@ -199,7 +199,7 @@ if VERSION >= v"1.9" # stack atol = abstol^(2.0^(-deriv_idx)), rtol = reltol^(2.0^(-deriv_idx))) if !check - @error("Check failed", solver,deriv_idx) + @error("Check failed", solver, deriv_idx) display(abs.(u_linear_upsampled .- u_interp_upsampled)) end @test check @@ -221,7 +221,7 @@ if VERSION >= v"1.9" # stack test_linearization(prob_ode_rigidbody, solver(); max_deriv) test_linearization(prob_ode_nonlinchem, solver(); max_deriv) test_linearization(prob_ode_lorenz, solver(); max_deriv) - + # We do not support 2d states yet. #test_linearization(prob_ode_2Dlinear, solver(); max_deriv) end