Drop old code from examples
This commit is contained in:
parent
9007c8bc7c
commit
b040bbb7fe
@ -47,14 +47,6 @@ append!(values, fill(-0.5, 4))
|
||||
=#
|
||||
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
|
||||
Random.seed!(58271)
|
||||
guess = hcat(
|
||||
@ -69,39 +61,12 @@ guess = hcat(
|
||||
BigFloat[0, 0, 0, 0, 1]
|
||||
)
|
||||
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
|
||||
#=
|
||||
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)
|
||||
=#
|
||||
# complete the gram matrix using Newton's method with backtracking
|
||||
L, success, history = Engine.realize_gram(gram, guess, frozen)
|
||||
completed_gram = L'*Engine.Q*L
|
||||
println("Completed Gram matrix:\n")
|
||||
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
|
||||
println("\nTarget accuracy achieved!")
|
||||
else
|
||||
|
@ -50,19 +50,11 @@ guess = begin
|
||||
)
|
||||
end
|
||||
|
||||
# complete the gram matrix
|
||||
#=
|
||||
L, history = Engine.realize_gram_gradient(gram, guess, scaled_tol = 0.01)
|
||||
L_pol, history_pol = Engine.realize_gram_newton(gram, L)
|
||||
=#
|
||||
# complete the gram matrix using Newton's method with backtracking
|
||||
L, success, history = Engine.realize_gram(gram, guess)
|
||||
completed_gram = L'*Engine.Q*L
|
||||
println("Completed Gram matrix:\n")
|
||||
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
|
||||
println("\nTarget accuracy achieved!")
|
||||
else
|
||||
|
@ -53,10 +53,7 @@ guess = hcat(
|
||||
)
|
||||
frozen = [CartesianIndex(j, 6) for j in 1:5]
|
||||
|
||||
# complete the gram matrix
|
||||
#=
|
||||
L, history = Engine.realize_gram_newton(gram, guess)
|
||||
=#
|
||||
# complete the gram matrix using Newton's method with backtracking
|
||||
L, success, history = Engine.realize_gram(gram, guess, frozen)
|
||||
completed_gram = L'*Engine.Q*L
|
||||
println("Completed Gram matrix:\n")
|
||||
|
@ -77,7 +77,7 @@ frozen = vcat(
|
||||
[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)
|
||||
completed_gram = L'*Engine.Q*L
|
||||
println("Completed Gram matrix:\n")
|
||||
|
Loading…
Reference in New Issue
Block a user