Above one dimension there is no sorting shortcut, so the coupling is an assignment problem. With equal-size samples the optimal coupling is a permutation, found here by the Hungarian method – exact and deterministic, unlike entropic approximations that depend on a regularisation parameter and a stopping rule.
References
Villani, C. (2009). Optimal Transport: Old and New, Springer Grundlehren 338, ch 6; Kuhn, H. W. (1955) NRLQ 2:83-97.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Wsdt2d(V, V)
#> $estimate
#> [1] 0
#>
#> $wpp
#> [1] 0
#>
#> $assignment
#> [1] 0 1 2 3 4 5 6 7
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Wasserstein-p by optimal assignment"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
