Documentation


Types

TruncatedTensorAlgebra

The core algebraic structures of the package. TruncatedTensorAlgebra defines the ambient space

\[T_{d,k} := \bigoplus_{\ell=0}^{k} (\mathbb{R}^d)^{\otimes \ell} = \mathbb{R} \oplus \mathbb{R}^d \oplus \mathbb{R}^{d\times d} \oplus \dots \oplus \mathbb{R}^{d \times \dots \times d},\]

together with a coefficient ring and a sequence type (e.g., :iis for iterated-integrals signatures, :p2id for two-parameter id-signatures). Elements of this algebra are represented by TruncatedTensorAlgebraElem, which stores the graded components as a vector of arrays.

For a sufficiently smooth path $X:[0,1]\to \mathbb{R}^d$, its truncated iterated-integrals signature is

\[\sigma^{\le k}(X) = 1 \oplus \sigma^{(1)}(X) \oplus \dots \oplus \sigma^{(k)}(X) \in T_{d,k},\]

with entries

\[\sigma^{(\ell)}(X)_{w_1,\dots,w_\ell} := \int_{0 \le t_1 \le \dots \le t_\ell \le 1} \dot X_{w_1}(t_1)\cdots \dot X_{w_\ell}(t_\ell) \, \mathrm{d}t_1 \cdots \mathrm{d}t_\ell, \quad 1\le w_j \le d.\]

By Chen–Chow's theorem, the image of $\sigma^{\le k}$ lies in the free nilpotent Lie group $\mathcal{G}_{d,k}$ (Friz and Victoir, 2010; Theorem 7.28).

TruncatedTensorAlgebraType
TruncatedTensorAlgebra{R}

Structure that stores a truncated signature of a rough path or a two-parameter object (membrane).

Concrete signatures are stored as elements of this algebra via TruncatedTensorAlgebraElem.

Fields

  • base_algebra::R Base algebra over which the signature is defined.

  • base_dimension::Int Dimension d of the underlying path or membrane.

  • truncation_level::Int Truncation level k of the signature.

  • sequence_type::Symbol Type of signature:

    • :iis — iterated-integrals signature of a rough path (default),
    • :p2id — two-parameter signature for membranes

Example

julia> A = TruncatedTensorAlgebra(QQ, 2, 3; sequence_type = :iis)
TruncatedTensorAlgebra(QQ, 2, 3, :iis)

See also TruncatedTensorAlgebraElem.

source

The constructor of TruncatedTensorAlgebra{R} is flexible with respect to the choice of coefficients. In particular, it supports standard Julia numeric types such as Float64 and other floating-point representations. Moreover, it integrates with the algebraic structures available in Oscar.jl, allowing the use of coefficient rings such as rational numbers or polynomial rings.

truncation_levelMethod
truncation_level(F::TruncatedTensorAlgebra)

Return the truncation level k of the truncated tensor algebra F.

Description

This corresponds to the highest tensor level stored in the truncated signature:

\[ S^{\leq k}(X) = (1, S^1(X), ..., S^k(X))\]

Returns

  • Int: truncation level k.
source
base_dimensionMethod
base_dimension(F::TruncatedTensorAlgebra)

Return the base dimension d of the truncated tensor algebra F.

Description

This is the dimension of the underlying path or membrane from which the signature is computed.

Returns

  • Int: dimension d.
source
base_algebraMethod
base_algebra(F::TruncatedTensorAlgebra)

Return the base algebra of the truncated tensor algebra F.

Description

This specifies the algebra over which tensor coefficients of the signature are defined.

Returns

  • R: base algebra.
source
sequence_typeMethod
sequence_type(F::TruncatedTensorAlgebra)

Return the sequence type of the truncated tensor algebra F.

Description

Indicates the type of signature stored in the algebra:

  • :iis — iterated-integrals signature (rough paths),
  • :p2id — two-parameter signature (membranes).

Returns

  • Symbol: sequence type.
source

TruncatedTensorAlgebraElem

Accessor functions for the components of a TruncatedTensorAlgebraElem.

TruncatedTensorAlgebraElemType
TruncatedTensorAlgebraElem{R,E}

