Skip to content

compile_lie_quotient

from tensorsig.offset_coded_signatures.quotients import compile_lie_quotient

Compile a quotient-native normal form and sparse runtime bracket.

Compilation is exact for every current rule and has no numerical rank tolerance.

Source code in src/tensorsig/offset_coded_signatures/_lie_quotients/compiler.py
def compile_lie_quotient(
    quotient: LieQuotient,
    alphabet: QuotientAlphabet,
    max_depth: int,
) -> LieQuotientPlan:
    """Compile a quotient-native normal form and sparse runtime bracket.

    Compilation is exact for every current rule and has no numerical rank
    tolerance.
    """
    if not isinstance(quotient, LieQuotient):
        raise TypeError("quotient must be a LieQuotient.")
    if not isinstance(alphabet, (ProjectedAlphabet, OffsetAlphabet)):
        raise TypeError("alphabet must be ProjectedAlphabet or OffsetAlphabet.")
    if not isinstance(max_depth, int) or isinstance(max_depth, bool):
        raise TypeError("max_depth must be an integer.")
    return _compile_lie_quotient_cached(
        quotient,
        alphabet,
        max_depth,
    )