Registered Member
|
Hello,
I'm trying to adapt the conjugate gradient method so that it can be use with a sparse matrix product:
The objective is to eventually add some extra code in order to avoid determining the resulting matrix explicitly but instead do always the following product:
where x is a dense vector. Therefore, for now, I'm trying to use the type MatrixMatrixType:
However inside my code I get the following error: SparseProduct.h:47:84: error: invalid use of incomplete type ‘struct Eigen::internal::traits<Eigen::TransposeImpl<const Eigen::SparseMatrix<double, 0>, Eigen::Sparse> >’ typename traits<_RhsNested>::Index>::type Index; So, just to have a complete example that triggers this issue:
Should I be using something else in the types of SparseSparseProduct? I would be grateful for any help! João Leal P.S.- Edited in order to have a complete example with the issue. |
Moderator
|
You must use "Eigen::Transpose<const MatrixType>". However, this will result in (A^T * A) * x instead of A^T * (A * x). So that's probably not the right way to do so. It would be better to implement a true LSCG class properly support preconditioning.
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]