Skip to main content

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


Download files

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

Source Distribution

squarenet-0.2.1.tar.gz (104.4 kB view details)

Uploaded Source

Built Distribution

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

squarenet-0.2.1-py3-none-any.whl (102.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: squarenet-0.2.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

Hashes for squarenet-0.2.1.tar.gz
Algorithm Hash digest
SHA256 64b4e4c589dbba03d9ea31e0e1bab4d78af40f6ddda90a3c7ef7d3189c3b6d0f
MD5 588064febca37c60ead387fed6246a4b
BLAKE2b-256 a1ee075ec686806e5cd62c7845c738b57c13c107c1b644e24d381b59f68a70b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: squarenet-0.2.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

Hashes for squarenet-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eab811bb342457a426063a0b890b5b665a6641d445e95adc520d1d06ce8f1a67
MD5 b0f239a4979cbee827e17274130f120f
BLAKE2b-256 2895b8ec5f1099336567be16eb9f758068ec59ee97b3460341e4a73cd3aad8b5

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