Log sig functions#

prepare_log_sig_cuda#

int prepare_log_sig_cuda(uint64_t dimension, uint64_t degree, int method, bool use_disk = false) noexcept#

Prepares GPU-side data structures needed for log signature methods 1 and 2.

Parameters:
  • dimension – Dimension of the underlying path space.

  • degree – Truncation degree.

  • method – Method (1 or 2).

  • use_disk – If true, check the shared disk cache before computing, and save to disk if not found.

Returns:

Status code (0 = success).

clear_cache_cuda#

int clear_cache_cuda(bool use_disk = false) noexcept#

Clears all GPU-side cached data for log signature computation.

Parameters:

use_disk – If true, also delete the shared disk cache.

Returns:

Status code (0 = success).

sig_to_log_sig_cuda#

int sig_to_log_sig_cuda_f(const float *sig, float *out, uint64_t dimension, uint64_t degree, int method) noexcept#

Converts a signature to its log signature on the GPU using the specified method.

Method 0: expanded tensor log (output size = sig_length). Method 1: Lyndon words (output size = log_sig_length). Method 2: Lyndon basis (output size = log_sig_length). Methods 1 and 2 require a prior call to prepare_log_sig_cuda.

Parameters:
  • sig – Pointer to input signature (on device), size = sig_length(dimension, degree).

  • out – Pointer to output buffer (on device, preallocated).

  • dimension – Dimension of the underlying path space.

  • degree – Truncation degree of the signature.

  • method – Method for log signature computation (0, 1, or 2).

Returns:

Status code (0 = success).

int sig_to_log_sig_cuda_d(const double *sig, double *out, uint64_t dimension, uint64_t degree, int method) noexcept#

batch_sig_to_log_sig_cuda#

int batch_sig_to_log_sig_cuda_f(const float *sig, float *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method) noexcept#

Converts a batch of signatures to log signatures on the GPU using the specified method.

Parameters:
  • sig – Pointer to batch of input signatures (on device), size = batch_size * sig_length(dimension, degree).

  • out – Pointer to output buffer (on device, preallocated).

  • batch_size – Batch size.

  • dimension – Dimension of the underlying path space.

  • degree – Truncation degree of the signature.

  • method – Method for log signature computation (0, 1, or 2).

Returns:

Status code (0 = success).

int batch_sig_to_log_sig_cuda_d(const double *sig, double *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method) noexcept#

sig_to_log_sig_backprop_cuda#

int sig_to_log_sig_backprop_cuda_f(const float *sig, float *out, const float *log_sig_derivs, uint64_t dimension, uint64_t degree, int method) noexcept#

Backpropagates through the sig_to_log_sig_cuda function.

Parameters:
  • sig – Pointer to input signature (on device), size = sig_length(dimension, degree).

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

  • log_sig_derivs – Pointer to dF/d(log_sig) (on device).

  • dimension – Dimension of the underlying path space.

  • degree – Truncation degree of the signature.

  • method – Method for log signature computation (0, 1, or 2).

Returns:

Status code (0 = success).

int sig_to_log_sig_backprop_cuda_d(const double *sig, double *out, const double *log_sig_derivs, uint64_t dimension, uint64_t degree, int method) noexcept#

batch_sig_to_log_sig_backprop_cuda#

int batch_sig_to_log_sig_backprop_cuda_f(const float *sig, float *out, const float *log_sig_derivs, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method) noexcept#

Backpropagates through the batch_sig_to_log_sig_cuda function.

Parameters:
  • sig – Pointer to batch of input signatures (on device), size = batch_size * sig_length(dimension, degree).

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

  • log_sig_derivs – Pointer to dF/d(log_sig) (on device).

  • batch_size – Batch size.

  • dimension – Dimension of the underlying path space.

  • degree – Truncation degree of the signature.

  • method – Method for log signature computation (0, 1, or 2).

Returns:

Status code (0 = success).

int batch_sig_to_log_sig_backprop_cuda_d(const double *sig, double *out, const double *log_sig_derivs, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method) 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}
}