Skip to content

Commit ab02348

Browse files
committed
Code readability improvements.
1 parent f35157a commit ab02348

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/steady_state_stability.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ function steady_state_stability(u::Vector{T}, rs::ReactionSystem, p;
3535
# Warning checks.
3636
!is_autonomous(rs) && non_autonomous_war && @warn "Attempting to compute stability for a non-autonomous system. Set `non_autonomous_war=false` to disable this warning."
3737

38-
# Because Jacobian currently requires ps to be a normal vector, can be removed once this get fixed in MTK.
38+
# Because Jacobian currently requires u and p to be a normal vector.
39+
# Can be removed once this get fixed in MTK.
3940
if (u isa Vector{<:Pair}) || (u isa Dict)
4041
u_dict = Dict(symmap_to_varmap(rs, u))
4142
u = [u_dict[var] for var in states(rs)]
@@ -45,12 +46,13 @@ function steady_state_stability(u::Vector{T}, rs::ReactionSystem, p;
4546
p = [p_dict[var] for var in parameters(rs)]
4647
end
4748

48-
# Computes stability
49+
# Computes stability (by checking that the real part of all eigenvalues are negative).
4950
jac = ss_jac(u, p, Inf)
5051
return maximum(real.(eigvals(jac))) < 0
5152
end
5253
# Computes the stability for a vector of steady states.
53-
function steady_state_stability(us::Vector{Vector{T}}, rs::ReactionSystem, p; sparse=false, ss_jac = steady_state_jac(rs; u0=us[1], sparse=sparse)) where T
54+
function steady_state_stability(us::Vector{Vector{T}}, rs::ReactionSystem, p;
55+
sparse=false, ss_jac = steady_state_jac(rs; u0=us[1], sparse=sparse)) where T
5456
return [steady_state_stability(u, rs, p) for u in us]
5557
end
5658

0 commit comments

Comments
 (0)