geodesic_pos: Compute Wasserstein geodesics

Description Usage Arguments Value Examples

View source: R/ws_geodesic.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

WSGeometry documentation built on Dec. 15, 2021, 1:08 a.m.