![]() |
SemiDiscreteOT 1.0
Semi-Discrete Optimal Transport Library
|
A class for computing and managing optimal transport map approximations. More...
#include <OptimalTransportPlan.h>
Public Member Functions | |
OptimalTransportPlan (const std::string &strategy_name="modal") | |
Constructor taking an optional strategy name. | |
void | set_distance_function (const std::function< double(const Point< spacedim > &, const Point< spacedim > &)> &dist) |
Set the distance function used to compute distances between points. This function accepts a callable object (e.g., lambda) that takes two points as input and returns a double representing their distance. | |
void | set_source_measure (const std::vector< Point< spacedim > > &points, const std::vector< double > &density) |
Set the source measure data. | |
void | set_target_measure (const std::vector< Point< spacedim > > &points, const std::vector< double > &density) |
Set the target measure data. | |
void | set_potential (const Vector< double > &potential, const double regularization_param=0.0) |
Set the optimal transport potential. | |
void | set_truncation_radius (double radius) |
Set the truncation radius for map computation. Points outside this radius will not be considered in the map computation. A negative value means no truncation (all points are considered). | |
void | compute_map () |
Compute the optimal transport map approximation using the current strategy. | |
void | save_map (const std::string &output_dir) const |
Save the computed transport map to files. | |
void | set_strategy (const std::string &strategy_name) |
Change the approximation strategy. | |
Static Public Member Functions | |
static std::vector< std::string > | get_available_strategies () |
Get available strategy names. | |
Static Private Member Functions | |
static std::unique_ptr< MapApproximationStrategy< spacedim > > | create_strategy (const std::string &name) |
Private Attributes | |
std::vector< Point< spacedim > > | source_points |
std::vector< double > | source_density |
std::vector< Point< spacedim > > | target_points |
std::vector< double > | target_density |
Vector< double > | transport_potential |
double | epsilon |
double | truncation_radius = -1.0 |
std::function< double(const Point< spacedim > &, const Point< spacedim > &)> | distance_function |
std::unique_ptr< MapApproximationStrategy< spacedim > > | strategy |
A class for computing and managing optimal transport map approximations.
This class provides various strategies for approximating the optimal transport map given source/target measures and optimal transport potentials.
spacedim | The dimension of the space the mesh is embedded in. |
Definition at line 46 of file OptimalTransportPlan.h.
OptimalTransportPlanSpace::OptimalTransportPlan< spacedim >::OptimalTransportPlan | ( | const std::string & | strategy_name = "modal" | ) |
Constructor taking an optional strategy name.
strategy_name | The name of the approximation strategy to use. |
Definition at line 9 of file OptimalTransportPlan.cc.
|
inline |
Set the distance function used to compute distances between points. This function accepts a callable object (e.g., lambda) that takes two points as input and returns a double representing their distance.
distance_function | Function to compute distance between two points. |
Definition at line 61 of file OptimalTransportPlan.h.
void OptimalTransportPlanSpace::OptimalTransportPlan< spacedim >::set_source_measure | ( | const std::vector< Point< spacedim > > & | points, |
const std::vector< double > & | density | ||
) |
Set the source measure data.
points | Vector of source points |
density | Vector of density values at source points |
Definition at line 17 of file OptimalTransportPlan.cc.
void OptimalTransportPlanSpace::OptimalTransportPlan< spacedim >::set_target_measure | ( | const std::vector< Point< spacedim > > & | points, |
const std::vector< double > & | density | ||
) |
Set the target measure data.
points | Vector of target points |
density | Vector of density values at target points |
Definition at line 27 of file OptimalTransportPlan.cc.
void OptimalTransportPlanSpace::OptimalTransportPlan< spacedim >::set_potential | ( | const Vector< double > & | potential, |
const double | regularization_param = 0.0 |
||
) |
Set the optimal transport potential.
potential | Vector of potential values at target points |
regularization_param | The regularization parameter used (if any) |
Definition at line 37 of file OptimalTransportPlan.cc.
void OptimalTransportPlanSpace::OptimalTransportPlan< spacedim >::set_truncation_radius | ( | double | radius | ) |
Set the truncation radius for map computation. Points outside this radius will not be considered in the map computation. A negative value means no truncation (all points are considered).
radius | The truncation radius |
Definition at line 47 of file OptimalTransportPlan.cc.
void OptimalTransportPlanSpace::OptimalTransportPlan< spacedim >::compute_map | ( | ) |
Compute the optimal transport map approximation using the current strategy.
Definition at line 53 of file OptimalTransportPlan.cc.
void OptimalTransportPlanSpace::OptimalTransportPlan< spacedim >::save_map | ( | const std::string & | output_dir | ) | const |
Save the computed transport map to files.
output_dir | Directory where to save the results |
Definition at line 67 of file OptimalTransportPlan.cc.
void OptimalTransportPlanSpace::OptimalTransportPlan< spacedim >::set_strategy | ( | const std::string & | strategy_name | ) |
Change the approximation strategy.
strategy_name | Name of the strategy to use |
Definition at line 75 of file OptimalTransportPlan.cc.
|
static |
Get available strategy names.
Definition at line 81 of file OptimalTransportPlan.cc.
|
staticprivate |
|
private |
Definition at line 123 of file OptimalTransportPlan.h.
|
private |
Definition at line 124 of file OptimalTransportPlan.h.
|
private |
Definition at line 125 of file OptimalTransportPlan.h.
|
private |
Definition at line 126 of file OptimalTransportPlan.h.
|
private |
Definition at line 127 of file OptimalTransportPlan.h.
|
private |
Definition at line 128 of file OptimalTransportPlan.h.
|
private |
Definition at line 129 of file OptimalTransportPlan.h.
|
private |
Definition at line 132 of file OptimalTransportPlan.h.
|
private |
Definition at line 135 of file OptimalTransportPlan.h.