From c6219e89dc819a61732210783f8e161957c8dbed Mon Sep 17 00:00:00 2001 From: Lars Kastner Date: Fri, 24 Mar 2023 11:53:18 +0100 Subject: [PATCH 1/4] [LieAlgebraBases] Eliminate abbreviation forGap --- .../basisLieHighestWeight/BasisLieHighestWeight.jl | 9 ++++----- experimental/basisLieHighestWeight/LieAlgebras.jl | 7 +++---- experimental/basisLieHighestWeight/NewMonomial.jl | 1 - experimental/basisLieHighestWeight/RootConversion.jl | 5 ++--- experimental/basisLieHighestWeight/WeylPolytope.jl | 5 ++--- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl b/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl index 9311c18652b1..6b595fcc24db 100644 --- a/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl +++ b/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl @@ -12,7 +12,6 @@ include("./NewMonomial.jl") #include("./VectorSpaceBases.jl") #--- bekommt gerade noch ZZ, Short und TVEC aus VectorSpaceBases G = Oscar.GAP.Globals -forGap = Oscar.GAP.julia_to_gap fromGap = Oscar.GAP.gap_to_julia @@ -52,7 +51,7 @@ function sub_simple_refl(word, L, n) """ R = G.RootSystem(L) CG = fromGap(G.CanonicalGenerators(R)[1], recursive = false) - ops = forGap([CG[i] for i in word], recursive = false) + ops = GAP.Obj([CG[i] for i in word], recursive = false) return ops end @@ -107,7 +106,7 @@ function compute_monomials(t, n, L, hw, ops, wts, wts_eps, monomial_order, calc_ end # calculation required - gapDim = G.DimensionOfHighestWeightModule(L, forGap(hw)) # number of monomials that we need to find, i.e. |M_{hw}|. + gapDim = G.DimensionOfHighestWeightModule(L, GAP.Obj(hw)) # number of monomials that we need to find, i.e. |M_{hw}|. # fundamental weights if is_fundamental(hw) # if hw is a fundamental weight, no partition into smaller summands is possible. This is the basecase of the recursion. push!(no_minkowski, hw) @@ -351,7 +350,7 @@ function get_dim_weightspace(t, n, L, hw) """ # calculate dimension for dominant weights with GAP R = G.RootSystem(L) - W = fromGap(G.DominantCharacter(R, forGap(hw))) + W = fromGap(G.DominantCharacter(R, GAP.Obj(hw))) dominant_weights = W[1] dominant_weights_dim = W[2] dim_weightspace = [] @@ -369,4 +368,4 @@ end -end \ No newline at end of file +end diff --git a/experimental/basisLieHighestWeight/LieAlgebras.jl b/experimental/basisLieHighestWeight/LieAlgebras.jl index c9bb8b20b100..890528173fce 100644 --- a/experimental/basisLieHighestWeight/LieAlgebras.jl +++ b/experimental/basisLieHighestWeight/LieAlgebras.jl @@ -4,7 +4,6 @@ using Oscar using SparseArrays G = Oscar.GAP.Globals -forGap = Oscar.GAP.julia_to_gap fromGap = Oscar.GAP.gap_to_julia @@ -12,7 +11,7 @@ function lieAlgebra(t::String, n::Int) """ Creates the Lie-algebra as a GAP object that gets used for a lot other computations with GAP """ - L = G.SimpleLieAlgebra(forGap(t), n, G.Rationals) + L = G.SimpleLieAlgebra(GAP.Obj(t), n, G.Rationals) return L, G.ChevalleyBasis(L) end @@ -24,7 +23,7 @@ function matricesForOperators(L, hw, ops) """ used to create tensorMatricesForOperators """ - M = G.HighestWeightModule(L, forGap(hw)) + M = G.HighestWeightModule(L, GAP.Obj(hw)) mats = G.List(ops, o -> G.MatrixOfAction(G.Basis(M), o)) mats = gapReshape.(fromGap(mats)) d = lcm(denominator.(union(mats...))) @@ -47,4 +46,4 @@ function weightsForOperators(L, cartan, ops) return [ [asVec(h*v)[nzi(v)] / asVec(v)[nzi(v)] for h in cartan] for v in ops ] -end \ No newline at end of file +end diff --git a/experimental/basisLieHighestWeight/NewMonomial.jl b/experimental/basisLieHighestWeight/NewMonomial.jl index 4cc12b7782ca..bcf7f9baf75c 100644 --- a/experimental/basisLieHighestWeight/NewMonomial.jl +++ b/experimental/basisLieHighestWeight/NewMonomial.jl @@ -14,7 +14,6 @@ include("./MonomialOrder.jl") include("./WeylPolytope.jl") G = Oscar.GAP.Globals -forGap = Oscar.GAP.julia_to_gap fromGap = Oscar.GAP.gap_to_julia diff --git a/experimental/basisLieHighestWeight/RootConversion.jl b/experimental/basisLieHighestWeight/RootConversion.jl index c3471cec0a4a..34ed98f11615 100644 --- a/experimental/basisLieHighestWeight/RootConversion.jl +++ b/experimental/basisLieHighestWeight/RootConversion.jl @@ -2,7 +2,6 @@ using Oscar G = Oscar.GAP.Globals -forGap = Oscar.GAP.julia_to_gap fromGap = Oscar.GAP.gap_to_julia ############################################ @@ -77,7 +76,7 @@ function alpha_to_w(t, n, weight) end function get_CartanMatrix(t, n) - L = G.SimpleLieAlgebra(forGap(t), n, G.Rationals) + L = G.SimpleLieAlgebra(GAP.Obj(t), n, G.Rationals) R = G.RootSystem(L) C_list = fromGap(G.CartanMatrix(R)) C = zeros(n,n) @@ -381,4 +380,4 @@ function eps_to_w_A(n, weight) end end return res -end \ No newline at end of file +end diff --git a/experimental/basisLieHighestWeight/WeylPolytope.jl b/experimental/basisLieHighestWeight/WeylPolytope.jl index 00d864271374..735627329328 100644 --- a/experimental/basisLieHighestWeight/WeylPolytope.jl +++ b/experimental/basisLieHighestWeight/WeylPolytope.jl @@ -4,7 +4,6 @@ using Oscar include("./RootConversion.jl") G = Oscar.GAP.Globals -forGap = Oscar.GAP.julia_to_gap fromGap = Oscar.GAP.gap_to_julia ######################### @@ -37,7 +36,7 @@ function orbit_weylgroup(t::String, n::Int, hw) # initialization L, CH = lieAlgebra(t, n) W = G.WeylGroup(G.RootSystem(L)) - orb = G.WeylOrbitIterator(W, forGap(hw)) + orb = G.WeylOrbitIterator(W, GAP.Obj(hw)) vertices = [] # operate with the weylgroup on hw @@ -180,4 +179,4 @@ function get_monomials_of_weightspace_Xn(wts, weight) poly = polytope.Polytope(INEQUALITIES=ineq, EQUATIONS=equ) monomials = lattice_points(Polyhedron(poly)) return monomials -end \ No newline at end of file +end From 8cd22e91c5c3b3fc0003efa5c0f48815bed88f36 Mon Sep 17 00:00:00 2001 From: Lars Kastner Date: Fri, 24 Mar 2023 12:01:38 +0100 Subject: [PATCH 2/4] [LieAlgebraBases] Eliminate abbreviation G = GAP.Globals --- .../basisLieHighestWeight/BasisLieHighestWeight.jl | 11 +++++------ experimental/basisLieHighestWeight/LieAlgebras.jl | 11 +++++------ experimental/basisLieHighestWeight/NewMonomial.jl | 1 - experimental/basisLieHighestWeight/RootConversion.jl | 7 +++---- experimental/basisLieHighestWeight/WeylPolytope.jl | 11 +++++------ 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl b/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl index 6b595fcc24db..de9f766f79ff 100644 --- a/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl +++ b/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl @@ -11,7 +11,6 @@ include("./NewMonomial.jl") #include("./VectorSpaceBases.jl") #--- bekommt gerade noch ZZ, Short und TVEC aus VectorSpaceBases -G = Oscar.GAP.Globals fromGap = Oscar.GAP.gap_to_julia @@ -49,8 +48,8 @@ function sub_simple_refl(word, L, n) """ substitute simple reflections (i,i+1), saved in dec by i, with E_{i,i+1} """ - R = G.RootSystem(L) - CG = fromGap(G.CanonicalGenerators(R)[1], recursive = false) + R = GAP.Globals.RootSystem(L) + CG = fromGap(GAP.Globals.CanonicalGenerators(R)[1], recursive = false) ops = GAP.Obj([CG[i] for i in word], recursive = false) return ops end @@ -106,7 +105,7 @@ function compute_monomials(t, n, L, hw, ops, wts, wts_eps, monomial_order, calc_ end # calculation required - gapDim = G.DimensionOfHighestWeightModule(L, GAP.Obj(hw)) # number of monomials that we need to find, i.e. |M_{hw}|. + gapDim = GAP.Globals.DimensionOfHighestWeightModule(L, GAP.Obj(hw)) # number of monomials that we need to find, i.e. |M_{hw}|. # fundamental weights if is_fundamental(hw) # if hw is a fundamental weight, no partition into smaller summands is possible. This is the basecase of the recursion. push!(no_minkowski, hw) @@ -349,8 +348,8 @@ function get_dim_weightspace(t, n, L, hw) and we can therefore calculate the dimension of each weightspace """ # calculate dimension for dominant weights with GAP - R = G.RootSystem(L) - W = fromGap(G.DominantCharacter(R, GAP.Obj(hw))) + R = GAP.Globals.RootSystem(L) + W = fromGap(GAP.Globals.DominantCharacter(R, GAP.Obj(hw))) dominant_weights = W[1] dominant_weights_dim = W[2] dim_weightspace = [] diff --git a/experimental/basisLieHighestWeight/LieAlgebras.jl b/experimental/basisLieHighestWeight/LieAlgebras.jl index 890528173fce..15d08b5772f4 100644 --- a/experimental/basisLieHighestWeight/LieAlgebras.jl +++ b/experimental/basisLieHighestWeight/LieAlgebras.jl @@ -3,7 +3,6 @@ using Oscar using SparseArrays -G = Oscar.GAP.Globals fromGap = Oscar.GAP.gap_to_julia @@ -11,8 +10,8 @@ function lieAlgebra(t::String, n::Int) """ Creates the Lie-algebra as a GAP object that gets used for a lot other computations with GAP """ - L = G.SimpleLieAlgebra(GAP.Obj(t), n, G.Rationals) - return L, G.ChevalleyBasis(L) + L = GAP.Globals.SimpleLieAlgebra(GAP.Obj(t), n, GAP.Globals.Rationals) + return L, GAP.Globals.ChevalleyBasis(L) end @@ -23,8 +22,8 @@ function matricesForOperators(L, hw, ops) """ used to create tensorMatricesForOperators """ - M = G.HighestWeightModule(L, GAP.Obj(hw)) - mats = G.List(ops, o -> G.MatrixOfAction(G.Basis(M), o)) + M = GAP.Globals.HighestWeightModule(L, GAP.Obj(hw)) + mats = GAP.Globals.List(ops, o -> GAP.Globals.MatrixOfAction(GAP.Globals.Basis(M), o)) mats = gapReshape.(fromGap(mats)) d = lcm(denominator.(union(mats...))) mats = (A->ZZ.(A*d)).(mats) @@ -38,7 +37,7 @@ function weightsForOperators(L, cartan, ops) """ cartan = fromGap(cartan, recursive=false) ops = fromGap(ops, recursive=false) - asVec(v) = fromGap(G.ExtRepOfObj(v)) + asVec(v) = fromGap(GAP.Globals.ExtRepOfObj(v)) if any(iszero.(asVec.(ops))) error("ops should be non-zero") end diff --git a/experimental/basisLieHighestWeight/NewMonomial.jl b/experimental/basisLieHighestWeight/NewMonomial.jl index bcf7f9baf75c..1cef58b776eb 100644 --- a/experimental/basisLieHighestWeight/NewMonomial.jl +++ b/experimental/basisLieHighestWeight/NewMonomial.jl @@ -13,7 +13,6 @@ include("./LieAlgebras.jl") include("./MonomialOrder.jl") include("./WeylPolytope.jl") -G = Oscar.GAP.Globals fromGap = Oscar.GAP.gap_to_julia diff --git a/experimental/basisLieHighestWeight/RootConversion.jl b/experimental/basisLieHighestWeight/RootConversion.jl index 34ed98f11615..3226ae84e562 100644 --- a/experimental/basisLieHighestWeight/RootConversion.jl +++ b/experimental/basisLieHighestWeight/RootConversion.jl @@ -1,7 +1,6 @@ #using Gapjm using Oscar -G = Oscar.GAP.Globals fromGap = Oscar.GAP.gap_to_julia ############################################ @@ -76,9 +75,9 @@ function alpha_to_w(t, n, weight) end function get_CartanMatrix(t, n) - L = G.SimpleLieAlgebra(GAP.Obj(t), n, G.Rationals) - R = G.RootSystem(L) - C_list = fromGap(G.CartanMatrix(R)) + L = GAP.Globals.SimpleLieAlgebra(GAP.Obj(t), n, GAP.Globals.Rationals) + R = GAP.Globals.RootSystem(L) + C_list = fromGap(GAP.Globals.CartanMatrix(R)) C = zeros(n,n) for i in 1:n for j in 1:n diff --git a/experimental/basisLieHighestWeight/WeylPolytope.jl b/experimental/basisLieHighestWeight/WeylPolytope.jl index 735627329328..d9a57d76bd9d 100644 --- a/experimental/basisLieHighestWeight/WeylPolytope.jl +++ b/experimental/basisLieHighestWeight/WeylPolytope.jl @@ -3,7 +3,6 @@ using Oscar include("./RootConversion.jl") -G = Oscar.GAP.Globals fromGap = Oscar.GAP.gap_to_julia ######################### @@ -35,14 +34,14 @@ function orbit_weylgroup(t::String, n::Int, hw) # also possible with polymake orbit_polytope(Vector input_point, Group g), root_system(String type) to save the equations, constant summand missing # initialization L, CH = lieAlgebra(t, n) - W = G.WeylGroup(G.RootSystem(L)) - orb = G.WeylOrbitIterator(W, GAP.Obj(hw)) + W = GAP.Globals.WeylGroup(GAP.Globals.RootSystem(L)) + orb = GAP.Globals.WeylOrbitIterator(W, GAP.Obj(hw)) vertices = [] # operate with the weylgroup on hw - G.IsDoneIterator(orb) - while !(G.IsDoneIterator(orb)) - w = G.NextIterator(orb) + GAP.Globals.IsDoneIterator(orb) + while !(GAP.Globals.IsDoneIterator(orb)) + w = GAP.Globals.NextIterator(orb) push!(vertices, fromGap(w)) end From 6b081e35dcc1739d5789f281e75c879930d7ff44 Mon Sep 17 00:00:00 2001 From: Lars Kastner Date: Fri, 24 Mar 2023 13:42:09 +0100 Subject: [PATCH 3/4] Typo prevented tests from running --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index d682d42322aa..3bc7b7266608 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -125,7 +125,7 @@ include("Serialization/runtests.jl") include("StraightLinePrograms/runtests.jl") -include("experimental/basisLieHighestWeight/MB-test.jl") +include("Experimental/basisLieHighestWeight/MB-test.jl") @static if compiletimes Base.cumulative_compile_timing(false); From 0089ae0e00e1bcb0b53d34d0a00edafdcca6163f Mon Sep 17 00:00:00 2001 From: Lars Kastner Date: Fri, 24 Mar 2023 16:13:14 +0100 Subject: [PATCH 4/4] [BasisLieHighestWeight] First docs example --- .../src/Experimental/basisLieHighestWeight.md | 7 +++++-- .../BasisLieHighestWeight.jl | 21 ++++++++++++++++--- experimental/basisLieHighestWeight/main.jl | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/src/Experimental/basisLieHighestWeight.md b/docs/src/Experimental/basisLieHighestWeight.md index 391a1ec7305e..7fc64f8ce43c 100644 --- a/docs/src/Experimental/basisLieHighestWeight.md +++ b/docs/src/Experimental/basisLieHighestWeight.md @@ -1,9 +1,9 @@ ```@meta -CurrentModule = Oscar +CurrentModule = Oscar.BasisLieHighestWeight ``` ```@setup oscar -using Oscar +using Oscar.BasisLieHighestWeight ``` ```@contents @@ -11,3 +11,6 @@ Pages = ["basisLieHighestWeight.md"] ``` # Monomial bases for Lie algebras +```@docs +basisLieHighestWeight2 +``` diff --git a/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl b/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl index de9f766f79ff..db3f22e858b1 100644 --- a/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl +++ b/experimental/basisLieHighestWeight/BasisLieHighestWeight.jl @@ -4,6 +4,7 @@ export is_fundamental using Polymake using Distributed +using Markdown #using CUDA #using CuArrays @@ -13,11 +14,25 @@ include("./NewMonomial.jl") fromGap = Oscar.GAP.gap_to_julia +@doc Markdown.doc""" + basisLieHighestWeight2(t, n, hw; ops = "regular", known_monomials = [], monomial_order = "GRevLex", cache_size::Int = 1000000, parallel::Bool = false, return_no_minkowski::Bool = false, return_ops::Bool = false) +Compute a monomial basis for the highest weight module with highest weight +``hw`` (in terms of the fundamental weights), for a simple Lie algebra of type +``t`` and rank ``n``. + +# Parameters +- `t`: Explain +- `n`: Explain +- `hw`: Explain + +# Examples +```jldoctest +julia> 1+1 +2 +``` +""" function basisLieHighestWeight2(t, n, hw; ops = "regular", known_monomials = [], monomial_order = "GRevLex", cache_size::Int = 1000000, parallel::Bool = false, return_no_minkowski::Bool = false, return_ops::Bool = false) - """ - Compute a monomial basis for the highest weight module with highest weight ``hw`` (in terms of the fundamental weights), for a simple Lie algebra of type ``t`` and rank ``n``. - """ # The function precomputes objects that are independent of the highest weight and can be used in all recursion steps. Then it starts the recursion and returns the result. # initialization diff --git a/experimental/basisLieHighestWeight/main.jl b/experimental/basisLieHighestWeight/main.jl index 4bfca765ad45..9a1de065dda7 100644 --- a/experimental/basisLieHighestWeight/main.jl +++ b/experimental/basisLieHighestWeight/main.jl @@ -1,2 +1,2 @@ include("BasisLieHighestWeight.jl") -export MB \ No newline at end of file +export BasisLieHighestWeight