powered by
Kantorovich distance using the CVXR package
CVXR
kantorovich_CVX( mu, nu, dist = NULL, solution = FALSE, stop_if_fail = TRUE, solver = "ECOS", ... )
(row margins) probability measure in numeric mode
(column margins) probability measure in numeric mode
matrix, the distance to be minimized on average; if NULL, the 0-1 distance is used.
NULL
logical; if TRUE the solution is returned in the "solution" attributes of the output
TRUE
"solution"
logical; if TRUE, an error is returned in the case when no solution is found; if FALSE, the output of psolve is returned with a warning
FALSE
psolve
the CVX solver, passed to psolve
CVX
other arguments passed to psolve
mu <- c(1/7,2/7,4/7) nu <- c(1/4,1/4,1/2) kantorovich_CVX(mu, nu)
Run the code above in your browser using DataLab