Skip to content

Can't create large multidimensional array in BLZ #2

@FrancescAlted

Description

@FrancescAlted

[Adapted from https://github.com/Blosc/bcolz/issues/25]

With Numpy I can do something like this:

foo = np.zeros([ 2 ] * 20)

And get an ndarray with the corresponding shape. I can then:

ac = blz.barray(foo)

To get a barray object. Great. But I'm playing around with blaze.blz because I want to use array sizes that are larger than could otherwise fit in memory, and [2] * 20 is an easy shape for Numpy to handle, so for me it's a baseline of sorts.

Looking to explore the capabilities of blze.blz, I try to create the object directly, without the intermediate Numpy step:

ac = blz.zeros([2] * 20)

But I get an error:

In [11]: blz.zeros([2]*20)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-11-32ca191bdff9> in <module>()
----> 1 blz.zeros([2]*20)

/home/faltet/software/blz/blz/bfuncs.pyc in zeros(shape, dtype, **kwargs)
    239     """
    240     dtype = np.dtype(dtype)
--> 241     return fill(shape=shape, dflt=np.zeros((), dtype), dtype=dtype, **kwargs)
    242 
    243 

/home/faltet/software/blz/blz/bfuncs.pyc in fill(shape, dflt, dtype, **kwargs)
    203     # Then fill it
    204     # We need an array for the defaults so as to keep the atom info
--> 205     dflt = np.array(obj.dflt, dtype=dtype)
    206     # Making strides=(0,) below is a trick to create the array fast and
    207     # without memory consumption

ValueError: number of dimensions must be within [0, 32]

Which leads me to wonder: is something like this possible using blz?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions