我是靠谱客的博主 自觉飞鸟,这篇文章主要介绍eigen+c++实现截取某些列前言代码结果,现在分享给大家,希望可以做个参考。

前言

为了得到矩阵的某些列,需要单独将这些列提取出来

代码

#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++实现截取某些列前言代码结果内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部