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

sig_to_log_sig_cuda#

int sig_to_log_sig_cuda_f(const float *sig, float *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method, bool scalar_term = true) 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 sig_to_log_sig_cuda_d(const double *sig, double *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method, bool scalar_term = true) 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 batch_size, uint64_t dimension, uint64_t degree, int method, bool scalar_term = true) noexcept#

Backpropagates through the 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 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, bool scalar_term = true) noexcept#

log_sig_combine_cuda#

int log_sig_combine_cuda_f(const float *log_sig1, const float *log_sig2, float *out, uint64_t batch_size, uint64_t dimension, uint64_t degree) noexcept#

Combines batches of truncated log-signatures on the GPU using the BCH formula.

Parameters:
  • log_sig1 – Pointer to batch of first log-signatures (on device), size = batch_size * log_sig_length(dimension, degree).

  • log_sig2 – Pointer to batch of second log-signatures (on device), same size as log_sig1.

  • out – Pointer to output buffer (on device, preallocated), same size as log_sig1.

  • batch_size – Batch size.

  • dimension – Dimension of the underlying path space.

  • degree – Truncation degree of the log-signatures.

Returns:

Status code (0 = success).

int log_sig_combine_cuda_d(const double *log_sig1, const double *log_sig2, double *out, uint64_t batch_size, uint64_t dimension, uint64_t degree) noexcept#

log_sig_combine_backprop_cuda#

int log_sig_combine_backprop_cuda_f(const float *d_out, float *d_ls1, float *d_ls2, const float *ls1, const float *ls2, uint64_t batch_size, uint64_t dimension, uint64_t degree) noexcept#
int log_sig_combine_backprop_cuda_d(const double *d_out, double *d_ls1, double *d_ls2, const double *ls1, const double *ls2, uint64_t batch_size, uint64_t dimension, uint64_t degree) noexcept#

log_sig_join_cuda#

int log_sig_join_cuda_f(const float *log_sig, const float *displacement, float *out, uint64_t batch_size, uint64_t dimension, uint64_t degree) noexcept#
int log_sig_join_cuda_d(const double *log_sig, const double *displacement, double *out, uint64_t batch_size, uint64_t dimension, uint64_t degree) noexcept#

log_sig_join_backprop_cuda#

int log_sig_join_backprop_cuda_f(const float *d_out, float *d_logsig, float *d_displacement, const float *log_sig, const float *displacement, uint64_t batch_size, uint64_t dimension, uint64_t degree) noexcept#
int log_sig_join_backprop_cuda_d(const double *d_out, double *d_logsig, double *d_displacement, const double *log_sig, const double *displacement, uint64_t batch_size, uint64_t dimension, uint64_t degree) noexcept#

log_sig_from_path_cuda#

int log_sig_from_path_cuda_f(const float *path, float *out, uint64_t batch_size, uint64_t length, uint64_t dimension, uint64_t degree) noexcept#
int log_sig_from_path_cuda_d(const double *path, double *out, uint64_t batch_size, uint64_t length, uint64_t dimension, uint64_t degree) noexcept#
int log_sig_from_path_backprop_cuda_f(const float *d_out, float *d_path, const float *path, uint64_t batch_size, uint64_t length, uint64_t dimension, uint64_t degree) noexcept#
int log_sig_from_path_backprop_cuda_d(const double *d_out, double *d_path, const double *path, uint64_t batch_size, uint64_t length, uint64_t dimension, uint64_t degree) noexcept#

logsig_to_sig_cuda#

int logsig_to_sig_cuda_f(const float *log_sig, float *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method, bool scalar_term = true) noexcept#
int logsig_to_sig_cuda_d(const double *log_sig, double *out, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method, bool scalar_term = true) noexcept#
int logsig_to_sig_backprop_cuda_f(const float *log_sig, float *d_logsig, const float *d_sig, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method, bool scalar_term = true) noexcept#
int logsig_to_sig_backprop_cuda_d(const double *log_sig, double *d_logsig, const double *d_sig, uint64_t batch_size, uint64_t dimension, uint64_t degree, int method, bool scalar_term = true) 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}
}