Irrep#

class cuequivariance.Irrep#

Rep 的子类,用于李群的不可约表示。

它通过添加以下内容扩展了基类

  • 用于解析字符串表示的正则表达式模式。

  • 两个不可约表示的张量积的选择规则。

  • 用于排序不可约表示的排序关系。

  • 用于计算克莱布什-戈尔丹系数的克莱布什-戈尔丹方法。

定义自定义不可约表示的简单示例#

在某些情况下,您可能希望定义群 \(Z_2\) 的自定义不可约表示集。以下是如何定义 cue.Irrep 群的不可约表示的简单示例。为此,我们需要定义一个继承自 cue.Irrep 的类,并实现所需的方法。

from __future__ import annotations
import re
from typing import Iterator
import numpy as np
import cuequivariance as cue


class Z2(cue.Irrep):
    odd: bool

    def __init__(rep: Z2, odd: bool):
        rep.odd = odd

    @classmethod
    def regexp_pattern(cls) -> re.Pattern:
        return re.compile(r"(odd|even)")

    @classmethod
    def from_string(cls, string: str) -> Z2:
        return cls(odd=string == "odd")

    def __repr__(rep: Z2) -> str:
        return "odd" if rep.odd else "even"

    def __mul__(rep1: Z2, rep2: Z2) -> Iterator[Z2]:
        return [Z2(odd=rep1.odd ^ rep2.odd)]

    @classmethod
    def clebsch_gordan(cls, rep1: Z2, rep2: Z2, rep3: Z2) -> np.ndarray:
        if rep3 in rep1 * rep2:
            return np.array(
                [[[[1]]]]
            )  # (number_of_paths, rep1.dim, rep2.dim, rep3.dim)
        else:
            return np.zeros((0, 1, 1, 1))

    @property
    def dim(rep: Z2) -> int:
        return 1

    def __lt__(rep1: Z2, rep2: Z2) -> bool:
        # False < True
        return rep1.odd < rep2.odd

    @classmethod
    def iterator(cls) -> Iterator[Z2]:
        for odd in [False, True]:
            yield Z2(odd=odd)

    def discrete_generators(rep: Z2) -> np.ndarray:
        if rep.odd:
            return -np.ones((1, 1, 1))  # (number_of_generators, rep.dim, rep.dim)
        else:
            return np.ones((1, 1, 1))

    def continuous_generators(rep: Z2) -> np.ndarray:
        return np.zeros((0, rep.dim, rep.dim))  # (lie_dim, rep.dim, rep.dim)

    def algebra(self) -> np.ndarray:
        return np.zeros((0, 0, 0))  # (lie_dim, lie_dim, lie_dim)


cue.Irreps(Z2, "13x odd + 6x even")
13xodd+6xeven

待实现的方法

classmethod regexp_pattern() Pattern#

用于解析字符串表示的正则表达式模式。

classmethod from_string(
string: str,
) Irrep#

从字符串表示创建实例。

classmethod iterator() Iterable[Irrep]#

李群的所有不可约表示的迭代器。

  • 第一个元素是平凡不可约表示

  • 元素遵守由 __lt__ 定义的偏序

classmethod clebsch_gordan(
rep1: Irrep,
rep2: Irrep,
rep3: Irrep,
) ndarray#

克莱布什-戈尔丹系数张量。

形状为 (路径数量, rep1.dim, rep2.dim, rep3.dim),其中 rep3 是输出不可约表示。

另请参阅

clebsch_gordan().

classmethod trivial() Irrep#

返回平凡不可约表示。

通过返回迭代器的第一个元素来实现。