Hello,
I'm trying to make an array of size n*n*2. It should be of the form:
[[[0,0],[1,0],[2,0],[3,0],[4,0], ... ,[n,0]],
[[0,1],[1,1],[2,1],[3,1],[4,1], ... ,[n,1]],
[[0,2],[1,2],[2,2],[3,2],[4,2], ... ,[n,2]],
[[0,3],[1,3],[2,3],[3,3],[4,3], ... ,[n,3]],
[[0,4],[1,4],[2,4],[3,4],[4,4], ...
2009/3/31 Ian Mallett geometr...@gmail.com:
Hello,
I'm trying to make an array of size n*n*2. It should be of the form:
[[[0,0],[1,0],[2,0],[3,0],[4,0], ... ,[n,0]],
[[0,1],[1,1],[2,1],[3,1],[4,1], ... ,[n,1]],
[[0,2],[1,2],[2,2],[3,2],[4,2], ... ,[n,2]],
[[0,3],[1,3],[2,3],[3,3],[4,3],
On Tue, Mar 31, 2009 at 5:32 PM, Robert Kern robert.k...@gmail.com wrote:
How do you want to fill in the array? If you are typing it in
literally into your code, you would do basically the above, without
the ...'s, and wrap it in numpy.array(...).
I know that, but in some cases, n will be
2009/3/31 Ian Mallett geometr...@gmail.com:
On Tue, Mar 31, 2009 at 5:32 PM, Robert Kern robert.k...@gmail.com wrote:
How do you want to fill in the array? If you are typing it in
literally into your code, you would do basically the above, without
the ...'s, and wrap it in numpy.array(...).
2009/3/31 Ian Mallett geometr...@gmail.com:
The array follows a pattern: each array of length 2 represents the x,y index
of that array within the larger array.
Ah, right. Use dstack(mgrid[0:n,0:n]).
--
Robert Kern
I have come to believe that the whole world is an enigma, a harmless
enigma
Thanks!
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
The array follows a pattern: each array of length 2 represents the x,y
index of that array within the larger array.
Is this what you are after?
numpy.array(list(numpy.ndindex(n,n))).reshape(n,n,2)
--
This message and any attachments are confidential, proprietary, and may be
Same. Thanks, too.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion