diff --git a/ext/NonlinearSolvePETScExt.jl b/ext/NonlinearSolvePETScExt.jl index 0f8aa2bea..cee56fc77 100644 --- a/ext/NonlinearSolvePETScExt.jl +++ b/ext/NonlinearSolvePETScExt.jl @@ -35,7 +35,7 @@ function SciMLBase.__solve( end if petsclibidx === nothing - error("No compatible PETSc library found for element type $(T). Pass in a \ + error(lazy"No compatible PETSc library found for element type $(T). Pass in a \ custom `petsclib` via `PETScSNES(; petsclib = , ....)`.") end petsclib = PETSc.petsclibs[petsclibidx] diff --git a/ext/NonlinearSolveSIAMFANLEquationsExt.jl b/ext/NonlinearSolveSIAMFANLEquationsExt.jl index eafe079f4..ab2fd5ebf 100644 --- a/ext/NonlinearSolveSIAMFANLEquationsExt.jl +++ b/ext/NonlinearSolveSIAMFANLEquationsExt.jl @@ -18,7 +18,7 @@ function siamfanlequations_retcode_mapping(sol) elseif sol.errcode == -1 return ReturnCode.Default else - error("Unknown SIAMFANLEquations return code: $(sol.errcode)") + error(lazy"Unknown SIAMFANLEquations return code: $(sol.errcode)") end end diff --git a/lib/NonlinearSolveBase/src/abstract_types.jl b/lib/NonlinearSolveBase/src/abstract_types.jl index 252650d03..6b78940f5 100644 --- a/lib/NonlinearSolveBase/src/abstract_types.jl +++ b/lib/NonlinearSolveBase/src/abstract_types.jl @@ -336,7 +336,7 @@ function Base.show(io::IO, ::MIME"text/plain", cache::AbstractNonlinearSolveCach end function show_nonlinearsolve_cache(io::IO, cache::AbstractNonlinearSolveCache, indent = 0) - println(io, "$(nameof(typeof(cache)))(") + println(io, lazy"$(nameof(typeof(cache)))(") show_nonlinearsolve_algorithm( io, cache.alg, diff --git a/lib/NonlinearSolveBase/src/autodiff.jl b/lib/NonlinearSolveBase/src/autodiff.jl index b09992c1b..4a9f2edbc 100644 --- a/lib/NonlinearSolveBase/src/autodiff.jl +++ b/lib/NonlinearSolveBase/src/autodiff.jl @@ -23,11 +23,11 @@ function select_forward_mode_autodiff( if warn_check_mode && !(ADTypes.mode(ad) isa ADTypes.ForwardMode) && !(ADTypes.mode(ad) isa ADTypes.ForwardOrReverseMode) && !is_finite_differences_backend(ad) - @warn "The chosen AD backend $(ad) is not a forward mode AD. Use with caution." + @warn lazy"The chosen AD backend $(ad) is not a forward mode AD. Use with caution." end if incompatible_backend_and_problem(prob, ad) adₙ = select_forward_mode_autodiff(prob, nothing; warn_check_mode) - @warn "The chosen AD backend `$(ad)` does not support the chosen problem. This \ + @warn lazy"The chosen AD backend `$(ad)` does not support the chosen problem. This \ could be because the backend package for the chosen AD isn't loaded. After \ running autodiff selection detected `$(adₙ)` as a potential forward mode \ backend." @@ -50,11 +50,11 @@ function select_reverse_mode_autodiff( if warn_check_mode && !(ADTypes.mode(ad) isa ADTypes.ReverseMode) && !(ADTypes.mode(ad) isa ADTypes.ForwardOrReverseMode) && !is_finite_differences_backend(ad) - @warn "The chosen AD backend $(ad) is not a reverse mode AD. Use with caution." + @warn lazy"The chosen AD backend $(ad) is not a reverse mode AD. Use with caution." end if incompatible_backend_and_problem(prob, ad) adₙ = select_reverse_mode_autodiff(prob, nothing; warn_check_mode) - @warn "The chosen AD backend `$(ad)` does not support the chosen problem. This \ + @warn lazy"The chosen AD backend `$(ad)` does not support the chosen problem. This \ could be because the backend package for the chosen AD isn't loaded. After \ running autodiff selection detected `$(adₙ)` as a potential reverse mode \ backend." @@ -75,7 +75,7 @@ end function select_jacobian_autodiff(prob::AbstractNonlinearProblem, ad::AbstractADType) if incompatible_backend_and_problem(prob, ad) adₙ = select_jacobian_autodiff(prob, nothing) - @warn "The chosen AD backend `$(ad)` does not support the chosen problem. This \ + @warn lazy"The chosen AD backend `$(ad)` does not support the chosen problem. This \ could be because the backend package for the chosen AD isn't loaded. After \ running autodiff selection detected `$(adₙ)` as a potential jacobian \ backend." diff --git a/lib/NonlinearSolveBase/src/descent/damped_newton.jl b/lib/NonlinearSolveBase/src/descent/damped_newton.jl index f6523e399..8058a48a5 100644 --- a/lib/NonlinearSolveBase/src/descent/damped_newton.jl +++ b/lib/NonlinearSolveBase/src/descent/damped_newton.jl @@ -215,7 +215,7 @@ function InternalAPI.solve!( end b = cache.Jᵀfu_cache else - error("Unknown Mode: $(cache.mode).") + error(lazy"Unknown Mode: $(cache.mode).") end end diff --git a/lib/NonlinearSolveBase/src/jacobian.jl b/lib/NonlinearSolveBase/src/jacobian.jl index 46c2f0c4a..acc727432 100644 --- a/lib/NonlinearSolveBase/src/jacobian.jl +++ b/lib/NonlinearSolveBase/src/jacobian.jl @@ -234,7 +234,7 @@ function construct_concrete_adtype(f::NonlinearFunction, ad::AbstractADType) else if sparse_or_structured_prototype(f.jac_prototype) if !(sparsity_detector isa NoSparsityDetector) - @warn "`jac_prototype` is a sparse matrix but sparsity = $(f.sparsity) \ + @warn lazy"`jac_prototype` is a sparse matrix but sparsity = $(f.sparsity) \ has also been specified. Ignoring sparsity field and using \ `jac_prototype` sparsity." end @@ -248,7 +248,7 @@ function construct_concrete_adtype(f::NonlinearFunction, ad::AbstractADType) end function construct_concrete_adtype(::NonlinearFunction, ad::AutoSparse) - error("Specifying a sparse AD type for Nonlinear Problems was removed in v4. \ + error(lazy"Specifying a sparse AD type for Nonlinear Problems was removed in v4. \ Instead use the `sparsity`, `jac_prototype`, and `colorvec` to specify \ the right sparsity pattern and coloring algorithm. Ignoring the sparsity \ detection algorithm and coloring algorithm present in $(ad).") diff --git a/lib/NonlinearSolveBase/src/linear_solve.jl b/lib/NonlinearSolveBase/src/linear_solve.jl index 592524ec3..667564255 100644 --- a/lib/NonlinearSolveBase/src/linear_solve.jl +++ b/lib/NonlinearSolveBase/src/linear_solve.jl @@ -100,7 +100,7 @@ fix_incompatible_linsolve_arguments(A, b, u) = u fix_incompatible_linsolve_arguments(::SArray, ::SArray, u::SArray) = u function fix_incompatible_linsolve_arguments(A, b, u::SArray) (Core.Compiler.return_type(\, Tuple{typeof(A), typeof(b)}) <: typeof(u)) && return u - @warn "Solving Linear System A::$(typeof(A)) x::$(typeof(u)) = b::$(typeof(u)) is not \ + @warn lazy"Solving Linear System A::$(typeof(A)) x::$(typeof(u)) = b::$(typeof(u)) is not \ properly supported. Converting `x` to a mutable array. Check the return type \ of the nonlinear function provided for optimal performance." maxlog=1 return MArray(u) diff --git a/lib/NonlinearSolveBase/src/polyalg.jl b/lib/NonlinearSolveBase/src/polyalg.jl index cc07248ce..90ca2ca2e 100644 --- a/lib/NonlinearSolveBase/src/polyalg.jl +++ b/lib/NonlinearSolveBase/src/polyalg.jl @@ -92,12 +92,12 @@ function Base.show(io::IO, ::MIME"text/plain", cache::NonlinearSolvePolyAlgorith println(io, "NonlinearSolvePolyAlgorithmCache with \ $(Utils.unwrap_val(cache.static_length)) algorithms:") best_alg = ifelse(cache.best == -1, "nothing", cache.best) - println(io, " Best Algorithm: $(best_alg)") + println(io, lazy" Best Algorithm: $(best_alg)") println( - io, " Current Algorithm: [$(cache.current) / $(Utils.unwrap_val(cache.static_length))]" + io, lazy" Current Algorithm: [$(cache.current) / $(Utils.unwrap_val(cache.static_length))]" ) - println(io, " nsteps: $(cache.nsteps)") - println(io, " retcode: $(cache.retcode)") + println(io, lazy" nsteps: $(cache.nsteps)") + println(io, lazy" retcode: $(cache.retcode)") print(io, " Current Cache: ") NonlinearSolveBase.show_nonlinearsolve_cache(io, cache.caches[cache.current], 4) end diff --git a/lib/NonlinearSolveBase/src/utils.jl b/lib/NonlinearSolveBase/src/utils.jl index 18d78c451..3261ddf39 100644 --- a/lib/NonlinearSolveBase/src/utils.jl +++ b/lib/NonlinearSolveBase/src/utils.jl @@ -22,7 +22,7 @@ end function Base.convert(::Type{AbstractArray}, A::Pinv) hasmethod(pinv, Tuple{typeof(A.J)}) && return pinv(A.J) - @warn "`pinv` not defined for $(typeof(A.J)). Jacobian will not be inverted when \ + @warn lazy"`pinv` not defined for $(typeof(A.J)). Jacobian will not be inverted when \ tracing." maxlog=1 return A.J end diff --git a/lib/NonlinearSolveBase/src/wrappers.jl b/lib/NonlinearSolveBase/src/wrappers.jl index f24508835..32e63e832 100644 --- a/lib/NonlinearSolveBase/src/wrappers.jl +++ b/lib/NonlinearSolveBase/src/wrappers.jl @@ -4,7 +4,7 @@ function assert_extension_supported_termination_condition( no_termination_condition = termination_condition === nothing no_termination_condition && return nothing abs_norm_supported && termination_condition isa AbsNormTerminationMode && return nothing - throw(AssertionError("`$(nameof(typeof(alg)))` does not support termination conditions!")) + throw(AssertionError(lazy"`$(nameof(typeof(alg)))` does not support termination conditions!")) end function construct_extension_function_wrapper( diff --git a/lib/NonlinearSolveSciPy/src/NonlinearSolveSciPy.jl b/lib/NonlinearSolveSciPy/src/NonlinearSolveSciPy.jl index 5d7165722..2df40ee94 100644 --- a/lib/NonlinearSolveSciPy/src/NonlinearSolveSciPy.jl +++ b/lib/NonlinearSolveSciPy/src/NonlinearSolveSciPy.jl @@ -43,9 +43,12 @@ function SciPyLeastSquares(; method::String = "trf", loss::String = "linear") valid_methods = ("trf", "dogbox", "lm") valid_losses = ("linear", "soft_l1", "huber", "cauchy", "arctan") method in valid_methods || - throw(ArgumentError("Invalid method: $method. Valid methods are: $(join(valid_methods, ", "))")) + throw(ArgumentError( + lazy"Invalid method: $method. Valid methods are: $(join(valid_methods, ", "))")) loss in valid_losses || - throw(ArgumentError("Invalid loss: $loss. Valid loss functions are: $(join(valid_losses, ", "))")) + throw(ArgumentError( + lazy"Invalid loss: $loss. Valid loss functions are: $(join(valid_losses, ", + "))")) return SciPyLeastSquares(method, loss, :SciPyLeastSquares) end