Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code from BasisLieHighestWeight #2402

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.12.1-DEV"
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
AlgebraicSolving = "66b61cbe-0446-4d5d-9090-1ff510639f9d"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Documenter is declared a docs-dependency in docs/Project.toml.

GAP = "c863536a-3901-11e9-33e7-d5cd0df7b904"
Hecke = "3e1990a7-5d81-5526-99ce-9ba3ff248f21"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Expand Down
79 changes: 37 additions & 42 deletions experimental/BasisLieHighestWeight/src/BasisLieHighestWeight.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module BasisLieHighestWeight
export LieAlgebra
export basis_lie_highest_weight
export is_fundamental
export get_dim_weightspace
export orbit_weylgroup

using ..Oscar
using ..Oscar: GAPWrap
Expand All @@ -12,32 +15,50 @@ using Polymake
# TODO Adapt arguments in function outside of BasisLieHighestWeight.jl
# TODO Summarize function
# TODO Groundup-structure for the special functions
# TODO Bugfix cache_size != 0

# TODO Export and docstring:
# TODO Export and docstring (?):
# basis_lie_highest_weight
# get_dim_weightspace
# orbit_weylgroup
# get_lattice_points_of_weightspace
# convert_lattice_points_to_monomials
# convert_monomials_to_lattice_points

# tensorMatricesForOperators
# weights_for_operators

# w_to_eps
# eps_to_w
# alpha_to_eps
# eps_to_alpha
# w_to_eps
# eps_to_w

struct LieAlgebra
# TODO GAPWrap-wrappers are missing for
# ChevalleyBasis
# DimensionOfHighestWeightModule
# SimpleLieAlgebra
# Rationals
# HighestWeightModule
# List
# MatrixOfAction
# RootSystem
# CartanMatrix
# WeylGroup
# DominantCharacter
# DimensionOfHighestWeightModule
# CanonicalGenerators


struct LieAlgebraStructure
lie_type::String
rank::Int
lie_algebra_gap::GAP.Obj
end

function LieAlgebraStructure(lie_type::String, rank::Int)
return LieAlgebraStructure(lie_type, rank, create_lie_algebra(lie_type, rank))
end


struct BirationalSequence
operators::GAP.Obj # TODO Integer
operators_vectors::Vector{Vector{Any}}
Expand All @@ -53,7 +74,7 @@ struct MonomialBasis
end

