0

我正在使用 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;

但它不起作用。错误之一是:错误 C2955:'Eigen::SparseMatrix':使用类模板需要模板参数列表

我已经宣布了:

SparseMatrix Assembly(double ***p_objs);

我使用 Eigen 有一些困难,参考对我来说不清楚。感谢你们对我的帮助

4

1 回答 1

1

根据您的代码,您应该使用

SparseMatrix<double> KMDMatrix::Assembly(double ***p_objs){

在返回类型说明符中

于 2011-12-19T20:13:16.393 回答