Re: [R] Matrix operations

From: <Bill.Venables_at_csiro.au>
Date: Tue, 29 Jun 2010 13:07:40 +1000

Oops. Try

A <- sum(X * solve(V, X))

(too fast!)

-----Original Message-----

From: Venables, Bill (CMIS, Cleveland)
Sent: Tuesday, 29 June 2010 1:05 PM
To: 'Dmitrij Kudriavcev'; 'r-help_at_r-project.org' Subject: RE: [R] Matrix operations

Since X is a vector, then

A <- sum(X, solve(V, X))

is probably slightly better here.

-----Original Message-----

From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of Dmitrij Kudriavcev Sent: Tuesday, 29 June 2010 12:29 PM
To: r-help_at_r-project.org
Subject: [R] Matrix operations

Hello

I have a quick question.

I need to compute matrix in R, like A <- t(X) %*% solve(V) %*% X, where X is a vector and V is a matrix

This code works, but now i want to optimize it. I have try:

A <- crossprod(X, solve(V)) %*% X

Is there another, better way?

WBR
Dima

        [[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. Received on Tue 29 Jun 2010 - 03:09:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Jun 2010 - 03:10:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive