powered by
Computes the 2-Wasserstein distance between the (covariance) matrices A and B.
dwasserstein(A, B)
A numeric object with the 2-Wasserstein distance of A and B.
Two symmetric positive semi-definite matrices.
Valentina Masarotto, Guido Masarotto
Masarotto, V., Panaretos, V.M. & Zemel, Y. (2019) "Procrustes Metrics on Covariance Operators and Optimal Transportation of Gaussian Processes", Sankhya A 81, 172-213 tools:::Rd_expr_doi("10.1007/s13171-018-0130-1")
gaussBary
n <- 10 matrices <- rWishart(2,n,diag(n)) A <- matrices[,,2] B <- matrices[,,1] dwasserstein(A,B) dwasserstein(A, 10*crossprod(B))
Run the code above in your browser using DataLab