---------------------------------------------------------------------------------------------------------------
This is the basic C++ program of C++ armadillo library which shows how to get the value of conjugate of the given matrix of some particular size. It can be carried out by the help of inbuilt function "conj" in armadillo library. It takes one parameter i.e input matrix name. Conjugate of element a+ib is a-ib.
---------------------------------------------------------------------------------------------------------------
Program::
#include <iostream>
#include <armadillo>using namespace std;
using namespace arma;
int main()
{
//initialize the random generator //Create a 4 x 4 random matrix and printing it
cx_mat X = randu<cx_mat>(5,5); //random vector of size 5 x 5 (generared by this syntax)
cx_mat Y = conj(X); //conjugate of the given input matrix cout << "Matrix X::\n"<<endl;
cout<< X << endl;
cout << "Conjugate matrix Y::" << endl; //displaying
cout << Y << endl;
return 0;
}
---------------------------------------------------------------------------------------------------------------
Commands to run program on terminal::
$ g++ filename.cpp -o objectname -O2 -larmadillo
$ ./objectname
---------------------------------------------------------------------------------------------------------------
Output::
Matrix X::
(+7.868e-01,+2.505e-01) (+2.742e-01,+5.610e-01) (+2.393e-01,+3.201e-01) (+4.599e-01,+2.573e-01) (+5.050e-01,+6.962e-01)
(+7.107e-01,+9.467e-01) (+1.400e-01,+5.439e-01) (+9.105e-01,+1.648e-01) (+7.770e-01,+5.839e-01) (+9.122e-02,+9.071e-01)
(+1.927e-02,+4.049e-01) (+5.219e-01,+8.571e-01) (+2.455e-01,+1.983e-01) (+9.503e-01,+4.381e-01) (+3.091e-02,+1.520e-01)
(+2.513e-01,+2.271e-02) (+4.998e-01,+4.194e-01) (+7.159e-01,+9.678e-01) (+3.223e-01,+5.324e-01) (+9.815e-01,+6.204e-01)
(+5.206e-01,+3.447e-01) (+7.443e-01,+2.492e-01) (+7.694e-01,+8.071e-02) (+2.564e-01,+4.554e-02) (+2.988e-01,+3.613e-01)
Conjugate matrix Y::
(+7.868e-01,-2.505e-01) (+2.742e-01,-5.610e-01) (+2.393e-01,-3.201e-01) (+4.599e-01,-2.573e-01) (+5.050e-01,-6.962e-01)
(+7.107e-01,-9.467e-01) (+1.400e-01,-5.439e-01) (+9.105e-01,-1.648e-01) (+7.770e-01,-5.839e-01) (+9.122e-02,-9.071e-01)
(+1.927e-02,-4.049e-01) (+5.219e-01,-8.571e-01) (+2.455e-01,-1.983e-01) (+9.503e-01,-4.381e-01) (+3.091e-02,-1.520e-01)
(+2.513e-01,-2.271e-02) (+4.998e-01,-4.194e-01) (+7.159e-01,-9.678e-01) (+3.223e-01,-5.324e-01) (+9.815e-01,-6.204e-01)
(+5.206e-01,-3.447e-01) (+7.443e-01,-2.492e-01) (+7.694e-01,-8.071e-02) (+2.564e-01,-4.554e-02) (+2.988e-01,-3.613e-01)
Comments