Skip to main content

Sparse local operations for point clouds in any dimension.

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.0.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.0-py3-none-any.whl (36.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: squarenet-1.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 1fbd04443f8184992df6652fc8f01cac1907a13e3b0a170cdb6d0a6134cf14a1
MD5 56dc514a3fbf162429a1e091651b2d32
BLAKE2b-256 a2ed83e59e05de381ed0587b0cec97273f1ddae5af1894cc126a4373ad9dd3cf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: squarenet-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3cb8b3e0f03ecf5a3c5d37619c18598071be1b9043699f57e153b6c86c53d9ce
MD5 bece08ef181d0b8383204e05cded2d90
BLAKE2b-256 b3b0543c9a548456c16c8b3f2ccc1c164fa15366a7c4483d79075e4d214c93b1

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