forked from StudioInfinity/dyna3
Try numerical low-rank factorization
The best technique I've found so far is the homemade gradient descent routine in `descent-test.jl`.
This commit is contained in:
parent
ef33b8ee10
commit
58a5c38e62
3 changed files with 223 additions and 0 deletions
37
engine-proto/gram-test/overlap-test.jl
Normal file
37
engine-proto/gram-test/overlap-test.jl
Normal file
|
@ -0,0 +1,37 @@
|
|||
using LinearAlgebra
|
||||
using AbstractAlgebra
|
||||
|
||||
function printgood(msg)
|
||||
printstyled("✓", color = :green)
|
||||
println(" ", msg)
|
||||
end
|
||||
|
||||
function printbad(msg)
|
||||
printstyled("✗", color = :red)
|
||||
println(" ", msg)
|
||||
end
|
||||
|
||||
F, gens = rational_function_field(Generic.Rationals{BigInt}(), ["x", "t₁", "t₂", "t₃"])
|
||||
x = gens[1]
|
||||
t = gens[2:4]
|
||||
|
||||
# three mutually tangent spheres which are all perpendicular to the x, y plane
|
||||
M = matrix_space(F, 7, 7)
|
||||
gram = M(F[
|
||||
1 -1 -1 -1 -1 t[1] t[2];
|
||||
-1 1 -1 -1 -1 x t[3]
|
||||
-1 -1 1 -1 -1 -1 -1;
|
||||
-1 -1 -1 1 -1 -1 -1;
|
||||
-1 -1 -1 -1 1 -1 -1;
|
||||
t[1] x -1 -1 -1 1 -1;
|
||||
t[2] t[3] -1 -1 -1 -1 1
|
||||
])
|
||||
|
||||
r, p, L, U = lu(gram)
|
||||
if isone(p)
|
||||
printgood("Found a solution")
|
||||
else
|
||||
printbad("Didn't find a solution")
|
||||
end
|
||||
solution = transpose(L)
|
||||
mform = U * inv(solution)
|
Loading…
Add table
Add a link
Reference in a new issue