# Operations on Weight Multisets

## Basic Operations

In this section, basic access and arithmetic operations for weight multisets are described. Addition generally corresponds to direct sum of representations. The other arithmetic operations do not necessarily correspond to meaningful operations on the corresponding representation.

### `RootDatum(D): LieRepDec -> RootDtm`

The Root datum over which the weight multiset $D$ is defined.

### `Weights(D): LieRepDec -> SeqEnum, SeqEnum`

### `WeightsAndMultiplicities(D): LieRepDec -> SeqEnum, SeqEnum`

The sequences of weights and multiplicities in the weight multiset $D$.

### `Multiset(D): LieRepDec -> SetMulti`

The weights and multiplicities of the weight multiset $D$ as a normal multiset consisting of vectors.

### `Multiplicity(D, v): LieRepDec, ModTupRngElt -> RngIntElt`

### `Multiplicity(D, v): LieRepDec, SeqEnum -> RngIntElt`

The multiplicity of the weight $v$ in the weight multiset $D$.

### `D eq E: LieRepDec, LieRepDec -> BoolElt`

Returns `true` if, and only if, the weight multisets $D$ and $E$ are identical, i.e. they are defined over identical root data, with equal weights and multiplicities.

### `D + E: LieRepDec, LieRepDec -> BoolElt`

The sum (union) of weight multisets $D$ and $E$, i.e. this corresponds to the direct sum of the two decomposition multisets. The underlying root data must be the same.

Add $V_v$ to $D$. The length of $v$ must be equal to $\dim(R_D)$.

### `D +:= E: LieRepDec, LieRepDec`

Add the weight multiset $E$ to $D$. $R_D$ must be equal to $R_E$.

### `AddRepresentation(~D, E, c): LieRepDec, LieRepDec, RngIntElt`

### `AddRepresentation(~D, E): LieRepDec, LieRepDec`

Add $c$ times the weight multiset $E$ to $D$. The integer $c$ may be omitted, in which case it is assumed to be equal to $1$. The root data of $D$ and $E$ must be identical.

### `D + v: LieRepDec, ModTupRngElt -> BoolElt`

### `D + v: LieRepDec, SeqEnum -> BoolElt`

Add the weight $v$ to the multiset $D$. The weight $v$ must be a sequence of length $d$ or an element of ${\mathbb{Z}}^d$, where $d$ is the dimension of the root datum $R$.

### `AddRepresentation(~D, v, c): LieRepDec, ModTupRngElt, RngIntElt`

### `AddRepresentation(~D, v, c): LieRepDec, SeqEnum, RngIntElt`

### `AddRepresentation(~D, v): LieRepDec, ModTupRngElt`

### `AddRepresentation(~D, v): LieRepDec, SeqEnum`

Add $c$ times the weight $v$ to the multiset $D$. The integer $c$ may be omitted, in which case it is assumed to be equal to $1$. The length of $v$ must be equal to the dimension of the root datum of $D$.

### `D +:= v: LieRepDec, ModTupRngElt`

### `D +:= v: LieRepDec, SeqEnum`

Add the weight $v$ to the multiset $D$. The length of $v$ must be equal to the dimension of the root datum of $D$.

### `D * c: LieRepDec, RngIntElt -> LieRepDec`

The multiset whose weights are equal to those of $D$, and whose multiplicities are $c$ times the multiplicities of $D$.

### `D / c: LieRepDec, RngIntElt -> LieRepDec`

The multiset whose weights are equal to those of $D$, and whose multiplicities are the multiplicities of $D$ divided by $c$. An error is flagged if any of the multiplicities of $D$ is not divisible by $c$.

### `D *:= c: LieRepDec, RngIntElt`

Multiply all multiplicities of the weight multiset $D$ by $c$.

### `D /:= c: LieRepDec, RngIntElt`

Divide all multiplicities of the weight multiset $D$ by $c$. An error is flagged if a multiplicity of $D$ is not divisible by $c$.

### `D * E: LieRepDec, LieRepDec -> LieRepDec`

### `ProductRepresentation(D, E): LieRepDec, LieRepDec -> LieRepDec`

The product of the two weight multisets $D$ and $E$, viewed as polynomials as in the LiE package [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)]. The root datum of the resulting decomposition is the direct sum of the root data of $D$ and $E$. Note that this is does not correspond to the direct sum or tensor product of representations.

