pointgrid-rs
High-performance Rust implementation of deterministic point-grid alignment and numerical primitives for semantic maps.
Overview
pointgrid-rs provides fast, deterministic algorithms for:
- Point-grid alignment: Maps 2D points to a checkerboard grid pattern
- 1D uniform filtering: Scipy-compatible filtering with reflect/wrap boundary modes
- Linear sum assignment: Optimal assignment solver for cost matrices
This package is a drop-in replacement for the Python pointgrid package, offering 700x faster performance on large datasets.
Installation
pip install pointgrid-rs
Usage
Point-Grid Alignment
import numpy as np
import pointgrid_rs
points = np.array([[0.0, 0.0], [0.1, 0.2], [0.9, 1.0], [0.4, 0.6]])
aligned = pointgrid_rs.align_points_to_grid(points)
# Returns: array([[0.12857143, 0. ],
# [0. , 0.14285714],
# [0.64285714, 0.85714286],
# [0.38571429, 0.57142857]])
Uniform Filter
values = np.array([1.0, 2.0, 3.0, 4.0])
filtered = pointgrid_rs.uniform_filter1d(values, [4], size=3, axis=0, mode='reflect')
# Returns: array([1.33333333, 2. , 3. , 3.66666667])
Linear Sum Assignment
costs = np.array([[4.0, 1.0, 3.0],
[2.0, 0.0, 5.0],
[3.0, 2.0, 2.0]])
assignment = pointgrid_rs.linear_sum_assignment(costs)
# Returns: array([1, 0, 2])
Performance
Benchmark on 10,000 points:
| Implementation | Time |
|---|---|
| Python pointgrid | 2,756 ms |
| Rust pointgrid-rs | 4.3 ms |
Speedup: 700x faster
API Reference
align_points_to_grid(points: np.ndarray) -> np.ndarray
Aligns 2D points to a deterministic checkerboard grid pattern.
Parameters:
points: numpy array of shape (n, 2) containing 2D coordinates
Returns:
- numpy array of shape (n, 2) with aligned coordinates
uniform_filter1d(values: np.ndarray, shape: list, size: int, axis: int, mode: str) -> np.ndarray
Applies a uniform (box) filter along a specified axis with boundary handling.
Parameters:
values: 1D numpy array of valuesshape: list specifying the shape of the multi-dimensional arraysize: size of the uniform filter kernelaxis: axis along which to apply the filtermode: boundary mode, either 'reflect' or 'wrap'
Returns:
- 1D numpy array with filtered values
linear_sum_assignment(costs: np.ndarray) -> np.ndarray
Solves the linear sum assignment problem (Hungarian algorithm).
Parameters:
costs: 2D numpy array of shape (n, n) containing the cost matrix
Returns:
- 1D numpy array where result[i] is the column assigned to row i
License
MIT
Acknowledgements
This is a Rust reimplementation of the original pointgrid Python package by the Yale DHLab.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pointgrid_rs-0.1.3.tar.gz.
File metadata
- Download URL: pointgrid_rs-0.1.3.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ca678e3dec5a170b525f9d2afece07fb6b63f43904ec93abbb2d7698bb3528c
|
|
| MD5 |
46eb29c95ee4d3437782af657d01175e
|
|
| BLAKE2b-256 |
e543a45ecb0e829336dcddf7e0158b736cab01a58143082b40c4024044eb6104
|
File details
Details for the file pointgrid_rs-0.1.3-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: pointgrid_rs-0.1.3-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 277.6 kB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86eedbe811239231d2ee4cb981bd4e8e3a3f297d75b9d84c64eef5451a7fe677
|
|
| MD5 |
14cf84b64c12db2618dd454ecda050e0
|
|
| BLAKE2b-256 |
fe27b82a7c36be6f594fc1b6507551e17b680ba4d81514199800c827256276b9
|
File details
Details for the file pointgrid_rs-0.1.3-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: pointgrid_rs-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 244.8 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2c7b4e1b2b057d9949fe3985180d76fa0b4bc5f2fbc123b3ed850ca31d6e0c2
|
|
| MD5 |
91cb28b493f3b48e2be6bf284092d294
|
|
| BLAKE2b-256 |
e2b28e70cc373b32f4cb534a8cc5e499abd755aed5b8fc98d48cda162ca677fb
|
File details
Details for the file pointgrid_rs-0.1.3-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: pointgrid_rs-0.1.3-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 327.1 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5d2c093232779f1b10dc0ebba5e2a604e37d95cedac4af0fd90c6ba7a338446
|
|
| MD5 |
6e9b9acfe9fd54a55f8e37248e408667
|
|
| BLAKE2b-256 |
f34209562a1a99f71b24486aecaac691700b5ffdd751d55871534f18bbb5133c
|
File details
Details for the file pointgrid_rs-0.1.3-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: pointgrid_rs-0.1.3-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 327.0 kB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
476b50ec6152a9f089cb5734359a585a4a9e9057becd6b07d460184224fe2c4f
|
|
| MD5 |
f850355fcf87a5560417b9e3578e2679
|
|
| BLAKE2b-256 |
6e7272a598e84f6f0a60a170e80c2406291ded4cce3206884323c2053f5181c8
|