Metadata-Version: 2.1
Name: pathsig
Version: 0.2.0
Summary: GPU-accelerated library for scalable and efficient differentiable path signature computations.
Author-Email: =?utf-8?q?Tobias_Nyg=C3=A5rd?= <tobias.nygard.24@ucl.ac.uk>
Project-URL: Documentation, https://pathsig.readthedocs.io/
Project-URL: Repository, https://github.com/tobiasny12/pathsig
Project-URL: Homepage, https://github.com/tobiasny12/pathsig
Project-URL: Issues, https://github.com/tobiasny12/pathsig/issues
Requires-Python: >=3.10
Requires-Dist: torch>=2.4
Description-Content-Type: text/markdown

# pathsig

pathsig is a GPU-accelerated library for differentiable signature and log-signature computations. It offers greater flexibility through projections and windowing, and achieves **~4–10×** speedups for training (forward + backward) and **~10–30×** speedups for forward-only evaluation in our benchmarks.

Documentation can be found at https://pathsig.readthedocs.io, and the accompanying paper is available on arXiv .

## Installation

```bash
pip install pathsig
```

## Quickstart
The example below computes truncated, windowed, and projected signatures on a CUDA tensor. Log-signatures are computed analogously, typically with a suitable projection (see the [documentation](https://pathsig.readthedocs.io/en/latest/api/logsignature.html)).
```python
import torch
import pathsig

x = torch.randn(32, 128, 8, device="cuda", dtype=torch.float32)

# Truncated signature
sig = pathsig.Signature(depth=4)
y = sig(x)  # (B, D)

# Windowed signature
windows = torch.tensor([[0, 32], [32, 64]], device="cuda")  # (W, 2)
sig = pathsig.Signature(depth=4, windows=windows)
y = sig(x)  # (B, W, D)

# Signature with a word projection
proj = pathsig.projections.words(
    words=[(0, 1), (2, 2, 3)],
    depth=4,
    path_dim=8,
    full_levels=(1,),
)
sig = pathsig.Signature(depth=4, projection=proj)
y = sig(x)  # (B, proj.sig_size)
```


## License and citation

This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.

