shielding | R Documentation |
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 , b |
arrays with |
nscales |
the number of scales generated in the multiscale algorithm. |
startscale |
the first scale on which the problem is solved. |
flood |
a real number. If positive, take the maximum of entry and |
measureScale |
the required precision for the entries. Computations are performed on
|
verbose |
logical. Toggles output to the console about the progress of the algorithm. |
basisKeep , basisRefine |
internal use only. |
If a
and b
do not have the same sum, they are normalized to sum 1 before
flood
and measureScale
transformations are applied.
A list of components
err |
error code. 0 if everything is ok. |
a_used , b_used |
the vectorized arrays that were actually used by the algorithm. |
coupling |
a vectorized coupling describing the optimal transport from a_used to b_used |
basis |
a matrix with two columns describing the basis obtained for the optimal transport |
u , v |
vectors of optimal values in the dual problem |
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)
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.
## Not run:
shielding(random64a$mass,random64b$mass,nscales=6,measureScale=1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.