This is the basic C++ program of C++ armadillo library which shows how to get the transpose of the given matrix of some particular size. It can be carried out in 2 ways that is by the help of inbuilt function "trans" in armadillo library or by the function ".t()". "trans" function takes just one parameter i.e the input matrix name while ".t()" function doesn't take any parameter. It can be called by input matrix as shown ::-> A.t();
mat B = trans(A); //calculating transpose of matrix A and storing in B by trans function
mat C = A.t(); //calculating transpose of matrix A and storing in C by .t() function
cout << "Matrix A::\n"<<endl;
cout<< A << endl;
cout << "Matrix B(Trans of matrix)::" << endl; //displaying
cout<< B << endl;
cout << "Matrix C(Trans of matrix)::" << endl; //displaying
cout<< B << endl;
Comments