March 2003
Intermediate to advanced
656 pages
39h 30m
English
reshape
reshape(a,shapetuple)
Returns an array r with shape
shapetuple, sharing
a’s data.
r
=reshape(
a,shapetuple
)
is just like
r
=
a
;
r
.shape=
shapetuple.
The product of
shapetuple’s items must
equal the product of
a
.shape’s,
but one of shapetuple’s
items may be -1 to ask for adaptation of that
axis’s length. For example:
print Numeric.reshape(range(12),(3,-1)) # prints: [[0 1 2 3] # [4 5 6 7] # [8 9 10 11]]