[Numpy-discussion] Irregular arrays

Travis Oliphant oliphant.travis at ieee.org
Wed Aug 30 01:58:53 CDT 2006


rw679aq02 at sneakemail.com wrote:
> Many problems are best solved with irregular array structures.  These
> are aggregations not having a rectangular shape.  To motivate, here's
> one example,
>
>    http://lambda-the-ultimate.org/files/HammingNumbersDeclarative.7z
>          - from http://lambda-the-ultimate.org/node/608#comment-5746
>
> Irregularity here changes an O(N^3) solution to O(N).  (The file format
> is a 7zip archive with a MathReader file inside, readable in Windows or
> Unix with free software.)
>
> These cases also arise in simulations where physical geometry determines
> array shape.  Here memory consumption is the minimization goal that
> makes irregularity desirable.  The access function will return NaN or
> zero for out-of-bounds requests.  There is no need to consume memory
> storing NaNs and zeros
>   

> Please advise how much support numpy/Scipy has for these structures, if
> any, including future plans.  If support exists, could you kindly supply
> a Scipy declaration matching the first example.
>   

SciPy has sparse matrix support (scipy.sparse) with several storage formats

You can also construct irregular arrays using arrays of objects or just 
lists of lists. 

-Travis





More information about the Numpy-discussion mailing list