Skip to content

LogSignaturePlan

from tensorsig.offset_coded_signatures.plans import LogSignaturePlan

Bases: _CompiledPlan

A minimal code-bound local primitive or quotient-primitive plan.

output_dimension property

output_dimension: int

Width of the coded alphabet before primitive projection.

local_quotient_residual property

local_quotient_residual: float | None

Return the reconstruction residual of the represented quotient map.

represented_quotient_indices property

represented_quotient_indices: Tensor

Coordinates reconstructed in the selected homogeneous levels.

quotient_basis property

quotient_basis: tuple[QuotientBasisElement, ...] | None

Stable labels aligned with reconstructed quotient coordinates.

ambient_words property

ambient_words: tuple[tuple[int, ...], ...] | None

Lyndon labels for unquotiented coordinates returned by reconstruction.

evaluate

evaluate(windows: Tensor, *, backend: str = 'auto') -> Tensor

Evaluate minimal local logsignature coordinates.

Source code in src/tensorsig/offset_coded_signatures/plans.py
def evaluate(self, windows: Tensor, *, backend: str = "auto") -> Tensor:
    """Evaluate minimal local logsignature coordinates."""
    return self._evaluate(windows, self._matrix_tensor(), backend=backend)

reconstruct

reconstruct(features: Tensor) -> Tensor

Reconstruct represented ambient or quotient coordinates.

Source code in src/tensorsig/offset_coded_signatures/plans.py
def reconstruct(self, features: Tensor) -> Tensor:
    """Reconstruct represented ambient or quotient coordinates."""
    if not features.dtype.is_floating_point:
        raise ValueError("features must have a floating-point dtype.")
    if features.shape[-1] != self.feature_count:
        raise ValueError(f"Expected {self.feature_count} trailing features.")
    if self._quotient_plan is not None:
        assert self._quotient_decoder is not None
        _, decoder = self._runtime_quotient_tensors(
            features.device,
            features.dtype,
        )
        assert decoder is not None
        return features @ decoder.T
    if not self.is_lossless:
        raise ValueError("A filtered primitive plan is not reconstructive.")
    blocks = []
    for basis, feature_slice in zip(
        self._bases,
        self.level_slices,
        strict=True,
    ):
        assert basis.ambient_decoder is not None
        _, _, decoder = basis.runtime_tensors(
            features.device,
            features.dtype,
        )
        assert decoder is not None
        blocks.append(features[..., feature_slice] @ decoder.T)
    return torch.cat(blocks, dim=-1)