Sig functions#

signature#

int 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, bool scalar_term = true, int n_jobs = 1) noexcept#

Computes the signatures of a batch of paths.

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 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, bool scalar_term = 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 batch_size, uint64_t dimension, uint64_t length, uint64_t degree, bool time_aug = false, bool lead_lag = false, float end_time = 1., bool scalar_term = true, int n_jobs = 1) noexcept#

Backpropagation through the 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 * length * dimension.

  • 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 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., bool scalar_term = true, int n_jobs = 1) noexcept#

linear_sig#

int linear_sig_f(const float *displacement, float *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, bool scalar_term = true, int n_jobs = 1) noexcept#
int linear_sig_d(const double *displacement, double *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, bool scalar_term = true, int n_jobs = 1) noexcept#

sig_join#

int sig_join_f(const float *sig, const float *displacement, float *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, bool prepend = false, bool scalar_term = true, int n_jobs = 1) noexcept#
int sig_join_d(const double *sig, const double *displacement, double *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, bool prepend = false, bool scalar_term = true, int n_jobs = 1) noexcept#

sig_join_backprop#

int sig_join_backprop_f(const float *d_out, float *d_sig, float *d_displacement, const float *sig, const float *displacement, uint64_t batch_size, uint64_t dimension, uint64_t degree, bool prepend = false, bool scalar_term = true, int n_jobs = 1) noexcept#
int sig_join_backprop_d(const double *d_out, double *d_sig, double *d_displacement, const double *sig, const double *displacement, uint64_t batch_size, uint64_t dimension, uint64_t degree, bool prepend = false, bool scalar_term = true, 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}
}