Go to the documentation of this file.
50 template <
class Operator>
63 const Operator &
A,
const std::optional<Vector>
initial = {},
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 power method.
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
AcceleratedPowerMethod(const Operator &A, const std::optional< Vector > initial={}, double initialBeta=0.0)
Eigen::Triplet< double > T
double beta(double a, double b)
bool compute(size_t maxIterations, double tol)
Power method for fast eigenvalue and eigenvector computation.
Compute maximum Eigenpair with accelerated power method.
Vector acceleratedPowerIteration(const Vector &x1, const Vector &x0, const double beta) const
bool converged(double tol) const
double estimateBeta(const size_t T=10) const
Rot2 R(Rot2::fromAngle(0.1))
Vector acceleratedPowerIteration() const
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:31:51