[Numpy-discussion] multiply array

Nadav Horesh nadavh at visionsense.com
Fri Apr 4 06:07:52 EDT 2008


result = (egimgs.T * eval.flat).T

or, in place

E = egimgs.T
E *= eval.flat

(egimgs would updated)

  Nadav.

-----הודעה מקורית-----
מאת: numpy-discussion-bounces at scipy.org בשם wilson
נשלח: ו 04-אפריל-08 08:58
אל: numpy-discussion at scipy.org
נושא: [Numpy-discussion] multiply array
 
hello
i have two arrays
#of shape (1,6)
eval=array([[3.,3.2,1.,1.1,5.,0.5]])

#of shape (6,8)
egimgs=array([
		 [3.,2.,1.,4.,5.,1.5,2.5,1.1],
		 [1.1,3.,.5,.2,.1,4.3,3.2,1.2],
		 [4.,3.,2.,6.,1.,4.,5.1,2.4],
		 [3.2,1.3,2.2,4.4,1.1,2.1,3.3,2.4],
		 [.4,.2,.1,.5,.3,.2,1.2,4.2],
		 [5.2,2.1,4.3,5.5,2.2,1.1,1.4,3.2]
		 ]
	    )

i need to multiply the first row of egimgs with the first element of
eval , second row of egimgs with second element of eval ..etc ...and
so on..finally i should get a result array of same shape as egimgs.
how should i proceed ? using  loops seems inefficient.can someone
suggest a better way?

thanks
W
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3166 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080404/2be13ee8/attachment.bin>


More information about the NumPy-Discussion mailing list