Skip to contents

$$C_{ij} = \|x_i - y_j\|_p$$ Peyre & Cuturi (2019), Sec. 2.4. p = Inf gives the sup norm.

Usage

Otcostlp(X, Y, p = 2)

Arguments

X, Y

Point sets, n x d and m x d.

p

Norm order, at least 1 (default 2).

Value

Named list with estimate, p, nrow, ncol, total, method.

References

Peyre & Cuturi (2019), Sec. 2.4.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Otcostlp(V, V)
#> $estimate
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
#> [1,]    0    1    2    3    4    5    6    7
#> [2,]    1    0    1    2    3    4    5    6
#> [3,]    2    1    0    1    2    3    4    5
#> [4,]    3    2    1    0    1    2    3    4
#> [5,]    4    3    2    1    0    1    2    3
#> [6,]    5    4    3    2    1    0    1    2
#> [7,]    6    5    4    3    2    1    0    1
#> [8,]    7    6    5    4    3    2    1    0
#> 
#> $p
#> [1] 2
#> 
#> $nrow
#> [1] 8
#> 
#> $ncol
#> [1] 8
#> 
#> $total
#> [1] 168
#> 
#> $method
#> [1] "l_p ground cost -- Peyre & Cuturi (2019) Sec. 2.4"
#>