我使用eigen 3.1.0-alpha1作为我的第一个小软件的求解器。我需要从一个类的方法返回一个稀疏矩阵:
SparseMatrix KMDMatrix::Assembly(double ***p_objs){
SparseMatrix <double> Kglobal(15,15);
for (int i = 0; i < N_POINTS; ++i){
for (int j = 0; j < 10; ++j){
for (int h = 0; h < 10; ++h){
Kglobal.coeffRef(i*5+j,i*5+h)+=p_objs[i][j][h];
}
}
}
return Kglobal;
但它不起作用。其中一个错误是: error C2955:'Eigen::SparseMatrix‘:使用类模板需要模板参数列表
我已经声明了:
SparseMatrix Assembly(double ***p_objs);
我在使用Eigen时有一些困难,参考资料对我来说不清楚。谢谢你对我的照顾
发布于 2011-12-19 20:13:16
根据您的代码,您应该使用
SparseMatrix<double> KMDMatrix::Assembly(double ***p_objs){
在返回类型说明符中
https://stackoverflow.com/questions/8566858
复制相似问题