Skip to main content

Rust Functions for Metric Space Analysis

This repository contains a set of functions implemented in Rust for the purpose of metric space analysis. These functions aim to provide superior performance by taking advantage of Rust's efficient memory management and computational capabilities.


CI version implementation license format



For a full walkthrough of cost-based metrics, see Jonathon Victor's website:


Installation

This package is bundled with the metricspace repository. It can also be installed separately using the following command:

pip install rs-distances

Note: Be sure to activate your virtual environment with Python 3.7 or higher before installing this package via pip.

Performance

The functions provided in this package are written in Rust and compiled into a shared library that can be utilized within Python. This approach is intended to boost the computational efficiency of metric space analysis operations.

Below is a comparative performance table of the spike-train iterator function implemented in Matlab, Python, and Rust. It should be noted that the Matlab version is not optimized using MEX (which would be comparable to Python's numba @jit), and the translations from Matlab to Python to Rust are not exact 1:1.

Spike-train iterator Matlab Python Rust
raw function 30.235s 64.992s 2.028s
with numba @jit 30.235s 25.119s 2.028s
with @jit + parralel 24.050s 18.067s 0.945s

Advantages of Rust Implementation

Array manipulations, particularly those performed within computationally intensive tasks, are highly sensitive to memory allocation and cleanup. Rust, with its ownership model and automatic memory management, excels in this area. Rust automatically reclaims the memory when an object (like an array or a slice) goes out of scope. This is a stark contrast to languages like Python, where a garbage collector is relied upon to perform memory cleanup. This difference provides Rust implementations with a distinct edge in performance, which is reflected in the comparative analysis shown above.

With these Rust implementations, you can achieve the high-level expressiveness of Python while benefiting from the superior performance and efficiency of Rust.

Metadata

Release files for rs-distances 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rs-distances 1.0.0
File Size Uploaded Provenance Actions
rs_distances-1.0.0.tar.gz 25.6 kB Without provenance Details for rs_distances-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rs-distances 1.0.0
File Interpreter ABI Platform Actions
rs_distances-1.0.0-cp310-none-win_amd64.whl CPython 3.10 none Windows x86-64 Details for rs_distances-1.0.0-cp310-none-win_amd64.whl

Total release size: 188.9 kB

Release files / rs_distances-1.0.0.tar.gz

Download URL rs_distances-1.0.0.tar.gz
Size 25.6 kB
Tags Source
SHA-256 checksum
How to use checksums
de227a7994a41b5f5471bab00c6b1d7d6cc3f301cbad08c162a614f288dc1b06
BLAKE2b-256 checksum
How to use checksums
f738143cadbaaa5492424a57327bd4af09ffc166cceb679d209c46992c18ca62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.0.1

Release files / rs_distances-1.0.0-cp310-none-win_amd64.whl

Download URL rs_distances-1.0.0-cp310-none-win_amd64.whl
Size 163.3 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
53c893c885fa17791408042bd3e5830a7cd8debf61b499143d2873abc6f0e2fa
BLAKE2b-256 checksum
How to use checksums
b5d4fdd5cbbded7b10928a01e17f16642f41a0702af4c94768458751c86adc45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.0.1

Security for rs-distances 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page