### `ProductRepresentation(D, E, R): LieRepDec, LieRepDec, RootDtm -> LieRepDec`

The product of the two weight multisets $D$ and $E$, viewed as polynomials as in the LiE package [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)]. The product is interpreted as a weight multiset over the root datum $R$. An error is flagged if the dimension of $R$ is not the sum of the dimensions of the root data of $D$ and $E$.

### `SubWeights(D, Q, S): LieRepDec, SeqEnum, RootDtm -> LieRepDec`

Let $k$ be the length of the sequence $Q$. The resulting decomposition $E$ has Root datum $S$, and to each highest weight of $D$ corresponds a highest weight $w'$ of $E$, with $w'_i = w_{Q[i]}$, where $i = 1, \ldots, k$. The multiplicities of $E$ are equal to the multiplicities of $D$, but one should note that $E$ might in fact have fewer unique highest weights than $D$, especially if $k < \dim(R_D)$. The dimension of the root datum $S$ must be equal to $k$.

### `PermuteWeights(D, pi, S): LieRepDec, GrpPermElt, RootDtm -> LieRepDec`

Permute the components of the weights in the multiset $D$ by the permutation $\pi$ and interpret the result as a weight multiset over the root datum $S$. If the underlying root datum of $D$ has dimension $d$, then $S$ must also have dimension $d$ and $\pi$ must be an element of ${\operatorname{Sym}}(d)$.

### `Example: Decomp Arithmetic (ex-122af0)`

Arithmetic with decompositions:

```magma
> R := RootDatum("A2" : Isogeny := "SC");
> D := LieRepresentationDecomposition(R, [[2,3],[4,3]], [1,3]);
> D:Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 2 of type A2
     Dimension of weight space:2
     Weights:
          [
               (2 3),
               (4 3)
          ]
     Multiplicities:
          [ 1, 3 ]
> E := D + [5,2];
> E:Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 2 of type A2
     Dimension of weight space:2
     Weights:
          [
               (2 3),
               (4 3),
               (5 2)
          ]
     Multiplicities:
          [ 1, 3, 1 ]
> PermuteWeights(E, Sym(2)!(1,2), R):Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 2 of type A2
     Dimension of weight space:2
     Weights:
          [
               (3 2),
               (3 4),
               (2 5)
          ]
     Multiplicities:
          [ 1, 3, 1 ]
> S := RootDatum("A1" : Isogeny := "SC");
> SubWeights(E, [2], S):Maximal;
Highest weight decomposition of representation of:
     S: Simply connected root datum of dimension 1 of type A1
     Dimension of weight space:1
     Weights:
          [
               (3),
               (2)
          ]
     Multiplicities:
          [ 4, 1 ]

```

## Conversion Functions

Functions for converting between different kinds of weight multiset (decomposition, character, and dominant character multisets). Note that it is the users responsibility to keep track of what kind of multiset they are using. If a function that expects one kind of set receives another, the output is likely to be meaningless.

### `VirtualDecomposition(C): LieRepDec -> LieRepDec`

### `VirtualDecomposition(R, v): RootDtm, Any -> LieRepDec`

The virtual decomposition multiset of the virtual module with dominant character multiset $C$. The second version is provided for convenience, and equivalent to `VirtualDecomposition(LieRepresentationDecomposition(R,v))`.

### `DecomposeCharacter(C): LieRepDec -> LieRepDec`

The decomposition multiset of the module with dominant character multiset $C$. An error is flagged if $D$ is virtual, i.e. if dominant weights occur with negative multiplicities.

### `DominantCharacter(D): LieRepDec -> LieRepDec`

Returns the dominant character multiset with decomposition $D$.

## Calculating with Representations

As described earlier, many operations on representations carry over naturally to operations on their decompositions. This section describes the various functions for this purpose that were ported from LiE.

Note that many functions in this sections have two variants: one that takes decompositions as an argument and one that takes a root datum and a highest weight.

### `RepresentationDimension(D): LieRepDec -> RngIntElt`

The dimension of the module with decomposition polynomial $D$. The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

### `RepresentationDimension(R, v): RootDtm, SeqEnum -> RngIntElt`

### `RepresentationDimension(R, v): RootDtm, ModTupRngElt -> RngIntElt`

