void syten::transpose_recursive | ( | ConstSpan< Scalar > const | inp, |
MutSpan< Scalar > | out, | ||
ConstSpan< IndexNumber > | in_perm, | ||
ConstSpan< Index > | in_dim, | ||
Conj | do_conj = Conj::n() |
||
) |
Recursive dense tensor transposition.
The idea is to view the tensor as a matrix such that the desired first leg is the major column index. Transposing this matrix brings the desired first leg into first position. For each value of this first index, we then have a smaller subproblem. This subproblem is solved by again transposing the block such that the desired second leg comes to the front (which is then the overall second leg) and recursing deeper.
References conj_inplace(), No, rank(), syten::SpanImpl::ConstSpan< T >::size(), and SYTEN_ASSERT.