Re: [R] Exponentiate a matrix

2006-09-22 Thread Ingmar Visser
Out of curiosity and possibly for later use: is there an R-function that does matrix logarithms? Best, Ingmar On 9/21/06 8:58 PM, Dimitrios Rizopoulos [EMAIL PROTECTED] wrote: Quoting Douglas Bates [EMAIL PROTECTED]: On 9/21/06, Dimitrios Rizopoulos [EMAIL PROTECTED] wrote: Quoting Duncan

Re: [R] Exponentiate a matrix

2006-09-22 Thread Paul Gilbert
I am getting a bit rusty on some of these things, but I seem to recall that there is a numerical advantage (speed and/or accuracy?) to diagonalizing: expM - function(X,e) { v - La.svd(X); v$u %*% diag(v$d^e) %*% v$vt } P - matrix(c(.3,.7, .7, .3), ncol=2) P %*% P %*% P [,1] [,2]

[R] Exponentiate a matrix

2006-09-21 Thread Doran, Harold
Suppose I have a square matrix P P - matrix(c(.3,.7, .7, .3), ncol=2) I know that P * P Returns the element by element product, whereas P%*%P Returns the matrix product. Now, P^2 also returns the element by element product. But, is there a slick way to write P %*% P %*% P Obviously,

Re: [R] Exponentiate a matrix

2006-09-21 Thread Duncan Murdoch
On 9/21/2006 10:40 AM, Doran, Harold wrote: Suppose I have a square matrix P P - matrix(c(.3,.7, .7, .3), ncol=2) I know that P * P Returns the element by element product, whereas P%*%P Returns the matrix product. Now, P^2 also returns the element by element product. But,

Re: [R] Exponentiate a matrix

2006-09-21 Thread Dimitrios Rizopoulos
Quoting Duncan Murdoch [EMAIL PROTECTED]: On 9/21/2006 10:40 AM, Doran, Harold wrote: Suppose I have a square matrix P P - matrix(c(.3,.7, .7, .3), ncol=2) I know that P * P Returns the element by element product, whereas P%*%P Returns the matrix product. Now, P^2 also returns

Re: [R] Exponentiate a matrix

2006-09-21 Thread Andreas Hary
:26 PM Subject: Re: [R] Exponentiate a matrix Quoting Duncan Murdoch [EMAIL PROTECTED]: On 9/21/2006 10:40 AM, Doran, Harold wrote: Suppose I have a square matrix P P - matrix(c(.3,.7, .7, .3), ncol=2) I know that P * P Returns the element by element product, whereas P%*%P Returns

Re: [R] Exponentiate a matrix

2006-09-21 Thread Douglas Bates
On 9/21/06, Dimitrios Rizopoulos [EMAIL PROTECTED] wrote: Quoting Duncan Murdoch [EMAIL PROTECTED]: On 9/21/2006 10:40 AM, Doran, Harold wrote: Suppose I have a square matrix P P - matrix(c(.3,.7, .7, .3), ncol=2) I know that P * P Returns the element by element product,

Re: [R] Exponentiate a matrix

2006-09-21 Thread Dimitrios Rizopoulos
Quoting Douglas Bates [EMAIL PROTECTED]: On 9/21/06, Dimitrios Rizopoulos [EMAIL PROTECTED] wrote: Quoting Duncan Murdoch [EMAIL PROTECTED]: On 9/21/2006 10:40 AM, Doran, Harold wrote: Suppose I have a square matrix P P - matrix(c(.3,.7, .7, .3), ncol=2) I know that P * P