I am trying initializing sparseMatrix of Eigen, but it does not work when the initialization is in a class description. In the case of initialization in a function, not in a class, it works. I am writting codes by C++ and using Visual Studio 2017. I added public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW , but the problem remains.
#include <iostream>
#include <vector>
#include <Eigen/SparseCore>
#include <Eigen/Sparse>
#include "pch.h"
using namespace Eigen;
namespace A {
class A
{
std::size_t max_doc_id = 4;
std::size_t max_term_id = 4;
SparseMatrix<float, Eigen::RowMajor, int64_t> smat(max_term_id, max_doc_id);
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
I want to decide the size of smat matrix (col=4, row=4) , but the error message is like this (actually it is written in Japanese so it may not correct) "the member A::A::max_term_id is not the name of the type." I appreciate if you can help me.