Engine prototype #13
@ -2,8 +2,23 @@ module Engine
|
|||||||
|
|
||||||
using LinearAlgebra
|
using LinearAlgebra
|
||||||
using SparseArrays
|
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
|
# the Lorentz form
|
||||||
Q = diagm([1, 1, 1, 1, -1])
|
Q = diagm([1, 1, 1, 1, -1])
|
||||||
|
Loading…
Reference in New Issue
Block a user