I am new to C++ and the eigen lib, I am doing some matrix multiplications, like 1xn * nxn * nx1, the result should be a scalar, or an 1×1 matrix. I need to do some further calculations with it. Is there a way to assign it to a double/complex variable?
I tried to directly assign the result to a double variable, it returned an error.
no viable conversion from ‘NonConstRealReturnType’ (aka ‘Eigen::CwiseUnaryViewEigen::internal::scalar_real_ref_op<std::complex<double>, Eigen::ProductEigen::Product<Eigen::CwiseUnaryOp<Eigen::internal::scalar_conjugate_op<std::complex<double>, Eigen::Transpose<const Eigen::SparseMatrixstd::complex<double, 1>>>, Eigen::SparseMatrixstd::complex<double, 1>, 2>, Eigen::SparseMatrixstd::complex<double, 1>, 2>>’) to ‘double’
And the result doesn’t seem to be an 1×1 matrix, because the compiler gives “no member named ‘coeffRef'”, when I try to use it.