Skip to content

function matrix_transpose(T *, const T *, shape<Dims>) tensor

template <typename T, index_t Dims>
void matrix_transpose(T* out, const T* in, shape<Dims> shape)

Transposes a matrix (supports scalar and compound types).

Works with both scalar types (e.g., float, int) and compound types (e.g., vec, complex). The input matrix must be packed in memory (no padding between rows or columns). In-place transpose (when in and out point to the same buffer) is supported.

Template parameters
T Element type (scalar or compound).
Dims Number of dimensions (2 or greater).
Parameters
out Output buffer (transposed matrix).
in Input buffer (original matrix).
shape Shape of the input matrix.

Defined at base/transpose.hpp:646