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_gridis false, size =batch_size. Ifreturn_gridis 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#
branched_sig_kernel_cuda#
-
int branched_sig_kernel_cuda_f(const float *gram, float *out, uint64_t batch_size, uint64_t dimension, uint64_t length1, uint64_t length2, uint64_t depth, uint64_t dyadic_order_1, uint64_t dyadic_order_2, bool return_grid = false) noexcept#
Computes the depth-recursive branched signature kernel from batch gram matrices on the GPU.
Computes the non-planar BCK branched signature kernel using the Chevyrev-Oberhauser recursion. The core consumes precomputed static-kernel increments rather than path coordinates.
- Parameters:
gram – Pointer to batch gram matrix data (row-major, on device), size =
batch_size * (length1 - 1) * (length2 - 1).out – Pointer to output buffer (row-major, preallocated, on device), size =
batch_size * (return_grid ? (((length1 - 1) << dyadic_order_1) + 1) * (((length2 - 1) << dyadic_order_2) + 1) : 1).batch_size – Batch size of the path pairs.
dimension – Dimension of the original paths. The kernel core uses
gram, so this is retained for API parity.length1 – Length of the first paths.
length2 – Length of the second paths.
depth – Truncation depth of the branched kernel recursion. If zero, the output is filled with ones.
dyadic_order_1 – Dyadic refinement for the first paths.
dyadic_order_2 – Dyadic refinement for the second paths.
return_grid – If true, returns the final-depth grid; otherwise returns the endpoint scalar per batch item.
- Returns:
Status code (0 = success).
-
int branched_sig_kernel_cuda_d(const double *gram, double *out, uint64_t batch_size, uint64_t dimension, uint64_t length1, uint64_t length2, uint64_t depth, uint64_t dyadic_order_1, uint64_t dyadic_order_2, bool return_grid = false) noexcept#
Double-precision variant of branched_sig_kernel_cuda_f.
branched_sig_kernel_backprop_cuda#
-
int branched_sig_kernel_backprop_cuda_f(const float *gram, float *out, const float *derivs, const float *k_stack, uint64_t batch_size, uint64_t dimension, uint64_t length1, uint64_t length2, uint64_t depth, uint64_t dyadic_order_1, uint64_t dyadic_order_2, bool return_grid = false) noexcept#
Backpropagates through branched_sig_kernel_cuda_f with respect to the gram matrix on the GPU.
Computes derivatives with respect to the precomputed static-kernel increments used by the branched signature kernel. Path-coordinate derivatives are handled by the Python static-kernel wrappers.
- Parameters:
gram – Pointer to batch gram matrix data (row-major, on device), size =
batch_size * (length1 - 1) * (length2 - 1).out – Pointer to output buffer for dF/d(gram) (row-major, preallocated, on device), size =
batch_size * (length1 - 1) * (length2 - 1).derivs – Pointer to input derivatives (on device). If
return_gridis false, size =batch_size. Ifreturn_gridis true, size =batch_size * (((length1 - 1) << dyadic_order_1) + 1) * (((length2 - 1) << dyadic_order_2) + 1).k_stack – Optional pointer to precomputed forward grids K_0, …, K_depth (row-major, on device). May be null. If supplied, size =
batch_size * (depth + 1) * (((length1 - 1) << dyadic_order_1) + 1) * (((length2 - 1) << dyadic_order_2) + 1).batch_size – Batch size of the path pairs.
dimension – Dimension of the original paths. The kernel core uses
gram, so this is retained for API parity.length1 – Length of the first paths.
length2 – Length of the second paths.
depth – Truncation depth of the branched kernel recursion. If zero, derivatives with respect to
gramare zero.dyadic_order_1 – Dyadic refinement for the first paths.
dyadic_order_2 – Dyadic refinement for the second paths.
return_grid – If true,
derivsis expected to be grid-sized per batch item; otherwise it has one scalar per batch item.
- Returns:
Status code (0 = success).
-
int branched_sig_kernel_backprop_cuda_d(const double *gram, double *out, const double *derivs, const double *k_stack, uint64_t batch_size, uint64_t dimension, uint64_t length1, uint64_t length2, uint64_t depth, uint64_t dyadic_order_1, uint64_t dyadic_order_2, bool return_grid = false) noexcept#
Double-precision variant of branched_sig_kernel_backprop_cuda_f.
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}
}