[Numpy-discussion] Using 2-D arrays in Numeric Python (numpy)

Linda Seltzer lseltzer at alumni.caltech.edu
Sat Oct 11 01:16:13 EDT 2008


I would appreciate it if someone could answer my question without
referring to subjects such as APIs and interfaces, since I am only
concerned with a mathematical application at this time.
In most tutorials, array examples are of the form:
a = array([1, 2, 3], [4, 5, 6] )
The problem with this is that I have an array of size 256 x 256, and I
have had applications with 3-d arrays of size 128x128x128.  In video, you
can arrays such as 640x480, etc.  So filling in the value of each element
is not practical.  I wish that tutorials provided real world examples.
I would appreciate it if someone could give me the actual statements
needed to define and initialize a 2-D array of size NxN, where N can be
any large number, where the initial values of the array elements are all
zeros, but will be changed by the program.
In Matlab, this is done as a = zeros(256,256).  If I try this in python,
it won't let the program overwrite the zeros.





More information about the NumPy-Discussion mailing list