[Numpy-discussion] ndarray.resize that preserve view content ?

Antoine Dechaume boolegue@gmail....
Wed Aug 4 10:31:05 CDT 2010


Yes it is, but is there a way to do it in-place?

On Wed, Aug 4, 2010 at 5:20 PM, Zachary Pincus <zachary.pincus@yale.edu>wrote:

> > A[:5,:5] shows the data I want, but it's not contiguous in memory.
> > A.resize(5,5) is contiguous, but do not contains the data I want.
> >
> > How to get both efficiently?
>
> A[:5,:5].copy()
> will give you a new, contiguous array that has the same contents as
> A[5:,5:], but in a new chunk of memory. Is this what you need?
>
>
>
>
> On Aug 4, 2010, at 11:17 AM, Antoine Dechaume wrote:
>
> > I forgot to refer to resize, sorry about that.
> >
> > A[:5,:5] shows the data I want, but it's not contiguous in memory.
> > A.resize(5,5) is contiguous, but do not contains the data I want.
> >
> > How to get both efficiently?
> >
> >
> > On Wed, Aug 4, 2010 at 5:01 PM, Robert Kern <robert.kern@gmail.com>
> > wrote:
> > On Wed, Aug 4, 2010 at 09:29, Antoine Dechaume <boolegue@gmail.com>
> > wrote:
> > > Hi,
> > >
> > > given A=empty([10,10]), I would like to keep A[:5,:5] as a
> > contiguous memory
> > > segment.
> > >
> > > How to do it efficiently?
> >
> > I'm not sure I understand what you want. Your Subject line and the
> > body of your email conflict with each other. Can you try to explain
> > what you want in other words?
> >
> > --
> > 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
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100804/7995d8cd/attachment.html 


More information about the NumPy-Discussion mailing list