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

#include <Polynomial.h>

Public Member Functions

 Polynomial (std::vector< T > _coeffs, std::vector< std::complex< T > > _roots)
 Create polynomial object from given vectors of coefficients and roots.
 
 Polynomial (std::vector< T > args)
 Create polynomial object from given vector of coefficients.
 
template<typename... Args>
 Polynomial (Args...args)
 Create polynomial object from given coefficients.
 
int degree () const
 Get polynomials degree.
 
void setRoots (std::vector< std::complex< T > > args)
 Set roots for this polynomial.
 
template<typename... Args>
void setRoots (Args...args)
 Set roots for this polynomial.
 
void setCoeffs (std::vector< T > args)
 Set coefficients for this polynomial.
 
template<typename... Args>
void setCoeffs (Args...args)
 Set coefficients for this polynomial.
 
void setSolver (BaseSolver< T > *solver)
 Set solver for this polynomial.
 
void solve (std::vector< std::complex< T > > &roots, std::vector< int > &conv, int maxiter=80)
 Find the roots of this polynomial.
 
Polynomial operator+ (Polynomial &rhs)
 
Polynomial operator- (const Polynomial &rhs) const
 
Polynomial operator* (const Polynomial &other)
 
Polynomial operator/ (Polynomial &divisor)
 
void divide (Polynomial &divisor, Polynomial &quotient, Polynomial &remainder)
 Divides one polynomial by another.
 
Polynomialoperator*= (const Polynomial &other)
 
Polynomialoperator= (const Polynomial &other)
 
operator[] (int i) const
 
T & operator[] (int i)
 
std::vector< T > diff (int deg=1)
 Calculates the derivative of a Polynomial object.
 
void print ()
 

Protected Attributes

std::vector< std::complex< T > > roots
 
std::vector< T > coeffs
 
BaseSolver< T > * Solver
 

Constructor & Destructor Documentation

◆ Polynomial() [1/3]

template<typename T >
Laguerre::Polynomial< T >::Polynomial ( std::vector< T > _coeffs,
std::vector< std::complex< T > > _roots )
inline

Create polynomial object from given vectors of coefficients and roots.

Parameters
_coeffsVector of coefficients.
_rootsVector of roots.

◆ Polynomial() [2/3]

template<typename T >
Laguerre::Polynomial< T >::Polynomial ( std::vector< T > args)
inline

Create polynomial object from given vector of coefficients.

Parameters
argsVector of coefficients.

◆ Polynomial() [3/3]

template<typename T >
template<typename... Args>
Laguerre::Polynomial< T >::Polynomial ( Args... args)
inline

Create polynomial object from given coefficients.

Parameters
argsCoefficients.

Member Function Documentation

◆ degree()

template<typename T >
int Laguerre::Polynomial< T >::degree ( ) const
inline

Get polynomials degree.

Returns
Degree of the polynomial.

◆ diff()

template<typename T >
std::vector< T > Laguerre::Polynomial< T >::diff ( int deg = 1)
inline

Calculates the derivative of a Polynomial object.

This function calculates the derivative of a given degree of the Polynomial object. The default degree of the derivative is 1, which means it calculates the first derivative if no degree is specified.

Template Parameters
TThe data type of the Polynomial coefficients.
Parameters
degThe degree of the derivative. Default is 1.
Returns
A vector of coefficients representing the derivative of the Polynomial.

◆ divide()

template<typename T >
void Laguerre::Polynomial< T >::divide ( Polynomial< T > & divisor,
Polynomial< T > & quotient,
Polynomial< T > & remainder )
inline

Divides one polynomial by another.

This function performs polynomial division. Given a divisor and a dividend (the instance calling the function), it calculates the quotient and the remainder of the division.

Parameters
divisorThe polynomial to divide by.
quotientThe result of the division.
remainderThe remainder after division.

◆ operator*()

template<typename T >
Polynomial Laguerre::Polynomial< T >::operator* ( const Polynomial< T > & other)
inline

◆ operator*=()

template<typename T >
Polynomial & Laguerre::Polynomial< T >::operator*= ( const Polynomial< T > & other)
inline

◆ operator+()

template<typename T >
Polynomial Laguerre::Polynomial< T >::operator+ ( Polynomial< T > & rhs)
inline

◆ operator-()

template<typename T >
Polynomial Laguerre::Polynomial< T >::operator- ( const Polynomial< T > & rhs) const
inline

◆ operator/()

template<typename T >
Polynomial Laguerre::Polynomial< T >::operator/ ( Polynomial< T > & divisor)
inline

◆ operator=()

template<typename T >
Polynomial & Laguerre::Polynomial< T >::operator= ( const Polynomial< T > & other)
inline

◆ operator[]() [1/2]

template<typename T >
T & Laguerre::Polynomial< T >::operator[] ( int i)
inline

◆ operator[]() [2/2]

template<typename T >
T Laguerre::Polynomial< T >::operator[] ( int i) const
inline

◆ print()

template<typename T >
void Laguerre::Polynomial< T >::print ( )
inline

◆ setCoeffs() [1/2]

template<typename T >
template<typename... Args>
void Laguerre::Polynomial< T >::setCoeffs ( Args... args)
inline

Set coefficients for this polynomial.

Parameters
argsGiven coefficients.

◆ setCoeffs() [2/2]

template<typename T >
void Laguerre::Polynomial< T >::setCoeffs ( std::vector< T > args)
inline

Set coefficients for this polynomial.

Parameters
argsVector of coefficients.

◆ setRoots() [1/2]

template<typename T >
template<typename... Args>
void Laguerre::Polynomial< T >::setRoots ( Args... args)
inline

Set roots for this polynomial.

Parameters
argsGiven roots.

◆ setRoots() [2/2]

template<typename T >
void Laguerre::Polynomial< T >::setRoots ( std::vector< std::complex< T > > args)
inline

Set roots for this polynomial.

Parameters
argsVector of roots.

◆ setSolver()

template<typename T >
void Laguerre::Polynomial< T >::setSolver ( BaseSolver< T > * solver)
inline

Set solver for this polynomial.

Parameters
solverPointer to a Solver object.

◆ solve()

template<typename T >
void Laguerre::Polynomial< T >::solve ( std::vector< std::complex< T > > & roots,
std::vector< int > & conv,
int maxiter = 80 )
inline

Find the roots of this polynomial.

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

Member Data Documentation

◆ coeffs

template<typename T >
std::vector<T> Laguerre::Polynomial< T >::coeffs
protected

◆ roots

template<typename T >
std::vector<std::complex<T> > Laguerre::Polynomial< T >::roots
protected

◆ Solver

template<typename T >
BaseSolver<T>* Laguerre::Polynomial< T >::Solver
protected

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