#include#include int main() { Eigen::Matrix2d mat; mat << 1, 2, 3, 4; std::cout << "Original matrix:\n" << mat << "\n\n"; std::cout << "Transposed matrix:\n" << mat.transpose() << "\n"; return 0; }
Original matrix: 1 2 3 4 Transposed matrix: 1 3 2 4
#include#include int main() { Eigen::Matrix2d mat; mat << 1, 2, 3, 4; std::cout << "Original matrix:\n" << mat << "\n\n"; std::cout << "Adjoint matrix:\n" << mat.adjoint() << "\n"; return 0; }
Original matrix: 1 2 3 4 Adjoint matrix: 4 -2 -3 1Eigen is an open-source C++ library for linear algebra that is available on various platforms including Windows, Linux, and OSX. The library can be downloaded from the Eigen website and is licensed under the LGPL 3.0 license.