@@ -296,56 +296,61 @@ function SciMLBase.solve!(
296296 )
297297 __appleaccelerate_isavailable () ||
298298 error (" Error, AppleAccelerate binary is missing but solve is being called. Report this issue" )
299- A = cache. A
300- A = convert (AbstractMatrix, A)
299+ A_work = convert (AbstractMatrix, cache. A)
301300 check_safety = alg. residualsafety && cache. isfresh
302301 needs_backup = check_safety ||
303302 (cache. alg isa DefaultLinearSolver && cache. alg. safetyfallback && cache. isfresh)
304- A_original = needs_backup ? _copy_A_for_safety (cache) : A
303+ A_original = needs_backup ? _copy_A_for_safety (cache) : A_work
305304 verbose = cache. verbose
306305 if cache. isfresh
307306 cacheval = @get_cacheval (cache, :AppleAccelerateLUFactorization )
308- if length (cacheval. ipiv) != min (size (A, 1 ), size (A, 2 ))
309- cacheval. ipiv = similar (A, Cint, min (size (A, 1 ), size (A, 2 )))
307+ if length (cacheval. ipiv) != min (size (A_work, 1 ), size (A_work, 2 ))
308+ cacheval. ipiv = similar (
309+ A_work, Cint, min (size (A_work, 1 ), size (A_work, 2 ))
310+ )
310311 end
311- cacheval. factors = A
312- info_value = aa_getrf! (A , cacheval. ipiv, cacheval. info, false )
312+ cacheval. factors = A_work
313+ info_value = aa_getrf! (A_work , cacheval. ipiv, cacheval. info, false )
313314
314315 if info_value != 0
315316 if verbose. blas_info != SciMLLogging. Silent () ||
316317 verbose. blas_errors != SciMLLogging. Silent () ||
317318 verbose. blas_invalid_args != SciMLLogging. Silent ()
318- op_info = get_blas_operation_info (
319- :dgetrf , A , cache. b,
319+ failure_op_info = get_blas_operation_info (
320+ :dgetrf , A_work , cache. b,
320321 condition = verbose. condition_number != SciMLLogging. Silent ()
321322 )
322- @SciMLMessage (cache. verbose, :condition_number ) do
323- if isinf (op_info. condition_number)
324- return " Matrix condition number calculation failed."
325- else
326- return " Matrix condition number: $(round (op_info. condition_number, sigdigits = 4 )) for $(size (A, 1 )) ×$(size (A, 2 )) matrix in dgetrf"
323+ let op_info = failure_op_info
324+ @SciMLMessage (cache. verbose, :condition_number ) do
325+ if isinf (op_info. condition_number)
326+ return " Matrix condition number calculation failed."
327+ else
328+ return " Matrix condition number: $(round (op_info. condition_number, sigdigits = 4 )) for $(size (A_work, 1 )) ×$(size (A_work, 2 )) matrix in dgetrf"
329+ end
327330 end
328331 end
329332 verb_option,
330333 message = blas_info_msg (
331- :dgetrf , info_value; extra_context = op_info
334+ :dgetrf , info_value; extra_context = failure_op_info
332335 )
333336 @SciMLMessage (message, verbose, verb_option)
334337 end
335338 else
336339 @SciMLMessage (cache. verbose, :blas_success ) do
337- op_info = get_blas_operation_info (
338- :dgetrf , A , cache. b,
340+ success_op_info = get_blas_operation_info (
341+ :dgetrf , A_work , cache. b,
339342 condition = verbose. condition_number != SciMLLogging. Silent ()
340343 )
341- @SciMLMessage (cache. verbose, :condition_number ) do
342- if isinf (op_info. condition_number)
343- return " Matrix condition number calculation failed."
344- else
345- return " Matrix condition number: $(round (op_info. condition_number, sigdigits = 4 )) for $(size (A, 1 )) ×$(size (A, 2 )) matrix in dgetrf"
344+ let op_info = success_op_info
345+ @SciMLMessage (cache. verbose, :condition_number ) do
346+ if isinf (op_info. condition_number)
347+ return " Matrix condition number calculation failed."
348+ else
349+ return " Matrix condition number: $(round (op_info. condition_number, sigdigits = 4 )) for $(size (A_work, 1 )) ×$(size (A_work, 2 )) matrix in dgetrf"
350+ end
346351 end
347352 end
348- return " BLAS LU factorization (dgetrf) completed successfully for $(op_info . matrix_size) matrix"
353+ return " BLAS LU factorization (dgetrf) completed successfully for $(success_op_info . matrix_size) matrix"
349354 end
350355 end
351356
@@ -359,21 +364,21 @@ function SciMLBase.solve!(
359364 end
360365
361366 cacheval = @get_cacheval (cache, :AppleAccelerateLUFactorization )
362- A = cacheval. factors
367+ factors = cacheval. factors
363368 info = cacheval. info
364369 require_one_based_indexing (cache. u, cache. b)
365- m, n = size (A , 1 ), size (A , 2 )
370+ m, n = size (factors , 1 ), size (factors , 2 )
366371 if m > n
367372 Bc = copy (cache. b)
368- aa_getrs! (' N' , cacheval . factors, cacheval. ipiv, Bc, info)
373+ aa_getrs! (' N' , factors, cacheval. ipiv, Bc, info)
369374 if cache. b isa AbstractMatrix
370375 copyto! (cache. u, @view (Bc[1 : n, :]))
371376 else
372377 copyto! (cache. u, 1 , Bc, 1 , n)
373378 end
374379 else
375380 copyto! (cache. u, cache. b)
376- aa_getrs! (' N' , cacheval . factors, cacheval. ipiv, cache. u, info)
381+ aa_getrs! (' N' , factors, cacheval. ipiv, cache. u, info)
377382 end
378383
379384 if check_safety
0 commit comments