The dimension of the module with highest weight $v$ over the root datum $R$. The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

### `CasimirValue(R, w): RootDtm, ModTupRngElt -> FldRatElt`

### `CasimirValue(R, w): RootDtm, SeqEnum[RngIntElt] -> FldRatElt`

The value of the quadratic Casimir on representation with highest weight $w$, normalised to take the value 2 on the highest weight of the adjoint representation. This function is due to Dr. Bruce Westbury, University of Warwick.

### `QuantumDimension(R, w): RootDtm, ModTupRngElt -> SetMulti`

### `QuantumDimension(R, w): RootDtm, SeqEnum[RngIntElt] -> SetMulti`

Two Multisets of positive integers, $Num$ and $Den$, which should be read as follows. Take the product of the integers in $Num$ and divide by the product of the integers in $Den$ to get the ordinary dimension. Replacing each integer by the quantum integer will give the quantum dimension. This function is due to Dr. Bruce Westbury, University of Warwick.

### `Example: Quantum Dimension (ex-e2320d)`

Dimensions:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> D := AdjointRepresentationDecomposition(R);
> RepresentationDimension(D);
28
> wts, mps := WeightsAndMultiplicities(D); wts,mps;
[
    (0 1 0 0)
]
[ 1 ]
> num,den := QuantumDimension(R, wts[1]); num,den;
{* 4^^2, 7 *}
{* 1, 2^^2 *}
> &*num/&*den;
28

```

### `Branch(FromGrp, ToGrp, v, M): RootDtm, RootDtm, ModTupRngElt, AlgMatElt -> LieRepDec`

### `Branch(FromGrp, ToGrp, v, M): RootDtm, RootDtm, SeqEnum, AlgMatElt -> LieRepDec`

```magma
Virtual: BoolElt                    Default: false
```

The decomposition polynomial of the restriction to ToGrp of the irreducible module $V_v$ with respect to the restriction matrix $M$. The matrix $M$ must have dim(FromGrp) rows and Dim(ToGrp) columns.

The matrix $M$ is used in such a way that any weight $v'$ (expressed on the basis of fundamental weights for $g$), when restricted to a torus of ToGrp, becomes the weight $v'M$ (expressed on the basis of fundamental weights for ToGrp). A suitable restriction matrix can often be obtained by use of [`RestrictionMatrix`](representation-other.md#function-lierepdecrestrictionmatrix). The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

The optional argument `Virtual` may be set to `true` to allow occurrence of virtual weights.

### `Branch(ToGrp, D, M): RootDtm, LieRepDec, AlgMatElt -> LieRepDec`

```magma
Virtual: BoolElt                    Default: false
```

As [`Branch`](#function-branchfrtovm)`(FromGrp, ToGrp, v, M)` but with the irreducible module $v$ replaced by the module with decomposition $D$.

### `Collect(R, D, M): RootDtm, LieRepDec, AlgMatElt -> LieRepDec`

This function attempts to perform the inverse operation of [`Branch`](#function-branchtodm), namely to reconstruct an $R$-module from its restriction to $R_D$.

Please note that in LiE one must supply the inverse of the matrix used in Branch. Magma, however, is able to compute inverses itself, so one needs to provide the matrix used in Branch, and not its inverse.

$M$ must be a square matrix whose dimension is equal to the dimension of $R_D$. The dimension of $R$ must be equal to the dimension of $R_D$ as well. The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

### `Example: Branch Collect (ex-e0936d)`

Branch and Collect:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> S := RootDatum("A3T1" : Isogeny := "SC");
> M := RestrictionMatrix(R, S);
> br := Branch(R, S, [1,0,0,0], M);
> br;
Highest weight decomposition of representation of:
     S: Simply connected root datum of dimension 4 of type A3
     Number of terms: 2
> cl := Collect(R, br, M);
> cl:Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Dimension of weight space:4
     Weights:
          [
               (1 0 0 0)
          ]
     Multiplicities:
          [ 1 ]

```

### `TensorProduct(R, v, w): RootDtm, ModTupRngElt, ModTupRngElt -> .`

### `TensorProduct(R, v, w): RootDtm, SeqEnum, SeqEnum -> .`

```magma
Goal: Any                    Default: 
```

The decomposition multiset of the tensor product of the representations with highest weights $v$ and $w$ over the root datum $R$.

If the optional parameter `Goal` is set, only the multiplicity of the irreducible module with highest weight `Goal` is returned. This does not greatly speed up the process, as the same computational steps need to be made, but it will significantly reduce memory consumption. The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

### `TensorProduct(D, E): LieRepDec, LieRepDec -> .`

```magma
Goal: Any                    Default: 
```

The decomposition multiset of the tensor product of the representations with decomposition multisets $D$ and $E$.

If the optional parameter `Goal` is set, only the multiplicity of the irreducible module with highest weight `Goal` is returned. This does not greatly speed up the process, as the same computational steps need to be made, but it will significantly reduce memory consumption. The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

### `TensorProduct(Q): [LieRepDec] -> LieRepDec`

```magma
Goal: Any                    Default: 
```

The decomposition multiset of the tensor product of the representations with decomposition multisets in the sequence $Q$.

If the optional parameter `Goal` is set, only the multiplicity of the irreducible module with highest weight `Goal` is returned. This does not greatly speed up the process, as the same computational steps need to be made, but it will significantly reduce memory consumption. The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

### `TensorPower(R, n, v): RootDtm, RngIntElt, ModTupRngElt -> LieRepDec`

### `TensorPower(R, n, v): RootDtm, RngIntElt, SeqEnum -> LieRepDec`

### `TensorPower(D, n): LieRepDec, RngIntElt -> LieRepDec`

The decomposition of the $n$-th tensor power of $V^R_v$ or $D$.

### `Example: Tensor Power (ex-58edc6)`

