kantorovich_CVX {kantorovich} | R Documentation |
Computes Kantorovich distance with CVX
Description
Kantorovich distance using the CVXR
package
Usage
kantorovich_CVX(
mu,
nu,
dist,
solution = FALSE,
stop_if_fail = TRUE,
solver = "ECOS",
...
)
Arguments
mu |
(row margins) probability measure in numeric mode |
nu |
(column margins) probability measure in numeric mode |
dist |
matrix defining the distance to be minimized on average |
solution |
logical; if |
stop_if_fail |
logical; if |
solver |
the |
... |
other arguments passed to |
Examples
x <- c(1.5, 2, -3)
mu <- c(1/7, 2/7, 4/7)
y <- c(4, 3.5, 0, -2)
nu <- c(1/4, 1/4, 1/4, 1/4)
M <- outer(x, y, FUN = function(x, y) abs(x - y))
kantorovich_CVX(mu, nu, dist = M)
[Package kantorovich version 3.2.0 Index]