Skip to content

Commit

Permalink
Refactor algorithm input and some Lie algebra stuff
Browse files Browse the repository at this point in the history
- completely rewrite operator generation (by index, by coeffs of simple roots, lustzig)
- more accessors for Lie algebra data
- remove some type conversions
- rename all vars `lie_algebra` to avoid shadowing of function
- Update user functions' arguments to Ghislain's whishes
  • Loading branch information
lgoettgens committed Oct 27, 2023
1 parent c168769 commit aae61c3
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 338 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ include("TensorModels.jl")
include("MonomialOrder.jl")
include("RootConversion.jl")
include("WeylPolytope.jl")
include("WordCalculations.jl")
include("MainAlgorithm.jl")
include("UserFunctions.jl")

Expand Down
68 changes: 33 additions & 35 deletions experimental/BasisLieHighestWeight/src/LieAlgebras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
lie_type::Symbol
rank::Int
lie_algebra_gap::GAP.Obj
chevalley_basis::NTuple{3,Vector{GAP.Obj}}

function LieAlgebraStructure(lie_type::Symbol, rank::Int)
lie_algebra_gap = GAP.Globals.SimpleLieAlgebra(
GAP.Obj(lie_type), rank, GAP.Globals.Rationals
)
return new(lie_type, rank, lie_algebra_gap)
chevalley_basis = NTuple{3,Vector{GAP.Obj}}(GAP.Globals.ChevalleyBasis(lie_algebra_gap))
return new(lie_type, rank, lie_algebra_gap, chevalley_basis)
end
end

Expand All @@ -23,25 +25,37 @@ end
return inv(cartan_matrix(L))
end

function Base.show(io::IO, lie_algebra::LieAlgebraStructure)
print(io, "Lie-Algebra of type ", lie_algebra.lie_type, " and rank ", lie_algebra.rank)
function Base.show(io::IO, L::LieAlgebraStructure)
print(io, "Lie-Algebra of type ", L.lie_type, " and rank ", L.rank)
end

function lie_algebra_with_basis(type::Symbol, rk::Int)
lie_algebra = LieAlgebraStructure(type, rk)
chevalley_basis = NTuple{3,Vector{GAP.Obj}}(
GAP.Globals.ChevalleyBasis(lie_algebra.lie_algebra_gap)
)
return lie_algebra, chevalley_basis
function lie_algebra(type::Symbol, rk::Int)
return LieAlgebraStructure(type, rk)
end

function chevalley_basis_gap(L::LieAlgebraStructure)
return L.chevalley_basis
end

function cartan_sub_basis(L::LieAlgebraStructure)
return L.chevalley_basis[3]
end

function root_system_gap(L::LieAlgebraStructure)
return GAP.Globals.RootSystem(L.lie_algebra_gap)
end

function num_positive_roots(L::LieAlgebraStructure)
return length(GAP.Globals.PositiveRoots(root_system_gap(L)))
end

function matricesForOperators(
lie_algebra::GAP.Obj, highest_weight::Vector{ZZRingElem}, operators::Vector{GAP.Obj}
L::GAP.Obj, highest_weight::Vector{ZZRingElem}, operators::Vector{GAP.Obj}
)::Vector{SMat{ZZRingElem}}
"""
used to create tensorMatricesForOperators
"""
M = GAP.Globals.HighestWeightModule(lie_algebra, GAP.Obj(Vector{Int}(highest_weight)))
M = GAP.Globals.HighestWeightModule(L, GAP.Obj(Vector{Int}(highest_weight)))
matrices_of_operators = [
sparse_matrix(transpose(matrix(QQ, GAP.Globals.MatrixOfAction(GAPWrap.Basis(M), o))))
for o in operators
Expand All @@ -53,32 +67,16 @@ function matricesForOperators(
return matrices_of_operators
end

function weights_for_operators(
lie_algebra::GAP.Obj, cartan_sub::Vector{GAP.Obj}, operators::Vector{GAP.Obj}
)::Vector{Vector{ZZRingElem}}
function weight(L::LieAlgebraStructure, operator::GAP.Obj)
"""
Calculates the weight weights[i] in w_i for each operator operators[i]
Calculates the weight in w_i for operator
"""
"""cartan = [Vector{Int}(x) for x in GAP.Globals.ExtRepOfObj.(cartan)]
operators = [Vector{Int}(x) for x in GAP.Globals.ExtRepOfObj.(operators)]
if any(iszero.(operators))
error("ops should be non-zero")
end
println([findfirst(v .!= 0) for v in operators])
return [
[(dot(h, v))[findfirst(v .!= 0)] / (v)[findfirst(v .!= 0)] for h in cartan] for v in operators
]
"""
if any(iszero, operators)
error("ops should be non-zero")
end
basis = GAP.Globals.Basis(lie_algebra)
@req !iszero(operator) "Operators should be non-zero"
basis = GAP.Globals.Basis(L.lie_algebra_gap)
basis_ind = GAP.Globals.Position(basis, operator)
denom = GAP.Globals.Coefficients(basis, operator)[basis_ind]
return [
begin
ind = GAP.Globals.Position(basis, v)
denom = GAP.Globals.Coefficients(basis, v)[ind]
[ZZ(GAP.Globals.Coefficients(basis, h * v)[ind]//denom) for h in cartan_sub]
end for v in operators
ZZ(GAP.Globals.Coefficients(basis, h * operator)[basis_ind]//denom) for
h in cartan_sub_basis(L)
]
end
Loading

0 comments on commit aae61c3

Please sign in to comment.