@@ -33,14 +33,19 @@ function common_nullspace_as_weight_vectors(
3333)
3434 dim(ws) == 1 && return [WeightVector(weight(ws), v) for v in basis(space(ws))]
3535
36- logging && printstyled(" Looking for the highest weight vectors in $(str_irr(" W" , weight(ws))) of dimension $(dim(ws)) ...\n " , color= :green)
36+ logging && printstyled(" Looking for $(nhwv) highest weight vectors in $(str_irr(" W" , weight(ws))) of dimension $(dim(ws)) ...\n " , color= :green)
3737 wsₙ = ws
3838 for X in Xs
3939 wsₙ = ws_nullspace(X, a, wsₙ)
40- isnothing(wsₙ) && return WeightVector[]
40+ if isnothing(wsₙ)
41+ logging && printstyled(" Found no common nullspace, smth is wrong!\n " , color= :red)
42+ return WeightVector[] # error("Didn't find any highest weight vectors, had to find $(nhwv)")
43+ end
4144 end
4245
43- @assert dim(wsₙ) == nhwv
46+ if dim(wsₙ) != nhwv
47+ error(" Found $(dim(wsₙ)) highest weight vectors, expected $(nhwv) " )
48+ end
4449 logging && printstyled(" Found: " , color= :green)
4550 logging && printstyled(" $(join(map(repr, basis(space(wsₙ))), " , " )) \n " , color= :green)
4651
7075
7176function irreducibles(
7277 ρ:: GroupRepresentation{A, S} ;
73- logging:: Bool = true
78+ logging:: Bool = true ,
79+ decomp_count:: Union{Dict{AbstractWeightStruct, Int},Nothing} = nothing
7480) where {A<: AbstractGroupAction{Lie} , S<: VariableSpace }
7581 logging && printstyled(" Decomposing the space of variables $(to_string(space(ρ))) into irreducibles...\n " , color= :red)
7682
8692
8793function irreducibles(
8894 ρ:: GroupRepresentation{A, S} ;
89- logging:: Bool = true
95+ logging:: Bool = true ,
96+ decomp_count:: Dict{AbstractWeightStruct, Int} = nothing
9097) where {T, F, A<: AbstractGroupAction{Lie} , S<: SymmetricPower{T, F, <:HighestWeightModule} }
9198 V = space(ρ)
9299 logging && printstyled(" Decomposing $(to_string(V)) into irreducibles...\n " , color= :blue)
93100
94101 Vb = base_space(V)
95- power(V) == 1 && return [IrreducibleRepresentation(action(ρ), Vb)]
96102 ws = weight_structure(Vb)
103+
104+ if ! isnothing(decomp_count)
105+ t = SymWeightStruct(highest_weight(Vb), power(V))
106+ decomp_count[t] = get(decomp_count, t, 0 ) + 1
107+ end
97108
98109 logging && printstyled(" Applying Clebsch-Gordan to decompose $(to_string(V)) into irreducibles...\n " , color= :blue)
99110 sym_ws, cg_decomp = sym_weight_struct(highest_weight(Vb), algebra(action(ρ)), power(V), ws)
@@ -106,22 +117,24 @@ end
106117
107118function irreducibles(
108119 ρ:: GroupRepresentation{A, T} ;
109- logging:: Bool = true
120+ logging:: Bool = true ,
121+ decomp_count:: Dict{AbstractWeightStruct, Int} = nothing
110122) where {A<: AbstractGroupAction{Lie} , T<: SymmetricPower }
111123 V = space(ρ)
112124 logging && printstyled(" Decomposing $(to_string(V)) into irreducibles...\n " , color= :magenta)
113125
114126 ρ_base = GroupRepresentation(action(ρ), base_space(V))
115- irreds_base = irreducibles(ρ_base)
127+ irreds_base = irreducibles(ρ_base; decomp_count = decomp_count )
116128 if length(irreds_base) == 1
117129 logging && printstyled(" $(to_string(base_space(V))) is already irreducible, decomposing its symmetric power directly...\n " , color= :magenta)
118130 V = SymmetricPower(space(first(irreds_base)), power(V))
119131 ρᵢ = GroupRepresentation(action(ρ), V)
120- return irreducibles(ρᵢ)
132+ return irreducibles(ρᵢ; decomp_count = decomp_count )
121133 end
122134 mexps = multiexponents(degree= power(V), nvars= length(irreds_base))
123135
124136 Vs = [TensorProduct([SymmetricPower(space(irreds_base[idx]), val) for (val, idx) in zip(mexp. nzval, mexp. nzind)]) for mexp in mexps]
137+ @assert dim(V) == sum([dim(Vᵢ) for Vᵢ in Vs])
125138 if logging
126139 printstyled(" Sym$(superscript(power(V))) (" , color= :magenta)
127140 printstyled(join([to_string(space(irr)) for irr in irreds_base], " ⊕ " ), " ) = " , color= :magenta)
@@ -132,22 +145,40 @@ function irreducibles(
132145 irreds = IrreducibleRepresentation{A}[]
133146 for Vᵢ in Vs
134147 ρᵢ = GroupRepresentation(action(ρ), Vᵢ)
135- append!(irreds, irreducibles(ρᵢ))
148+ append!(irreds, irreducibles(ρᵢ; decomp_count = decomp_count ))
136149 end
137150 return irreds
138151end
139152
140153function irreducibles(
141154 ρ:: GroupRepresentation{A, S} ;
142- logging:: Bool = true
155+ logging:: Bool = true ,
156+ decomp_count:: Dict{AbstractWeightStruct, Int} = nothing
143157) where {T, F, A<: AbstractGroupAction{Lie} , S<: TensorProduct{T, F, <:HighestWeightModule, <:HighestWeightModule} }
144- logging && printstyled(" Decomposing $(to_string(V)) into irreducibles...\n " , color= :blue)
145158 V = space(ρ)
146- hw₁, hw₂ = highest_weight(first(V)), highest_weight(second(V))
159+ logging && printstyled(" Decomposing $(to_string(V)) into irreducibles...\n " , color= :blue)
160+
161+ V₁, V₂ = first(V), second(V)
162+ if dim(V₁) == 1 || dim(V₂) == 1
163+ logging && printstyled(" One of the factors is 1-dimensional, returning the tensor product of the highest weight vectors\n " , color= :red)
164+ return [IrreducibleRepresentation(action(ρ), hw_vector(V₁)* hw_vector(V₂))]
165+ end
166+
167+ hw₁, hw₂ = highest_weight(V₁), highest_weight(V₂)
168+ if ! isnothing(decomp_count)
169+ t = TensorWeightStruct(hw₁, hw₂)
170+ decomp_count[t] = get(decomp_count, t, 0 ) + 1
171+ end
147172
148173 logging && printstyled(" Applying Clebsch-Gordan to decompose $(to_string(V)) into irreducibles...\n " , color= :blue)
149- ws₁, ws₂ = weight_structure(first(V)), weight_structure(second(V)) # TODO : save once computed
150- tensor_ws, cg_decomp = tensor_weight_struct(hw₁, hw₂, algebra(action(ρ)), ws₁, ws₂)
174+ cg_decomp = tensor(hw₁, hw₂, algebra(action(ρ)))
175+ if length(cg_decomp) == 1
176+ logging && printstyled(" The tensor product is irreducible, returning the tensor product of the highest weight vectors\n " , color= :red)
177+ return [IrreducibleRepresentation(action(ρ), hw_vector(V₁)* hw_vector(V₂))]
178+ end
179+
180+ ws₁, ws₂ = weight_structure(V₁), weight_structure(V₂) # TODO : speed up, but how?
181+ tensor_ws = tensor_weight_struct(cg_decomp, ws₁, ws₂)
151182 logging && printstyled(to_string(V), " = " , join([str_irr(" V" , w) for w in weights(tensor_ws)], " ⊕ " ), " \n " , color= :blue)
152183
153184 Xs = positive_root_elements(algebra(action(ρ)))
@@ -157,12 +188,17 @@ end
157188
158189function irreducibles(
159190 ρ:: GroupRepresentation{A, S} ;
160- logging:: Bool = true
191+ logging:: Bool = true ,
192+ decomp_count:: Dict{AbstractWeightStruct, Int} = nothing
161193) where {A<: AbstractGroupAction{Lie} , S<: TensorProduct }
162194 V = space(ρ)
163195 logging && printstyled(" Decomposing $(to_string(V)) into irreducibles...\n " , color= :magenta)
164- irrs₁ = irreducibles(GroupRepresentation(action(ρ), first(space(ρ))))
165- irrs₂ = irreducibles(GroupRepresentation(action(ρ), second(space(ρ))))
196+
197+ irrs₁ = irreducibles(GroupRepresentation(action(ρ), first(space(ρ))); decomp_count= decomp_count)
198+ @assert sum([dim(space(irr)) for irr in irrs₁]) == dim(first(space(ρ)))
199+
200+ irrs₂ = irreducibles(GroupRepresentation(action(ρ), second(space(ρ))); decomp_count= decomp_count)
201+ @assert sum([dim(space(irr)) for irr in irrs₂]) == dim(second(space(ρ)))
166202
167203 logging && printstyled(" Decomposing tensor product knowing irreducibles of the factors...\n " , color= :magenta)
168204 logging && printstyled(" ($(join([to_string(space(irr)) for irr in irrs₁], " ⊕ " )) ) ⊗ " , color= :magenta)
@@ -173,7 +209,9 @@ function irreducibles(
173209 for irr₁ in irrs₁, irr₂ in irrs₂
174210 V = TensorProduct([space(irr₁), space(irr₂)])
175211 ρV = GroupRepresentation(action(ρ), V)
176- append!(irreds, irreducibles(ρV))
212+ irrs = irreducibles(ρV; decomp_count= decomp_count)
213+ @assert sum([dim(space(irr)) for irr in irrs]) == dim(V)
214+ append!(irreds, irrs)
177215 end
178216 return irreds
179217end
@@ -182,14 +220,16 @@ function irreducibles(
182220 ρ:: GroupRepresentation{A, S}
183221) where {A<: AbstractGroupAction{Lie} , S<: FixedDegreePolynomials }
184222 V = space(ρ)
185- return irreducibles(GroupRepresentation(action(ρ), SymmetricPower(var_space(V), degree(V))))
223+ d = Dict{AbstractWeightStruct, Int}()
224+ return irreducibles(GroupRepresentation(action(ρ), SymmetricPower(var_space(V), degree(V))); decomp_count= d), d
186225end
187226
188227function irreducibles(
189228 ρ:: GroupRepresentation{A, S}
190229) where {A<: AbstractGroupAction{Lie} , S<: FixedMultidegreePolynomials }
191230 V = space(ρ)
192- return irreducibles(GroupRepresentation(action(ρ), TensorProduct([SymmetricPower(Vᵢ, dᵢ) for (Vᵢ, dᵢ) in zip(var_spaces(V), degrees(V))])))
231+ d = Dict{AbstractWeightStruct, Int}()
232+ return irreducibles(GroupRepresentation(action(ρ), TensorProduct([SymmetricPower(Vᵢ, dᵢ) for (Vᵢ, dᵢ) in zip(var_spaces(V), degrees(V))])); decomp_count= d), d
193233end
194234
195235
0 commit comments