Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-28 Thread Martin Maechler
> "DB" == Douglas Bates > on Sun, 27 Sep 2009 17:25:39 -0500 writes: DB> There is a logm function in the expm package in the expm project on DB> R-forge. See http://expm.R-forge.R-project.org/ DB> Martin was the person who added that function so I will defer to his D

Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-27 Thread Charles C. Berry
On Sun, 27 Sep 2009, Douglas Bates wrote: There is a logm function in the expm package in the expm project on R-forge. See http://expm.R-forge.R-project.org/ Martin was the person who added that function so I will defer to his explanations of what it does. I know he has been traveling and it

Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-27 Thread Douglas Bates
There is a logm function in the expm package in the expm project on R-forge. See http://expm.R-forge.R-project.org/ Martin was the person who added that function so I will defer to his explanations of what it does. I know he has been traveling and it may be a day or two before he can get to this

Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-27 Thread Charles C. Berry
On Sat, 26 Sep 2009, spencerg wrote: Sylvester's formula (http://en.wikipedia.org/wiki/Sylvester%27s_formula) applies to a square matrix A = S L solve(S), where L = a diagonal matrix and S = matrix of eigenvectors. Let "f" be an analytic function [for which f(A) is well defined]. Then f(

Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-26 Thread spencerg
Sylvester's formula (http://en.wikipedia.org/wiki/Sylvester%27s_formula) applies to a square matrix A = S L solve(S), where L = a diagonal matrix and S = matrix of eigenvectors. Let "f" be an analytic function [for which f(A) is well defined]. Then f(A) = S f(L) solve(S). We can

Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-26 Thread Gabor Grothendieck
Often one uses matrix logarithms on symmetric positive definite matrices so the assumption of being symmetric is sufficient in many cases. On Sat, Sep 26, 2009 at 7:28 PM, Charles C. Berry wrote: > On Sat, 26 Sep 2009, Gabor Grothendieck wrote: > >> OK. Try this: >> >>> library(Matrix) >>> M <- m

Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-26 Thread Charles C. Berry
On Sat, 26 Sep 2009, Gabor Grothendieck wrote: OK. Try this: library(Matrix) M <- matrix(c(2, 1, 1, 2), 2); M [,1] [,2] [1,]21 [2,]12 Right. expm( M ) is diagonalizable. But for M <- matrix( c(0,1,0,0), 2 ) you get the wrong result. Maybe I should have added that I

Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-26 Thread Gabor Grothendieck
OK. Try this: > library(Matrix) > M <- matrix(c(2, 1, 1, 2), 2); M [,1] [,2] [1,]21 [2,]12 > # log of expm(M) is original matrix M > with(eigen(expm(M)), vectors %*% diag(log(values)) %*% t(vectors)) [,1] [,2] [1,]21 [2,]12 On Sat, Sep 26, 2009 at 6:24

Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-26 Thread Charles C. Berry
On Sat, 26 Sep 2009, Gabor Grothendieck wrote: Try: expm( - M) Mimosa probably meant say 'the inverse function'. I do not see one in R. Chuck On Sat, Sep 26, 2009 at 5:06 PM, Mimosa Zeus wrote: Dear R users, Does anyone has implemented the inverse of the matrix exponential (expm in th

Re: [R] implementation of matrix logarithm (inverse of matrix exponential)

2009-09-26 Thread Gabor Grothendieck
Try: expm( - M) On Sat, Sep 26, 2009 at 5:06 PM, Mimosa Zeus wrote: > Dear R users, > > Does anyone has implemented the inverse of the matrix exponential (expm in > the package Matrix)? > > In Matlab, there're logm and expm, there's only expm in R. > Cheers > Mimosa > > > >        [[alternative