您好,我有一个代码可以实现 libeigen2 来计算特征向量。现在我想使用 boost::serialization 来保存信息以供以后检索。从示例教程中,我想出了以下代码!
class RandomNode {
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & is_leaf_;
ar & depth_;
ar & num_classes_;
ar & num_features_;
// Split node members
ar & random_feature_indices_;
ar & random_feature_weights_;
ar & threshold_;
ar & leftChild_;
ar & rightChild_;
}
bool is_leaf_;
int depth_;
int num_classes_;
int num_features_;
// Split node members
VectorXi random_feature_indices_;
VectorXd random_feature_weights_;
double threshold_;
RandomNode* leftChild_;
RandomNode* rightChild_;
// Methods and so on
}
现在,当我尝试运行此代码时,出现以下错误
/usr/include/boost/serialization/access.hpp:118:9: error: ‘class Eigen::Matrix<double, 10000, 1>’ has no member named ‘serialize’
如何序列化 Eigen::Matrix 类?可能吗 ?提前致谢。