Re: [R] multiplication question

From: Murali Menon <feanor0_at_hotmail.com>
Date: Thu, 03 Jul 2008 08:40:06 +0000

Thanks for your help, folks.  

The sum of (outer product less the diagonal) works.  

(In the original post, I guess I should have specified 'pair-wise product' of two vectors to be clearer).

Date: Thu, 3 Jul 2008 00:25:10 +0300From: lebatsnok_at_gmail.comTo: feanor0_at_hotmail.comSubject: Re: [R] multiplication questionCC: r-help_at_stat.math.ethz.chfor example ...x <- 1:5 ; y<- 6:8(m <- x %o% y) # is this what you mean by product of two vectors?sum(m[row(m)!=col(m)]) # or ...sum(m)-sum(diag(m)) On Wed, Jul 2, 2008 at 7:30 PM, Murali Menon <feanor0_at_hotmail.com> wrote:

folks,is there a clever way to compute the sum of the product of two vectors such that the common indices are not multiplied together?i.e. if i have vectors X, Y, how can i computeSum  (X[i] * Y[j])i != jwhere i != jalso, what if i wantedSum (X[i] * Y[j] * R[i, j])i != jwhere R is a matrix?thanks,murali______________________________________________R-help@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
_________________________________________________________________
[[elided Hotmail spam]]

        [[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. Received on Thu 03 Jul 2008 - 09:59:45 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 Thu 03 Jul 2008 - 10:31:24 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