numerics
Loading...
Searching...
No Matches
power.hpp File Reference

Power iteration, inverse iteration, Rayleigh quotient iteration. More...

#include "core/matrix.hpp"
#include "core/vector.hpp"
#include "core/policy.hpp"
#include "linalg/factorization/lu.hpp"
#include <cmath>
#include <stdexcept>

Go to the source code of this file.

Classes

struct  num::PowerResult
 Result of a single-eigenvalue iteration. More...
 

Namespaces

namespace  num
 
namespace  num::detail
 

Functions

real num::detail::normalise (Vector &v)
 Normalise v in-place; returns the old norm.
 
PowerResult num::power_iteration (const Matrix &A, real tol=1e-10, idx max_iter=1000, Backend backend=default_backend)
 Power iteration – finds the eigenvalue largest in absolute value.
 
PowerResult num::inverse_iteration (const Matrix &A, real sigma, real tol=1e-10, idx max_iter=1000, Backend backend=default_backend)
 Inverse iteration – finds the eigenvalue closest to a shift sigma.
 
PowerResult num::rayleigh_iteration (const Matrix &A, const Vector &x0, real tol=1e-10, idx max_iter=50, Backend backend=default_backend)
 Rayleigh quotient iteration – cubically convergent.
 

Detailed Description

Power iteration, inverse iteration, Rayleigh quotient iteration.

All three methods accept a backend parameter:

power_iteration(A) // default_backend power_iteration(A, tol, max, num::omp) // OmpBackend – parallel matvec power_iteration(A, tol, max, num::blas) // BlasBackend – BLAS matvec

The backend is forwarded to every matvec, dot, axpy, and norm call inside the iteration.

Definition in file power.hpp.