Sig functions#

signature#

int signature_f(const float *path, float *out, uint64_t dimension, uint64_t length, uint64_t degree, bool time_aug = false, bool lead_lag = false, float end_time = 1., bool horner = true) noexcept#

Computes the signature of a path of type float.

Parameters:
  • path – Pointer to path data (row-major), size = length * dimension.

  • out – Pointer to output buffer (preallocated), size = sig_length(dimension, degree).

  • dimension – Dimension of the path.

  • length – Length of the path.

  • degree – Truncation degree of the signature.

  • time_aug – Whether to add time augmentation (default = false).

  • lead_lag – Whether to apply lead-lag transform (default = false).

  • end_time – End time for time augmentation (default = 1.0).

  • horner – Whether to use Horner’s scheme (default = true).

Returns:

Status code (0 = success).

int signature_d(const double *path, double *out, uint64_t dimension, uint64_t length, uint64_t degree, bool time_aug = false, bool lead_lag = false, double end_time = 1., bool horner = true) noexcept#

batch_signature#

int batch_signature_f(const float *path, float *out, uint64_t batch_size, uint64_t dimension, uint64_t length, uint64_t degree, bool time_aug = false, bool lead_lag = false, float end_time = 1., bool horner = true, int n_jobs = 1) noexcept#

Computes the signature of a path of type float.

Parameters:
  • path – Pointer to path batch data (row-major), size = batch_size * length * dimension.

  • out – Pointer to output buffer (row-major, preallocated), size = batch_size * sig_length(dimension, degree).

  • batch_size – Batch size of the paths.

  • dimension – Dimension of the path.

  • length – Length of the path.

  • degree – Truncation degree of the signature.

  • time_aug – Whether to add time augmentation (default = false).

  • lead_lag – Whether to apply lead-lag transform (default = false).

  • end_time – End time for time augmentation (default = 1.0).

  • horner – Whether to use Horner’s scheme (default = true).

  • n_jobs – 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 (default = 1).

Returns:

Status code (0 = success).

int batch_signature_d(const double *path, double *out, uint64_t batch_size, uint64_t dimension, uint64_t length, uint64_t degree, bool time_aug = false, bool lead_lag = false, double end_time = 1., bool horner = true, int n_jobs = 1) noexcept#

sig_backprop#

int sig_backprop_f(const float *path, float *out, const float *sig_derivs, const float *sig, uint64_t dimension, uint64_t length, uint64_t degree, bool time_aug = false, bool lead_lag = false, float end_time = 1.) noexcept#

Backpropagation through the signature_f function.

Parameters:
  • path – Pointer to path data (row-major), size = length * dimension.

  • out – Pointer to output buffer (preallocated), size = sig_length(dimension, degree).

  • sig_derivs – Pointer to derivatives with respect to the signature, size = sig_length(dimension, degree).

  • sig – Pointer to signature of the path (precomputed), size = sig_length(dimension, degree).

  • dimension – Dimension of the path.

  • length – Length of the path.

  • degree – Truncation degree of the signature.

  • time_aug – Whether time augmentation was applied (default = false).

  • lead_lag – Whether the lead-lag transform was applied (default = false).

  • end_time – End time for time augmentation (default = 1.0).

Returns:

Status code (0 = success).

int sig_backprop_d(const double *path, double *out, const double *sig_derivs, const double *sig, uint64_t dimension, uint64_t length, uint64_t degree, bool time_aug = false, bool lead_lag = false, double end_time = 1.) noexcept#

batch_sig_backprop#

int batch_sig_backprop_f(const float *path, float *out, const float *sig_derivs, const float *sig, uint64_t batch_size, uint64_t dimension, uint64_t length, uint64_t degree, bool time_aug = false, bool lead_lag = false, float end_time = 1., int n_jobs = 1) noexcept#

Backpropagation through the batch_signature_f function.

Parameters:
  • path – Pointer to path batch data (row-major), size = batch_size * length * dimension.

  • out – Pointer to output buffer (row-major, preallocated), size = batch_size * sig_length(dimension, degree).

  • sig_derivs – Pointer to derivatives with respect to the signatures (row-major), size = batch_size * sig_length(dimension, degree).

  • sig – Pointer to signatures of the paths (row-major, precomputed), size = batch_size * sig_length(dimension, degree).

  • batch_size – Batch size of the paths.

  • dimension – Dimension of the path.

  • length – Length of the path.

  • degree – Truncation degree of the signature.

  • time_aug – Whether time augmentation was applied (default = false).

  • lead_lag – Whether the lead-lag transform was applied (default = false).

  • end_time – End time for time augmentation (default = 1.0).

  • n_jobs – 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 (default = 1).

Returns:

Status code (0 = success).

int batch_sig_backprop_d(const double *path, double *out, const double *sig_derivs, const double *sig, uint64_t batch_size, uint64_t dimension, uint64_t length, uint64_t degree, bool time_aug = false, bool lead_lag = false, double end_time = 1., int n_jobs = 1) noexcept#

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