Skip to contents

Projecting to a line makes the transport problem a sort, so a sliced distance costs O(L n log n) instead of the cubic price of the linear program, and it still metrises weak convergence. The directions are a van der Corput / AS 241 sequence rather than a pseudo-random one, so the value is reproducible across arms and across runs.

Usage

Otsw(X, Y, p = 2, n_proj = 32)

Arguments

X, Y

Two point clouds with the same number of points.

p

Exponent, positive.

n_proj

Number of directions.

Value

List with SW, SW_p, per_proj, n, d, n_proj.

Details

Formula: \(SW_p(mu,nu) = (E_theta [W_p(P_theta mu, P_theta nu)^p])^(1/p)\) – Bonneel et al. (2015) eq. (5); Peyre and Cuturi (2019) eq. (10.13), p. 166.

References

Bonneel, N., Rabin, J., Peyre, G. and Pfister, H. (2015). Journal of Mathematical Imaging and Vision 51(1):22-45. doi:10.1007/s10851-014-0506-3 .

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Otsw(V, V)
#> $SW
#> [1] 0
#> 
#> $SW_p
#> [1] 0
#> 
#> $per_proj
#>  [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
#> 
#> $n
#> [1] 8
#> 
#> $d
#> [1] 1
#> 
#> $n_proj
#> [1] 32
#> 
#> $method
#> [1] "Sliced Wasserstein distance"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"