SyTen

◆ transpose_impl()

template<Rank rank, typename Scalar , TransposeMethod method = TransposeMethod::Default, Rank... Ranks>
void syten::transpose_impl ( ConstSpan< Scalar > const  inp,
MutSpan< Scalar >  out,
ConstSpan< Index in_perm,
ConstSpan< Index in_dim,
Conj  do_conj = Conj::n(),
bool  do_checks = true,
std::index_sequence< Ranks... >  = {} 
)

Implementation of syten::transpose() below.

Because the effective rank of the transposed array may differ from the original rank due to removal of one-dimensional indices and combination of runs of different indices, we need some tricks to still call the transposition routines with the proper effective rank. This is done by taking a variadic index sequence (generated below by default-constructing one) and then checking whether the effective size of the permutation array is equal to every member and – if so – calling the appropriate transposition routine. Compile times are bit badly affected.

Remarks
Arguments are exactly the same as for syten::transpose.
rank-1 transpositions should be handled directly in syten::transpose.
rank-2 transpositions are special-cased early on if TransposeMethod::Default is used.