Sig coef functions#

sig_coef#

int sig_coef_f(const float *path, float *out, const uint64_t *multi_idx, uint64_t num_multi_idx, const uint64_t *degrees, uint64_t batch_size, uint64_t dimension, uint64_t length, bool time_aug = false, bool lead_lag = false, float end_time = 1., bool prefixes = false, int n_jobs = 1) noexcept#

For a batch of paths of type float, computes coefficients of their signatures.

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

  • out – Pointer to output buffer (preallocated), size = batch_size * (prefixes ? sum(max(degrees[i], 1)) : num_multi_idx).

  • multi_idx – Pointer to flattened array of multi indices, size = sum(degrees[i]).

  • num_multi_idx – Number of multi indices.

  • degrees – Pointer to array of degrees of the multi indices, size = num_multi_idx.

  • batch_size – Batch size.

  • dimension – Dimension of the path.

  • length – Length of the path.

  • 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).

  • prefixes – If true, will additionally return coefficients for all prefixes of words (default = false).

  • 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_coef_d(const double *path, double *out, const uint64_t *multi_idx, uint64_t num_multi_idx, const uint64_t *degrees, uint64_t batch_size, uint64_t dimension, uint64_t length, bool time_aug = false, bool lead_lag = false, double end_time = 1., bool prefixes = false, int n_jobs = 1) noexcept#

sig_coef_backprop#

int sig_coef_backprop_f(const float *path, float *out, const float *coefs, float *derivs, const uint64_t *multi_idx, uint64_t num_multi_idx, const uint64_t *degrees, uint64_t batch_size, uint64_t dimension, uint64_t length, bool time_aug = false, bool lead_lag = false, float end_time = 1., int n_jobs = 1) noexcept#

Backpropagation through the sig_coef functions.

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

  • out – Pointer to output buffer (preallocated), size = batch_size * length * dimension.

  • coefs – Pointer to coefficients computed using sig_coef with prefixes=true, size = batch_size * sum(degrees[i]).

  • derivs – Pointer to derivatives with respect to coefficients, size = batch_size * sum(degrees[i]). Modified in-place.

  • multi_idx – Pointer to flattened array of multi indices, size = sum(degrees[i]).

  • num_multi_idx – Number of multi indices.

  • degrees – Pointer to array of degrees of the multi indices, size = num_multi_idx.

  • batch_size – Batch size.

  • dimension – Dimension of the path.

  • length – Length of the path.

  • 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_coef_backprop_d(const double *path, double *out, const double *coefs, double *derivs, const uint64_t *multi_idx, uint64_t num_multi_idx, const uint64_t *degrees, uint64_t batch_size, uint64_t dimension, uint64_t length, 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}
}