Try something about like this: v1 %o% v2 - diag(v1*v2)
On Wed, Jul 2, 2008 at 1:30 PM, Murali Menon <[EMAIL PROTECTED]> 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 compute > > Sum (X[i] * Y[j]) > i != j > > where i != j > > also, what if i wanted > > Sum (X[i] * Y[j] * R[i, j]) > i != j > > where R is a matrix? > > thanks, > > murali > > > _________________________________________________________________ > Enter the Zune-A-Day Giveaway for your chance to win day after day after > day > > M_Mobile_Zune_V1 > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@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. > > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@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.