特征如何沿特定维度连接矩阵? [英] Eigen how to concatenate matrix along a specific dimension?

查看:120
本文介绍了特征如何沿特定维度连接矩阵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个特征矩阵,我想连接它们,如在matlab中 cat(0,A,B)

I have two eigen matrices and I would like to concatenate them, like in matlab cat(0, A, B)

在特征中有什么等同的东西吗?

Is there anything equivalent in eigen?

谢谢。

推荐答案

您可以使用逗号初始化语法。

You can use the comma initializer syntax for that.

水平:

MatrixXd C(A.rows(), A.cols()+B.cols());
C << A, B;

垂直:

MatrixXd D(A.rows()+B.rows(), A.cols());
D << A,
     B;

这篇关于特征如何沿特定维度连接矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