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 Distribution

squarenet-1.1.2.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file squarenet-1.1.2.tar.gz.

File metadata

  • Download URL: squarenet-1.1.2.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for squarenet-1.1.2.tar.gz
Algorithm Hash digest
SHA256 0d2f6879c31c20888a780d8162d54c2c3f62dd0c0499f32ddb30153fe3a56a73
MD5 0c66fe23a7584685c6628d1ef10a6333
BLAKE2b-256 f2ee090b45d926c75df2eac90ead7ca6b6bc9b7e5963c498502eecf40530b333

See more details on using hashes here.

File details

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

File metadata

  • Download URL: squarenet-1.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1cc3637af68b73fac85279c2ac10ff2cb3674a41c21443132b2e495f2570e8ff
MD5 dca91899b7cac8af9d7051d773e66874
BLAKE2b-256 7eff50bd84bd631985d198bf34c7385784be04aeb726b48b581d498b41c6cfbf

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