Skip to contents

The loop is NOT stopped by the tolerance: exactly max_iter scalings are performed, the marginal violation after each is recorded, and the first index below tol is read off the finished trace. Cuturi (2013), Sec. 4.1; Peyre & Cuturi (2019), Sec. 4.2.

Usage

Otsinkit(a, b, C, epsilon, tol, max_iter = 200L)

Arguments

a, b

Non-negative marginals; closed here.

C

Cost matrix.

epsilon

Positive regularisation strength.

tol

Sup-norm marginal-violation threshold.

max_iter

Fixed trace length (default 200).

Value

Named list with estimate, reached, final_error, trace, method.

References

Cuturi (2013), Sec. 4.1.

Examples

Otsinkit(a = c(1, 2, 3, 4, 5, 6, 7, 8), b = 5L, C = c(1, 2, 3, 4, 5, 6, 7, 8), epsilon = 5L,
  tol = 0.5)
#> $estimate
#> [1] 1
#> 
#> $reached
#> [1] TRUE
#> 
#> $final_error
#> [1] 0
#> 
#> $trace
#>   [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#>  [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#>  [75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> [112] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> [149] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> [186] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 
#> $method
#> [1] "Sinkhorn iterations to reach tol, from a fixed-length trace -- Cuturi (2013) Sec. 4.1"
#>