Skip to contents

$$T = \mathrm{diag}(u) K \mathrm{diag}(v),\ K = e^{-C/\varepsilon}$$ Cuturi (2013), eq. (2) and Sec. 4.1; Peyre & Cuturi (2019), eq. (4.2). The loop runs exactly max_iter scalings – no tolerance, no early exit – so the result is deterministic.

Usage

Otsinkh(a, b, C, epsilon, max_iter = 200L)

Arguments

a, b

Non-negative marginals; each closed to unit mass here.

C

Cost matrix, length(a) by length(b).

epsilon

Positive regularisation strength.

max_iter

Fixed number of scalings (default 200).

Value

Named list with estimate (the cost <T,C>), T, u, v, iters, marginal_error, method.

References

Cuturi (2013), eq. (2).

Examples

Otsinkh(c(0.5, 0.5), c(0.2, 0.5, 0.3),
        matrix(c(0, 1, 1, 0, 4, 1), 2, 3), 0.5)$estimate
#> [1] 0.6204204