You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In newer version of DifferentialEquations.jl and RecursiveArrayTools.jl I am unable to get the matrix whose columns correspond to the solution at certain time steps using sol[:, :], where sol is the output of solve(ODEProblem). Instead it throws an AssertionError (written below). I am still able to get specific columns out with sol[:, 1] or sol[:, end]. I only get an error when trying to get the full matrix sol[:, :].
Expected behavior
Here is an example that works in DifferentialEquations.jl v7.12.0 and RecursiveArrayTools.jl v3.10.0 on a Windows 11 PC with Julia 1.10.1.
using DifferentialEquations
functionf!(du, u, p, t)
du[1] = u[2]
du[2] =-u[1]
end
u0 = [1.0; 0.0]
tspan = (0.0, 10.0)
prob =ODEProblem(f!, u0, tspan)
sol =solve(prob)
u = sol[:, :]
Running the same example again, this time with DifferentialEquations.jl v7.13.0 and RecursiveArrayTools.jl v3.10.1 on a MacOs 14.3.1 also with Julia 1.10.1 I get an AssertionError from RecursiveArrayTools.jl
using DifferentialEquations
functionf!(du, u, p, t)
du[1] = u[2]
du[2] =-u[1]
end
u0 = [1.0; 0.0]
tspan = (0.0, 10.0)
prob =ODEProblem(f!, u0, tspan)
sol =solve(prob)
u = sol[:, :]
Error & Stacktrace ⚠️
ERROR: AssertionError:length(I) ==ndims(A.u)
Stacktrace:
[1] _getindex
@ ~/.julia/packages/RecursiveArrayTools/dzBRE/src/vector_of_array.jl:309 [inlined]
[2] getindex(A::ODESolution{…}, _arg::Function, args::Function)
@ RecursiveArrayTools ~/.julia/packages/RecursiveArrayTools/dzBRE/src/vector_of_array.jl:435
[3] top-level scope
@ REPL[9]:1
Some type information was truncated. Use `show(err)` to see complete types.
Environment (please complete the following information):
Here is the environment info in the case where i get an AssertionError. Below all this, I provide equivalent info for when I get the expected output.
Output of using Pkg; Pkg.status()
`~/.julia/environments/v1.10/Project.toml`
[6e4b80f9] BenchmarkTools v1.5.0
[336ed68f] CSV v0.10.13
[13f3f980] CairoMakie v0.11.9
[a93c6f00] DataFrames v1.6.1
[8bb1440f] DelimitedFiles v1.9.1
⌅ [459566f4] DiffEqCallbacks v2.37.0
[0c46a032] DifferentialEquations v7.13.0
[31c24e10] Distributions v0.25.107
[e9467ef8] GLMakie v0.9.9
[b964fa9f] LaTeXStrings v1.3.1
[5fb14364] OhMyREPL v0.5.24
[91a5bcdd] Plots v1.40.1
[6e0679c1] QuantumOptics v1.0.15
[bd369af6] Tables v1.11.1
[10745b16] Statistics v1.10.0
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`
Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Julia Version 1.10.1
Commit 7790d6f064 (2024-02-1320:41 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU:16×12th Gen Intel(R) Core(TM) i5-12500H
WORD_SIZE:64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, alderlake)
Threads:1 default, 0 interactive, 1 GC (on 16 virtual cores)
Additional context
The code that gives the AssertionError was added to RecursiveArrayTools.jl just a few days ago, but I do not know how DifferentialEquations.jl actually uses RecursiveArrayTools.jl, so I decided to post the problem here.
The text was updated successfully, but these errors were encountered:
Ahh, I was not aware that I wasn't using the standard way to get the solution. I tested Array(sol) and that does indeed work in both versions. Thank you for clarifying.
Newer versions of DifferentialEquations.jl (and its dependency
RecursiveArrayTools.jl) changed the way the solution can be accesed as
an array, causing the example run files to error out. Apparently, the
way the solution was used as an array, although it worked fine before,
it was never officially supported (see:
SciML/DifferentialEquations.jl#1021). This
commit fixed this issue, using the syntax officially supported. This
makes the code work with both the newer versions and the older ones as
well.
Describe the bug 🐞
In newer version of DifferentialEquations.jl and RecursiveArrayTools.jl I am unable to get the matrix whose columns correspond to the solution at certain time steps using
sol[:, :]
, wheresol
is the output ofsolve(ODEProblem)
. Instead it throws an AssertionError (written below). I am still able to get specific columns out withsol[:, 1]
orsol[:, end]
. I only get an error when trying to get the full matrixsol[:, :]
.Expected behavior
Here is an example that works in DifferentialEquations.jl v7.12.0 and RecursiveArrayTools.jl v3.10.0 on a Windows 11 PC with Julia 1.10.1.
The output is
Minimal Reproducible Example 👇
Running the same example again, this time with DifferentialEquations.jl v7.13.0 and RecursiveArrayTools.jl v3.10.1 on a MacOs 14.3.1 also with Julia 1.10.1 I get an
AssertionError
from RecursiveArrayTools.jlError & Stacktrace⚠️
Environment (please complete the following information):
Here is the environment info in the case where i get an
AssertionError
. Below all this, I provide equivalent info for when I get the expected output.using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Environment info in which I get the expected behaviour:
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
The code that gives the
AssertionError
was added to RecursiveArrayTools.jl just a few days ago, but I do not know how DifferentialEquations.jl actually uses RecursiveArrayTools.jl, so I decided to post the problem here.The text was updated successfully, but these errors were encountered: