Runs the multiscale version of the Shielding Method (a.k.a. Short Cut Method) for computing the optimal transport (cost/plan) on a rectangular grid in \(d\) dimensions for the squared Euclidean distance as cost function.
shielding(
a,
b,
nscales = 2,
startscale = 1,
flood = 0,
measureScale = 1e-06,
verbose = FALSE,
basisKeep = 1,
basisRefine = 1
)
A list of components
error code. 0 if everything is ok.
the vectorized arrays that were actually used by the algorithm. a
, b
after
applying flood
and measureScale
.
a vectorized coupling describing the optimal transport from a_used to b_used
a matrix with two columns describing the basis obtained for the optimal transport
vectors of optimal values in the dual problem
arrays with \(d\) coordinates representing source and target measure, respectively. The entries must be all positive.
the number of scales generated in the multiscale algorithm.
the first scale on which the problem is solved.
a real number. If positive, take the maximum of entry and flood
for each
entry of a
and b
.
the required precision for the entries. Computations are performed on
round(a/measureScale)
and the same for b
using integer arithmetics.
logical. Toggles output to the console about the progress of the algorithm.
internal use only.
For larger problems (thousands of grid points) there are considerable speed improvements when shielding
can use the CPLEX numerical solver for the underlying constrained optimization problems.
If a local installation of CPLEX is available, the transport package can be linked against it during installation.
See the file src/Makevars in the source package for instructions.
Bernhard Schmitzer schmitzer@uni-muenster.de and
Dominic Schuhmacher dschuhm1@uni-goettingen.de
(based on C++ code by Bernhard Schmitzer)
If a
and b
do not have the same sum, they are normalized to sum 1 before
flood
and measureScale
transformations are applied.
B. Schmitzer (2016). A sparse multiscale algorithm for dense optimal transport. J. Math. Imaging Vision 56(2), 238--259. https://arxiv.org/abs/1510.05466
transport
, which calls this function if appropriate.
if (FALSE) {
shielding(random64a$mass,random64b$mass,nscales=6,measureScale=1) }
Run the code above in your browser using DataLab