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 abc53b4705 - Show all commits

View File

@ -2,8 +2,23 @@ module Engine
using LinearAlgebra
using SparseArrays
using Random
export Q, DescentHistory, realize_gram
export rand_on_shell, Q, DescentHistory, realize_gram
# === guessing ===
##[TO DO] write a test to confirm that the outputs are on the correct shells
##[TO DO] this can fail at generating spacelike vectors
function rand_on_shell(rng::AbstractRNG, shells::Array{T}) where T <: Number
space_parts = randn(rng, T, 4, size(shells, 1))
space_self_prods = [dot(x, x) for x in eachcol(space_parts)]
return [space_parts; sqrt.(space_self_prods .- shells)']
end
rand_on_shell(shells::Array{<:Number}) = rand_on_shell(Random.default_rng(), shells)
# === Gram matrix realization ===
# the Lorentz form
Q = diagm([1, 1, 1, 1, -1])