Skip to content

Commit

Permalink
Merge pull request #951 from AayushSabharwal/as/indexing-rework
Browse files Browse the repository at this point in the history
fix: bump compat, update to use new RecursiveArrayTools
  • Loading branch information
ChrisRackauckas authored Dec 13, 2023
2 parents 433eb0d + b5df83a commit 80bb7fd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Parameters = "0.12.0"
PreallocationTools = "0.4"
PrecompileTools = "1"
Printf = "1.9"
RecursiveArrayTools = "2"
RecursiveArrayTools = "2, 3"
Reexport = "1.0"
SciMLBase = "2.7.0"
SciMLOperators = "0.2, 0.3"
Expand Down
12 changes: 10 additions & 2 deletions src/common_defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ end
@inline function UNITLESS_ABS2(x::AbstractArray)
mapreduce(UNITLESS_ABS2, abs2_and_sum, x, init = zero(real(value(eltype(x)))))
end
@inline function UNITLESS_ABS2(x::RecursiveArrayTools.AbstractVectorOfArray)
mapreduce(UNITLESS_ABS2, abs2_and_sum, x.u, init = zero(real(value(eltype(x)))))
end
@inline function UNITLESS_ABS2(x::RecursiveArrayTools.ArrayPartition)
mapreduce(UNITLESS_ABS2, abs2_and_sum, x.x, init = zero(real(value(eltype(x)))))
end
Expand Down Expand Up @@ -64,7 +67,11 @@ end
Base.FastMath.sqrt_fast(real(sum(abs2 f, u)) / max(length(u), 1))
end

@inline function ODE_DEFAULT_NORM(u::AbstractArray, t)
@inline function ODE_DEFAULT_NORM(u::Union{
AbstractArray,
RecursiveArrayTools.AbstractVectorOfArray,
},
t)
Base.FastMath.sqrt_fast(UNITLESS_ABS2(u) / max(recursive_length(u), 1))
end

Expand All @@ -90,7 +97,8 @@ end
@inline NAN_CHECK(x::Number) = isnan(x)
@inline NAN_CHECK(x::Float64) = isnan(x) || (x > 1e50)
@inline NAN_CHECK(x::Enum) = false
@inline NAN_CHECK(x::AbstractArray) = any(NAN_CHECK, x)
@inline NAN_CHECK(x::Union{AbstractArray, RecursiveArrayTools.AbstractVectorOfArray}) = any(NAN_CHECK,
x)
@inline NAN_CHECK(x::RecursiveArrayTools.ArrayPartition) = any(NAN_CHECK, x.x)
@inline function NAN_CHECK(x::SparseArrays.AbstractSparseMatrixCSC)
any(NAN_CHECK, SparseArrays.nonzeros(x))
Expand Down
2 changes: 1 addition & 1 deletion src/fastpow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const EXP2FT = (Float32(0x1.6a09e667f3bcdp-1),
TBLBITS = UInt32(4)
TBLSIZE = UInt32(1 << TBLBITS)

redux = Float32(0x1.8p23f) / TBLSIZE
redux = Float32(0x1.8p23) / TBLSIZE
P1 = Float32(0x1.62e430p-1)
P2 = Float32(0x1.ebfbe0p-3)
P3 = Float32(0x1.c6b348p-5)
Expand Down
1 change: 0 additions & 1 deletion test/plot_vars.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dt = 0.1
sol = solve(prob, InternalEuler.FwdEulerAlg(), tstops = 0:dt:1)
syms = [:x, :y, :z]

@test SciMLBase.has_syms(prob.f) == true
@test SciMLBase.interpret_vars([(0, 1), (1, 3), (4, 5)], sol, syms) == [
(SciMLBase.DEFAULT_PLOT_FUNC, 0, 1),
(SciMLBase.DEFAULT_PLOT_FUNC, 1, 3),
Expand Down

0 comments on commit 80bb7fd

Please sign in to comment.