26 #include <Eigen/Sparse> 57 template <
class Operator>
79 const std::optional<Vector>
initial = {})
116 const double ritzValue = x.dot(A_ * x);
117 const double error = (A_ * x - ritzValue *
x).norm();
132 bool isConverged =
false;
134 for (
size_t i = 0;
i < maxIterations && !isConverged;
i++) {
139 ritzValue_ = ritzVector_.dot(A_ * ritzVector_);
bool compute(size_t maxIterations, double tol)
Vector powerIteration(const Vector &x) const
Eigen::SparseMatrix< double > Sparse
Compute maximum Eigenpair with power method.
PowerMethod(const Operator &A, const std::optional< Vector > initial={})
Construct from the aim matrix and intial ritz vector.
typedef and functions to augment Eigen's VectorXd
double eigenvalue() const
Return the eigenvalue.
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
bool converged(double tol) const
Vector eigenvector() const
Return the eigenvector.
Vector powerIteration() const
size_t nrIterations() const
Return the number of iterations.