This method adds a dimension rather than permuting the existing ones. One of the key properties of a permutation is that it is invertible with a permutation, but this method is not.
It's convenient to have some function for turning a vector into a row vector but it would be much easier to program if functions applied simple composable logic consistently. For example, I would rather the 1-arg permutedims just rotate the dimensions by one. Rather than having custom logic for the Vector case, just apply the same logic and obtain a no-op.
This method adds a dimension rather than permuting the existing ones. One of the key properties of a permutation is that it is invertible with a permutation, but this method is not.
It's convenient to have some function for turning a vector into a row vector but it would be much easier to program if functions applied simple composable logic consistently. For example, I would rather the 1-arg
permutedims
just rotate the dimensions by one. Rather than having custom logic for theVector
case, just apply the same logic and obtain a no-op.reshape
can be used for adding a dimension to a vector: