[R] Vector multiplication wrap-around

Wollenberg, Kurt R KWollenberg at tufts-nemc.org
Tue Nov 9 18:04:42 CET 2004


Greetings:

In a function I'm trying to write I am multiplying each row in a matrix by a
vector. When the vector extends beyond the end of the matrix I need to have
the multiplication wrap around (continue with column 1 of the matrix).
Initially I got this to work with a loop (old programming habits die hard).
Now, after going back through MASS I've figured out how to do the
multiplication efficiently (without loops) but I can't seem to solve the
wrapping problem. Is there an efficient method for making vector
multiplication wrap around the end of the matrix? I'm using R-2.0.0 running
on Windows XP Pro 2002.

Cheers,
Kurt Wollenberg, PhD
Tufts Center for Vision Research 
New England Medical Center
750 Washington St, Box 450 
Boston, MA, USA
kwollenberg at tufts-nemc.org 
617-636-8945 (Fax)
617-636-9028 (Lab)

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but  "That's funny ..." 
--Isaac Asimov


********************** 
Confidentiality Notice\ **********************\      The inf...{{dropped}}




More information about the R-help mailing list