We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1275c9d commit c232484Copy full SHA for c232484
src/systems/diffeqs/abstractodesystem.jl
@@ -19,7 +19,10 @@ end
19
20
function calculate_jacobian(sys::AbstractODESystem;
21
sparse=false, simplify=false)
22
- isempty(get_jac(sys)[]) || return get_jac(sys)[] # use cached Jacobian, if possible
+ cache = get_jac(sys)[]
23
+ if cache isa Tuple && cache[2] == (sparse, simplify)
24
+ return cache[1]
25
+ end
26
rhs = [eq.rhs for eq ∈ equations(sys)]
27
28
iv = get_iv(sys)
@@ -31,7 +34,7 @@ function calculate_jacobian(sys::AbstractODESystem;
31
34
jac = jacobian(rhs, dvs, simplify=simplify)
32
35
end
33
36
- get_jac(sys)[] = jac # cache Jacobian
37
+ get_jac(sys)[] = jac, (sparse, simplify) # cache Jacobian
38
return jac
39
40
0 commit comments