[Numpy-discussion] Multiplying every 3 elements by a vector?

Marlin Rowley marlin_rowley@hotmail....
Wed Jul 9 14:16:47 CDT 2008


All:
 
I'm trying to take a constant vector:
 
 v = (0.122169, 0.61516, 0.262671)
 
and multiply those values by every 3 components in an array of length N:
 
A = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ....]
 
So what I want is: 
 
v[0]*A[0]
v[1]*A[1]
v[2]*A[2]
v[0]*A[3]
v[1]*A[4]
v[2]*A[5]
v[0]*A[6]
 
...
 
How do I do this with one command in numPy?
 
-M
_________________________________________________________________
Need to know now? Get instant answers with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_messenger_072008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080709/b389af0c/attachment.html 


More information about the Numpy-discussion mailing list