SyTen

◆ transpose_recursive()

template<Rank rank, typename Scalar >
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.

Remarks
The use of the additional workspace provided here is probably not optimal, I have a feeling that it should be possible to do this in a better way.
This function can only be called with a non-trivial at-least-rank-2 permutation.

References conj_inplace(), No, rank(), syten::SpanImpl::ConstSpan< T >::size(), and SYTEN_ASSERT.

+ Here is the call graph for this function: