ott.problems.quadratic.quadratic_problem.QuadraticProblem.marginal_dependent_cost

ott.problems.quadratic.quadratic_problem.QuadraticProblem.marginal_dependent_cost#

QuadraticProblem.marginal_dependent_cost(marginal_1, marginal_2)[source]#

Initialize cost term that depends on the marginals of the transport.

Uses the first term in eq. 6, p. 1 of [Peyré et al., 2016].

Let \(p\) be the [n,] marginal of the transport matrix for samples from geom_xx and \(q\) the [m,] marginal of the transport matrix for samples from geom_yy.

When cost_xx (resp. cost_yy) is the cost matrix of geom_xx (resp. geom_yy), the cost term that depends on these marginals can be written as:

\[\text{marginal_dep_term} = \text{lin1}(\text{cost_xx}) p \mathbb{1}_{m}^T + \mathbb{1}_{n}(\text{lin2}(\text{cost_yy}) q)^T\]

This helper function instantiates these two low-rank matrices and groups them into a single low-rank cost geometry object.

Parameters:
  • marginal_1 (Array) – [n,], first marginal of transport matrix.

  • marginal_2 (Array) – [m,], second marginal of transport matrix.

Return type:

LRCGeometry

Returns:

Low-rank geometry of rank 2, storing normalization constants.