Re: [Numpy-discussion] setting items in a matrix

2007-12-23 Thread Tim Michelsen
To learn array basics: URL:http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/python/arrays.html URL:http://www.scipy.org/Numpy_Example_List#head-a8a8874581c2ebfc69a37ab513974a229ff3bfaa

Re: [Numpy-discussion] setting items in a matrix

2007-12-21 Thread Matthieu Brucher
Hi, You can use ones as well if the array (not matrix) has the same values, or the array function to create an array from a sequence, or matrix for matrix and a sequence of sequences a = n.ones((3,5)) * 9 b = n.array((1, 2, 3), (4, 5, 6), (6, 7, 8)) c = n.matrix((1, 2, 3), (4, 5, 6), (6, 7,

Re: [Numpy-discussion] setting items in a matrix

2007-12-21 Thread lorenzo bolla
or, you can either use fill. In [53]: M = numpy.matrix(numpy.zeros((3,5))) In [55]: M.fill(999) In [56]: M Out[56]: matrix([[ 999., 999., 999., 999., 999.], [ 999., 999., 999., 999., 999.], [ 999., 999., 999., 999., 999.]]) L. On 12/21/07, [EMAIL PROTECTED] [EMAIL

Re: [Numpy-discussion] setting items in a matrix

2007-12-21 Thread Charles R Harris
On Dec 21, 2007 12:37 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hi i am a beginner with numpy and python,so pardon me if this doubt seems silly i want to create a matrix with say 3 rows and 5 columns..and then set the values of each item in it .for this i did something like below

[Numpy-discussion] setting items in a matrix

2007-12-20 Thread [EMAIL PROTECTED]
hi i am a beginner with numpy and python,so pardon me if this doubt seems silly i want to create a matrix with say 3 rows and 5 columns..and then set the values of each item in it .for this i did something like below myarray=zeros((3,5)) #then set the items for row in range(3): for col in

[Numpy-discussion] setting items in a matrix

2007-12-20 Thread [EMAIL PROTECTED]
hi i am a beginner with numpy and python,so pardon me if this doubt seems silly i want to create a matrix with say 3 rows and 5 columns..and then set the values of each item in it .for this i did something like below myarray=zeros((3,5)) #then set the items for row in range(3): for col in