
Computes the weight vector of the Apollonius diagram describing the semidiscrete optimal transport plan for the Euclidean distance cost function and the associated Wasserstein distance.
semidiscrete1(
source,
target,
xrange = c(0, 1),
yrange = c(0, 1),
verbose = FALSE,
reg = 0
)
A list describing the solution. The components are
A vector of length equal to the first dimension of target
containing the weights for the Apollonius diagram discribing the
optimal semidiscrete transport from source to target.
The
A return code. Equal to 1 if everything is OK, since our code
interrupts the usual lbfgs code. Other values can be converted to the
corresponding return message by using ret_message
.
A matrix specifing the source measure.
A three-column matrix specifing the target measure in the form x-coordinate, y-coordinate, mass.
Vectors with two components defining the window on which
the source measure lives. Defaults to source
is interpreted as an image of equally sized quadratic pixels
on this window.
Logical. Shall information about multiscale progress and L-BFGS return codes be printed?
A non-negative regularization parameter. It is usually not necessary to deviate from the default 0.
Valentin Hartmann valentin.hartmann@epfl.ch (stand-alone C++ code)
Dominic Schuhmacher schuhmacher@math.uni-goettingen.de (R-port)
V. Hartmann and D. Schuhmacher (2017). Semi-discrete optimal transport --- the case p=1. Preprint arXiv:1706.07650
Menelaos Karavelas and Mariette Yvinec. 2D Apollonius Graphs (Delaunay Graphs of Disks). In CGAL User and Reference Manual. CGAL Editorial Board, 4.12 edition, 2018
Naoaki Okazaki (2010). libLBFGS: a library of Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS). Version 1.10
ret_message
, semidiscrete
.
if (FALSE) {
# the following function rotates a matrix m clockwise, so
# that image(rococlock(m)) has the same orientation as print(m):
roclock <- function(m) t(m)[, nrow(m):1]
set.seed(30)
n <- 20
nu <- matrix(c(runif(2*n), rgamma(n,3,1)), n, 3)
pixelbdry <- seq(0,1,length=33)
image(pixelbdry, pixelbdry, roclock(random32a$mass), asp=1, col = grey(seq(0,1,length.out=32)))
points(nu[,1], nu[,2], pch=16, cex=sqrt(nu[,3])/2, col=2)
res <- semidiscrete1(random32a$mass, nu)
plot_apollonius(nu[,1:2], res$weights, show_weights = FALSE, add = TRUE)
points(nu[,1], nu[,2], pch=16, cex=sqrt(nu[,3])/2, col=2)}
Run the code above in your browser using DataLab