Skip to content

Commit f4b7b05

Browse files
claudeChrisRackauckas
authored andcommitted
Allow LSO as legitimate term and revert incorrect changes
- Add LSO to .typos.toml as allowed term - LSO is a legitimate abbreviation used in optimization contexts - Revert incorrect ALSO changes back to LSO in extension file - LSO should not be treated as a typo
1 parent 30b8128 commit f4b7b05

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

.typos.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ ists = "ists"
99
ispcs = "ispcs"
1010
eqs = "eqs"
1111
rhs = "rhs"
12-
MTK = "MTK"
12+
MTK = "MTK"
13+
14+
# NonlinearSolve specific terms
15+
LSO = "LSO" # Legitimate abbreviation used in optimization contexts

ext/NonlinearSolveLeastSquaresOptimExt.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using NonlinearSolveBase: NonlinearSolveBase, TraceMinimal
66
using NonlinearSolve: NonlinearSolve, LeastSquaresOptimJL
77
using SciMLBase: SciMLBase, AbstractNonlinearProblem, ReturnCode
88

9-
const ALSO = LeastSquaresOptim
9+
const LSO = LeastSquaresOptim
1010

1111
function SciMLBase.__solve(
1212
prob::AbstractNonlinearProblem, alg::LeastSquaresOptimJL, args...;
@@ -23,32 +23,32 @@ function SciMLBase.__solve(
2323
reltol = NonlinearSolveBase.get_tolerance(reltol, eltype(u))
2424

2525
if prob.f.jac === nothing && alg.autodiff isa Symbol
26-
lsoprob = ALSO.LeastSquaresProblem(;
26+
lsoprob = LSO.LeastSquaresProblem(;
2727
x = u, f!, y = resid, alg.autodiff, J = prob.f.jac_prototype,
2828
output_length = length(resid)
2929
)
3030
else
3131
g! = NonlinearSolveBase.construct_extension_jac(prob, alg, u, resid; alg.autodiff)
32-
lsoprob = ALSO.LeastSquaresProblem(;
32+
lsoprob = LSO.LeastSquaresProblem(;
3333
x = u, f!, y = resid, g!, J = prob.f.jac_prototype,
3434
output_length = length(resid)
3535
)
3636
end
3737

38-
linsolve = alg.linsolve === :qr ? ALSO.QR() :
39-
(alg.linsolve === :cholesky ? ALSO.Cholesky() :
40-
(alg.linsolve === :lsmr ? ALSO.LSMR() : nothing))
38+
linsolve = alg.linsolve === :qr ? LSO.QR() :
39+
(alg.linsolve === :cholesky ? LSO.Cholesky() :
40+
(alg.linsolve === :lsmr ? LSO.LSMR() : nothing))
4141

4242
lso_solver = if alg.alg === :lm
43-
ALSO.LevenbergMarquardt(linsolve)
43+
LSO.LevenbergMarquardt(linsolve)
4444
elseif alg.alg === :dogleg
45-
ALSO.Dogleg(linsolve)
45+
LSO.Dogleg(linsolve)
4646
else
4747
throw(ArgumentError("Unknown LeastSquaresOptim Algorithm: $(Meta.quot(alg.alg))"))
4848
end
4949

50-
allocated_prob = ALSO.LeastSquaresProblemAllocated(lsoprob, lso_solver)
51-
res = ALSO.optimize!(
50+
allocated_prob = LSO.LeastSquaresProblemAllocated(lsoprob, lso_solver)
51+
res = LSO.optimize!(
5252
allocated_prob;
5353
x_tol = reltol, f_tol = abstol, g_tol = abstol, iterations = maxiters,
5454
show_trace = show_trace isa Val{true}, store_trace = store_trace isa Val{true},

0 commit comments

Comments
 (0)