Concrete truncated signature of a rough path or membrane.

This object stores the actual tensor coefficients of the signature up to a fixed truncation level.

Type Parameters

  • R: base algebra of the parent signature object.
  • E: type of the coefficients at each tensor level.

Fields

  • parent::TruncatedTensorAlgebra{R} Signature metadata (dimension, truncation level, type).

  • elem::Vector{Array{E}} Sequence of tensors representing the signature:

    • elem[:] level 1 (vector),
    • elem[:,:]: level 2,
    • elem[:,:,:, ..., :]: level k,

See also TruncatedTensorAlgebra

source
Base.parentMethod
parent(a::TruncatedTensorAlgebraElem)

Return the parent truncated tensor algebra of the element a.

Description

The parent contains the structural metadata of the signature, including dimension, truncation level, and sequence type.

Returns

  • TruncatedTensorAlgebra: parent algebra.
source
tensor_sequenceMethod
tensor_sequence(a::TruncatedTensorAlgebraElem)

Return the tensor sequence representing the truncated signature.

Description

The result is a vector of tensors:

  • index 1: level 0 tensor (escalar),
  • index 2: level 1 tensor (vector),
  • index 3: level 2 tensor (matrix),
  • ...
  • index k: level k-1 tensor.

Each entry is an array of order equal to its level.

Returns

  • Vector{Array{E}}: tensor sequence.
source
Base.getindexMethod
Base.getindex(x::TruncatedTensorAlgebraElem, w...)

Return a tensor element of x at the level determined by the number of indices w....

Description

  • Access tensors at different levels of a truncated tensor algebra element.
  • The number of indices w determines the level:
    • S[:] → level 1 (vector)
    • S[:,:] → level 2 (matrix)
    • S[:,:,:] → level 3 (tensor)
    • and so on for level k.

Arguments

  • x::TruncatedTensorAlgebraElem : element of a truncated tensor algebra.
  • w... : indices to access the tensor at the given level.

Returns

  • A tensor of order k, indexed by w....

Example

using Oscar
d, k = 2, 3
T = TruncatedTensorAlgebra(QQ, d, k)

# Signature of the canonical axis path
S=sig(T, :axis)

S[1]       # level 1
S[:]       # level 1 full
S[:, :]    # level 2
S[:, :, :] # level 3
source

Standard algebraic operations on TruncatedTensorAlgebraElem. All operations respect the truncated tensor algebra structure: multiplication is the shuffle/group product (truncated at level $k$), and exp/log map between the Lie algebra and the Lie group $G_{d,k}$.

Base.:+Function
Base.:+(a::TruncatedTensorAlgebraElem, b::TruncatedTensorAlgebraElem)

Element-wise addition of two elements of a truncated tensor algebra.

Arguments

  • a::TruncatedTensorAlgebraElem: Left-hand side.
  • b::TruncatedTensorAlgebraElem: Right-hand side.

Returns

A new TruncatedTensorAlgebraElem whose tensor sequence is the level-wise sum of those of a and b.

Throws

  • ArgumentError if the sequence_type of a or b is not :iis, :p2id, or :p2, or if they have different sequence types.

Notes

  • Both elements must share the same parent algebra.
  • Addition is defined for sequence_type{:iis, :p2id, :p2}.
source
Base.:-Function
Base.:-(a::TruncatedTensorAlgebraElem, b::TruncatedTensorAlgebraElem)

Element-wise subtraction of two elements of a truncated tensor algebra.

Arguments

  • a::TruncatedTensorAlgebraElem: Left-hand side.
  • b::TruncatedTensorAlgebraElem: Right-hand side.

Returns

A new TruncatedTensorAlgebraElem whose tensor sequence is the level-wise difference of those of a and b.

Throws

  • ArgumentError if the sequence_type of a or b is not :iis, :p2id, or :p2, or if they have different sequence types.

Notes

  • Both elements must share the same parent algebra.
  • Subtraction is defined for sequence_type{:iis, :p2id, :p2}.
  • Analogous to +, see Base.:+.
source
Base.:*Function
Base.:*(a::TruncatedTensorAlgebraElem, b::TruncatedTensorAlgebraElem)

