-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Using Jacobian sparsity structures of large ODEs/PDEs downstream #1160
Comments
using ModelingToolkit
prob = ODEProblem(kse, uinit, (0.0, T), p)
sys = modelingtoolkitize(prob)
prob_jac = ODEProblem(sys, uinit, (0.0, T), p, jac=true, sparse=true)
prob_jac.f.jac_prototype |
Cool, it worked. Here are the comparisons:
These two are the main operations that take time in my algorithm (and also matrix-vector multiplication, but there it is quite obvious that the sparse will be faster). The timings of calculating the 10 largest Lyapunov exponents went down from 1 hour to 6 minutes. ;) I'll also write a tutorial about this in the DynamicalSystems.jl, if you believe the 5 lines of code you pasted above are "stable". |
(compile times are much larger now, but of course this is totally worth it) |
Yeah that code has been stable and I expect it to continue to be. And yeah, compile times are next 😅 |
Nothing more here than JuliaSimCompiler |
Hi, I want to take advantage of the Jacobian sparsity pipeline that modelling toolkit offers, and use the sparse jacobian, and the generated function acting on this sparse Jacobian, in some packages downsteeam (specifically
DynamicalSystems.lyapunovs
). To this end I need both the Jacobian function, but also an initialized sparse matrix with the correct sparsity strucutre.Here is my MWE, which uses a spatial discretization of the Kuramoto Shivashinky model:
the initial condition above generates a travelling wave
You will notice that
f2 =
will error, becausesparse
is not a valid keyword forODEFunction
.f1 =
works for me. However, when I typef1.jac_prototype
, the value of that field isnothing
. So in conclusion I haven't found of a way to get an instance of a sparse Jacobian matrix so far.The text was updated successfully, but these errors were encountered: