Decomposition of the tensor product 
of irreps of SU(n) into a direct sum

Version 1.0
Robert Coquereaux
CPT, CNRS, Luminy, Marseille

What the program does

Given two irreducible representations of SU(n) specified by the components of their highest weights in the basis of fundamental weights, the program determines the decomposition of their tensor product into a sum of irreducible representations (irreps). 
The result is a list of pairs: 
the first element of each pair gives the highest weight of each irrep of the decomposition, 
the second element gives its multiplicity (i.e. the corresponding Littlewood-Richardson coefficient).
The program remembers the obtained results.
Example

Timing[tensorproduct[{1,2,0,1},{1,0,1,2}]](* first time *)

Timing[tensorproduct[{1,2,0,1},{1,0,1,2}]](* no recalculation *)

The dynamic interface: Why two sections for the CDF Player ?

The main function is tenspromatform (or equivalently, tensorproduct), and it is defined in the main program (package).
The code for the interface, that is used to generate a cdf file, comes next.
Now, why two versions ?

The first version of the interface code (for the CDF Player on the computer) updates correctly and automatically the given components of the weights, even after having increased or decreased their number (the value of n-1, for SU(n)), but unfortunately, while using the same code, the components are not updated automatically with the present IOS version (iPad) of the CDF Player : for this reason, in the second version, the user first enters all the components, and then he has to hit the “Update” button. 
Since the latter version also works on the computer (although it is not as nice as the first), this is the version that has been uploaded as standalone. 

The user enters the components of the weights (the predefined value of n is n=4). 
The decomposition of the tensor product is either dynamically updated (first version), or manually updated (hit the “Update” button: second version).
To change the value of n, one uses the two buttons : “Increase n” or “Decrease n”.

History

The package was written in 2014.
The code for the interface (dynamic module, cdf file) was written in August 2017.
It was made public on the R.C. web site in September 2017.

The decomposition of the tensor product of irreducible representations is done by using an improved hive technique. 
In order to speed up the calculation we use a basis of elementary pictographs where syzygies (constraints) are eliminated before the actual reduction of the system of inequalities takes place. See the subsection DETAILS.

Other related programs : SU(n) oblades and honeycombs.

Links

Related programs:

Notebooks (nb files, they also include the source code for the cdf version) 
(HyperlinkURL["Tensor product of SU(n) irreducible representations (Littlewood-Richardson coefficients)", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/nb/tensorProdIrrep.nb])
(HyperlinkURL["Pictographs: oblades for SU(n)", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/nb/obladesSUn.nb])
(HyperlinkURL["Pictographs: honeycombs for SU(n)", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/nb/honeycombsSUn.nb])
(HyperlinkURL["Dimensions of irreps of SU(n)", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/nb/dimensionsOfIrrepsSUn.nb])

CDF files (standalone)
for the Wolfram CDF Player
(HyperlinkURL["Tensor product of SU(n) irreducible representations (Littlewood-Richardson coefficients). CDF file", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/cdf/tensorProdIrrep.cdf])
(HyperlinkURL["Pictographs: oblades for SU(n). CDF file", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/cdf/obladesSUn.cdf])
(HyperlinkURL["Pictographs: honeycombs for SU(n). CDF file", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/cdf/honeycombsSUn.cdf])
(HyperlinkURL["Dimensions of irreps of SU(n). CDF file", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/cdf/dimensionsOfIrrepsSUn.cdf])

CDF files adapted to the first version of the CDF Player on IOS 
(when the latter is updated,  one should use the previous files instead):
(HyperlinkURL["Pictographs: oblades for SU(n). CDF file, IOS.", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/cdf/obladesSUnForIOS.cdf])
(HyperlinkURL["Pictographs: honeycombs for SU(n). CDF file, IOS.", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/cdf/honeycombsSUnForIOS.cdf])

Files for the cdf web plug-in 
(dying technology: the plug-in is incompatible with most recent browsers, these files will not be updated):
(HyperlinkURL["Tensor product of SU(n) irreducible representations (Littlewood-Richardson coefficients). CDF file for web plug-in", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/cdf/tensorProdIrrepWeb.cdf])
(HyperlinkURL["Pictographs: oblades for SU(n). CDF file for web plug-in", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/cdf/obladesSUnWeb.cdf])
(HyperlinkURL["Pictographs: honeycombs for SU(n). CDF file for web plug-in", http://www.cpt.univ-mrs.fr/~coque/Computer_programs/cdf/honeycombsSUnWeb.cdf])

Licence

MIT License
Copyright (c) 2017 RobertCoquereaux
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Main program: package (local copy) called by the cdf file

shorttensorProdIrrepPackage

BeginPackage["shorttensorProdIrrepPackage`"];
(*usages go here*)

oblade::usage=
"Evaluation of oblade[n] initializes all relevant data for SU(n). It returns n and set the variable currentgroup to n.";

tensorproduct::usage="tensorproduct[lambda,mu] returns the decomposition into irreducible components nu of a tensor product of two irreps lambda, mu, of the Lie group SU(n), given by the components of their highest weights along the basis of fundamental weights.  The last entry of each term is its multiplicity.";

tenspromatform::usage=
"tenspromatform[{lambda,mu}] returns tensorproduct[lambda,mu]";

currentgroup::usage = "currentgroup returns the argument n of the group SU(n) currently in use.";

Begin["Private`"];

(* Sides,edges,components and equations *)
(* Sides *)
(* p will run from 1 to NN-1 *)
lambdalabel[n_,p_]:=1/2 (2+3 p+p^2);
mulabel[n_,p_]:=(n+1)(n+2)/2-p;
nulabel[n_,p_]:=1/2 (n+n^2-2 n p+(-1+p) p+2);

oblade[var_]:= With[{NN=var},
 
(* Equations on sides *)
(* conservation equations at the external vertices (weights) *)
lambdaequations = And[
Apply[And,Table[lambda[p,0,0]== Sum[ j[p,NN-(s+p),s] ,{s,0,NN-p}],{p,1,NN-1}]],
Apply[And,Table[lambda[0,p,0]== Sum[ j[s,p,NN-(s+p)] ,{s,0,NN-p}],{p,1,NN-1}]],
Apply[And,Table[lambda[0,0,p]== Sum[ j[s,NN-(s+p),p] ,{s,0,NN-p}],{p,1,NN-1}]]];
(* Edges values (in terms of fundamental pictographs)*)
edgesEW[NN]= Table[FoldList[Plus][Table[j[t,NN-s,s-t],{s,t,NN-1}]],{t,1,NN-1}];
edgesNESW[NN]= Table[FoldList[Plus][Table[j[s-p,p,NN-s],{s,p,NN-1}]],{p,1,NN-1}];
edgesNWSE[NN]= Table[FoldList[Plus][Table[j[NN-s,s-p,p],{s,p,NN-1}]],{p,1,NN-1}];
(* Edge labelling doublets *)
edgesEWlabels[lev_]:=Table[Take[Table[1/2 (4+p+p^2)+(lev-1),{p,lev,NN}],{z,z+1}],{z,1,NN-lev}];
edgesNESWlabels[lev_]:=Table[Take[Table[1/2 (3p+p^2)+1/2 (lev-1) (lev)+ (lev-1) p,{p,1,NN}],{z,z+1}],{z,1,NN-lev}];
edgesNWSElabels[lev_]:=Table[Take[Range[1+1/2 (-lev+NN) (1-lev+NN),1-lev+NN+1/2 (-lev+NN) (1-lev+NN)],{z,z+1}],{z,1,NN-lev}];

(* Fundamental pictographs and positivity constraints *)
components = Join[
Table[Table[ j[p,NN-(s+p),s] ,{s,0,NN-p}],{p,1,NN-1}],
Table[Table[ j[s,p,NN-(s+p)] ,{s,0,NN-p}],{p,1,NN-1}],
Table[Table[ j[s,NN-(s+p),p] ,{s,0,NN-p}],{p,1,NN-1}]];
fundamentalcomponents = Union[Flatten[components]];
positivityconstraints=And[
Apply[And,Map[# >= 0 &,Flatten@edgesEW[NN]]],
Apply[And,Map[# >= 0 &,Flatten@edgesNESW[NN]]],
Apply[And,Map[# >= 0 &,Flatten@edgesNWSE[NN]]]
];
buildlambdainput[{l1__},{l2__}]:=Flatten[{
MapThread[Rule,{Table[lambda[p,0,0],{p,1,NN-1}],{l1}}],
MapThread[Rule,{Table[lambda[0,p,0],{p,1,NN-1}],{l2}}]}];
buildlambdainput[{l1__},{l2__},{l3__}]:=Flatten[{
MapThread[Rule,{Table[lambda[p,0,0],{p,1,NN-1}],{l1}}],
MapThread[Rule,{Table[lambda[0,p,0],{p,1,NN-1}],{l2}}],
MapThread[Rule,{Table[lambda[0,0,p],{p,1,NN-1}],{l3}}]}];

(* Values of edges if only lambda and mu are given *) 
(* This version of componentsEdgesAndnuc, in this short package, uses Solve rather than Reduce *)
componentsEdgesAndnuc[{lam__},{mu__}]:= 
componentsEdgesAndnuc[{lam},{mu}]= 
Module[{redsol,locrules,nuclist,fundcompval,edgesEWValues,edgesNESWValues,edgesNWSEValues},
redsol=Solve[And[lambdaequations/. buildlambdainput[{lam},{mu}],positivityconstraints],Integers];
nuclist=Table[lambda[0,0,p],{p,1,NN-1}]/. redsol ;
{{},{} ,{},{},nuclist}];

currentgroup=NN]

tensorproductCC[{lam__},{mu__}]:=componentsEdgesAndnuc[{lam},{mu}][[5]];
(* Getting only the weights nuc (ie conjugated nu),tallied,and their multiplicities *)

tensorproduct[{lam__},{mu__}]:=If[
Length[{lam}]==Length[{mu}],
Switch[
ValueQ[currentgroup],False,oblade[Length[{lam}]+1];tensorproduct[{lam},{mu}],
True,If[
Length[{lam}]== currentgroup-1, 
SortBy[Tally[Map[Reverse,tensorproductCC[{lam},{mu}]]],Last], 
oblade[Length[{lam}]+1];
tensorproduct[{lam},{mu}]]],
Print["Weights should have the same number of components"]];

tenspromatform[mat_]:= Apply[tensorproduct,mat];

End[];(*private*)

EndPackage[];

Names["shorttensorProdIrrepPackage`*"]

Examples

tensorproduct[{1,2,0,3},{1,0,2,1}]

currentgroup

tensorproduct[{1,2},{3,1}]

currentgroup

tenspromatform::usage

Code for interface (for the CDF Player on computer)

DECOMPOSITION INTO A DIRECT SUM OF THE PRODUCT OF IRREDUCIBLE REPRESENTATIONS OF SU(n)  -  Interface - Automatic update of components.

limitlenval=800;
limittimeval=1.5;

Print[Style["Web version: The number of inequivalent irreps generated by the program should be smaller than ",12,Bold], Style[limitlenval,12,Bold]]

Print[Style["Web version: the computation is terminated if it takes more than ",12,Bold],
Style[limittimeval,12,Bold],Style[" seconds",12,Bold]]

With[{fieldSize=3,n=4, limitlen=limitlenval, limittime=limittimeval},DynamicModule[{rows=2,cols=n-1,mat=Table[RandomInteger[3],{2},{n-1}],myRange},
myRange[s_]:= Range[s];
Dynamic@Manipulate[
Row[{"Product decomposition",MatrixForm[mat]," = ",
CheckAbort[If[Length[#]>limitlen, Abort[],#],Print["Output too large: the number of inequivalent irreps should be smaller than ", limitlen]]&[TimeConstrained[tenspromatform[mat],limittime,Print["More time needed: the computation is terminated if it takes more than ", limittime, " seconds"]]]}],Evaluate@With[{makeRow=Function[{rowIndex}, Map[Function[{colIndex},InputField[Dynamic[mat[[rowIndex,colIndex]]],Number,FieldSize->fieldSize]],myRange[cols]],HoldAll]},
Row[{Grid[Map[makeRow,myRange[rows]]],Invisible["xxxxxx"],Column[{"Tensor product of two irreducible representations specified by their higest weight.","Lines refer to the n-1 components of the chosen highest weights in the basis of fundamental weights (Dynkin basis)."}]}]],
Row[{Panel[Style[cols+1,FontSize->14,Bold],Style["SU(n), with n =",Bold, FontSize->14],Left,BaselinePosition->Bottom],
Panel[Style[Column[{"Product of irreducible","representations of SU(n)","Decomposition into direct sum"},Center], "Title"]]},Invisible["xxxxxx"]],
Column[{"The result is a list of pairs:", "The first element gives the components of each term of the decomposition.","the second element gives its multiplicity."}],
Button["Decrease n",If[rows>1,
mat=Map[(Drop[#,-1])&,mat];
cols--;]],
Button["Increase n",
mat=Transpose[Append[Transpose[mat],Table[0,{1+1}]]];
cols++;]],SaveDefinitions->True,SynchronousUpdating-> False]]

CAPTION

The program decomposes the product of two irreducible representations of SU(n) into a direct sum.

DETAILS

The decomposition of the tensor product of irreducible representations is done by using an improved hive technique developed by the author and inspired from [1], [2], [3]. 
In order to speed up the calculation we use a basis of elementary pictographs where syzygies (constraints) are eliminated before the actual reduction of the system of inequalities takes place.
Pictographs themselves (BZ-triangles, KT-honeycombs, O-blades), corresponding to a chosen space of intertwiners,  are not displayed here :  see the companion programs HYPERLINK. 

[1] MouseOver
[2] MouseOver
[3] MouseOver

The code is made of two parts :
- A Mathematica package called shorttensorProdIrrepPackage available there HYPERLINK. It can be run into any Mathematica session. It does not contain any limitation.
 The main symbol exported by the package is the function tensorproduct (see also the related command tenspromatform).
- A dynamic module that builds the user interface. This latter code is a bit convoluted because it is supposed to run not only in Mathematica but also with the various versions of the CDF Reader. As of September 2017, the IOS version of the CDF Reader does not accept nested manipulate commands (this would have been the easiest solution).

CAVEATS

CITATION

If you use this program in a scientific publication or talk, please give proper academic credit to the author :

MouseOver
MouseOver
September 2017

Code for interface  (for the CDF Player on IOS)

DECOMPOSITION INTO A DIRECT SUM OF THE PRODUCT OF IRREDUCIBLE REPRESENTATIONS OF SU(n)  -  Interface - Manual update of components.

limitlenval=800;
limittimeval=1.5;

Print[Style["Web version: The number of inequivalent irreps generated by the program should be smaller than ",12,Bold], Style[limitlenval,12,Bold]]

Print[Style["Web version: the computation is terminated if it takes more than ",12,Bold],
Style[limittimeval,12,Bold],Style[" seconds",12,Bold]]

With[{fieldSize=3,n=4, limitlen=limitlenval, limittime=limittimeval},DynamicModule[{rows=2,cols=n-1,mat=Table[RandomInteger[3],{2},{n-1}],myRange},
myRange[s_]:= Range[s];
Dynamic@Manipulate[
Row[{Invisible[doit],"Product decomposition",MatrixForm[mat]," = ",
CheckAbort[If[Length[#]>limitlen, Abort[],#],Print["Output too large: the number of inequivalent irreps should be smaller than ", limitlen]]&[TimeConstrained[tenspromatform[mat],limittime,Print["More time needed: the computation is terminated if it takes more than ", limittime, " seconds"]]]}],Evaluate@With[{makeRow=Function[{rowIndex}, Map[Function[{colIndex},InputField[Dynamic[mat[[rowIndex,colIndex]]],Number,FieldSize->fieldSize]],myRange[cols]],HoldAll]},
Row[{Grid[Map[makeRow,myRange[rows]]],Invisible["xxxxxx"],Column[{"Tensor product of two irreducible representations specified by their higest weight.","Lines refer to the n-1 components of the chosen highest weights in the basis of fundamental weights (Dynkin basis)."}]}]],
Row[{Panel[Style[cols+1,FontSize->14,Bold],Style["SU(n), with n =",Bold, FontSize->14],Left,BaselinePosition->Bottom],
Button[Style["Update", Bold, FontSize->14,Blue],rows++;rows--;],
Panel[Style[Column[{"Product of irreducible","representations of SU(n)","Decomposition into direct sum"},Center], "Title"]]},Invisible["xxxxxx"]],
Column[{"The result is a list of pairs:", "The first element gives the components of each term of the decomposition.","the second element gives its multiplicity."}],
Button["Decrease n",
If[rows>1,
mat=Map[(Drop[#,-1])&,mat];
cols--;]],
Button["Increase n",
mat=Transpose[Append[Transpose[mat],Table[0,{1+1}]]];
cols++;],
{{doit,0,""},{0},ControlType->None},
TrackedSymbols:> {doit}],
SaveDefinitions->True,SynchronousUpdating-> False]]

CAPTION

The program decomposes the product of two irreducible representations of SU(n) into a direct sum.

DETAILS

The decomposition of the tensor product of irreducible representations is done by using an improved hive technique developed by the author and inspired from [1], [2], [3]. 
In order to speed up the calculation we use a basis of elementary pictographs where syzygies (constraints) are eliminated before the actual reduction of the system of inequalities takes place.
Pictographs themselves (BZ-triangles, KT-honeycombs, O-blades), corresponding to a chosen space of intertwiners,  are not displayed here :  see the companion programs “obladesSUn” and “hobeycombsSUn”. 

[1] MouseOver
[2] MouseOver
[3] MouseOver

The code is made of two parts :
- A Mathematica package called “shorttensorProdIrrepPackage” defined in the file “tensorProdIrrep.nb” . It can be downloaded and run into any Mathematica session. It does not contain any limitation.
The main symbol exported by the package is the function tensorproduct (and the related command tenspromatform).
- A dynamic module that builds the user interface. This latter code is a bit convoluted because it is supposed to run not only in Mathematica but also with the various versions of the CDF Reader. 
Using nested manipulate commands would have been the preferred solution, but as of September 2017, the IOS version of the CDF Reader does not accept nested manipulate commands.

CAVEATS

CITATION

If you use this program in a scientific publication or talk, please give proper academic credit to the author :

MouseOver
MouseOver
September 2017

Todo

Warning: because of the change of behavior of Reduce when the nb of solutions  > 10 we use Solve here, but one should find a replacement for componentsEdgesAndnuc[{lam__},{mu__},{nuc__}] with three arguments.
 This is not used here anyway in the shorttensorProdIrrepPackage, the latter being an adapted (because it uses solve) and shortened version (because it only contains the tensorproduct code) of the /Users/robert/Library/Mathematica/Applications/oblade.m package.
If we modify the package, using not only the fct tensorproduct with two arguments, but the fct tensorproductCC, or the fct multiplicity, with three arguments, for instance if we use the full tensorProdIrrepPackage we should worry when using components of weights for SU(n), with n larger than 10. 
To solve this problem we could revert to Reduce (instead of Solve) but modify its DiscreteSolutionBound option.

Add formulae and values for dimensions of irreps

On the iPad the cdf program works fine when the tablet is in portrait (vertical) mode, but not when it is on landscape ( horizontal) mode !

This file uses a single Manipulate wrapped into a dynamic module, in order to avoid a code using nested manipulates, something forbidden (as of Nov 2017) by the IOS cdf Reader.

WIP

dimensionIrrepSU[ruplet_]:=
With[{rk=Length[ruplet]},Product[With[{p=pval},Product[(p+Sum[ruplet[[t]],{t,s,s+p-1}]),{s,1,rk-(p-1)}]],{pval,1,rk}]/Product[x!, {x,1,rk}]]

Examples

restp=tensorproduct[{1,2,0,3},{1,0,2,1}]

dimensionIrrepSU[{2,0,1,2}]

MapAt[dimensionIrrepSU,restp,Table[{z,1},{z,1,Length[restp]}]]

Apply[Times,%,{1}]

Total[%]

Apply[Times,Map[dimensionIrrepSU,{{1,2,0,3},{1,0,2,1}}]]