numarray :: multiplying all the elements in 1d array

Suresh Jeevanandam jm.suresh at gmail.com
Tue Dec 20 09:02:13 EST 2005


Hi all,
	Lets say I have an array:
	from numarray import *
	a = array([ 6,  7,  8,  9, 10, 11, 12])

	I want to multiply out all the elements and get the result.
	
	r = 1.0
	for i in a:
  		r = r*i

	Is there any faster, efficient way of doing this.

Thanks,

regards,
Suresh
	



More information about the Python-list mailing list