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).
TruncatedTensorAlgebra — Type
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::RBase algebra over which the signature is defined.base_dimension::IntDimensiondof the underlying path or membrane.truncation_level::IntTruncation levelkof the signature.sequence_type::SymbolType 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.
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_level — Method
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 levelk.
base_dimension — Method
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: dimensiond.
base_algebra — Method
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.
sequence_type — Method
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.
TruncatedTensorAlgebraElem
Accessor functions for the components of a TruncatedTensorAlgebraElem.
TruncatedTensorAlgebraElem — Type
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
Base.parent — Method
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.
tensor_sequence — Method
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: levelk-1tensor.
Each entry is an array of order equal to its level.
Returns
Vector{Array{E}}: tensor sequence.
Base.getindex — Method
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
wdetermines 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 byw....
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 3Standard 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
ArgumentErrorif thesequence_typeofaorbis 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}.
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
ArgumentErrorif thesequence_typeofaorbis 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
+, seeBase.:+.
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
ArgumentErrorif thesequence_typeofaandbis not a matching pair of:iisor:p2id. The type:p2is 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 termsaⱼ ⊗ b_{i-j}are accumulated viaconcatenate_tensors. - See also:
Base.:+,Base.:-.
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.
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.
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(ntimes).n == 0: the identity elementone(parent(a)).n < 0:inv(a) * inv(a) * ... * inv(a)(|n|times).
Throws
ArgumentErrorifsequence_typeis not:iisor:p2id.
using Oscar
T = TruncatedTensorAlgebra(QQ,2, 3)
T=sig(T,:axis)
T^3Notes
Base.inv — Function
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
ArgumentErrorifsequence_typeis not:iisor:p2id.
Notes
Base.exp — Function
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
ArgumentErrorifsequence_typeis not:iis.
Example
using Oscar
T = TruncatedTensorAlgebra(QQ,2, 3)
T=sig(T,:axis)
exp(T)Notes
Base.log — Function
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
ArgumentErrorifsequence_typeis not:iis.
Example
using Oscar
T = TruncatedTensorAlgebra(QQ,2, 3)
T=sig(T,:axis)
log(T)
exp(log(T))==TNotes
Base.vec — Function
vec(x::TruncatedTensorAlgebraElem) -> VectorFlatten 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)Base.:(==) — Function
==(a::TruncatedTensorAlgebraElem, b::TruncatedTensorAlgebraElem) -> BoolTest 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
ArgumentErrorif either element has an unsupportedsequence_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 == S2Signature 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_type | Description | Key arguments |
|---|---|---|
:point | Constant path (unit in $G_{d,k}$) | — |
:axis | Canonical axis path | — |
:mono | Moment path | — |
:pwln | Piecewise linear path | coef, algorithm (:Chen or :congruence) |
:poly | Polynomial path | coef, algorithm (:congruence, :ARS26 or :LS26) |
:pwmon | Piecewise monomial path | composition, regularity |
:spline | Piecewise polynomial (spline) path | coef, composition, regularity |
:segment | Single linear segment | coef |
:axis (membrane) | Canonical axis membrane | shape |
:mono (membrane) | Monomial membrane | shape |
:pwbln | Piecewise bilinear membrane | coef, shape, algorithm (:congruence or :LS26) |
:poly (membrane) | Polynomial membrane | coef, shape |
For membrane types, set
sequence_type=:p2idwhen constructingTruncatedTensorAlgebra.
sig — Function
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::TruncatedTensorAlgebraTruncated tensor algebra specifying the dimension, truncation level, base algebra, and signature type.geom_type::SymbolType of path whose signature is to be computed. Supported values include:For
:iissequence type:pointSignature of a constant path (unit signature: level-0 is 1, higher levels are 0).:segmentSignature of a single segment; requirescoefto specify vector.:axisSignature of a path moving along coordinate axes. Optionalalgorithm::AFS19– Closed-form formulas (Améndola et al., 2019):Chen– Computes using Chen’s identity
:monoSignature of a monomial path.:pwlnPiecewise linear path. Optional arguments:coef– Matrix of coefficientsalgorithm–:Chen,:congruence, or:LS26(Schmitz, 2025)
:pwmonPiecewise monomial path. Optional arguments:composition– Exponents of each segmentregularity– Regularity of the pathalgorithm–:Chenor:ALS26(Améndola et al., 2026)
:polyPolynomial path. Optionalalgorithm::congruenceor:default:ARS26– Alternative method (Améndola et al., 2026+)
:splineSpline path with optionalcoef,composition, andregularity
For
:p2idsequence type:point– Constant path:mono– Monomial membrane:axis– Axis-aligned membrane,algorithmcan be:AFS19(Améndola et al., 2019) or:Chen:poly– Polynomial membrane; ifcoefis 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;algorithmcan be:congruenceor: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
coefandshapeprovide the data describing the path when needed.compositionandregularityare used for piecewise monomial or spline paths.- Throws
ArgumentErrorif unsupported combination of arguments is provided.
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.
recover — Function
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:defaultand:Buchberger.algorithm::Symbol: Algorithm used to recoverA. Options::default/:Buchberger— solves the systemS = A*corevia Gröbner basis computation overQQ. Requirescore, 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. Requiresbase_algebra(parent(S)) == QQand truncation levelk = 3.
Returns
- For
:default/:Buchberger: a matrix of leading coefficients representingA, recovered via normal forms modulo the ideal. - For
:Sch25: the inverse of the transformation matrix computed bytensor_learning_3, i.e.,A = inv(tensor_learning_3(6 * S₃))whereS₃is the level-3 tensor ofS.
Throws
AssertionErrorifcoreis not provided when using:defaultor:Buchberger.AssertionErrorif the resulting ideal is not zero-dimensional or not of degree 1 (when using:default/:Buchberger).AssertionErrorifbase_algebrais notQQork ≠ 3(when using:Sch25).ErrorExceptionif an unknown algorithm symbol is passed.
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.
algorithm | Description |
|---|---|
| (default) | Polynomial surjection map |
:geodesic | Geodesic barycenter (Améndola and Schmitz, 2025; Prop. 4.4) |
:AS25trunc2 | Truncation-level-2 formula (Améndola and Schmitz, 2025; Thm. 4.11) |
:CDMSSU24aBCH | Asymmetrized BCH series (Clausel et al., 2024) |
bary — Function
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— callsbary_TA, the general iterative algorithm valid for any truncation level .:geodesic— geodesic midpoint formulab₁ · 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 levelk = 2.:AS25trunc2— closed-form expression from (Améndola and Schmitz, 2025; Theorem 4.11), valid only for truncation levelk = 2.
Returns
A TruncatedTensorAlgebraElem{R,E} representing the barycenter of bs.
Throws
ArgumentErrorif the combination ofalgorithmand input arguments is not supported (e.g.,:geodesicwith more than 2 elements, ortrunc2algorithms withk ≠ 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
bsmust 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).