【发布时间】:2013-11-15 21:30:30
【问题描述】:
II 想在我目前正在从事的几何项目中将 Eigen 用于线性代数。这是一个很棒的库,相对较小且易于使用且足够流行。
但是,我还想使用自定义定义的“Double”类来比较计算机精度中的两个浮点值(例如两者之间的差异必须小于给定精度)。对于我的自定义类型,我已经实现了大部分 std::math c++11 函数和所有运算符(包括一元 -、conj、imag、abs2...)。我做了这些链接中列出的所有事情:
http://eigen.tuxfamily.org/dox-devel/TopicCustomizingEigen.html
https://forum.kde.org/viewtopic.php?f=74&t=26631
但是,我仍然在 Eigen Jacobi.h 文件中遇到编译错误,更具体地说是在第 340,341 行:
x[i] = c * xi + numext::conj(s) * yi;
y[i] = -s * xi + numext::conj(c) * yi;
我从编译器收到以下错误(Vs 2012、Win32、发布和调试配置)
eigen\src/Jacobi/Jacobi.h(341): error C3767: '*': candidate function(s) not accessible
operator* 在我的自定义类型中定义为以下情况:
CustomType operator*(CustomType const &_other);
CustomType operator*(double const &_other);
double operator*(CustomType const &_other);
我尝试用以下方式定义 conj :
CustomType conj(CustomType const &_type){return _type;}
double conj(customType const &_type){return _type.get();}
我尝试在 Eigen::numext 命名空间以及我的 CustomType 命名空间中定义 conj,但没有成功。 任何人都有提示、链接、建议或知道 Eigen 需要的东西我可能忘记了吗?
【问题讨论】: