DualPotentials.transport(vec, forward=True)[source]#

Transport vec according to Brenier formula [Brenier, 1991].

Uses Theorem 1.17 from [Santambrogio, 2015] to compute an OT map when given the Legendre transform of the dual potentials.

That OT map can be recovered as \(x- (\nabla h^*)\circ \nabla f(x)\), where \(h^*\) is the Legendre transform of \(h\). For instance, in the case \(h(\cdot) = \|\cdot\|^2, \nabla h(\cdot) = 2 \cdot\,\), one has \(h^*(\cdot) = \|.\|^2 / 4\), and therefore \(\nabla h^*(\cdot) = 0.5 \cdot\,\).

When the dual potentials are solved in correlation form (only in the Sq. Euclidean distance case), the maps are \(\nabla g\) for forward, \(\nabla f\) for backward.

  • vec (Array) – Points to transport, array of shape [n, d].

  • forward (bool) – Whether to transport the points from source to the target distribution or vice-versa.

Return type:



The transported points.