-
Notifications
You must be signed in to change notification settings - Fork 2
ode23s 2D matrix input #13
Comments
Could you please add a more explicit minimal example? |
Here's one: using ODE
t0 = 0.0
y0 = rand(4,2)
ode = ODE.ExplicitODE(t0,y0,(t,y,dy)->dy[1]=y[1])
opts = Dict(:initstep=>0.1,
:tstop=>1.0,
#:tout=>[0.,0.5,1.],
#:points=>:all,
:reltol=>1e-5,
:abstol=>1e-5)
#stepper = ODE.ModifiedRosenbrockIntegrator
stepper = ODE.ModifiedRosenbrockIntegrator
sol = ODE.solve(ode,stepper;opts...)
for (t,y) in sol # iterate over the solution
println((t,y))
end |
Our constraints on that are the
Of course if we allow |
This is related SciML/ODE.jl#102 . We should probably merge that test into this branch. Note that there, I think we should treat the matrix as a scalar: anything not an |
But we also need some discussion/documentation on scalar vs vector and how to handle different input. |
@pwl reshapes don't require a copy, it just creates a new view. So there really shouldn't be a performance loss at all if you reshape(A\vec(b),size(b)). |
@ChrisRackauckas it's not about performance but about consistency with API for other solvers. If you have an idea on how to realize this please let us know. |
I was responding to:
The answer is yes. When done correctly with views (and reshape/vec, which are essentially shorthands for common views), you won't have a measurable loss of performance. As for the API, I don't see why you would have a restriction at all. Julia's iteration lets you iterate through any array using |
Sorry, I didn't notice this line. You want to have While this is in principle possible, this kind of solution is not too far from restricting ourselves to |
I don't have a way of passing the Jacobian yet, but I am going to just document it as that it needs to work on the vec'd version of the input. I think in most cases where the user can hand calculate the Jacobian, they will also have easily put it as a vector anyways so this is more of a fringe case. But when the user doesn't pass the Jacobian, then the generalization still works without a hitch. I can see someone making a different choice though. |
ode23s
fails with 2D matrices as the y0. Here's the traceback:The code is generated from DifferentialEquations.jl's wrapper. I'll be making that public ASAP so you'll be able to use that to track it down if needed. I know that it's this method since all of the other methods worked just fine on the same test case.
The text was updated successfully, but these errors were encountered: