pysiglib.sig_join

Contents

pysiglib.sig_join#

Added in version v3.0.0.

sig_join(sig, displacement, dimension, degree, *, prepend=False, n_jobs=1)[source]#

Extends a truncated signature by a single displacement vector. This is equivalent to computing sig_combine(sig, linear_sig(displacement)), but is more efficient as it avoids constructing the intermediate linear signature.

Given a signature \(S(x)\) and a displacement \(v\), this computes

\[S(x * v) = S(x) \otimes S(v),\]

where \(S(v)\) is the signature of the linear path defined by \(v\).

Parameters:
  • sig (numpy.ndarray | torch.tensor) – The existing truncated signature, of shape (sig_length,) or (batch_size, sig_length).

  • displacement (numpy.ndarray | torch.tensor) – The displacement vector, of shape (dimension,) or (batch_size, dimension).

  • dimension (int) – Dimension of the underlying space, \(d\).

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

  • prepend (bool) – If True, prepend the linear segment to the front of the path rather than appending it at the end. In that case this computes \(S(v) \otimes S(x) = S(v * x)\). Default is False.

  • n_jobs (int) – Number of threads to run in parallel. If n_jobs = 1, the computation is run serially. If set to -1, all available threads are used. For n_jobs below -1, (max_threads + 1 + n_jobs) threads are used. For example if n_jobs = -2, all threads but one are used.

Returns:

Extended signature, \(S(x * v)\).

Return type:

numpy.ndarray | torch.tensor

Example usage:

import pysiglib
import numpy as np

dimension = 5
degree = 3

path = np.random.uniform(size=(100, dimension))
sig = pysiglib.sig(path, degree)

displacement = np.random.uniform(size=(dimension,))
extended_sig = pysiglib.sig_join(sig, displacement, dimension, degree)

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}
}