deblais
Exact optimal transport between point clouds
Loading...
Searching...
No Matches
solve.hpp File Reference

deblais::solve(): exact optimal transport between two weighted point clouds for the cost \(|x - y|^p\) (squared Euclidean by default). More...

#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <numeric>
#include <stdexcept>
#include <string>
#include <vector>
#include "detail/cost.hpp"
#include "detail/curve.hpp"
#include "detail/line.hpp"
#include "detail/multiscale.hpp"
#include "detail/parallel.hpp"
#include "detail/pool_simplex.hpp"
#include "detail/pricing.hpp"
#include "options.hpp"
#include "plan.hpp"

Classes

struct  deblais::Recipe
 What the automatic mode decides for a problem, as returned by recipe(). More...
struct  deblais::AutoThresholds
 Sizes at which the automatic mode changes method. More...

Namespaces

namespace  deblais
 Public interface of the library.

Macros

#define DEBLAIS_MAX_DIM   4
 Largest dimension accepted by the solve() overloads that take the dimension at run time.

Functions

Recipe deblais::recipe (int dim, std::size_t n1, std::size_t n2, const Options &options=Options())
 The automatic mode: method and main parameters chosen for a problem.
template<int D>
Plan deblais::solve (const Cloud &source, const Cloud &target, const Options &options=Options())
 Solves the optimal transport problem between two weighted point clouds for the cost \(|x - y|^p\) (Options::p, 2 by default).
Plan deblais::solve (int dim, const Cloud &source, const Cloud &target, const Options &options=Options())
 Solves a problem whose dimension is known at run time.
Plan deblais::solve (int dim, const std::vector< double > &x, const std::vector< double > &y, const Options &options=Options())
 Solves between the uniform probability measures of two clouds stored point after point.
Plan deblais::solve (int dim, const std::vector< double > &x, const std::vector< double > &a, const std::vector< double > &y, const std::vector< double > &b, const Options &options=Options())
 Solves between two weighted clouds stored point after point.
template<std::size_t D>
Plan deblais::solve (const std::vector< std::array< double, D > > &x, const std::vector< std::array< double, D > > &y, const Options &options=Options())
 Solves between the uniform probability measures of two vectors of points.
template<std::size_t D>
Plan deblais::solve (const std::vector< std::array< double, D > > &x, const std::vector< double > &a, const std::vector< std::array< double, D > > &y, const std::vector< double > &b, const Options &options=Options())
 Solves between two weighted vectors of points.

Detailed Description

deblais::solve(): exact optimal transport between two weighted point clouds for the cost \(|x - y|^p\) (squared Euclidean by default).

\[ \min_{P \ge 0} \ \sum_{ij} P_{ij}\,|x_i - y_j|^p \quad \text{subject to} \quad \sum_j P_{ij} = a_i, \qquad \sum_i P_{ij} = b_j . \]

The cost matrix is never stored: the memory of a solve is linear in the number of points, and the result is a sparse plan with its dual potentials.

Macro Definition Documentation

◆ DEBLAIS_MAX_DIM

#define DEBLAIS_MAX_DIM   4

Largest dimension accepted by the solve() overloads that take the dimension at run time.

Define it before including the library to raise it: every dimension up to this one is instantiated. The overloads whose dimension is a template argument have no such limit.