Skip to main content

Sparse local operations for point clouds in any dimension.

Project description

SquareNet

SquareNet is a lightweight framework for mapping unstructured point clouds into structured N-dimensional grids, enabling fast and efficient local operations.

✨ Key Idea

SquareNet builds a bijective mapping between point indices and a structured grid:

  • Bijection: each point maps to exactly one grid cell
  • Neighborhood preservation: nearby points remain close in the grid

This allows replacing expensive spatial queries (k-NN, radius search) with simple array slicing.


🚀 Features

  • Fast point cloud → grid mapping
  • Invertible transformation
  • Efficient local neighborhood operations
  • Sparse Gram matrix computation via sliding windows
  • NumPy-friendly (no heavy dependencies required)

📦 Installation

pip install squarenet

🧠 Basic Usage

from squarenet import SquareNet

sqnet = SquareNet(IJ=(L, W, H, ...), max_iter = 100)

# Original data: (N, D)
points = np.random.rand(N, D)
Sqnet.fit(points)

# Map (N, *) to the grid: (L, W, H, ..., *)
sqX = sqnet.map(X)

# Back to original ordering
X_rec = sqnet.invert_map(sqX)

🔬 Local Processing Example

Compute a local (sparse) Gram matrix using a sliding window:

G = sqnet.gram(X, ws=(5, 5))

Instead of computing a full (N × N) matrix, SquareNet only computes interactions within local neighborhoods.


🗺️ Demo Dataset

A small demo dataset (France map) is included:

Sqnet.fit("france")

🧱 Project Structure

src/
  squarenet/
    __init__.py
    core.py
    utils.py
    data/france.geojson

🎯 Why SquareNet?

Traditional point cloud pipelines rely on:

  • k-NN search (O(N log N))
  • irregular memory access
  • poor GPU utilization

SquareNet enables:

  • O(N) local operations
  • contiguous memory access
  • vectorized operations on a sliding window

📈 Use Cases

  • Point cloud processing
  • Graph-to-grid transformations
  • Fast kernel methods
  • Local feature aggregation
  • Deep learning preprocessing

🛠️ Development

git clone https://github.com/ArmanddeCacqueray/SquareNet
cd squarenet
pip install -e .

📄 License

MIT License


🤝 Contributing

Contributions are welcome. Please open an issue or submit a pull request.

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.1.0.tar.gz (6.8 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.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for squarenet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a2cbb2985858acd75a3476e9552e95d6704b5344d5a546ccb1f020e2c652200
MD5 06d65f586e27f08dcb23b1ad78d83879
BLAKE2b-256 9890a3792cc2b4b7247f23214230498a3a8514deeb99a2a8b983922740a60064

See more details on using hashes here.

File details

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

File metadata

  • Download URL: squarenet-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 952bcd25556d12da600ac4f604b9de38672e8312bedfb35a1c2a6fe71d880a7b
MD5 bd07f2089eeec4030da08bf91bc776a7
BLAKE2b-256 aa3d80ee459e5700ea9f9074cce7b478a69ca8edd0753f4c3cc3625e2823cbdd

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