matrixbase::Conjugate

Description

Replace this matrix with the Conjugate of this matrix.

Syntax

int Conjugate( )

Parameters

Return

Returns 0 on success and -1 on failure which occurs if the matrix is empty.

Examples

EX1

// Get conjugation of a complex matrix
void matrixbase_Conjugate_ex1()
{
    int rc;
    matrix<complex> mComplex = {2+3i, 2-3i, 2, 3i, 0, 99};
    mComplex[0][5]=NANUM;
//  Input matrix is:
//        {2+3i, 2-3i, 2,  3i, 0, --}
//  Result matrix is:
//        {2-3i, 2+3i, 2, -3i, 0, --} 
 
    rc=mComplex.Conjugate();      // Get the conjugation
    if(rc!=0) 
        printf("  Error: Conjugate failed.\n");
    else{
        MatrixPage MatPg1;
                MatPg1.Create("Origin");
                MatrixLayer MatLy1 = MatPg1.Layers(0);
                MatLy1.SetInternalData(FSI_COMPLEX);   // Set the internal data type to complex
                Matrix<complex> Mat1(MatLy1);
        Mat1 = mComplex;
        printf("Conjugate success. Observe that the conjugate of NANUM is also a NANUM.\n");
    }
}

Remark

Replace this matrix with the Conjugate of this matrix. A runtime error occurs if the underlying base type of this matrix is not double or Complex.

See Also

MatrixLayer::SetInternalData, matrixbase::GetReal, matrixbase::GetImaginary, matrixbase::GetPhase, matrixbase::GetAmplitude, matrixbase::Cross, matrixbase::Inverse, matrixbase::MakeComplex

Header to Include

origin.h