[Numpy-discussion] Make array uncopyable

Daniel Lepage dplepage@gmail....
Wed Mar 23 14:05:21 CDT 2011


Hi all,
   Is there a way to mark an array as uncopyable? If you have very
large data arrays some numpy functions will cause MemoryErrors because
behind the scenes they e.g. transpose the arrays into Fortran order to
feed them into Fortran libraries (numpy.linalg.svd is an example of
this). It would be great if there were a way to mark an array as "too
big to copy" so that an attempt to call transpose() or astype() would
raise an exception immediately instead of clobbering the machine's
memory first, but I don't know of any flag that does this.

I suppose I could always subclass ndarray and redefine transpose(),
astype(), etc., but it'd be nice if there were an easier way.

Thanks,
Dan Lepage


More information about the NumPy-Discussion mailing list