Re: [R] Computing time for matrix addition or subtraction

2006-11-13 Thread Prof Brian Ripley
On Sun, 12 Nov 2006, YONGWAN CHUN wrote: I wonder by chance if there is a way to reduce computing time for matrix addition or subtraction. With a lot of iterations, it would be helpful to reduce a little amount time. Yes, by making use of an optimized BLAS: see the R-admin manual. On my

Re: [R] Computing time for matrix addition or subtraction

2006-11-13 Thread Matthias Kohl
not concerning your subject line, but function crossprod may be useful, too Matthias - original message Subject: Re: [R] Computing time for matrix addition or subtraction Sent: Mon, 13 Nov 2006 From: Prof Brian Ripley[EMAIL PROTECTED] On Sun, 12 Nov 2006, YONGWAN CHUN wrote

[R] Computing time for matrix addition or subtraction

2006-11-12 Thread YONGWAN CHUN
Hello, I wonder by chance if there is a way to reduce computing time for matrix addition or subtraction. With a lot of iterations, it would be helpful to reduce a little amount time. Simple example is as below n - 2000 P - matrix(rnorm(n*n),n,n) PP - P %*% P M - diag(n) - P R - M + t(M) -

Re: [R] Computing time for matrix addition or subtraction

2006-11-12 Thread Gabor Grothendieck
This is slightly faster but not by much: ad - function(m, a) { diag(m) - diag(m) + a; m } R - ad(P %*% P - t(P) - P, 1) On 11/12/06, YONGWAN CHUN [EMAIL PROTECTED] wrote: Hello, I wonder by chance if there is a way to reduce computing time for matrix addition or subtraction. With a lot of