1+ export AbstractLieAlgebraRepresentation,
2+ IrreducibleRepresentation,
3+ space_basis,
4+ to_expressions,
5+ IsotypicComponent,
6+ mul,
7+ irreducible_components,
8+ PolynomialVectorSpace,
9+ is_upto,
10+ LieAlgebraRepresentation,
11+ space,
12+ isotypic_components
13+
114abstract type AbstractLieAlgebraRepresentation end
215
316struct IrreducibleRepresentation{T<: AbstractLieAlgebraAction } <: AbstractLieAlgebraRepresentation
@@ -52,10 +65,10 @@ struct PolynomialVectorSpace
5265end
5366
5467PolynomialVectorSpace (;
55- variables:: Vector{Variable} ,
68+ variables:: AbstractArray ,
5669 degree:: Int ,
5770 upto:: Bool = true
58- ) = PolynomialVectorSpace (variables, degree, upto)
71+ ) = PolynomialVectorSpace (Variable .( collect ( flatten ( variables))) , degree, upto)
5972
6073variables (V:: PolynomialVectorSpace ) = V. vars
6174nvariables (V:: PolynomialVectorSpace ) = length (V. vars)
@@ -75,7 +88,9 @@ Base.:(==)(
7588
7689function Base. show (io:: IO , V:: PolynomialVectorSpace )
7790 println (io, " PolynomialVectorSpace of dimension $(dim (V)) " )
78- print (io, " variables: $(variables (V)) " )
91+ println (io, " $(nvariables (V)) variables: " , join (variables (V), " , " ))
92+ println (io, " degree of polynomials: $(degree (V)) " )
93+ print (io, " homogeneous: $(! is_upto (V)) " )
7994end
8095
8196
@@ -85,6 +100,11 @@ struct LieAlgebraRepresentation{T<:AbstractLieAlgebraAction} <: AbstractLieAlgeb
85100 isotypic:: Vector{IsotypicComponent{T}}
86101end
87102
103+ LieAlgebraRepresentation (
104+ action:: T ,
105+ V:: PolynomialVectorSpace
106+ ) where {T<: AbstractLieAlgebraAction } = LieAlgebraRepresentation {T} (action, V, [])
107+
88108function LieAlgebraRepresentation (
89109 alg:: LieAlgebra ,
90110 V:: PolynomialVectorSpace ,
@@ -104,20 +124,21 @@ function LieAlgebraRepresentation(
104124 return LieAlgebraRepresentation (alg, V, var_groups, iso_comps)
105125end
106126
107- algebra (π:: LieAlgebraRepresentation ) = π. alg
127+ action (π:: LieAlgebraRepresentation ) = π. action
128+ algebra (π:: LieAlgebraRepresentation ) = algebra (π. action)
108129space (π:: LieAlgebraRepresentation ) = π. V
109130isotypic_components (π:: LieAlgebraRepresentation ) = π. isotypic
110131irreducible_components (π:: LieAlgebraRepresentation ) = vcat ([irreducible_components (iso) for iso in π. isotypic]. .. )
111- dim (π:: LieAlgebraRepresentation ) = sum ([ dim (ic) for ic in isotypic_components (π)] )
132+ dim (π:: LieAlgebraRepresentation ) = dim (space (π))
112133
113134# called by Shift+Enter
114135function Base. show (io:: IO , mime:: MIME"text/plain" , π:: LieAlgebraRepresentation )
115136 println (
116137 io,
117- " LieAlgebraRepresentation of $(name (π . alg )) " ,
138+ " LieAlgebraRepresentation of $(name (algebra (π) )) " ,
118139 " on the $(dim (π)) -dimensional vector space:"
119140 )
120- show (io, mime, π . var_groups )
141+ show (io, mime, action (π) )
121142 # print(io, " action on variables: $(π.var_groups)")
122143end
123144
@@ -133,6 +154,38 @@ function nullspace_as_weight_vectors(
133154 return wvs
134155end
135156
157+ function sym_weight_structure (alg:: LieAlgebra , d:: Integer , mexps:: Vector{<:SparseVector} )
158+ d = Int (d)
159+ d == 0 && return WeightStructure ([0 ], [[1 ;;]])
160+ d == 1 && return weight_structure (alg)
161+ combs = multiexponents (; degree= d, nvars= nweights (alg))
162+ new_weights_dict = Dict {Vector{Int}, Vector{typeof(combs[1])}} ()
163+ for comb in combs
164+ w = sum ([comb. nzval[i]* weights (alg, comb. nzind[i]) for i in 1 : length (comb. nzind)])
165+ val = get (new_weights_dict, w, nothing )
166+ if isnothing (val)
167+ new_weights_dict[w] = [comb]
168+ else
169+ push! (new_weights_dict[w], comb)
170+ end
171+ end
172+ new_weights = [zeros (Int, 0 ) for _ in 1 : length (new_weights_dict)]
173+ new_weight_spaces = [zeros (ComplexF64, 0 , 0 ) for _ in 1 : length (new_weights_dict)]
174+ for (i, (weight, combs)) in enumerate (new_weights_dict)
175+ new_weights[i] = weight
176+ Ms = [⊙ (weight_spaces (alg, comb. nzind), comb. nzval, mexps) for comb in combs]
177+ new_weight_spaces[i] = hcat (Ms... )
178+ end
179+ return WeightStructure (new_weights, new_weight_spaces)
180+ end
181+
182+ tensor_weight_structure (
183+ alg:: LieAlgebra ,
184+ ds:: AbstractVector{<:Integer} ,
185+ v_mexps:: Vector{<:Vector{<:SparseVector}} ,
186+ tensor_basis # TODO : add type
187+ ) = tensor_weight_structure ([sym_weight_structure (alg, d, mexps) for (d, mexps) in zip (ds, v_mexps)], tensor_basis)
188+
136189function weight_module (
137190 alg:: LieAlgebra ,
138191 variables:: Vector{Vector{Variable}} ,
159212
160213# TODO : supposes that all the vars in V occur in var_groups
161214function LieAlgebraRepresentation (
162- alg:: LieAlgebra ,
163- V:: PolynomialVectorSpace ;
164- action:: Vector{Vector{Variable}}
215+ action:: LieAlgebraAction ,
216+ V:: PolynomialVectorSpace
165217)
166218 @assert issetequal (vcat (action... ), variables (V))
167219 groups_mexps = multiexponents (degree= degree (V), nvars= length (action), upto= is_upto (V))
0 commit comments