[Numpy-discussion] flatten() without copy - is this possible?

Anne Archibald peridot.faceted@gmail....
Fri Jun 8 20:22:12 CDT 2007


On 05/06/07, Charles R Harris <charlesr.harris@gmail.com> wrote:
>
> On 6/5/07, dmitrey <openopt@ukr.net> wrote:
> > Thank you, but all your examples deal with 3-dimensional arrays. and I
> > still misunderstood, is it possible somehow for 2-dimensional arrays or
> no?
> > D.
>
> There is nothing special about the number of dimensions, all arrays have the
> same methods..

Of course. But he was asking whether the examples I was giving, of
arrays that could and couldn't be flattened, would work in 2D.

There is nothing special about 3D; there are 2D matrices that can be
flattened and 2D matrices that can't. Think about the matrix in terms
of strides and lengths specifying how the elements are laid out in
memory and things should become much clearer. I suspect the numpy book
(which is not expensive) does a better job of explaining it.

Anne.


More information about the Numpy-discussion mailing list