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

Gabor Grothendieck ggrothendieck at gmail.com
Sun Sep 27 00:49:38 CEST 2009


OK. Try this:

> library(Matrix)
> M <- matrix(c(2, 1, 1, 2), 2); M
     [,1] [,2]
[1,]    2    1
[2,]    1    2

> # log of expm(M) is original matrix M
> with(eigen(expm(M)), vectors %*% diag(log(values)) %*% t(vectors))
     [,1] [,2]
[1,]    2    1
[2,]    1    2


On Sat, Sep 26, 2009 at 6:24 PM, Charles C. Berry <cberry at tajo.ucsd.edu> wrote:
> 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 <mimosa1879 at yahoo.fr> 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 HTML version deleted]]
>>>
>>>
>>> ______________________________________________
>>> R-help at r-project.org 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.
>>>
>>>
>>
>> ______________________________________________
>> R-help at r-project.org 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.
>>
>
> Charles C. Berry                            (858) 534-2098
>                                            Dept of Family/Preventive
> Medicine
> E mailto:cberry at tajo.ucsd.edu               UC San Diego
> http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901
>
>




More information about the R-help mailing list