Drop old code from examples

This commit is contained in:
Aaron Fenyes 2024-07-18 00:50:48 -07:00
parent 9007c8bc7c
commit b040bbb7fe
4 changed files with 4 additions and 50 deletions

View File

@ -47,14 +47,6 @@ append!(values, fill(-0.5, 4))
=# =#
gram = sparse(J, K, values) gram = sparse(J, K, values)
# set initial guess (random)
## Random.seed!(58271) # stuck; step size collapses on step 48
## Random.seed!(58272) # good convergence
## Random.seed!(58273) # stuck; step size collapses on step 18
## Random.seed!(58274) # stuck
## Random.seed!(58275) #
## guess = Engine.rand_on_shell(fill(BigFloat(-1), 8))
# set initial guess # set initial guess
Random.seed!(58271) Random.seed!(58271)
guess = hcat( guess = hcat(
@ -69,39 +61,12 @@ guess = hcat(
BigFloat[0, 0, 0, 0, 1] BigFloat[0, 0, 0, 0, 1]
) )
frozen = [CartesianIndex(j, 9) for j in 1:5] frozen = [CartesianIndex(j, 9) for j in 1:5]
#=
guess = hcat(
Engine.plane(BigFloat[0, 0, 1], BigFloat(0)),
Engine.sphere(BigFloat[0, 0, 0], BigFloat(0.9)),
Engine.plane(BigFloat[1, 0, 0], BigFloat(1)),
Engine.plane(BigFloat[cos(2pi/3), sin(2pi/3), 0], BigFloat(1)),
Engine.plane(BigFloat[cos(-2pi/3), sin(-2pi/3), 0], BigFloat(1)),
Engine.sphere(4//3*BigFloat[-1, 0, 0], BigFloat(1//3)),
Engine.sphere(4//3*BigFloat[cos(-pi/3), sin(-pi/3), 0], BigFloat(1//3)),
Engine.sphere(4//3*BigFloat[cos(pi/3), sin(pi/3), 0], BigFloat(1//3)),
BigFloat[0, 0, 0, 1, 1]
)
=#
# complete the gram matrix using gradient descent followed by Newton's method # complete the gram matrix using Newton's method with backtracking
#=
L, history = Engine.realize_gram_gradient(gram, guess, scaled_tol = 0.01)
L_pol, history_pol = Engine.realize_gram_newton(gram, L, rate = 0.3, scaled_tol = 1e-9)
L_pol2, history_pol2 = Engine.realize_gram_newton(gram, L_pol)
=#
L, success, history = Engine.realize_gram(gram, guess, frozen) L, success, history = Engine.realize_gram(gram, guess, frozen)
completed_gram = L'*Engine.Q*L completed_gram = L'*Engine.Q*L
println("Completed Gram matrix:\n") println("Completed Gram matrix:\n")
display(completed_gram) display(completed_gram)
#=
println(
"\nSteps: ",
size(history.scaled_loss, 1),
" + ", size(history_pol.scaled_loss, 1),
" + ", size(history_pol2.scaled_loss, 1)
)
println("Loss: ", history_pol2.scaled_loss[end], "\n")
=#
if success if success
println("\nTarget accuracy achieved!") println("\nTarget accuracy achieved!")
else else

View File

@ -50,19 +50,11 @@ guess = begin
) )
end end
# complete the gram matrix # complete the gram matrix using Newton's method with backtracking
#=
L, history = Engine.realize_gram_gradient(gram, guess, scaled_tol = 0.01)
L_pol, history_pol = Engine.realize_gram_newton(gram, L)
=#
L, success, history = Engine.realize_gram(gram, guess) L, success, history = Engine.realize_gram(gram, guess)
completed_gram = L'*Engine.Q*L completed_gram = L'*Engine.Q*L
println("Completed Gram matrix:\n") println("Completed Gram matrix:\n")
display(completed_gram) display(completed_gram)
#=
println("\nSteps: ", size(history.scaled_loss, 1), " + ", size(history_pol.scaled_loss, 1))
println("Loss: ", history_pol.scaled_loss[end], "\n")
=#
if success if success
println("\nTarget accuracy achieved!") println("\nTarget accuracy achieved!")
else else

View File

@ -53,10 +53,7 @@ guess = hcat(
) )
frozen = [CartesianIndex(j, 6) for j in 1:5] frozen = [CartesianIndex(j, 6) for j in 1:5]
# complete the gram matrix # complete the gram matrix using Newton's method with backtracking
#=
L, history = Engine.realize_gram_newton(gram, guess)
=#
L, success, history = Engine.realize_gram(gram, guess, frozen) L, success, history = Engine.realize_gram(gram, guess, frozen)
completed_gram = L'*Engine.Q*L completed_gram = L'*Engine.Q*L
println("Completed Gram matrix:\n") println("Completed Gram matrix:\n")

View File

@ -77,7 +77,7 @@ frozen = vcat(
[CartesianIndex(j, 11) for j in 1:5] [CartesianIndex(j, 11) for j in 1:5]
) )
# complete the gram matrix # complete the gram matrix using Newton's method with backtracking
L, success, history = Engine.realize_gram(gram, guess, frozen) L, success, history = Engine.realize_gram(gram, guess, frozen)
completed_gram = L'*Engine.Q*L completed_gram = L'*Engine.Q*L
println("Completed Gram matrix:\n") println("Completed Gram matrix:\n")