[R] Calculating trace of products

2006-08-14 Thread Søren Højsgaard
Dear all, I need to calculate tr(A B), tr(A B A B) and similar quantities **fast** where the matrices A, B are symmetrical. I've searched for built-in functions for that purpose, but without luck. Can anyone help? Thanks in advance Søren [[alternative HTML version deleted]]

Re: [R] Calculating trace of products

2006-08-14 Thread roger koenker
I would suspect that something simple like sum(diag(crossprod(A,B))) would be quite competitive... url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox: 217-333-4558University of Illinois fax:

Re: [R] Calculating trace of products

2006-08-14 Thread Dimitris Rizopoulos
- Original Message - From: Søren Højsgaard [EMAIL PROTECTED] To: R-help list r-help@stat.math.ethz.ch Sent: Monday, August 14, 2006 1:58 PM Subject: [R] Calculating trace of products Dear all, I need to calculate tr(A B), tr(A B A B) and similar quantities **fast** where the matrices