@@ -174,9 +174,9 @@ function perform_step!(cache::GeneralKlementCache{iip, IJ}) where {iip, IJ}
174174 cache. J_cache = jacobian!! (cache. J_cache, cache)
175175 cache. J = __get_diagonal!! (cache. J, cache. J_cache)
176176 end
177- ill_conditioned = __is_ill_conditioned (cache. J)
177+ ill_conditioned = __is_ill_conditioned (_vec ( cache. J) )
178178 elseif IJ === :identity
179- ill_conditioned = __is_ill_conditioned (cache. J)
179+ ill_conditioned = __is_ill_conditioned (_vec ( cache. J) )
180180 end
181181
182182 if ill_conditioned
@@ -228,7 +228,7 @@ function perform_step!(cache::GeneralKlementCache{iip, IJ}) where {iip, IJ}
228228 @bb @. cache. J += ((cache. fu - cache. fu_cache_2 - cache. J * cache. du) /
229229 ifelse (iszero (cache. Jdu), T (1e-5 ), cache. Jdu)) * cache. du *
230230 (cache. J^ 2 )
231- else
231+ elseif IJ === :true_jacobian
232232 # Klement Updates to the Full Jacobian don't work for most problems, we should
233233 # probably be using the Broyden Update Rule here
234234 @bb @. cache. J_cache = cache. J' ^ 2
@@ -241,6 +241,8 @@ function perform_step!(cache::GeneralKlementCache{iip, IJ}) where {iip, IJ}
241241 @bb @. cache. J_cache *= cache. J
242242 @bb cache. J_cache_2 = cache. J_cache × cache. J
243243 @bb cache. J .+ = cache. J_cache_2
244+ else
245+ error (" Invalid `init_jacobian` value" )
244246 end
245247
246248 @bb copyto! (cache. fu_cache_2, cache. fu)
0 commit comments