前言
为了得到矩阵的某些列,需要单独将这些列提取出来
代码
#include<iostream>
#include<vector>
#include<Eigen/Dense>
#pragma warning(disable: 4996)
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd test_matrix = MatrixXd::Random(4, 6);
cout << test_matrix << endl << endl;
// 比如我要依次取出第2列、第5列、第1列
vector<int> indexs{ 1,4,0 };
MatrixXd index_metrix = test_matrix(Eigen::placeholders::all, indexs);
cout << index_metrix << endl;
return 0;
}
结果
最后
以上就是自觉飞鸟最近收集整理的关于eigen+c++实现截取某些列前言代码结果的全部内容,更多相关eigen+c++实现截取某些列前言代码结果内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复