Skip to main content

Tools to construct/handle PowerDiagram, notably for semi-discrete optimal transport

Project description

SDOT

This package contains tools to handle

  • semi-discrete transport plans (between discrete and generic densities),
  • polyhedral convex functions (max of affine functions),
  • and power diagrams (a generalization of Voronoi diagrams).

It works in any number of dimensions. It is highly optimized, in terms of execution speed and memory usage.

Historically, this package is a re-design of the pysdot package, which was written to handle a wide number of semi-discrete transport applications (partial transport, Moreau-Yosida regularization, etc...) but only worked in 2D or 3D. Additionaly, and more specifically, we wanted the APIs much more comprehensive and generic.

Currently, there are bindings for C++ and Python.

Installation

Pip

For python, pip install sdot should do the job, including some precompiled libraries for the most common cases (2D/3D, float64, ...). If your cases are not included in the distribution, the required dynamic libraries will be automatically compiled on first use. In this situation, you will need to have a C++ compiler installed on your machine. As scons is used to find and call the compiler, all you need to do is install one compiler that is compatible with this builder (for instance g++, clang, xcode, vscode, ...).

For a compiler : under Debian like, sudo apt install g++. Under Mac os, xcode-select --install. Under Windows, you can follow this link.

Sources

To get that latest version, sdot can also be installed from the git repository.

For the python modules:

git clone https://github.com/sdot-team/sdot.git
# maybe after a micromamba activate ...
cd sdot/src/python
pip install flit
flit install -s # -s makes symbolic links to the sources

Notebook examples

Here are some notebooks you can download and test on your own machine or via google colab to understand the overall spirit.

  • Power or voronoi diagrams in python: file, colab.
  • Optimal transport operations in python: file, colab.
  • Polyhedral convex function in python: file, colab.

If you're looking for more simple examples, there is an example directory with more concise notebooks, oriented on specific tasks.

Extensive documentation

The generated pydoc files

A word on performance

The most common tools to handle voronoi and power diagrams start from delaunay (regular) triangulations. Building this triangulation is generaly the most time-consuming part of this approach, notably because one have to deal with the problems that come with digital precision...

Nevertheless, for most applications of the sdot package, we only need the integrals of the cells and the boundaries, meaning that most of the problems with digital precision naturally vanish at the end. We also realized that it was much more convenient for the user to work directly with the cells.

Bearing in mind that exact connectivity may of course be required for some applications (the 'dual' geometry becoming the triangulation in our case :) ), we therefore decided to give a try to algorithms with a focus on the cells, that are computed individually in a fully parallel fashion. We tried to stay on the user specified scalar types (e.g. float64) as long as possible. Finally, we designed adapted spatial acceleration structures to stay within O(n log(n)) execution speed with the smallest possible constant.

Internally, it is written in C++/Cuda with SIMD/SIMT instructions. It support large vectors, for out-of-core and multi-machine computations. More on this page.

On going work

  • pre-guess of the weight to avoid void cells at the beginning
  • non-linear solvers to avoid bad newton directions
  • pytorch compatible operations

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

sdot-2024.12.6.1.tar.gz (70.0 kB view details)

Uploaded Source

Built Distribution

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

sdot-2024.12.6.1-py2.py3-none-any.whl (102.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sdot-2024.12.6.1.tar.gz.

File metadata

  • Download URL: sdot-2024.12.6.1.tar.gz
  • Upload date:
  • Size: 70.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for sdot-2024.12.6.1.tar.gz
Algorithm Hash digest
SHA256 9ba0d9b446c8377bc1499bef158aee258d73e3484def55325e986c6199650f9e
MD5 a7567f2040bf15f593fb8b54767342c3
BLAKE2b-256 bc605b772e934d52f8a2680d5f7ca716ac822b8c7579173f144f868991bae024

See more details on using hashes here.

File details

Details for the file sdot-2024.12.6.1-py2.py3-none-any.whl.

File metadata

  • Download URL: sdot-2024.12.6.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 102.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for sdot-2024.12.6.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 244dbbff6bb93163b678c1c87ccd04d4401ba94f4026b92e0755a2391bf50097
MD5 07a98a0412fda8cc4b8c53a10c8a2770
BLAKE2b-256 a0e773b4ba34793214b82817751b3bd80135a9b4b846d25c6bbae22c070a810d

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