kr_dist: Compute the p-Kantorovich-Rubinstein distance between two...

Description Usage Arguments Value References Examples

View source: R/unbalanced_transport.R

Description

This function constructs the corresponding problem and solves it suing the transport-function.

Usage

1
kr_dist(A, B, p = 2, C)

Arguments

A

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

B

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

p

A positive real number specifying the order of the Kantorovich-Rubinstein distance.

C

A positive real number specifying the cost parameter of the Kantorovich-Rubinstein distance.

Value

A list containing an entry "distance" (specifying the KR distance between the two measures) and an entry "plan" containing an optimal plan for the unbalanced optimal transport problem.

References

Kantorovich-Rubinstein distance and barycenter for finitely supported measures: Foundations and Algorithms; Florian Heinemann, Marcel Klatt, Axel Munk; https://arxiv.org/pdf/2112.03581.pdf.

Examples

1
2
3
4
5
6
7
8
M<-1000
W1<-runif(M)
W2<-runif(M)
pos1<-matrix(runif(M*2),M,2)
pos2<-matrix(runif(M*2),M,2)
wpp1<-transport::wpp(pos1,W1)
wpp2<-transport::wpp(pos2,W2)
system.time(res<-WSGeometry:::kr_dist(wpp1,wpp2,2,2))

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