@@ -106,10 +106,13 @@ unknowns); a `redundancy` of `0` means full row rank (no redundant equations).
106106 rank deficient at a particular operating point, and vice versa.
107107"""
108108function analyze_initialization_jacobian (
109- prob; rtol = 1e-8 , atol = 0.0 , threshold = 1e-3 , verbose = true )
110- empty_result = (; jacobian = nothing , singular_values = Float64[], rank = 0 ,
109+ prob; rtol = 1.0e-8 , atol = 0.0 , threshold = 1.0e-3 , verbose = true
110+ )
111+ empty_result = (;
112+ jacobian = nothing , singular_values = Float64[], rank = 0 ,
111113 nullity = 0 , redundancy = 0 , underdetermined_unknowns = Pair[],
112- redundant_equations = Pair[])
114+ redundant_equations = Pair[],
115+ )
113116 iprob = _initialization_problem (prob)
114117 if iprob === nothing
115118 verbose &&
@@ -148,24 +151,28 @@ function analyze_initialization_jacobian(
148151 # Participation = diagonal of the null-space projector (squared row norm over an
149152 # orthonormal null-space basis), invariant to the arbitrary basis within the null space.
150153 col_w = nullity == 0 ? zeros (ncols) :
151- vec (sum (abs2, @view (fact. V[:, col_isnull]); dims = 2 ))
154+ vec (sum (abs2, @view (fact. V[:, col_isnull]); dims = 2 ))
152155 row_w = redundancy == 0 ? zeros (nrows) :
153- vec (sum (abs2, @view (fact. U[:, row_isnull]); dims = 2 ))
156+ vec (sum (abs2, @view (fact. U[:, row_isnull]); dims = 2 ))
154157 syms = variable_symbols (iprob)
155158 eqs = _initialization_equations (iprob)
156159 underdetermined_unknowns = sort (
157160 [syms[i] => col_w[i] for i in 1 : ncols if col_w[i] > threshold];
158- by = last, rev = true )
161+ by = last, rev = true
162+ )
159163 redundant_equations = sort (
160164 [(eqs === nothing ? i : eqs[i]) => row_w[i] for i in 1 : nrows if row_w[i] > threshold];
161- by = last, rev = true )
165+ by = last, rev = true
166+ )
162167 if verbose
163168 println (" Initialization Jacobian rank analysis" )
164169 println (" residual Jacobian: $(nrows) ×$(ncols) , rank ≈ $rank , nullity ≈ $nullity , redundancy ≈ $redundancy " )
165170 if ! isempty (S)
166171 k = min (5 , length (S))
167- println (" smallest $k singular value(s): " ,
168- round .(S[(end - k + 1 ): end ], sigdigits = 3 ))
172+ println (
173+ " smallest $k singular value(s): " ,
174+ round .(S[(end - k + 1 ): end ], sigdigits = 3 )
175+ )
169176 end
170177 if nullity == 0
171178 println (" Full column rank at u0 — no underdetermined unknowns." )
@@ -184,8 +191,10 @@ function analyze_initialization_jacobian(
184191 end
185192 end
186193 end
187- return (; jacobian = J, singular_values = S, rank, nullity, redundancy,
188- underdetermined_unknowns, redundant_equations)
194+ return (;
195+ jacobian = J, singular_values = S, rank, nullity, redundancy,
196+ underdetermined_unknowns, redundant_equations,
197+ )
189198end
190199
191200# Symbolic equations of an initialization problem, in residual order, or `nothing` if not
0 commit comments