how do we call reshapes in linear algebra?

489 Views Asked by At

What is the notation for reshape operations in tensors, for example in python's numpy numpy.reshape(array,dimensions) or numpy.flatten(array)

Agreeing the order is important.

1

There are 1 best solutions below

2
On BEST ANSWER

"Reshaping" a matrix doesn't really have much of a mathematical meaning and I have personally never seen such a notion used in a mathematical text. In the library you are referencing (numpy) the operations of "reshaping" and "flattening" are tools to make it easier to abstract over the memory being used to represent an ndarray: they give you a "$n$-dimensional" view into a sequence of consecutive elements, which you can then treat like a matrix or a tensor.

If you have a legitimate mathematical use for these operations, you would need likely have to invent your own notation. For example, for $n=ab$, you could denote "reshaping" with the map $\mathrm{Reshape}_{a\times b}: \Bbb R^n \to \Bbb R^{a \times b}$ given by $$ \mathrm{Reshape}_{a\times b}(\vec v) = \begin{pmatrix} v_{(0b)+1} & v_{(0b)+2} & \cdots & v_{(0b)+b}\\ v_{(1b)+1} & v_{(1b)+2} & \cdots & v_{(1b)+b}\\ v_{(2b)+1} & v_{(2b)+2} & \cdots & v_{(2b)+b}\\ \vdots & \vdots & & \vdots\\ v_{(a-1)b+1} & v_{(a-1)b+2} & \cdots & v_{(a-1)b+b}\\ \end{pmatrix} $$ But this is hardly comprehensible and doesn't have any obvious useful properties that I can see.