Skip to content

Commit dc9986c

Browse files
committed
use ldiv!, formatter version 1
1 parent 17fc616 commit dc9986c

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install JuliaFormatter and format
1818
run: |
1919
using Pkg
20-
Pkg.add(PackageSpec(name="JuliaFormatter"))
20+
Pkg.add(PackageSpec(name="JuliaFormatter", version="1"))
2121
using JuliaFormatter
2222
format("."; verbose=true)
2323
shell: julia --color=yes {0}

src/Manopt.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ using LinearAlgebra:
2626
eigen,
2727
eigen!,
2828
eigvals,
29+
ldiv!,
2930
tril,
3031
Symmetric,
3132
dot,

src/solvers/LevenbergMarquardt.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,15 @@ end
210210

211211
function default_lm_lin_solve!(sk, JJ, grad_f_c)
212212
try
213-
sk .= cholesky(JJ) \ -grad_f_c
213+
ldiv!(sk, cholesky(JJ), grad_f_c)
214214
catch e
215215
if e isa PosDefException
216-
sk .= JJ \ -grad_f_c
216+
sk .= Symmetric(JJ) \ grad_f_c
217217
else
218218
rethrow()
219219
end
220220
end
221+
sk .*= -1
221222
return sk
222223
end
223224

test/solvers/test_Levenberg_Marquardt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,6 @@ end
283283
sk = similar(grad_f_c)
284284
Manopt.default_lm_lin_solve!(sk, JJ, grad_f_c)
285285
@test isapprox(sk, [-0.5, -1.0])
286-
@test_throws ArgumentError Manopt.default_lm_lin_solve!(sk, NaN .* JJ, grad_f_c)
286+
@test_throws SingularException Manopt.default_lm_lin_solve!(sk, NaN .* JJ, grad_f_c)
287287
end
288288
end

0 commit comments

Comments
 (0)