[R] geodesic distance (solution)

From: stefano iacus <stefano.iacus_at_unimi.it>
Date: Fri 04 Aug 2006 - 17:14:09 EST

> Hi,
> has anyone ever seen implemented in R the following "geodesic"
> distance between positive definite pxp matrices A and B?
> d(A,B) = \sum_{i=1}^p (\log \lambda_i)^2
> were \lambda is the solution of det(A -\lambda B) = 0
> thanks
> stefano

as I received few private email on the claimed solution, I'm posting it to r-help.

when matrix B is invertible (which is always my case), one approach is to notice that

det(A -\lambda * B) = 0

is equivalent to solve

det(B^-1*A -\lambda *I) = 0

which is a standard eigen value problem for the matrix B^-1 * A, hence

eigen(solve(B) %*% A)$values

is the answer.

I'm pretty sure that the problem can also be solved using some svd decomposition when B is not invertible.

hope it helps

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri Aug 04 17:18:12 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 04 Aug 2006 - 18:17:28 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.