I have a problem with the following piece of code, after some research I have singled out the problem in a separate line, but not sure now how to solve it.
typedef double ComplexType;
typedef std::complex<ComplexType> Complex;
typedef Eigen::SparseMatrix<Complex, Eigen::ColMajor, long long> SparseMatrixT;
typedef Eigen::SparseVector<Complex, Eigen::ColMajor, long long> SparseVectorC;
typedef Eigen::SparseLU<SparseMatrixT, Eigen::COLAMDOrdering< long long>> SolverT;
SparseVectorC Solve(const Eigen::Ref<const SparseVectorC>& Rhs)
{
auto _Result = m_LU.solve(Rhs); //SolverT m_LU; defined and "prepared" elsewhere
SparseVectorC Result = _Result; // cause error C2512
return Result;
}
the error shows
\eigen\src\core\solve.h(125): error C2512: 'Eigen::internal::evaluator< Eigen::SparseVector< Complex,0, long long > >': no appropriate default constructor available
How can I get the Result in either Sparse of Dense vector (since it is not supposed to be sparse unlike the Rhs). The matrix size is (could be) huge, so extra copy would be unpleasant.
The variable _Result is apparently sparse, however neither assignment (with or without casting) to Sparse or Dense vector (using available method toDense() which is probably make a copy) doesn't work.