Taking tensor powers nicely shows how rapidly the complexity of representations increases, especially if we have a reasonably high weight as highest weight:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> DAd := AdjointRepresentationDecomposition(R);
> pwrs := function(D, n)
>   Q := [D];
>   for i in [2..n] do
>     Q[i] := Tensor(Q[1], Q[i-1]);
>   end for;
>   return Q;
> end function;
> time Q := pwrs(DAd, 7);
Time: 4.900
> [ #q : q in Q ];
[ 1, 7, 15, 30, 54, 91, 143 ]
> DH := LieRepresentationDecomposition(R, [2,2,0,0]);
> time Q := pwrs(DH, 4); [ #q : q in Q ];
Time: 99.070
[ 1, 105, 390, 1017 ]

```

### `AdamsOperator(R, n, v): RootDtm, RngIntElt, ModTupRngElt -> LieRepDec`

### `AdamsOperator(R, n, v): RootDtm, RngIntElt, SeqEnum -> LieRepDec`

### `AdamsOperator(D, n): LieRepDec, RngIntElt -> LieRepDec`

The decomposition polynomial of the virtual module obtained by applying the $n$-th Adams operator to $V^R_v$ or $D$. The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

### `SymmetricPower(R, n, v): RootDtm, RngIntElt, ModTupRngElt -> LieRepDec`

### `SymmetricPower(R, n, v): RootDtm, RngIntElt, SeqEnum -> LieRepDec`

### `SymmetricPower(D, n): LieRepDec, RngIntElt -> LieRepDec`

The decomposition polynomial of $S^n(V^R_v)$, the $n$-th symmetric tensor power of $V^R_v$.

In the second form the irreducible module $V^R_v$ is replaced by the module with decomposition $D$. The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

### `AlternatingPower(R, n, v): RootDtm, RngIntElt, ModTupRngElt -> LieRepDec`

### `AlternatingPower(R, n, v): RootDtm, RngIntElt, SeqEnum -> LieRepDec`

### `AlternatingPower(D, n): LieRepDec, RngIntElt -> LieRepDec`

The decomposition polynomial of ${\rm Alt}^n(V^R_v)$, the $n$-th alternating tensor power of $V^R_v$.

In the second form the irreducible module $V^R_v$ is replaced by the module with decomposition $D$. The algorithm used is described in [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser)].

### `Plethysm(R, lambda, v): RootDtm, SeqEnum, ModTupRngElt -> LieRepDec`

### `Plethysm(R, lambda, v): RootDtm, SeqEnum, SeqEnum -> LieRepDec`

### `Plethysm(D, lambda): LieRepDec, SeqEnum -> LieRepDec`

The decomposition multiset of the $R_D$-module of the plethysm of $V^R_v$ corresponding to the partition $\lambda$. Here $\lambda$ should be a partition of $d= \dim V^R_v$, i.e., a non-increasing sequence consisting of positive integers with sum $d$. The value returned is the decomposition multiset of the representation of $R_D$ that is obtained by composing the representation of $R_D$ afforded by $V^R_v$, with the representation of ${\rm GL}(V^R_v)$ corresponding to the partition $\lambda$. The classical Frobenius formula is used (see [[Andersen, 1977](../../references.md#cite-andersen)] and [[James and Kerber, 1981](../../references.md#cite-james-kerber)]).

In the second form the irreducible module $V^R_v$ is replaced by the module with decomposition $D$.

### `Spectrum(R, v, t): RootDtm, ModTupRngElt, SeqEnum -> SeqEnum`

### `Spectrum(R, v, t): RootDtm, SeqEnum, SeqEnum -> SeqEnum`

### `Spectrum(D, t): LieRepDec, SeqEnum -> SeqEnum`

Let $n$ be the last entry of the sequence $t$; the toral element $t \in T$ will act in any representation of $R$ as a diagonalisable transformation, all of whose eigenvalues are $n$-th roots of unity. This function returns a sequence in which the $i$-th entry is the multiplicity of the eigenvalue $\zeta^i$ in the action of the toral element $t$ on the irreducible module $V^R_v$ (or the module with decomposition $D$, in the second case). Here $\zeta$ is the complex number $e^{2 \pi i /n}$.

See Section [Toral Elements](representations-introduction.md#subsectrdrepsintrotoral) for a description of the format of $t$.

### `Example: Spectrum (ex-66b7b0)`

Spectrum provides a means to recognise toral elements in a more natural form. [[van Leeuwen *et al.*, 1992](../../references.md#cite-leeuwen-cohen-lisser), Section 5.7.3].

```magma
> R := RootDatum("A4" : Isogeny := "SC");
> stdrep := [1,0,0,0];
> t := [1,0,0,0,2];
> stdrep := [1,0,0,0];
> Spectrum(R, stdrep, t);
[ 3, 2 ]
/* Showing that t has 3 eigenvalues 1 (1st root of unity),
   and 2 eigenvalues -1 (2nd root of unity) */
/* We may use the following function for constructing
   toral elements of A_n in the LiE format: */
> mktoral := function(b, d)
>     r := [ (i eq 1)
>               select b[i]
>               else b[i-1]+b[i] mod d
>             : i in [1..(#b-1)]
>          ];
>     r[#b] := d;
>     return r;
> end function;
> t2 := mktoral([0,0,0,1,1], 2); t2;
[ 0, 0, 0, 1, 2 ]
/* We restrict to a one parameter subgroup */
> RM := Transpose(Matrix([[0,0,0,1]]));
> T1 := RootDatum("T1" : Isogeny := "SC");
> Branch(R, T1, stdrep, RM):Maximal;
Highest weight decomposition of representation of:
     T1: Toral root datum of dimension 1
     Dimension of weight space:1
     Weights:
          [
               (1),
               (0),
               (-1)
          ]
     Multiplicities:
          [ 1, 3, 1 ]
/* Indicating that the element of that one parameter
   subgroup parametrised by some complex number z has
   one eigenvalue z^-1, three eigenvalues 1, and one
   eigenvalue z in the standard representation. */

```

### `Demazure(R, v, w): RootDtm, ModTupRngElt, GrpPermElt -> LieRepDec`

### `Demazure(R, v, w): RootDtm, SeqEnum, GrpPermElt -> LieRepDec`

### `Demazure(D, w): LieRepDec, GrpPermElt -> LieRepDec`

Starting with the highest weight $v$ of $R$, or the decomposition $D$, repeatedly apply the Demazure operator $M_{\alpha_i}$, taking for $i$ the successive entries of the Weyl word $w$ (viewed as product of simple reflections).

### `Demazure(R, v): RootDtm, ModTupRngElt -> LieRepDec`

### `Demazure(R, v): RootDtm, SeqEnum -> LieRepDec`

### `Demazure(D): LieRepDec -> LieRepDec`

Equivalent to [`Demazure`](#function-demazurervw)`(R, v, w)` or [`Demazure`](#function-demazured)`(D, w)` where $w$ is the longest word of the Coxeter group of $R$ or $R_D$.

If $D$ is a decomposition polynomial, then the result $E$ is the character polynomial of this decomposition. This is not the most efficient way to compute characters, but it can be very useful in checking other algorithms, since only the most elementary manipulations are involved.

### `Example: Branch Collect (ex-02a067)`

The Demazure operator:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> DAd := AdjointRepresentationDecomposition(R);
> DAdCp := Demazure(DAd); DAdCp;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Number of terms: 25
> DAd2 := AlternatingDominant(DAdCp); DAd2;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Number of terms: 1
> DAd2 eq DAd;
true

```

### `LittlewoodRichardsonTensor(p, q): ModTupRngElt, ModTupRngElt -> SeqEnum, SeqEnum[RngIntElt]`

### `LittlewoodRichardsonTensor(p, q): SeqEnum, SeqEnum -> SeqEnum, SeqEnum[RngIntElt]`

### `LittlewoodRichardsonTensor(P, M, Q, N): SeqEnum, SeqEnum[RngIntElt], SeqEnum, SeqEnum[RngIntElt] -> SeqEnum, SeqEnum[RngIntElt]`

In the first form, $p$ and $q$ are interpreted as dominant weights for the group $SL_n$ (of type $A_{n-1}$) expressed in partition coordinates. Here $n$ is the number of elements of $p$ (which must be equal to the number of elements of $q$).

The tensor product of the corresponding highest weight modules is computed using the Littlewood-Richardson rule, and the result is expressed again in partition coordinates. To be precise, two sequences P, M, are returned, meaning that the highest weight module with partition coordinates P[i] occurs in the tensor product with multiplicity M[i].

In the second form, instead of two irreducible modules, the tensor product of the module having partition coordinates P[i] with multiplicity M[i] and the module having partition coordinates Q[j] with multiplicity N[j] is computed.

### `LittlewoodRichardsonTensor(R, v, w): RootDtm, ModTupRngElt, ModTupRngElt -> LieRepDec`

### `LittlewoodRichardsonTensor(R, v, w): RootDtm, SeqEnum, SeqEnum -> LieRepDec`

### `LittlewoodRichardsonTensor(D, E): LieRepDec, LieRepDec -> LieRepDec`

In the first form, compute the tensor product of the irreducible $A_n$ representations with highest weights $v$ and $w$ using the Littlewood-Richardson rule. In the second form, compute the tensor product of the representations with decompositions $D$ and $E$.

This procedure converts the weights to partitions, computes the tensor product using the Littlewood-Richardson rule (as described above, see [`LittlewoodRichardsonTensor`](#function-littlewoodrichardsontensor-pq)), and converts the result back to a weight multiset.

### `Example: LR Tensor (ex-32f0be)`

We compare the Littlewood-Richardson tensor and the normal tensor:

```magma
> R := RootDatum("A2" : Isogeny := "SC");
> v := [1,2];
> w := [1,1];
> D1 := Tensor(R, v, w);
> D1;
Highest weight decomposition of representation of:
    R: Simply connected root datum of dimension 2 of type A2
    Weights:
        [
            (0 1),
            (2 0),
            (0 4),
            (3 1),
            (2 3),
            (1 2)
        ]
    Multiplicities:
        [ 1, 1, 1, 1, 1, 2 ]
> D2 := LittlewoodRichardsonTensor(R, v, w);
> D2;
Highest weight decomposition of representation of:
    R: Simply connected root datum of dimension 2 of type A2
    Weights:
        [
            (1 2),
            (2 3),
            (2 0),
            (0 4),
            (0 1),
            (3 1)
        ]
    Multiplicities:
        [ 2, 1, 1, 1, 1, 1 ]
> D1 eq D2;
true

```

So the results are identical, as they should be. We could also convert the weights to partitions by hand, directly compute the Littlewood- Richardson tensor, and compare that to the previous result:

```magma
> vp := WeightToPartition(v); wp := WeightToPartition(w);
> vp, wp;
[ 3, 2, 0 ]
[ 2, 1, 0 ]
> parts, mps := LittlewoodRichardsonTensor(vp, wp);
> parts, mps;
[
    (4 4 0),
    (4 3 1),
    (3 3 2),
    (5 3 0),
    (5 2 1),
    (4 2 2)
]
[ 1, 2, 1, 1, 1, 1 ]
> [ PartitionToWeight(p) : p in parts ];
[
    (0 4),
    (1 2),
    (0 1),
    (2 3),
    (3 1),
    (2 0)
]

```

So that again gives the same representation. Finally, note that in some cases computing tensor products using the Littlewood-Richardson rule may be faster than computing them in the normal way:

```magma
> R := RootDatum("A8" : Isogeny := "SC");
> v := [0,0,2,0,1,0,1,2];
> w := [0,2,1,2,0,0,1,0];
> time _ := Tensor(R, v, w);
Time: 2.630
> time _ := LittlewoodRichardsonTensor(R, v, w);
Time: 0.210

```

### `AlternatingDominant(D, w): LieRepDec, GrpPermElt -> LieRepDec`

### `AlternatingDominant(R, wt, w): RootDtm, ModTupRngElt, GrpPermElt -> LieRepDec`

### `AlternatingDominant(R, wt, w): RootDtm, SeqEnum, GrpPermElt -> LieRepDec`

Alternating Dominant of the representation with decomposition $D$ or the irreducible representation $V_{wt}$, with respect to Weyl group element $w$. Starting with $D$, the following operation is repeatedly applied, taking for $i$ the successive entries of $w$ (viewed as reflection). For any (weight, multiplicity) pair $(v, c)$ of $D$ let $v_i = \langle v, \alpha_i \rangle$ be its coefficient of $w_i$; the term is

**–**
unaltered if $v_i \geq 0$,

**–**
removed if $v_i = -1$, and

**–**
replaced by $((v + w_i)r_i - w_i, -c)$ if $v_i = -2$. As a result of the operation for $i$, the coefficient $v_i$ is made non-negative without affecting the image $M_{\alpha_i}(D)$ under the Demazure operator, and hence also without changing the value of its alternating Weyl sum [`AlternatingWeylSum`](#function-alternatingweylsumrv).

### `AlternatingDominant(D): LieRepDec -> LieRepDec`

### `AlternatingDominant(R, wt): RootDtm, ModTupRngElt -> LieRepDec`

### `AlternatingDominant(R, wt): RootDtm, SeqEnum -> LieRepDec`

Equivalent to (but somewhat faster than) the previous [`AlternatingDominant`](#function-altdomdw)($D$, $w$) and [`AlternatingDominant`](#function-altdomrwtw)($R$, $wt$, $w$), with $w$ the longest element of the corresponding Weyl group. If $D$ is interpreted as dominant weights with multiplicities, then the result $E$ contains highest weights and multiplicities.

### `Example: Alternating Dominant (ex-96a07b)`

Example of the alternating dominant:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> v := [1,5,2,1];
> Dec1 := LieRepresentationDecomposition(R, v);
> // First, we construct the character polynomial for the
> // module with highest weight lambda
> Dom := DominantCharacter(Dec1 : InBasis := "Weight"); Dom;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Number of terms: 176
> W := CoxeterGroup(R); #W; act := RootAction(W);
192
> domwts, dommps := WeightsAndMultiplicities(Dom);
> CP := LieRepresentationDecomposition(R);
> for i in [1..#domwts] do
>   wt := domwts[i]; mp := dommps[i];
>   wtor := WeightOrbit(W, wt : Basis := "Weight");
>   for wti in wtor do
>     AddRepresentation(~CP, wti, mp);
>   end for;
> end for;
> CP;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Number of terms: 17712
> time ad := AlternatingDominant(CP); ad:Maximal;
Time: 54.200
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Dimension of weight space:4
     Weights:
          [
               (1 5 2 1)
          ]
     Multiplicities:
          [ 1 ]
> time adalt := AlternatingDominant(CP, LongestElement(W));
Time: 8.330
> ad eq adalt;
true

```

### `AlternatingWeylSum(R, v): RootDtm, ModTupRngElt -> LieRepDec`

### `AlternatingWeylSum(R, v): RootDtm, SeqEnum -> LieRepDec`

### `AlternatingWeylSum(D): LieRepDec -> LieRepDec`

The alternating Weyl sum of $V^R_v$ or $D$. Useful for demonstration purposes, but the fact that the number of terms in the result is a multiple of the order of the CoxeterGroup of $R$ makes it impractical for most groups.
