Skip to main content

Gridification for point clouds in any dimension (fast greedy optimal transport through Cartesian Sort).

Project description


Open In Colab PyPI version Documentation Status

❒ SquareNet

SquareNet maps unstructured point clouds to structured grids through a bijective transformation. It replaces expensive spatial queries (k-NN, radius search) with super fast sliding window operations. Think of it as a powerful alternative to kd-trees, voxelization, rasterization and neighborhood graphs. ✔ Works in any dimension ✔ Handles non-convex geometries ✔ Scales to millions of points (fast processing) ✔ Support for Pytorch and Jax

Animation ✨

🚀 Why SquareNet?

  • Speed: $O(N)$ local operations via vectorized sliding windows.
  • Memory: Contiguous memory access instead of irregular spatial lookups.
  • Simplicity: No heavy spatial dependencies, pure native sorting logic

📦 Installation

pip install squarenet

🧠 Quick Start

-> 00_getting_started.ipynb

from squarenet import SquareNet
import numpy as np

# Initialize and Fit
N = 5*11*7*13
d = 4
X = np.random.rand(N, d)

IJKL = (5, 11, 7, 13)
sn = SquareNet(gridshape=IJKL)# Define grid dimensions, here 4D
sn.fit(X)

# Map any data indexed on the points e.g (N, *C) to the grid 
Xgrid = sn.map(X) #(5, 11, 7, 13, 4)
#and back
sn.invert_map(Xgrid)   # = X

Query neighbors

# d-dimensional query method
# approximate but super fast
sn.search_sorted(point) 

🗺️ Visualizing the Mapping

sn = SquareNet(gridshape=(400, 400))
sn.fit("france") 
sn.plot()

📈 Key Applications

  • Point-Cloud Processing: Fast spatial querys (neighbors, intersections...).
  • Kernel Methods: Efficient approximation of large kernels (sparse Gram matrix).
  • Deep Learning: Tensorization of flat datasets (CNN-Ready)

Packed

-----

License: MIT | Author: ArmanddeCacqueray

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

squarenet-1.1.1-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file squarenet-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: squarenet-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 36.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for squarenet-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b1244e442a08b557c4bc8387ad7f36c37ae2043b3fb474a56e1fb94a507d7b67
MD5 3e241c68a84ec7c49d1b398b03e39e46
BLAKE2b-256 abe74bf8ec6166bff91830044c9b118fbf078be59bcec886f74ec7091e2e6eab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page