7 #ifndef SPARSE_REGULAR_INVERSE_H 8 #define SPARSE_REGULAR_INVERSE_H 11 #include <Eigen/SparseCore> 12 #include <Eigen/IterativeLinearSolvers> 28 template <
typename Scalar,
int Uplo = Eigen::Lower,
int Flags = 0,
typename StorageIndex =
int>
52 m_mat(mat), m_n(mat.
rows())
54 if (mat.rows() != mat.cols())
55 throw std::invalid_argument(
"SparseRegularInverse: matrix must be square");
78 MapConstVec
x(x_in, m_n);
80 y.noalias() = m_cg.
solve(x);
92 MapConstVec
x(x_in, m_n);
94 y.noalias() = m_mat.template selfadjointView<Uplo>() * x;
100 #endif // SPARSE_REGULAR_INVERSE_H
SparseRegularInverse(ConstGenericSparseMatrix &mat)
A versatible sparse matrix representation.
A matrix or vector expression mapping an existing array of data.
const Solve< ConjugateGradient< _MatrixType, _UpLo, _Preconditioner >, Rhs > solve(const MatrixBase< Rhs > &b) const
A conjugate gradient solver for sparse (or dense) self-adjoint problems.
void mat_prod(const Scalar *x_in, Scalar *y_out) const
Eigen::Map< Vector > MapVec
ConjugateGradient< _MatrixType, _UpLo, _Preconditioner > & compute(const EigenBase< MatrixDerived > &A)
void solve(const Scalar *x_in, Scalar *y_out) const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Eigen::Map< const Vector > MapConstVec
Eigen::SparseMatrix< Scalar, Flags, StorageIndex > SparseMatrix
Eigen::ConjugateGradient< SparseMatrix > m_cg
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
const Eigen::Ref< const SparseMatrix > ConstGenericSparseMatrix
ConstGenericSparseMatrix m_mat
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x