pysiglib.logsig_to_sig

pysiglib.logsig_to_sig#

Added in version v3.0.0.

logsig_to_sig(log_sig, dimension, degree, *, time_aug=False, lead_lag=False, method=1, scalar_term=False, n_jobs=1)[source]#

Computes the signature from the log-signature via the truncated tensor exponential. This is the inverse of pysiglib.sig_to_log_sig().

Supports all methods (0, 1, 2). For methods 1 and 2, prepare_log_sig(dimension, degree, method=2) must be called first.

Parameters:
  • log_sig (numpy.ndarray | torch.tensor) – The log-signature or batch of log-signatures, given as a numpy.ndarray or torch.tensor. For a single log-signature, this must be of shape (sig_length,). For a batch, this must be of shape (batch_size, sig_length).

  • dimension (int) – Dimension of the underlying path(s).

  • degree (int) – Truncation degree of the (log) signature(s).

  • time_aug (bool) – Whether the signatures were computed with time_aug=True.

  • lead_lag (bool) – Whether the signatures were computed with lead_lag=True.

  • method (int) – Method to use (0, 1, or 2). Must match the method used to compute the log-signature.

  • scalar_term (bool) – For methods 1 and 2, controls whether the output sig includes the leading constant 1 at index 0. If True, included; if False (default), stripped. Ignored for method 0: the output format is inferred from the input log_sig (which is sig-shaped for method 0) and matches it.

  • 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:

Signature or a batch of signatures.

Return type:

numpy.ndarray | torch.tensor

Example usage:

import pysiglib
import numpy as np

path = np.random.uniform(size=(32, 100, 5))
degree = 4

sig = pysiglib.sig(path, degree)
log_sig = pysiglib.sig_to_log_sig(sig, 5, degree, method=0)
sig_recovered = pysiglib.logsig_to_sig(log_sig, 5, degree, method=0)
# sig_recovered pprox sig

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