我有两个特征矩阵,我想将它们连接起来,就像在 matlab 中一样cat(0, A, B)
eigen 有等价物吗?
Thanks.
您可以使用逗号初始值设定项语法。
水平方向:
MatrixXd C(A.rows(), A.cols()+B.cols());
C << A, B;
垂直:
// eigen uses provided dimensions in declaration to determine
// concatenation direction
MatrixXd D(A.rows()+B.rows(), A.cols()); // <-- D(A.rows() + B.rows(), ...)
D << A, B; // <-- syntax is the same for vertical and horizontal concatenation
为了便于阅读,可以使用空格来格式化垂直串联:
D << A,
B; // <-- But this is for readability only.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)