【发布时间】:2014-09-23 15:47:18
【问题描述】:
这是一个非Eigen用户可以回答的问题......
我想使用 Eigen API 来初始化头文件中的常量矩阵,但 Eigen 似乎没有提供构造函数来实现这一点,以下是我尝试过的:
// tried the following first, but Eigen does not provide such a constructor
//const Eigen::Matrix3f M<<1,2,3,4,5,6,7,8,9;
// then I tried the following, but this is not allowed in header file
//const Eigen::Matrix3f M;
//M <<1,2,3,4,5,6,7,8,9; // not allowed in header file
在头文件中实现此目的的替代方法是什么?
【问题讨论】:
-
如果它在头文件中,可能会为每个包含它的源文件复制数据,浪费内存。