Eigen求矩阵行列式

转置、伴随、行列式、逆矩阵

小矩阵(4 * 4及以下)eigen会自动优化,默认采用LU分解,效率不高

#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
    Matrix2d c;
     c << 1, 2,
     3, 4;
    //转置、伴随
    std::cout<<c<<std::endl<<std::endl;
    std::cout<<"转置\n"<<c.transpose()<<std::endl<<std::endl;
    std::cout<<"伴随\n"<<c.adjoint()<<std::endl<<std::endl;
    //逆矩阵、行列式
    std::cout << "行列式: " << c.determinant() << std::endl;
    std::cout << "逆矩阵\n" << c.inverse() << std::endl;
}

有关eigen库的一些基本使用方法 - CSDN博客 https://blog.csdn.net/r1254/article/details/47418871

猜你喜欢

转载自www.cnblogs.com/wxl845235800/p/9058051.html