Chen product (concatenation product) of two elements in a truncated tensor algebra, implementing Chen's identity for iterated integrals.

For two signatures a and b of a path, the product at level i is given by:

\[(a \cdot b)_i = a_i + b_i + \sum_{j=1}^{i-1} a_j \otimes b_{i-j}\]

where denotes the tensor product of arrays (concatenate_tensors).

Arguments

  • a::TruncatedTensorAlgebraElem{R,E}: Left-hand side element.
  • b::TruncatedTensorAlgebraElem{R,E}: Right-hand side element.

Returns

A new TruncatedTensorAlgebraElem representing the Chen product of a and b, truncated at the same level k as the parent algebra.

Throws

  • ArgumentError if the sequence_type of a and b is not a matching pair of :iis or :p2id. The type :p2 is not supported for this operation.

Notes

  • Both elements must share the same parent algebra and the same sequence_type.
  • The level-0 component is inherited from a (as expected for the Chen product).
  • The level-1 component is the sum a₁ + b₁.
  • For levels i ≥ 2, the cross terms aⱼ ⊗ b_{i-j} are accumulated via concatenate_tensors.
  • See also: Base.:+, Base.:-.
source
Base.:*(matrix::AbstractMatrix, x::TruncatedTensorAlgebraElem)

Matrix-tensor congruence multiplication.

  • Only defined for sequence_type == :iis.
  • Left-multiplies a truncated signature by a matrix using a tensor congruence operation.
source
Base.:*(a::Number, b::TruncatedTensorAlgebraElem)

Scalar multiplication of a truncated signature.

  • Only defined for sequence_type == :iis.
  • Multiplies each tensor level by the scalar a.
  • Supports numbers (Number) or algebra elements.
  • Returns a new TruncatedTensorAlgebraElem.
source
Base.:^Function
Base.:^(a::TruncatedTensorAlgebraElem, n::Int)

Exponentiation of an element in a truncated tensor algebra via iterated Chen product.

Arguments

  • a::TruncatedTensorAlgebraElem: Base element.
  • n::Int: Integer exponent (positive, negative, or zero).

Returns

A new TruncatedTensorAlgebraElem representing the n-fold Chen product of a:

  • n > 0: a * a * ... * a (n times).
  • n == 0: the identity element one(parent(a)).
  • n < 0: inv(a) * inv(a) * ... * inv(a) (|n| times).

Throws

  • ArgumentError if sequence_type is not :iis or :p2id.
using Oscar

T = TruncatedTensorAlgebra(QQ,2, 3)
T=sig(T,:axis)

T^3

Notes

  • Defined for sequence_type{:iis, :p2id}. Not supported for :p2.
  • See also: Base.inv, Base.:*.
source
Base.invFunction
Base.inv(a::TruncatedTensorAlgebraElem)

Multiplicative inverse (Chen inverse) of an element in a truncated tensor algebra.

The inverse is computed by lifting a to a free truncated signature algebra, inverting there, and evaluating the result back at a.

Arguments

  • a::TruncatedTensorAlgebraElem: Element to invert.

Returns

A new TruncatedTensorAlgebraElem representing a⁻¹ in the Chen product sense, satisfying a * inv(a) == one(parent(a)).

Throws

  • ArgumentError if sequence_type is not :iis or :p2id.

Notes

  • Defined for sequence_type{:iis, :p2id}. Not supported for :p2.
  • See also: Base.:*, Base.:^.
source
Base.expFunction
Base.exp(a::TruncatedTensorAlgebraElem)

Exponential of an element in a truncated tensor algebra, computed via the formal power series truncated at level k:

\[\exp(a) = \sum_{n=0}^{k} \frac{a^n}{n!}\]

The exponential is computed by lifting a to a free truncated signature algebra, evaluating exp there, and mapping the result back.

Arguments

  • a::TruncatedTensorAlgebraElem: Element to exponentiate.

Returns

A new TruncatedTensorAlgebraElem representing exp(a), truncated at the same level k as the parent algebra.

Throws

  • ArgumentError if sequence_type is not :iis.

Example

using Oscar

T = TruncatedTensorAlgebra(QQ,2, 3)

T=sig(T,:axis)

exp(T)

Notes

  • Only defined for sequence_type == :iis. Not supported for :p2id or :p2.
  • The input a is expected to have vanishing level-0 component, as is standard for log-signatures (i.e., a lives in the Lie algebra, not the group).
  • See also: Base.log, Base.inv, Base.:^.
source
Base.logFunction
Base.log(a::TruncatedTensorAlgebraElem)

Logarithm of an element in a truncated tensor algebra, computed via the formal power series truncated at level k:

\[\log(a) = \sum_{n=1}^{k} \frac{(-1)^{n+1}}{n} (a - 1)^n\]

The logarithm is computed by lifting a to a free truncated signature algebra, evaluating log there, and mapping the result back.

Arguments

  • a::TruncatedTensorAlgebraElem: Element to take the logarithm of.

Returns

A new TruncatedTensorAlgebraElem representing log(a), truncated at the same level k as the parent algebra. The result lives in the Lie algebra (vanishing level-0 component).

Throws

  • ArgumentError if sequence_type is not :iis.

Example

using Oscar 

T = TruncatedTensorAlgebra(QQ,2, 3)

T=sig(T,:axis)

log(T)
exp(log(T))==T

Notes

  • Only defined for sequence_type == :iis. Not supported for :p2id or :p2.
  • The input a is expected to have level-0 component equal to 1 (i.e., a lives in the group, not the Lie algebra).
  • log and exp are mutual inverses: log(exp(x)) == x and exp(log(a)) == a.
  • See also: Base.exp, Base.inv, Base.:^.
source
Base.vecFunction
vec(x::TruncatedTensorAlgebraElem) -> Vector

Flatten a TruncatedTensorAlgebraElem into a single vector by concatenating the vectorizations of each tensor in its sequence.

Arguments

  • x::TruncatedTensorAlgebraElem: Element of a truncated tensor algebra.

Returns

A Vector with all entries of the tensor sequence laid out contiguously.

Example

using Oscar
d, k = 2, 3
T = TruncatedTensorAlgebra(QQ, d, k)

# Signature of the canonical axis path
S=sig(T, :axis)


v = vec(S)
source
Base.:(==)Function
==(a::TruncatedTensorAlgebraElem, b::TruncatedTensorAlgebraElem) -> Bool

Test equality of two elements of a truncated tensor algebra.

Two elements are equal if they share the same parent algebra and their tensor sequences are equal. Only defined for sequence_type{:iis, :p2id, :p2}.

Arguments

  • a::TruncatedTensorAlgebraElem: Left-hand side.
  • b::TruncatedTensorAlgebraElem: Right-hand side.

Returns

true if same parent and same tensor sequence, false otherwise.

Throws

  • ArgumentError if either element has an unsupported sequence_type, or if they have different sequence types.

Example

using Oscar
d, k = 2, 3
T = TruncatedTensorAlgebra(QQ, d, k)

S1=sig(T, :axis)
S2=sig(T, :axis)

S1 == S2
source

Signature Constructors

The primary interface for computing signatures. sig dispatches on the geom_type symbol to select the appropriate path or membrane class, and accepts keyword arguments for coefficients, shape, composition, regularity, and algorithm choice. See the table below for supported geometry types.

geom_typeDescriptionKey arguments
:pointConstant path (unit in $G_{d,k}$)
:axisCanonical axis path
:monoMoment path
:pwlnPiecewise linear pathcoef, algorithm (:Chen or :congruence)
:polyPolynomial pathcoef, algorithm (:congruence, :ARS26 or :LS26)
:pwmonPiecewise monomial pathcomposition, regularity
:splinePiecewise polynomial (spline) pathcoef, composition, regularity
:segmentSingle linear segmentcoef
:axis (membrane)Canonical axis membraneshape
:mono (membrane)Monomial membraneshape
:pwblnPiecewise bilinear membranecoef, shape, algorithm (:congruence or :LS26)
:poly (membrane)Polynomial membranecoef, shape

For membrane types, set sequence_type=:p2id when constructing TruncatedTensorAlgebra.

