Irreps#

class cuequivariance.Irreps#

Direct sum of irreducible representations with multiplicities.

For more information, see Groups and Representations.

Parameters:
  • irrep_class – Class of the irreducible representations (e.g., SU2, SO3, O3).

  • input – A description of multiplicities of each irreducible representation.

Examples

>>> Irreps("SO3", "16x0 + 4x1")
16x0+4x1
>>> Irreps(cue.SO3, "16x0 + 4x1")
16x0+4x1
>>> Irreps(cue.SO3, [(16, 0), (4, 1)])
16x0+4x1
>>> with cue.assume("SO3"):
...     Irreps("16x0 + 4x1")
16x0+4x1

Methods

__init__(*args)#
new_scalars(mul)#

Return a representation with all scalar representations.

Examples

>>> Irreps("SO3", "32x1").new_scalars(2)
2x0
Parameters:

mul (int)

Return type:

Irreps

count(rep)#

Count the total multiplicity of a representation.

Examples

>>> Irreps("SO3", "100x0 + 20x1 + 10x0").count("0")
110
Parameters:

rep (str | Irrep)

Return type:

int

property dim: int#

Total dimension of the representation.

Examples

>>> Irreps("SO3", "100x0 + 10x1").dim
130
property num_irreps: int#

Return the number of irreducible representations.

Examples

>>> Irreps("SO3", "100x0 + 10x1").num_irreps
110
property muls: list[int]#

List of multiplicities.

Examples

>>> Irreps("SO3", "100x0 + 10x1").muls
[100, 10]
slices()#

List of slices for each segment of the representation.

Examples

>>> Irreps("SO3", "100x0 + 10x1").slices()
[slice(0, 100, None), slice(100, 130, None)]
Return type:

list[slice]

is_scalar()#

All representations are scalar.

Note

This function does not check the multiplicity of the representation.

Examples

>>> Irreps("SO3", "100x0 + 0x1").is_scalar()
False
>>> Irreps("SO3", "100x0").is_scalar()
True
Return type:

bool

merge_consecutive()#

Merge consecutive segments with the same representation.

Examples

>>> Irreps("SO3", "1 + 1 + 0 + 1").merge_consecutive()
2x1+0+1
Return type:

Irreps

remove_zero_multiplicities()#

Remove zero multiplicities.

Examples

>>> Irreps("SO3", "1 + 0x2 + 1").remove_zero_multiplicities()
1+1
Return type:

Irreps

simplify()#

Simplify the representation by removing zero multiplicities and merging consecutive tuples.

Examples

>>> Irreps("SO3", "1 + 0x2 + 1").simplify()
2x1
Return type:

Irreps

sort()#

Sort the representation.

Returns:

The sorted representation and associated permutations.

Return type:

SortResult

Examples

>>> Irreps("SO3", "1 + 2 + 0 + 1").sort()
SortResult(irreps=0+1+1+2, perm=(1, 3, 0, 2), inv=(2, 0, 3, 1))
regroup()#

Regroup the representation by sorting and simplifying.

Examples

>>> Irreps("SO3", "1 + 2 + 0 + 1").regroup()
0+2x1+2
Return type:

Irreps

set_mul(mul)#

Set the multiplicity of all segments.

Examples

>>> Irreps("SO3", "3x0 + 2x0 + 4x1").set_mul(2)
2x0+2x0+2x1
Parameters:

mul (int)

Return type:

Irreps

filter(*, keep=None, drop=None, mask=None)#

Filter the representation.

Parameters:
  • keep (str, list of Irrep, callable, optional) – Keep only the specified representations.

  • drop (str, list of Irrep, callable, optional) – Drop the specified representations.

  • mask (Sequence[bool] | None)

Return type:

Irreps

Examples

>>> Irreps("SO3", "4x0 + 4x1 + 2x2").filter(keep="0 + 1")
4x0+4x1
>>> Irreps("SO3", "4x0 + 4x1 + 2x2").filter(drop="0 + 1")
2x2
layout_insensitive()#

True if the representation is layout insensitive.

Examples

>>> Irreps("SO3", "100x0 + 1x1 + 1x2").layout_insensitive()
True
>>> Irreps("SO3", "100x0 + 2x1").layout_insensitive()
False
Return type:

bool