0
点赞
收藏
分享

微信扫一扫

eigen库相关函数 .replicate()

半夜放水 2022-01-31 阅读 53
Matrix<fpt,13,1> full_weight;
full_weight.replicate(10,1);//

不知道replicate()函数的功能是什么 ;

看了eigen的手册后就明白了 ;就是将你原本的矩阵(full_weight<13,1>)作为一个整体 填充这n行,m列的矩阵replicate(n,m);

下面是官方的手册:

Example:

MatrixXi m = MatrixXi::Random(2,3);
cout << "Here is the matrix m:" << endl << m << endl;
cout << "m.replicate<3,2>() = ..." << endl;
cout << m.replicate<3,2>() << endl
;



Output:

Here is the matrix m:
7 6 9
-2 6 -6
m.replicate<3,2>() = ...
7 6 9 7 6 9
-2 6 -6 -2 6 -6
7 6 9 7 6 9
-2 6 -6 -2 6 -6
7 6 9 7 6 9
-2 6 -6 -2 6 -6
举报

相关推荐

0 条评论