Use Newton's method for polishing

This commit is contained in:
Aaron Fenyes 2024-07-11 13:43:52 -07:00
parent d538cbf716
commit 3910b9f740
4 changed files with 103 additions and 18 deletions

View file

@ -47,13 +47,14 @@ guess = hcat(
Engine.rand_on_shell(fill(BigFloat(-1), 2))
)
# complete the gram matrix using gradient descent
L, history = Engine.realize_gram(gram, guess)
# complete the gram matrix using gradient descent followed by Newton's method
L, history = Engine.realize_gram_gradient(gram, guess, scaled_tol = 0.01)
L_pol, history_pol = Engine.realize_gram_newton(gram, L)
completed_gram = L'*Engine.Q*L
println("Completed Gram matrix:\n")
display(completed_gram)
println("\nSteps: ", size(history.stepsize, 1))
println("Loss: ", history.scaled_loss[end], "\n")
println("\nSteps: ", size(history.scaled_loss, 1), " + ", size(history_pol.scaled_loss, 1))
println("Loss: ", history_pol.scaled_loss[end], "\n")
# === algebraic check ===