sigFunction
sig(T::TruncatedTensorAlgebra, geom_type::Symbol; coef = [], shape = [], composition::Vector{Int} = Int[], regularity::Int = 0,algorithm::Symbol = :default)

Compute the truncated signature associated with a specified path type inside the truncated tensor algebra T.

Arguments

  • T::TruncatedTensorAlgebra Truncated tensor algebra specifying the dimension, truncation level, base algebra, and signature type.

  • geom_type::Symbol Type of path whose signature is to be computed. Supported values include:

    For :iis sequence type

    • :point Signature of a constant path (unit signature: level-0 is 1, higher levels are 0).

    • :segment Signature of a single segment; requires coef to specify vector.

    • :axis Signature of a path moving along coordinate axes. Optional algorithm:

    • :mono Signature of a monomial path.

    • :pwln Piecewise linear path. Optional arguments:

      • coef – Matrix of coefficients
      • algorithm:Chen, :congruence, or :LS26 (Schmitz, 2025)
    • :pwmon Piecewise monomial path. Optional arguments:

      • composition – Exponents of each segment
      • regularity – Regularity of the path
      • algorithm:Chen or :ALS26 (Améndola et al., 2026)
    • :poly Polynomial path. Optional algorithm:

    • :spline Spline path with optional coef, composition, and regularity

    For :p2id sequence type

    • :point – Constant path
    • :mono – Monomial membrane
    • :axis – Axis-aligned membrane, algorithm can be :AFS19(Améndola et al., 2019) or :Chen
    • :poly – Polynomial membrane; if coef is a matrix, it is interpreted as coefficients of a 2-parameter polynomial; otherwise, it is interpreted as a vector of coefficients for the monomial basis.
    • :pwbln – Piecewise bilinear path; algorithm can be :congruence or :LS26 (Améndola et al., 2026)

Notes

  • The function automatically dispatches based on sequence_type(T):
    • :iis – Indexed iterated sequences (typical rough path)
    • :p2id – 2-parameter (id) signature
    • :p2 – Currently not supported
  • coef and shape provide the data describing the path when needed.
  • composition and regularity are used for piecewise monomial or spline paths.
  • Throws ArgumentError if unsupported combination of arguments is provided.
source

Tensor Learning / Path Recovery

Tools for the inverse problem of recovering a path from its signature tensor. recover solves the polynomial system $S = A * C$ using Gröbner bases, where $C$ is a core tensor (axis, polynomial, spline, or membrane). The optional algorithm=:Sch25 selects the efficient congruence-stabilizer method that scales as $O(d^4)$ in expectation.

recoverFunction
recover(S::TruncatedTensorAlgebraElem; 
        core::Union{TruncatedTensorAlgebraElem, Nothing}=nothing,
        algorithm::Symbol = :default)

Recover a linear transformation matrix A from a truncated signature S, solving the tensor learning (path recovery) inverse problem:

\[S = A \cdot core\]

where core is a known core tensor (typically the signature of a canonical axis path) and A is the unknown invertible matrix encoding the path.

The uniqueness of this solution (over the reals) is guaranteed by (Pfeffer et al., 2019; Theorem 6.2) under the assumption that S lies in the orbit of core under matrix-tensor congruence.

See: (Schmitz, 2025).

Arguments

  • S::TruncatedTensorAlgebraElem: The observed truncated signature to invert.
  • core::Union{TruncatedTensorAlgebraElem, Nothing}: The core tensor representing the signature of the canonical axis path. Required for :default and :Buchberger.
  • algorithm::Symbol: Algorithm used to recover A. Options:
    • :default / :Buchberger — solves the system S = A*core via Gröbner basis computation over QQ. Requires core, and the resulting ideal must be zero-dimensional of degree 1.
    • :Sch25 — efficient algorithm from (Schmitz, 2025), based on symbolic multilinear algebra and Gauß transformations on the third-order signature tensor. Requires base_algebra(parent(S)) == QQ and truncation level k = 3.

Returns

  • For :default / :Buchberger: a matrix of leading coefficients representing A, recovered via normal forms modulo the ideal.
  • For :Sch25: the inverse of the transformation matrix computed by tensor_learning_3, i.e., A = inv(tensor_learning_3(6 * S₃)) where S₃ is the level-3 tensor of S.

Throws

  • AssertionError if core is not provided when using :default or :Buchberger.
  • AssertionError if the resulting ideal is not zero-dimensional or not of degree 1 (when using :default / :Buchberger).
  • AssertionError if base_algebra is not QQ or k ≠ 3 (when using :Sch25).
  • ErrorException if an unknown algorithm symbol is passed.
source

Barycenters

The expected signature of a family of paths is not necessarily itself a signature. Motivated by this, (Clausel et al., 2024; Améndola and Schmitz, 2025) introduce the notion of a Lie group barycenter on signatures, following Buser and Karcher.

Given $S_1,\dots,S_N\in\mathcal{G}_{d,k}$, the equation

\[0 = \sum_{i=1}^N \log\!\big(M^{-1}\cdot S_i\big)\]

defines a unique element $M\in\mathcal{G}_{d,k}$, called the Lie group barycenter.

By (Améndola and Schmitz, 2025; Proposition 4.9), the solution map

\[\mathsf{bary}:\mathcal{G}_{d,k}^N \to \mathcal{G}_{d,k}, \quad (S_1,\dots,S_N)\mapsto M\]

is a (non-commutative) polynomial surjection in the graded components. Our default implementation uses this polynomial map.

algorithmDescription
(default)Polynomial surjection map
:geodesicGeodesic barycenter (Améndola and Schmitz, 2025; Prop. 4.4)
:AS25trunc2Truncation-level-2 formula (Améndola and Schmitz, 2025; Thm. 4.11)
:CDMSSU24aBCHAsymmetrized BCH series (Clausel et al., 2024)
baryFunction
bary(bs::Vector{TruncatedTensorAlgebraElem{R, E}}; algorithm::Symbol = :default) where {R, E}

Compute the Lie group barycenter (in the sense of Buser and Karcher) of a collection of elements in a truncated tensor algebra, representing truncated path signatures.

The barycenter is the unique group element $m$ satisfying the implicit equation

\[\sum_{i=1}^{N} \log(m^{-1} \cdot b_i) = 0\]

in the associated Lie algebra. This is distinct from the naive mean (pointwise average of logarithms), as it preserves the group structure of the truncated signature space.

See also: (Améndola and Schmitz, 2025).

Arguments

  • bs::Vector{TruncatedTensorAlgebraElem{R,E}}: A nonempty vector of elements from the same truncated tensor algebra (all must share the same parent).
  • algorithm::Symbol: The algorithm used to compute the barycenter. Options:
    • :default — calls bary_TA, the general iterative algorithm valid for any truncation level .
    • :geodesic — geodesic midpoint formula b₁ · exp(½ · log(b₁⁻¹ · b₂)); only valid for exactly 2 elements.
    • :CDMSSU24trunc2 — specialized algorithm from (Améndola and Schmitz, 2025; Theorem 4.11). valid only for truncation level k = 2.
    • :AS25trunc2 — closed-form expression from (Améndola and Schmitz, 2025; Theorem 4.11), valid only for truncation level k = 2.

Returns

A TruncatedTensorAlgebraElem{R,E} representing the barycenter of bs.

Throws

  • ArgumentError if the combination of algorithm and input arguments is not supported (e.g., :geodesic with more than 2 elements, or trunc2 algorithms with k ≠ 2).

Examples

# Default algorithm (any number of elements, any truncation level)
bary(bs)

# Geodesic midpoint of exactly 2 elements
bary([b1, b2]; algorithm = :geodesic)

# Closed-form algorithm at truncation level k = 2
bary(bs; algorithm = :AS25trunc2)

Notes

  • All elements in bs must belong to the same parent algebra.
  • The barycenter is not the pointwise expectation of tensor entries; it lives in the free nilpotent Lie group and can be interpreted as the signature of some path.
  • For k ≥ 3, the barycenter differs from the naive mean in the Lie algebra; see (Améndola and Schmitz, 2025; Example 4.9).
source