A high-performance general-purpose compute library

Transpose a matrix. More...

Functions

AFAPI array transpose (const array &in, const bool conjugate=false)
 C++ Interface for transposing a matrix.
 
AFAPI void transposeInPlace (array &in, const bool conjugate=false)
 C++ Interface for transposing a matrix in-place.
 
AFAPI af_err af_transpose (af_array *out, af_array in, const bool conjugate)
 C Interface for transposing a matrix.
 
AFAPI af_err af_transpose_inplace (af_array in, const bool conjugate)
 C Interface for transposing a matrix in-place.
 

Detailed Description

Transpose a matrix.

Reverse or permute the dimensions of an array; returns the modified array. For an array a with two dimensions, transpose(a) gives the matrix transpose. For an array with more than two dimensions, the first two dimensions are transposed across higher dimensions.

Set conjugate=true to perform the complex conjugate transpose of a matrix which interchanges the row and column index for each element, reflecting the elements across the main diagonal and negating the imaginary part of any complex numbers. For example, if b = transpose(a, true) and element a(2, 1) is (1, 2), then element b(1, 2) is (1, -2).

In-place versions perform matrix transposition by reordering the input, reducing memory footprint.

Examples:

// Create a, a 2x3 array
array a = iota(dim4(2, 3)); // a = [0, 2, 4
// 1, 3, 5]
// Create b, the transpose of a
array b = transpose(a); // b = [0, 1,
// 2, 3,
// 4, 5]

Function Documentation

◆ af_transpose()

AFAPI af_err af_transpose ( af_array out,
af_array  in,
const bool  conjugate 
)

C Interface for transposing a matrix.

Parameters
[out]outthe transposed matrix
[in]inan input matrix
[in]conjugateif true, a conjugate transposition is performed
Returns
AF_SUCCESS if the process is successful.

◆ af_transpose_inplace()

AFAPI af_err af_transpose_inplace ( af_array  in,
const bool  conjugate 
)

C Interface for transposing a matrix in-place.

Parameters
[in,out]inis the matrix to be transposed in place
[in]conjugateif true, a conjugate transposition is performed

◆ transpose()

AFAPI array transpose ( const array in,
const bool  conjugate = false 
)

C++ Interface for transposing a matrix.

Parameters
[in]inan input matrix
[in]conjugateif true, a conjugate transposition is performed
Returns
the transposed matrix

◆ transposeInPlace()

AFAPI void transposeInPlace ( array in,
const bool  conjugate = false 
)

C++ Interface for transposing a matrix in-place.

Parameters
[in,out]inthe matrix to be transposed in-place
[in]conjugateif true, a conjugate transposition is performed