-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility with DifferentialEquations.jl #1
Comments
I think things are mostly close. I'd add: Base.ndims(u::Type{<:TupleVec}) = 1
Base.zero(u::TupleVec) = TupleVec(zero.(Tuple(u))) But the main issue I'm seeing is: julia> u0 = TupleVec(1.0, [0.0; 0.0])
TupleVec(1.0, [0.0, 0.0])
julia> u0 .+ u0
3-element Vector{Float64}:
2.0
0.0
0.0 While it's generally not a requirement of broadcast, we do generally require that broadcast is type-preserving if it's a linear combination of the same types + scalars, i.e. that the vector space property is held and the linear combination is in the vector space. |
There's already a Would it suffice to just define Broadcast.broadcastable(v::TupleVec) = Ref(v) so that it is not treated as a container for broadcasting? |
Disabling broadcasting then causes DiffEq to be stuck at this line: https://github.com/SciML/OrdinaryDiffEq.jl/blob/0ea61dc630ea0d6159e70aa134bbb674ae13fa25/lib/OrdinaryDiffEqCore/src/solve.jl#L239 (Aside from the question of why there is a default nonzero abstol at all, is there a way to get DiffEq to not treat the errors elementwise and instead just treat the solution as an opaque normed object?) If I override the default tolerances with because |
Right now, this package is not compatible with the RecursiveArrayTools.jl package used by DifferentialEquations.jl.
e.g. here is a simple example from the DifferentialEquations tutorial, modified to use a
TupleVec(dx, [dy, dz])
of a scalar and a vector:This gives the error:
Although it would technically be possible to support indexing into a
TupleVec
, i.e. to make it act like anAbstractVector
, I'd really rather keep it more general and represent an element of an arbitrary normed vector space. I don't see any fundamental technical reason why this shouldn't be compatible with numerical ODE solvers (just as it's already compatible with numerical integration).@ChrisRackauckas, is there a way to tell RecursiveArrayTools not to try to "look inside" a
TupleVec
, and instead treat it as an opaque mathematical object? As long as we're not trying to work in-place, at least for explicit solvers I don't see why you should need to look inside the vector.The text was updated successfully, but these errors were encountered: