On 23/04/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I thought I remembered there was a way to reshape in-place an array, but
> neither google, nor greping my mailbox brings anything out.
> Am I wrong, or is there indeed a way to reshape in-place an array ?

Sometimes it's just impossible to reshape an array without copying.
But reshape()  (either the method or the function) copies only the
array descriptor if that's possible. So you'll have a new ndarray
object, but the data will not be copied. Assigning to the shape
attribute might do what you want (if it triggers a reshape()
internally, which I think it does).

I don't think it's possible to *rearrange* the data in memory in
place. I can't even think of an algorithm to do that, off the top of
my head.

Anne
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to