| Crates.io | signature-rs |
| lib.rs | signature-rs |
| version | 0.1.0 |
| created_at | 2025-08-20 13:00:43.149124+00 |
| updated_at | 2025-08-20 13:00:43.149124+00 |
| description | High-performance log signature computation for paths and time series data |
| homepage | https://github.com/ChosunOne/signature-rs |
| repository | https://github.com/ChosunOne/signature-rs |
| max_upload_size | |
| id | 1803368 |
| size | 93,836 |
A Rust library for computing log signatures from path data.
ndarrayAdd this to your Cargo.toml:
[dependencies]
signature-rs = "0.1.0"
ndarray = "0.16"
use signature_rs::prelude::*;
use ndarray::array;
use ordered_float::NotNan;
// Create a path in 2D space
let path = array![[0.0, 0.0], [1.0, 0.5], [2.0, 1.0], [3.0, 0.0]];
let path = path.mapv(|v| NotNan::new(v).expect("value to be a number"));
// Build and compute log signature up to degree 3
let builder = LogSignatureBuilder::<ENotation>::new()
.with_num_dimensions(2)
.with_max_degree(3);
let log_sig = builder.build_from_path(&path.view());
// Access the computed log signature
println!("Log signature computed with {} terms", log_sig.series.coefficients.len());
use signature_rs::prelude::*;
use ndarray::Array2;
use num_rational::Ratio;
// Use exact rational arithmetic for precise computation
type Rational = Ratio<i64>;
// Create a path with rational coordinates
let mut path = Array2::<Rational>::zeros((4, 2));
path[[0, 0]] = Ratio::new(0, 1);
path[[0, 1]] = Ratio::new(0, 1);
path[[1, 0]] = Ratio::new(1, 1);
path[[1, 1]] = Ratio::new(1, 2);
path[[2, 0]] = Ratio::new(2, 1);
path[[2, 1]] = Ratio::new(1, 1);
// Compute log signature with exact arithmetic
let builder = LogSignatureBuilder::<ENotation>::new()
.with_num_dimensions(2)
.with_max_degree(4);
let log_sig = builder.build_from_path(&path.view());
// The result contains exact rational coefficients
for (word, coeff) in log_sig.series.basis.iter().zip(log_sig.series.coefficients.iter()) {
println!("Word: {:?}, Coefficient: {}", word, coeff);
}
LogSignatureBuilder<T>: Configurable builder for log signature computationLogSignature<T, U>: Contains computed log signature data