Engine prototype #13

Merged
glen merged 133 commits from engine-proto into main 2024-10-21 03:18:48 +00:00
Showing only changes of commit 2b6c4f4720 - Show all commits

View File

@ -10,10 +10,10 @@ using PolynomialRoots
# the difference between the matrices `target` and `attempt`, projected onto the # the difference between the matrices `target` and `attempt`, projected onto the
# subspace of matrices whose entries vanish at each empty index of `target` # subspace of matrices whose entries vanish at each empty index of `target`
function proj_diff(target, attempt) function proj_diff(target, attempt)
I, J, values = findnz(target) J, K, values = findnz(target)
result = zeros(size(target)...) result = zeros(size(target)...)
for (i, j, val) in zip(I, J, values) for (j, k, val) in zip(J, K, values)
result[i, j] = val - attempt[i, j] result[j, k] = val - attempt[j, k]
end end
result result
end end
@ -26,19 +26,19 @@ Q = diagm([-1, 1, 1, 1, 1])
# initialize the partial gram matrix for an arrangement of seven spheres in # initialize the partial gram matrix for an arrangement of seven spheres in
# which spheres 1 through 5 are mutually tangent, and spheres 3 through 7 are # which spheres 1 through 5 are mutually tangent, and spheres 3 through 7 are
# also mutually tangent # also mutually tangent
I = Int64[]
J = Int64[] J = Int64[]
K = Int64[]
values = BigFloat[] values = BigFloat[]
for i in 1:7 for j in 1:7
for j in 1:7 for k in 1:7
if (i <= 5 && j <= 5) || (i >= 3 && j >= 3) if (j <= 5 && k <= 5) || (j >= 3 && k >= 3)
push!(I, i)
push!(J, j) push!(J, j)
push!(values, i == j ? 1 : -1) push!(K, k)
push!(values, j == k ? 1 : -1)
end end
end end
end end
gram = sparse(I, J, values) gram = sparse(J, K, values)
# set the independent variable # set the independent variable
# #