JuliaDiff / SparseDiffTools.jl

Fast jacobian computation through sparsity exploitation and matrix coloring
MIT License
237 stars 41 forks source link

much faster oop jacobians #115

Closed ChrisRackauckas closed 4 years ago

ChrisRackauckas commented 4 years ago

Awesome, thanks

YingboMa commented 4 years ago
using OrdinaryDiffEq, StaticArrays
function lorenz(u,p,t)
 SA[10.0(u[2]-u[1]),u[1]*(28.0-u[3]) - u[2],u[1]*u[2] - (8/3)*u[3]]
end
u0 = SA[1.0;0.0;0.0]
tspan = (0.0,100.0)
prob = ODEProblem(lorenz,u0,tspan)
julia> @btime solve($prob, Rosenbrock23()); # PR
  2.536 ms (23810 allocations: 2.24 MiB)

julia> @btime solve($prob, Rosenbrock23()); # Master
  676.269 ms (1106918 allocations: 46.56 MiB)