dwasserstein: 2-Wasserstein distance

View source: R/gaussBary.R

dwassersteinR Documentation

2-Wasserstein distance

Description

Computes the 2-Wasserstein distance between the (covariance) matrices A and B.

Usage

  dwasserstein(A, B)

Arguments

A, B

Two symmetric positive semi-definite matrices.

Value

A numeric object with the 2-Wasserstein distance of A and B.

Author(s)

Valentina Masarotto, Guido Masarotto

References

Masarotto, V., Panaretos, V.M. & Zemel, Y. (2019) "Procrustes Metrics on Covariance Operators and Optimal Transportation of Gaussian Processes", Sankhya A 81, 172-213 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s13171-018-0130-1")}

See Also

gaussBary

Examples

n <- 10
matrices <- rWishart(2,n,diag(n))
A <- matrices[,,2]
B <- matrices[,,1]
dwasserstein(A,B)
dwasserstein(A, 10*crossprod(B))

fdWasserstein documentation built on May 29, 2024, 9:53 a.m.