Learn R Programming

WSGeometry (version 1.2.1)

geodesic_pos: Compute Wasserstein geodesics

Description

Computes the geodesic between two measures P1 and P2 in arbitrary dimensions at given timepoints.

Usage

geodesic_pos(P1, P2, p = 2, steps)

Arguments

P1

One of the following: A matrix, representing an image; A file name containing an image; A wpp-object.

P2

One of the following: A matrix, representing an image; A file name containing an image; A wpp-object.

p

A real number >=1 specifying the exponent of the Wasserstein distance.

steps

A vector of numbers in [0,1] describing the time points at which the geodesic should be evaluated.

Value

A list of the same length as steps where each element is a wpp-object describing the value of the geodesic at the corresponding times in steps.

Examples

Run this code
# NOT RUN {
U<-runif(20)
U<-U/sum(U)
pos<-matrix(runif(2*20),nrow=20,ncol=2)
P1<-transport::wpp(pos,U)
U<-runif(20)
U<-U/sum(U)
pos<-matrix(runif(2*20),nrow=20,ncol=2)
P2<-transport::wpp(pos,U)
geodesic<-geodesic_pos(P1,P2,p=2,seq(0,1,0.1))
## Set the image and/or gif flags to TRUE to run the example. 
## CRAN policy prevents examples from generating files in the working directory,
## so this had to be disabled.
plotGeodesic(geodesic,File="GeodesicR2",images=FALSE,gif=FALSE)
# }

Run the code above in your browser using DataLab