Sparse local operations for point clouds in any dimension.
Project description
🟦 SquareNet
SquareNet maps unstructured point clouds into structured D-dimensional grids. By building a bijective mapping, it replaces expensive spatial queries ($k$-NN, radius search) with simple array slicing.
🚀 Why SquareNet?
- Speed: $O(N)$ local operations via vectorized sliding windows.
- Memory: Contiguous memory access instead of irregular spatial lookups.
- Simplicity: Pure NumPy-based logic, no heavy spatial dependencies.
📦 Installation
pip install squarenet
# To include the demo (shapely)
pip install "squarenet[demo]"
🧠 Quick Start
from squarenet import SquareNet
import numpy as np
# Initialize and Fit
N = 5*11*7*13
d = 4
IJKL = (5, 11, 7, 13)
sqnet = SquareNet(IJ=IJKL) # Define grid dimensions, here 4D
points = np.random.rand(N, d)
sqnet.fit(points)
# Map cloud index to grid index: (N, *) -> (5, 11, 7, 13, *)
grid_X = sqnet.map(cloud_X)
cloud_X = sqnet.invert_map(grid_X) (5, 11, 7, 13, *) -> (N, *)
# Compute Local Gram Matrix (Sparse)
# Only computes interactions within a local window
G = sqnet.gram(points, ws=5)
🗺️ Visualizing the Mapping
You can use the built-in checkerboard to verify neighborhood preservation:
sqnet = SquareNet(IJ=(200, 200))
sqnet.fit("france")
sqnet.checkerboard()
📈 Key Applications
- Point Cloud Processing: Fast local feature aggregation.
- Kernel Methods: Efficient sparse approximation of large kernels.
- Deep Learning: Pre-structuring irregular data for CNN/Transformer inputs.
License: MIT | Author: ArmanddeCacqueray
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 squarenet-0.1.1.tar.gz.
File metadata
- Download URL: squarenet-0.1.1.tar.gz
- Upload date:
- Size: 104.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e36167966bd9154a1cbb76cd5d635812954dde0f77afa27635782ee54aab753
|
|
| MD5 |
2de469d9d0f8e6777f4870823aba4d2c
|
|
| BLAKE2b-256 |
5aef58c7b3d84ae2a292bf093522874e90c91eeae41513098602b4bc7ba443d3
|
File details
Details for the file squarenet-0.1.1-py3-none-any.whl.
File metadata
- Download URL: squarenet-0.1.1-py3-none-any.whl
- Upload date:
- Size: 102.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68d7ad33f0d6d33ed36130f738b92f22aa7464bcf6d70ace5bfbfca3a3cb2025
|
|
| MD5 |
f2ffb6f93011c18a57561ae23dd6ca23
|
|
| BLAKE2b-256 |
6fd6820b57004338478333f3cad9a888edf643713b3c90c2e5f41caa19c7711a
|