50 template <
class Operator>
63 const Operator &
A,
const boost::optional<Vector>
initial = boost::none,
64 double initialBeta = 0.0)
69 previousVector_ = Vector::Zero(this->
dim_);
81 const double beta)
const {
104 const double up = initVector.dot( this->
A_ * initVector );
105 const double down = initVector.dot(initVector);
106 const double mu = up / down;
107 double maxBeta = mu * mu / 4;
109 std::vector<double> betas;
113 for (
size_t t = 0;
t <
T;
t++) {
115 betas = {2 / 3 * maxBeta, 0.99 * maxBeta, maxBeta, 1.01 * maxBeta,
118 for (
size_t k = 0; k < betas.size(); ++k) {
123 for (
size_t j = 1;
j < 10;
j++) {
135 const double up = x.dot(this->
A_ * x);
136 const double down = x.dot(x);
137 const double mu = up / down;
139 if (mu * mu / 4 > maxBeta) {
142 maxBeta = mu * mu / 4;
147 return betas[maxIndex];
158 bool isConverged =
false;
160 for (
size_t i = 0;
i < maxIterations && !isConverged;
i++) {
166 previousVector_ = tmp;
Compute maximum Eigenpair with accelerated power method.
Rot2 R(Rot2::fromAngle(0.1))
Vector acceleratedPowerIteration() const
Vector acceleratedPowerIteration(const Vector &x1, const Vector &x0, const double beta) const
Power method for fast eigenvalue and eigenvector computation.
Compute maximum Eigenpair with power method.
double estimateBeta(const size_t T=10) const
Eigen::Triplet< double > T
bool compute(size_t maxIterations, double tol)
bool converged(double tol) const
AcceleratedPowerMethod(const Operator &A, const boost::optional< Vector > initial=boost::none, double initialBeta=0.0)
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