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

Gabor Grothendieck ggrothendieck at gmail.com
Sun Sep 27 01:51:56 CEST 2009


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 <cberry at tajo.ucsd.edu> wrote:
> 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,]    2    1
>> [2,]    1    2
>>
>
> 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 do not see the machinery in R for dealing
> with Jordan blocks.
>
> HTH,
>
> Chuck
>
>
>
>>> # 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
>>>
>>>
>>
>> ______________________________________________
>> 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