Sig functions#
signature_cuda#
-
int signature_cuda_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.f, bool horner = true) noexcept#
Computes the truncated signature of a path of type float on the GPU.
The signature is computed using the Horner algorithm by default, which is more efficient for longer paths and higher degrees. A naive algorithm (Chen’s identity applied iteratively) can be used as a fallback by setting
horner = false.- Parameters:
path – Pointer to input path data (row-major, on device), size =
length * dimension.out – Pointer to output buffer (row-major, preallocated, on device), size =
sig_length(transformed_dimension, degree), wheretransformed_dimension = (lead_lag ? 2 : 1) * dimension + (time_aug ? 1 : 0).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 the lead-lag transform (default = false).
end_time – End time for time augmentation (default = 1.0).
horner – Whether to use the Horner algorithm (default = true).
- Returns:
Status code (0 = success).
-
int signature_cuda_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_cuda#
-
int batch_signature_cuda_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.f, bool horner = true) noexcept#
Computes the truncated signatures of a batch of paths of type float on the GPU.
- Parameters:
path – Pointer to input batch path data (row-major, on device), size =
batch_size * length * dimension.out – Pointer to output buffer (row-major, preallocated, on device), size =
batch_size * sig_length(transformed_dimension, degree), wheretransformed_dimension = (lead_lag ? 2 : 1) * dimension + (time_aug ? 1 : 0).batch_size – Batch size.
dimension – Dimension of the paths.
length – Length of the paths.
degree – Truncation degree of the signature.
time_aug – Whether to add time augmentation (default = false).
lead_lag – Whether to apply the lead-lag transform (default = false).
end_time – End time for time augmentation (default = 1.0).
horner – Whether to use the Horner algorithm (default = true).
- Returns:
Status code (0 = success).
-
int batch_signature_cuda_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) noexcept#
sig_backprop_cuda#
-
int sig_backprop_cuda_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.f) noexcept#
Backpropagates through the signature computation on the GPU (float).
Given the forward signature and derivatives dF/d(sig), computes derivatives dF/d(path) with respect to the original path.
- Parameters:
path – Pointer to input path data (row-major, on device), size =
length * dimension.out – Pointer to output buffer (row-major, preallocated, on device), same size as path.
sig_derivs – Pointer to dF/d(sig) (on device), size =
sig_length(transformed_dimension, degree).sig – Pointer to forward signature (on device), same size as sig_derivs.
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_cuda_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_cuda#
-
int batch_sig_backprop_cuda_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.f) noexcept#
Backpropagates through the batch signature computation on the GPU (float).
- Parameters:
path – Pointer to input batch path data (row-major, on device), size =
batch_size * length * dimension.out – Pointer to output buffer (row-major, preallocated, on device), same size as path.
sig_derivs – Pointer to dF/d(sig) (on device), size =
batch_size * sig_length(transformed_dimension, degree).sig – Pointer to forward signatures (on device), same size as sig_derivs.
batch_size – Batch size.
dimension – Dimension of the paths.
length – Length of the paths.
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 batch_sig_backprop_cuda_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.) 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}
}