Eigen基本应用
来源:互联网 发布:网络营销策划方案例子 编辑:程序博客网 时间:2024/06/09 16:48
Eigen适用范围广,支持包括固定大小、任意大小的所有矩阵操作,甚至是稀疏矩阵;支持所有标准的数值类型,并且可以扩展为自定义的数值类型;支持多种矩阵分解及其几何特征的求解;它不支持的模块生态系统,提供了许多专门的功能,如非线性优化,矩阵功能,多项式解算器,快速傅立叶变换等。
Eigen支持多种编译环境。
1、矩阵操作:#include <iostream>#include <Eigen/Dense>using namespace Eigen;int main(){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 << "Here is the matrix m:\n" << m << std::endl;VectorXd v(2);v(0) = 4;v(1) = v(0) - 1;std::cout << "Here is the vector v:\n" << v << std::endl;}输出为Here is the matrix m: 3 -12.5 1.5Here is the vector v:43
2、求解特征值和特征向量#include <iostream>#include <Eigen/Dense>using namespace std;using namespace Eigen;int main(){Matrix2f A;A << 1, 2, 2, 3;cout << "Here is the matrix A:\n" << A << endl;SelfAdjointEigenSolver<Matrix2f> eigensolver(A);if (eigensolver.info() != Success) abort();cout << "The eigenvalues of A are:\n" << eigensolver.eigenvalues() << endl;cout << "Here's a matrix whose columns are eigenvectors of A \n"<< "corresponding to these eigenvalues:\n"<< eigensolver.eigenvectors() << endl;}输出为Here is the matrix A:1 22 3The eigenvalues of A are:-0.236 4.24Here's a matrix whose columns are eigenvectors of A corresponding to these eigenvalues:-0.851 -0.526 0.526 -0.851
原文链接:http://eigen.tuxfamily.org/index.php?title=Main_Page
http://baike.baidu.com/linkurl=2IZYOsGgCFEpJSF8HhYghkj6cn6suIBfuWvcjGcQAp8Rbo1nrvlBGrH0ZWdfxx9aTbY36rIzfE1gcVkTY8wg2K
0 0
- Eigen基本应用
- Eigen中的基本函数
- Eigen中的基本函数
- Eigen基本用法
- Eigen中的基本函数
- Eigen的点点应用
- eigen库的基本操作
- Eigen 基本类型的使用
- Eigen
- Eigen
- Eigen sparse 基本操作:构造 & 输出
- 有关eigen库的一些基本使用方法
- 有关eigen库的一些基本使用方法
- 有关eigen库的一些基本使用方法
- Eigen库的配置和基本用法
- Eigen中Levenberg-Marquardt算法的应用
- C++Eigen库的配置和基本使用
- opencv, image处理注意点,eigen库的应用
- LSTM简介
- git常用命令
- Ubuntu14.04下caffe的配置
- 数据结构课程主页-2015级
- Spring Boot Shiro权限管理
- Eigen基本应用
- python3高级特性
- Andorid获取状态栏高度
- Git创建仓库
- Volley源码解析
- J2SE视频之面向对象——踏破铁鞋无觅处
- php-fpm - 启动参数及重要配置详解
- JDK1.8源码分析之ThreadPoolExecutor
- TortoiseCVS安装使用详解