Laguerre polynomials
Loading...
Searching...
No Matches
Laguerre::ModifiedLaguerre18< T > Class Template Reference

#include <Laguerre18m.h>

Inheritance diagram for Laguerre::ModifiedLaguerre18< T >:
BaseSolver< T >

Public Member Functions

 ModifiedLaguerre18 ()
 
void operator() (std::vector< T > &poly, std::vector< std::complex< T > > &roots, std::vector< int > &conv, int itmax) override
 Find the roots of a polynomial using Laguerre's method.
 

Private Member Functions

cross (std::vector< int > &h, std::vector< T > &a, int c, int i)
 Calculate the determinant between two points.
 
void conv_hull (int n, std::vector< T > &a, std::vector< int > &h, int &c)
 Calculate the convex hull of a set of points. Dont forget to calculate Andrews alghoritm to vector a!
 
void estimates (vector< T > &alpha, int deg, std::vector< std::complex< T > > &roots, std::vector< int > &conv, int &nz)
 Estimate roots of a polynomial.
 
void rcheck_lag (std::vector< T > &p, vector< T > &alpha, int deg, complex< T > &b, complex< T > &c, complex< T > z, T r, int &conv, T &berr, T &cond)
 Perform Laguerre correction, compute backward error, and condition.
 
void check_lag (std::vector< T > &p, std::vector< T > &alpha, int deg, std::complex< T > &b, std::complex< T > &c, std::complex< T > z, T r, int &conv, T &berr, T &cond)
 Perform Laguerre correction, compute backward error, and condition.
 
void modify_lag (int deg, std::complex< T > &b, std::complex< T > &c, std::complex< T > z, int j, std::vector< std::complex< T > > &roots)
 Modify Laguerre correction based on Aberth's method.
 

Static Private Attributes

static constexpr T eps = std::numeric_limits<T>::epsilon()
 
static constexpr T big = std::numeric_limits<T>::max()
 
static constexpr T small = std::numeric_limits<T>::min()
 
static constexpr T PI = std::numbers::pi_v<T>
 
static constexpr T pi2 = PI*static_cast<T>(2)
 

Constructor & Destructor Documentation

◆ ModifiedLaguerre18()

template<typename T >
Laguerre::ModifiedLaguerre18< T >::ModifiedLaguerre18 ( )
inline

Member Function Documentation

◆ check_lag()

template<typename T >
void Laguerre::ModifiedLaguerre18< T >::check_lag ( std::vector< T > & p,
std::vector< T > & alpha,
int deg,
std::complex< T > & b,
std::complex< T > & c,
std::complex< T > z,
T r,
int & conv,
T & berr,
T & cond )
inlineprivate

Perform Laguerre correction, compute backward error, and condition.

Parameters
pVector of polynomial coefficients.
alphaVector of coefficients.
degDegree of the polynomial.
bOutput complex number representing root.
cOutput complex number representing correction.
zComplex number used for correction.
rValue used for correction.
convOutput value indicating convergence status.
berrOutput backward error.
condOutput condition number.

◆ conv_hull()

template<typename T >
void Laguerre::ModifiedLaguerre18< T >::conv_hull ( int n,
std::vector< T > & a,
std::vector< int > & h,
int & c )
inlineprivate

Calculate the convex hull of a set of points. Dont forget to calculate Andrews alghoritm to vector a!

Parameters
nNumber of points.
aVector of templated type T representing points coordinates.
hVector to store the convex hull.
cNumber of points in the convex hull.

◆ cross()

template<typename T >
T Laguerre::ModifiedLaguerre18< T >::cross ( std::vector< int > & h,
std::vector< T > & a,
int c,
int i )
inlineprivate

Calculate the determinant between two points.

Parameters
hVector of integers representing points.
aVector of Ts representing points' coordinates.
cIndex for the current point.
iIndex for the next point.
Returns
T Determinant between two points.

◆ estimates()

template<typename T >
void Laguerre::ModifiedLaguerre18< T >::estimates ( vector< T > & alpha,
int deg,
std::vector< std::complex< T > > & roots,
std::vector< int > & conv,
int & nz )
inlineprivate

Estimate roots of a polynomial.

Parameters
alphaPolynomial object.
degDegree of the polynomial.
rootsVector to store the estimated roots.
convVector to store convergence status of each root.
nzNumber of zeros.

◆ modify_lag()

template<typename T >
void Laguerre::ModifiedLaguerre18< T >::modify_lag ( int deg,
std::complex< T > & b,
std::complex< T > & c,
std::complex< T > z,
int j,
std::vector< std::complex< T > > & roots )
inlineprivate

Modify Laguerre correction based on Aberth's method.

Parameters
degDegree of the polynomial.
bComplex number representing root.
cComplex number representing correction.
zComplex number used for correction.
jIndex of the root to modify.
rootsVector of estimated roots.

◆ operator()()

template<typename T >
void Laguerre::ModifiedLaguerre18< T >::operator() ( std::vector< T > & poly,
std::vector< std::complex< T > > & roots,
std::vector< int > & conv,
int itmax )
inlineoverridevirtual

Find the roots of a polynomial using Laguerre's method.

Parameters
polyPolynomial object.
rootsVector to store the roots.
convVector to store convergence status of each root.
itmaxMaximum number of iterations.

Implements BaseSolver< T >.

◆ rcheck_lag()

template<typename T >
void Laguerre::ModifiedLaguerre18< T >::rcheck_lag ( std::vector< T > & p,
vector< T > & alpha,
int deg,
complex< T > & b,
complex< T > & c,
complex< T > z,
T r,
int & conv,
T & berr,
T & cond )
inlineprivate

Perform Laguerre correction, compute backward error, and condition.

Parameters
pPolynomial object.
alphaVector of coefficients.
bOutput complex number representing root.
cOutput complex number representing correction.
zComplex number used for correction.
rValue used for correction.
convOutput value indicating convergence status.
berrOutput backward error.
condOutput condition number.

Member Data Documentation

◆ big

template<typename T >
constexpr T Laguerre::ModifiedLaguerre18< T >::big = std::numeric_limits<T>::max()
staticconstexprprivate

◆ eps

template<typename T >
constexpr T Laguerre::ModifiedLaguerre18< T >::eps = std::numeric_limits<T>::epsilon()
staticconstexprprivate

◆ PI

template<typename T >
constexpr T Laguerre::ModifiedLaguerre18< T >::PI = std::numbers::pi_v<T>
staticconstexprprivate

◆ pi2

template<typename T >
constexpr T Laguerre::ModifiedLaguerre18< T >::pi2 = PI*static_cast<T>(2)
staticconstexprprivate

◆ small

template<typename T >
constexpr T Laguerre::ModifiedLaguerre18< T >::small = std::numeric_limits<T>::min()
staticconstexprprivate

The documentation for this class was generated from the following file: