SemiDiscreteOT 1.0
Semi-Discrete Optimal Transport Library
Loading...
Searching...
No Matches
Lloyd.h
Go to the documentation of this file.
1#ifndef LLOYD_H
2#define LLOYD_H
3
7
8using namespace dealii;
9
22template <int dim, int spacedim = dim>
23class Lloyd : public SemiDiscreteOT<dim, spacedim>
24{
25public:
30 Lloyd(const MPI_Comm &mpi_communicator);
34 void run();
40 void run_lloyd(
41 const double absolute_threshold=1e-8,
42 const unsigned int max_iterations=100);
47 void run_sot_iteration(const unsigned int n_iter);
52 void run_centroid_iteration(const unsigned int n_iter);
60 const std::vector<Point<spacedim>>& barycenters_next,
61 const std::vector<Point<spacedim>>& barycenters_prev,
62 double &l2_norm);
63
65 std::vector<Point<spacedim>> barycenters;
66 std::vector<Point<spacedim>> barycenters_prev;
67 Vector<double> potential;
68};
69
70#endif
71
A class for performing Lloyd's algorithm for semi-discrete optimal transport.
Definition Lloyd.h:24
void run_centroid_iteration(const unsigned int n_iter)
Runs a single iteration of the centroid computation.
Definition Lloyd.cc:83
void compute_step_norm(const std::vector< Point< spacedim > > &barycenters_next, const std::vector< Point< spacedim > > &barycenters_prev, double &l2_norm)
Computes the L2 norm of the step.
Definition Lloyd.cc:64
void run_sot_iteration(const unsigned int n_iter)
Runs a single iteration of the semi-discrete optimal transport solver.
Definition Lloyd.cc:180
void run_lloyd(const double absolute_threshold=1e-8, const unsigned int max_iterations=100)
Runs the Lloyd's algorithm with the given parameters.
Definition Lloyd.cc:14
Vector< double > potential
The optimal transport potential.
Definition Lloyd.h:67
std::vector< Point< spacedim > > barycenters_prev
The barycenters of the power cells in the previous iteration.
Definition Lloyd.h:66
std::vector< Point< spacedim > > barycenters
The barycenters of the power cells.
Definition Lloyd.h:65
void run()
Runs the Lloyd's algorithm.
Definition Lloyd.cc:285
LloydParameterManager param_manager_lloyd
The parameter manager for the Lloyd's algorithm.
Definition Lloyd.h:64
Main class for the semi-discrete optimal transport solver.
MPI_Comm mpi_communicator
The MPI communicator.