C++ 矩阵计算库 :Eigen库

Eigen http://eigen.tuxfamily.org/index.php?title=Main_Page

下载http://bitbucket.org/eigen/eigen/get/3.3.4.zip

2.91M

C++ 矩阵计算库 :Eigen库
Eigen3.3.4 API documentation
配置:vs2013配置Eigen库 - CSDN博客 https://blog.csdn.net/u012428169/article/details/71169546

项目-》属性-》c++常规--附加包含目录,添加解压文件夹目录即可(可重命名)。

C++ 矩阵计算库 :Eigen库

测试代码:

// EigenTest.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>  
#include <Eigen/Dense>  
#include <Eigen/Dense>
using Eigen::MatrixXd;

using namespace std; 

int _tmain(int argc, _TCHAR* argv[])
{
    MatrixXd m(2,2);
    m(0,0) = 3;
    m(1,0) = 2.5;
    m(0,1) = -1;
    m(1,1) = m(1,0) + m(0,1);
    std::cout << m << std::endl;
    system("pause");
    return 0;
}
#include "stdafx.h"
#include <iostream>
#include <EigenDense>
using namespace std;
using namespace Eigen;
void main()
{
    Matrix2d a;
    a << 1, 2,
        3, 4;
    MatrixXd b(2, 2);
    b << 2, 3,
        1, 4;
    cout << "a + b =n" << a + b << endl;
    cout << "a - b =n" << a - b << endl;
    cout << "Doing a += b;" << endl;
    a += b;
    cout << "Now a =n" << a << endl;
    cout << "a^T=  " << a.transpose() << endl;
    cout << "a*b= " << a*b << endl;
    Vector3d v(1, 2, 3);
    Vector3d w(1, 0, 0);
    cout << "-v + w - v =n" << -v + w - v << endl;
    cout << v << endl;
    cout << v.transpose() << endl;
    system("pause");
}

使用:

Eigen: The Matrix class http://eigen.tuxfamily.org/dox/group__TutorialMatrixClass.html

Matrix:

Matrixtypedef Matrix Matrix4f;
typedef Matrix MatrixXd;

Vectors:

typedef Matrix Vector3f;typedef Matrix RowVector2i;

Eigen库使用 - CSDN博客 https://blog.csdn.net/wokaowokaowokao12345/article/details/53397488

Eigen:矩阵计算简单用法(一)_暗海辰_新浪博客 http://blog.sina.com.cn/s/blog_691fc8920102v02r.html

Eigen介绍及简单使用(转置、共轭、伴随、矩阵相乘、矩阵向量相乘、求解矩阵的特征值和特征向量等) - CSDN博客 https://blog.csdn.net/fengbingchun/article/details/47378515

Eigen库使用 - CSDN博客 https://blog.csdn.net/wokaowokaowokao12345/article/details/53397488

原文链接: https://www.cnblogs.com/wxl845235800/p/8883236.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/272607

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月14日 下午10:52
下一篇 2023年2月14日 下午10:52

相关推荐