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