# [Numpy-discussion] Numpy Positional Array

Robert Kern robert.kern@gmail....
Tue Mar 31 19:32:28 CDT 2009

```2009/3/31 Ian Mallett <geometrian@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], ... ,[n,3]],
>  [[0,4],[1,4],[2,4],[3,4],[4,4], ... ,[n,4]],
>    ...   ...   ...   ...   ...   ...   ...
>  [[0,n],[1,n],[2,n],[3,n],[4,n], ... ,[n,n]]]
> Each vec2 represents the x,y position of the vec in the array itself.  I'm
> completely stuck on implementing this setup in numpy.  Any pointers?

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(...).

Otherwise, you can create empty arrays with numpy.empty((n,n,2)), or
filled in versions using zeros() and ones().

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
```