# n-dimensional matrix (tensor) permutation notation

I am looking for a mathematical notation for MATLAB's permute function

permute(A,order) rearranges the dimensions of A so that they are in the order specified by the vector order. B has the same values of A but the order of the subscripts needed to access any particular element is rearranged as specified by order. All the elements of order must be unique, real, positive, integer values.

If I am not mistaken, it is just a permutation of an n-order tensor. Is there a recommended notation for such an operation?

Note: The function does not permute columns of the matrix. It only permutes its dimensions.

In case of a 2D matrix there are only two possibilities:

1. permute($A_{m \times n}$, [1, 2]) = $A_{m \times n}$
2. permute($A_{m \times n}$, [2, 1]) = $A_{n \times m}$.

In case of a 3D matrix there are 6 permutations.

1. permute($A_{m \times n \times o}$, [1, 2, 3]) = $A_{m \times n \times o}$
2. permute($A_{m \times n \times o}$, [1, 3, 2]) = $A_{m \times o \times n}$
3. permute($A_{m \times n \times o}$, [2, 1, 3]) = $A_{n \times m \times o}$
4. ... and so on
• I don't know. I am also curious about it. – mathreadler Jun 29 '17 at 13:13

In my private notes, I have written $A^\sigma$ where $\sigma$ is the permutation in cycle notation. Example: $$R+R^{(2,3,4)}+R^{(4,3,2)}=0$$ Common transpositions would then look like $A^\top=A^{(1,2)}$.

But that's not perfect: One would want $(A^\sigma)^\tau = A^{(\sigma\tau)}$, but with the usual right-to-left composition rule the above would be $(A^\sigma)^\tau = A^{(\tau\sigma)}$.

A better option would then be to write $\sideset{^\sigma}{}{\!A}$ instead; then $\sideset{^\tau}{}{\left(\sideset{^\sigma}{}{\!A}\right)} = \sideset{^{(\tau\sigma)}}{}{\!A}$. But that looks exotic.

Another aspect: I often find expressions with slot-permuted tensors easier to understand when given the inverse permutation. Because those expressions typically do something with the leftmost or rightmost slots (e.g. contractions with adjacent tensor expressions), and I need to know which slots of the original $A$ have ended up there. That's basically an inverse lookup.

This leads to the following proposal: Write $A^{\bar{\sigma}}$ where $\bar{\sigma}$ is the inverse of the slots permutation. Literally known $\bar{\sigma}$ can be given in cycle notation. Note that $\bar{\sigma}$ maps $1$ to the slot number in the original $A$ that is leftmost after the permutation. Transpositions like $(1,2)$ are their own inverses, so the inversion is not an issue for those. This notation fulfills $(A^{\bar{\sigma}})^{\bar{\tau}} = A^{(\bar{\sigma}\bar{\tau})}$ with the usual right-to-left composition rule.

Note that the vector literal in your example lists the values $[\bar{\sigma}(1),\bar{\sigma}(2),\ldots]$. Thus your MATLAB snippet already uses the inverse permutation, and this proposal would just express that in cycle notation.

Whatever you decide to do, better declare it explicitly. As you can see from the above, the most suitable notation might not be the most intuitive one.

Suppose $A$ is an $m\times n$ matrix and that we want to permute the columns. Then we need a bijection $\sigma$ on $\{1,\ldots,n\}$ and we can define $f:M_{m\times n}\rightarrow M_{m\times n}$ as $$f([m_1,m_2,\ldots,m_n]) = [m_{\sigma^{-1}(1)},\ldots,m_{\sigma^{-1}(n)}].$$

• The function does not permute columns of the matrix. It only permutes its dimensions. – hubi86 Jun 29 '17 at 17:23