Closed antoine-levitt closed 6 years ago
Yes, Arrays of Arrays is something that currently gives us trouble. But most of the change is almost done. https://github.com/JuliaDiffEq/OrdinaryDiffEq.jl/pull/231 has most of it. The last thing that we need to find out is a replacement for:
https://github.com/JuliaDiffEq/OrdinaryDiffEq.jl/blob/master/src/solve.jl#L98
We need something that gives the element type of u
without units, but it needs to be compatible with the element type of u
being an array. If you have a solution to that then we'll finish this once and for all 👍
Assume the input is an abstract array of abstract arrays of... of numbers, and recurse on that using dispatch?
Assume the input is an abstract array of abstract arrays of... of numbers, and recurse on that using dispatch?
No, that's the current strategy:
https://github.com/JuliaDiffEq/OrdinaryDiffEq.jl/blob/master/src/solve.jl#L92
defined in:
https://github.com/JuliaDiffEq/RecursiveArrayTools.jl/blob/master/src/utils.jl#L95-L96
The issue is that for an abstract array of array of ..., this returns the bottom type, so the cache array is Array{Float64,1}
, which if you look at the current error message on JuliaDiffEq/OrdinaryDiffEq.jl#231 it's that it cannot convert the static array to a Float64
because it incorrectly got the eltype of u
as its number type. It needs to propagate that up back to the array type somehow, maybe via similar_type
.
Fixed by the newest release on a multitude of packages which will go through by the end of tomorrow.
Thanks! That resulted in a 4x speedup on a ODE in dimension 2x2x30x30 by StaticArraying the 2x2 part - not bad for such a simple change!
Sweet! I'll mark that down as a win!
Hi,
I'm trying to solve an ODE that operates on Arrays of StaticArrays. I think it implements all the operations DifferentialEquations needs, so should work? MWE:
gives