13template < terra::linalg::OperatorLike OperatorT >
21 const int iterations )
30 if ( norm < std::numeric_limits< double >::min() )
34 lincomb( tmpIt, { 1.0 / norm }, { tmpIt }, 0.0 );
37 apply( op, tmpIt, tmpAux );
40 for (
int iteration = 0; iteration < iterations; ++iteration )
44 if ( norm < std::numeric_limits< double >::min() )
46 return radius > 0.0 ? radius : 1.0;
48 lincomb( tmpIt, { 1.0 / norm }, { tmpAux }, 0.0 );
51 apply( op, tmpIt, tmpAux );
54 radius =
dot( tmpIt, tmpAux );
Definition block_preconditioner_2x2.hpp:7
double power_iteration(OperatorT &op, SrcOf< OperatorT > &tmpIt, SrcOf< OperatorT > &tmpAux, const int iterations)
Power iteration to estimate the largest eigenvalue of a row-normalized operator D^{-1}A,...
Definition power_iteration.hpp:15
void lincomb(Vector &y, const std::vector< ScalarOf< Vector > > &c, const std::vector< Vector > &x, const ScalarOf< Vector > &c0)
Compute a linear combination of vectors. Implements: .
Definition vector.hpp:72
ScalarOf< Vector > norm_2(const Vector &y)
Compute the 2-norm (Euclidean norm) of a vector. Implements: .
Definition vector.hpp:166
void randomize(Vector &y)
Randomize the entries of a vector. Sets each entry of to a random value.
Definition vector.hpp:146
Operator::SrcVectorType SrcOf
Alias for the source vector type of an operator.
Definition operator.hpp:145
ScalarOf< Vector > dot(const Vector &y, const Vector &x)
Compute the dot product of two vectors. Implements: .
Definition vector.hpp:118
void apply(LinearForm &L, typename LinearForm::DstVectorType &dst)
Apply a linear form and write to a destination vector.
Definition linear_form.hpp:37