Sig kernel functions#

sig_kernel_cuda#

int sig_kernel_cuda_f(const float *gram, float *out, uint64_t batch_size, uint64_t dimension, uint64_t length1, uint64_t length2, uint64_t dyadic_order_1, uint64_t dyadic_order_2, bool return_grid = false) noexcept#

Computes signature kernels of a batch of paths from their gram matrices.

Parameters:
  • gram – Pointer to batch gram matrix data (row-major), size = batch_size * (length1 - 1) * (length2 - 1).

  • out – Pointer to output buffer (row-major, preallocated), size = batch_size * (return_grid ? (((length1 - 1) << dyadic_order_1) + 1) * (((length2 - 1) << dyadic_order_2) + 1) : 1).

  • batch_size – Batch size of the paths.

  • dimension – Dimension of the path.

  • length1 – Length of the first path.

  • length2 – Length of the second path.

  • dyadic_order_1 – Dyadic refinement for the first path.

  • dyadic_order_2 – Dyadic refinement for the second path.

  • return_grid – Whether to return the entire PDE grid (default = false).

Returns:

Status code (0 = success).

int sig_kernel_cuda_d(const double *gram, double *out, uint64_t batch_size, uint64_t dimension, uint64_t length1, uint64_t length2, uint64_t dyadic_order_1, uint64_t dyadic_order_2, bool return_grid = false) noexcept#

sig_kernel_backprop_cuda#

int sig_kernel_backprop_cuda_f(const float *gram, float *out, const float *derivs, const float *k_grid, uint64_t batch_size, uint64_t dimension, uint64_t length1, uint64_t length2, uint64_t dyadic_order_1, uint64_t dyadic_order_2, bool return_grid = false) noexcept#

Backpropagation through sig_kernel.

Parameters:
  • gram – Pointer to batch gram matrix data (row-major), size = batch_size * (length1 - 1) * (length2 - 1).

  • out – Pointer to output buffer (row-major, preallocated), size = batch_size * (length1 - 1) * (length2 - 1).

  • derivs – Pointer to input derivatives. If return_grid is false, size = batch_size. If return_grid is true, size = batch_size * (((length1 - 1) << dyadic_order_1) + 1) * (((length2 - 1) << dyadic_order_2) + 1).

  • k_grid – Pointer to batch of signature kernel PDE grids (row-major, precomputed), size = batch_size * (((length1 - 1) << dyadic_order_1) + 1) * (((length2 - 1) << dyadic_order_2) + 1).

  • batch_size – Batch size of the paths.

  • dimension – Dimension of the paths.

  • length1 – Length of the first paths.

  • length2 – Length of the second paths.

  • dyadic_order_1 – Dyadic refinement for the first paths.

  • dyadic_order_2 – Dyadic refinement for the second paths.

  • return_grid – If true, derivs is expected to be grid-sized per batch element; if false, derivs has one scalar per batch element.

Returns:

Status code (0 = success).

int sig_kernel_backprop_cuda_d(const double *gram, double *out, const double *derivs, const double *k_grid, uint64_t batch_size, uint64_t dimension, uint64_t length1, uint64_t length2, uint64_t dyadic_order_1, uint64_t dyadic_order_2, bool return_grid = false) 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}
}