xnd-project / libxnd

Subsumed into xnd
https://xnd.io/
BSD 3-Clause "New" or "Revised" License
80 stars 12 forks source link

How to do reshape? #20

Closed saulshanabrook closed 5 years ago

saulshanabrook commented 6 years ago

Is it possible to change the shape of an xnd container from python?

skrah commented 5 years ago

Reshape is now implemented for the (most important) case that returning a view is possible:

>>> x = xnd([1,2,3,4,5,6])
>>> y = x.reshape(2,3)
>>> y[0][0] = 100
>>> y
xnd([[100, 2, 3], [4, 5, 6]], type='2 * 3 * int64')
>>> x
xnd([100, 2, 3, 4, 5, 6], type='6 * int64')