跳至内容

TransposeConjugate

TransposeConjugate

Transposing a complex matrix with conjugation. Reverse or permute the axes of a matrix by changing a sign of an imaginary part of a complex number, return the modified matrix.

matrix matrix::TransposeConjugate()

Return Value

Transposed complex conjugate matrix.

Simple algorithm of transposing a complex matrix with conjugation - method explanation

//--- Complex matrix transpose function with conjugation
matrix MatrixTranspose(const matrix& matrix_a) {
    //--- create a new matrix_c with dimensions inverse to matrix_a
    matrix matrix_c(matrix_a.Cols(), matrix_a.Rows());

    //--- go through all the rows of the new matrix
    for (ulong i = 0; i < matrix_c.Rows(); i++) {
        //--- go through all the columns of the new matrix
        for (ulong j = 0; j < matrix_c.Cols(); j++) {
            //--- transfer the real part of the element by transposing the index
            matrix_c[i][j].real = matrix_a[j][i].real;

            //--- transfer the imaginary part of the element by changing the sign (conjugation)
            matrix_c[i][j].imag = -matrix_a[j][i].imag;
        }
    }

    //--- return the transposed matrix with conjugation
    return (matrix_c);
}