pysiglib.sig_length

pysiglib.sig_length#

sig_length(dimension, degree, *, time_aug=False, lead_lag=False, scalar_term=False)[source]#

Returns the length of a truncated signature,

\[\sum_{i=0}^N d^i = \frac{d^{N+1} - 1}{d - 1},\]

where \(d\) is the dimension of the underlying path and \(N\) is the truncation level of the signature.

Parameters:
  • dimension (int) – Dimension of the underlying path, \(d\)

  • degree (int) – Truncation level of the signature, \(N\)

  • time_aug (bool) – Whether time augmentation is applied before computing the signature. This flag is provided for convenience, and is equivalent to calling sig_length(dimension + 1, degree).

  • lead_lag (bool) – Whether the lead lag transformation is applied before computing the signature. This flag is provided for convenience, and is equivalent to calling sig_length(2 * dimension, degree).

  • scalar_term (bool) – If True, the returned length includes the leading constant-term entry at index 0. If False (default), the length is one less. Must match the scalar_term value used with sig().

Returns:

Length of a truncated signature

Return type:

int

Example:#

import pysiglib

# Length of a truncated signature for a 3-dimensional path at degree 4
length = pysiglib.sig_length(3, 4, scalar_term=True)
print(length) # 121 (= 1 + 3 + 9 + 27 + 81)
# Signature length with time augmentation and lead-lag
import pysiglib

# lead_lag doubles the dimension (6), time_aug adds one (7)
length = pysiglib.sig_length(3, 4, time_aug=True, lead_lag=True, scalar_term=True)
print(length)  # 2801

Citation#

If you found this library useful in your research, please consider citing the paper:

@article{shmelev2025pysiglib,
  title={pySigLib-Fast Signature-Based Computations on CPU and GPU},
  author={Shmelev, Daniil and Salvi, Cristopher},
  journal={arXiv preprint arXiv:2509.10613},
  year={2025}
}