struct BasisLieHighestWeightStructure
lie_algebra::LieAlgebra
lie_algebra::LieAlgebraStructure
birational_sequence::BirationalSequence
highest_weight::Vector{Int}
monomial_order::Union{String, Function}
Expand Down Expand Up @@ -203,15 +224,17 @@ function basis_lie_highest_weight(
# steps. Then it starts the recursion and returns the result.

# initialization of objects that can be precomputed
lie_algebra_gap, chevalley_basis = create_lie_algebra(type, rank) # lie_algebra of type, rank and its chevalley_basis
lie_algebra = LieAlgebra(type, rank, lie_algebra_gap)
# lie_algebra of type, rank and its chevalley_basis
lie_algebra = LieAlgebraStructure(type, rank)
chevalley_basis = GAP.Globals.ChevalleyBasis(lie_algebra.lie_algebra_gap)

# operators that are represented by our monomials. x_i is connected to operators[i]
operators = get_operators(lie_algebra, operators, chevalley_basis)
weights = weights_for_operators(lie_algebra.lie_algebra_gap, chevalley_basis[3], operators) # weights of the operators
weights = (weight->Int.(weight)).(weights)
weights_eps = [w_to_eps(type, rank, w) for w in weights] # other root system

asVec(v) = fromGap(GAP.Globals.ExtRepOfObj(v)) # TODO
asVec(v) = fromGap(GAPWrap.ExtRepOfObj(v)) # TODO
birational_sequence = BirationalSequence(operators, [asVec(v) for v in operators], weights, weights_eps)

ZZx, _ = PolynomialRing(ZZ, length(operators)) # for our monomials
Expand Down Expand Up @@ -249,7 +272,7 @@ function sub_simple_refl(word::Vector{Int}, lie_algebra_gap::GAP.Obj)::GAP.Obj
return operators
end

function get_operators(lie_algebra::LieAlgebra, operators::Union{String, Vector{Int}},
function get_operators(lie_algebra::LieAlgebraStructure, operators::Union{String, Vector{Int}},
chevalley_basis::GAP.Obj)::GAP.Obj
"""
handles user input for operators
Expand Down Expand Up @@ -289,7 +312,7 @@ function get_operators(lie_algebra::LieAlgebra, operators::Union{String, Vector{
end

function compute_monomials(
lie_algebra::LieAlgebra,
lie_algebra::LieAlgebraStructure,
birational_sequence::BirationalSequence,
ZZx::ZZMPolyRing,
highest_weight::Vector{Int},
Expand Down Expand Up @@ -442,7 +465,7 @@ function add_known_monomials!(
end

function add_new_monomials!(
lie_algebra::LieAlgebra,
lie_algebra::LieAlgebraStructure,
birational_sequence::BirationalSequence,
ZZx::ZZMPolyRing,
matrices_of_operators::Vector{SMat{ZZRingElem}},
Expand Down Expand Up @@ -510,7 +533,7 @@ end


function add_by_hand(
lie_algebra::LieAlgebra,
lie_algebra::LieAlgebraStructure,
birational_sequence::BirationalSequence,
ZZx::ZZMPolyRing,
highest_weight::Vector{Int},
Expand Down Expand Up @@ -574,33 +597,5 @@ function add_by_hand(
return set_mon
end

function get_dim_weightspace(
lie_algebra::LieAlgebra,
highest_weight::Vector{Int}
)::Dict{Vector{Int}, Int}
"""
Calculates dictionary with weights as keys and dimension of corresponding weightspace as value. GAP computes the
dimension for all positive weights. The dimension is constant on orbits of the weylgroup, and we can therefore
calculate the dimension of each weightspace.
"""
# calculate dimension for dominant weights with GAP
root_system = GAP.Globals.RootSystem(lie_algebra.lie_algebra_gap)
result = GAP.Globals.DominantCharacter(root_system, GAP.Obj(highest_weight))
dominant_weights = [map(Int, item) for item in result[1]]
dominant_weights_dim = map(Int, result[2])
dominant_weights = convert(Vector{Vector{Int}}, dominant_weights)
weightspaces = Dict{Vector{Int}, Int}()

# calculate dimension for the rest by checking which positive weights lies in the orbit.
for i in 1:length(dominant_weights)
orbit_weights = orbit_weylgroup(lie_algebra, dominant_weights[i])
dim_weightspace = dominant_weights_dim[i]
for weight in orbit_weights
weightspaces[highest_weight - weight] = dim_weightspace
end
end
return weightspaces
end

end
export BasisLieHighestWeight
export BasisLieHighestWeight
12 changes: 6 additions & 6 deletions experimental/BasisLieHighestWeight/src/LieAlgebras.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
fromGap = Oscar.GAP.gap_to_julia


function create_lie_algebra(type::String, rank::Int)::Tuple{GAP.Obj, GAP.Obj}
function create_lie_algebra(type::String, rank::Int)::GAP.Obj
"""
Creates the Lie-algebra as a GAP object that gets used for a lot of other computations with GAP
"""
lie_algebra = GAP.Globals.SimpleLieAlgebra(GAP.Obj(type), rank, GAP.Globals.Rationals)
return lie_algebra, GAP.Globals.ChevalleyBasis(lie_algebra)
return lie_algebra
end


Expand All @@ -25,9 +25,9 @@ function matricesForOperators(lie_algebra::GAP.Obj, highest_weight::Vector{Int},
"""
used to create tensorMatricesForOperators
"""
M = Oscar.GAP.Globals.HighestWeightModule(lie_algebra, Oscar.GAP.julia_to_gap(highest_weight))
matrices_of_operators = Oscar.GAP.Globals.List(operators, o -> Oscar.GAP.Globals.MatrixOfAction(GAP.Globals.Basis(M), o))
matrices_of_operators = gapReshape.( Oscar.GAP.gap_to_julia(matrices_of_operators))
M = GAP.Globals.HighestWeightModule(lie_algebra, GAP.julia_to_gap(highest_weight))
matrices_of_operators = GAP.Globals.List(operators, o -> GAP.Globals.MatrixOfAction(GAPWrap.Basis(M), o))
matrices_of_operators = gapReshape.(GAP.gap_to_julia(matrices_of_operators))
denominators = map(y->denominator(y[2]), union(union(matrices_of_operators...)...))
common_denominator = lcm(denominators)# // 1
matrices_of_operators = (A->change_base_ring(ZZ, multiply_scalar(A, common_denominator))).(matrices_of_operators)
Expand Down Expand Up @@ -55,7 +55,7 @@ function weights_for_operators(lie_algebra::GAP.Obj, cartan::GAP.Obj, operators:
# TODO delete fromGap. Multiplication of cartan and operators is not regular matrix multiplication
cartan = fromGap(cartan, recursive=false)
operators = fromGap(operators, recursive=false)
asVec(v) = fromGap(GAP.Globals.ExtRepOfObj(v))
asVec(v) = fromGap(GAPWrap.ExtRepOfObj(v))
#println(cartan)
#println(operators)
if any(iszero.(asVec.(operators)))
Expand Down
41 changes: 37 additions & 4 deletions experimental/BasisLieHighestWeight/src/WeylPolytope.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function orbit_weylgroup(lie_algebra::LieAlgebra, weight_vector::Vector{Int})


function orbit_weylgroup(lie_algebra::LieAlgebraStructure, weight_vector::Vector{Int})
"""
operates weyl-group of type type and rank rank on vector weight_vector and returns list of vectors in orbit
input and output weights in terms of w_i
Expand All @@ -9,9 +11,9 @@ function orbit_weylgroup(lie_algebra::LieAlgebra, weight_vector::Vector{Int})
vertices = []

# operate with the weylgroup on weight_vector
GAP.Globals.IsDoneIterator(orbit_iterator)
while !(GAP.Globals.IsDoneIterator(orbit_iterator))
w = GAP.Globals.NextIterator(orbit_iterator)
GAPWrap.IsDoneIterator(orbit_iterator)
while !(GAPWrap.IsDoneIterator(orbit_iterator))
w = GAPWrap.NextIterator(orbit_iterator)
push!(vertices, Vector{Int}(w))
end

Expand All @@ -20,6 +22,37 @@ function orbit_weylgroup(lie_algebra::LieAlgebra, weight_vector::Vector{Int})
return vertices
end

function get_dim_weightspace(
lie_algebra::LieAlgebraStructure,
highest_weight::Vector{Int}
)::Dict{Vector{Int}, Int}
"""
Calculates dictionary with weights as keys and dimension of corresponding weightspace as value. GAP computes the
dimension for all positive weights. The dimension is constant on orbits of the weylgroup, and we can therefore
calculate the dimension of each weightspace.
"""
# calculate dimension for dominant weights with GAP
root_system = GAP.Globals.RootSystem(lie_algebra.lie_algebra_gap)
result = GAP.Globals.DominantCharacter(root_system, GAP.Obj(highest_weight))
dominant_weights = [map(Int, item) for item in result[1]]
dominant_weights_dim = map(Int, result[2])
dominant_weights = convert(Vector{Vector{Int}}, dominant_weights)
weightspaces = Dict{Vector{Int}, Int}()

# calculate dimension for the rest by checking which positive weights lies in the orbit.
for i in 1:length(dominant_weights)
orbit_weights = orbit_weylgroup(lie_algebra, dominant_weights[i])
dim_weightspace = dominant_weights_dim[i]
for weight in orbit_weights
weightspaces[highest_weight - weight] = dim_weightspace
end
end
return weightspaces
end




function convert_lattice_points_to_monomials(ZZx, lattice_points_weightspace)
return [finish(push_term!(MPolyBuildCtx(ZZx), ZZ(1), convert(Vector{Int}, convert(Vector{Int64}, lattice_point))))
for lattice_point in lattice_points_weightspace]
Expand Down