I have a templated matrix library called CMatrix
which interfaces with Eigen library for some functions. In order to switch between libraries I have a simple function:
template <typename T>
MatrixXd CMatrix<T>::ToMatrixXd()
{
const int nrow=m_row;
const int ncol=m_column;
MatrixXd matrixXd(nrow,ncol);
for(unsigned int i=0;i<nrow;i++)
for(unsigned int j=0;j<ncol;j++)
matrixXd(i,j)=GetCellValue(i,j);
return matrixXd;
}
Here the typename T is atomic types such as double, float...
I call this function in another function as:
MatrixXd eigMat=m.ToMatrixXd();
I get the following error message:
const math::CMatrix <double> as 'this' argument of 'Eigen::MatrixXd math::CMatrix<T>::ToMatrixXd() [with T = double; Eigen::MatrixXd = Eigen::Matrix <double, -1, -1>] discards qualifiers [-fpermissive]
It seems that number of rows and columns stay as negative which does not make sense. I tried:
MatrixXd eigMat(nrow,ncolumn) //both nrow and ncolumn positive
eigMat=m.ToMatrixXd();
I still get the above-mentioned error message. What could be going on wrong?
m
? – xaxxon