Flow123d  jenkins-Flow123d-linux-release-multijob-198
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
PadeApproximant Class Reference

This class implements the Pade approximation of exponential function. More...

#include <pade_approximant.hh>

Inheritance diagram for PadeApproximant:
Inheritance graph
[legend]
Collaboration diagram for PadeApproximant:
Collaboration graph
[legend]

Public Member Functions

 PadeApproximant (Input::Record in_rec)
 Constructor from input record. More...
 
 PadeApproximant (unsigned int nominator_degree, unsigned int denominator_degree)
 Constructor. More...
 
 ~PadeApproximant (void)
 Destructor. More...
 
void update_solution (arma::vec &init_vector, arma::vec &output_vec) override
 Updates solution of the ODEs system. More...
 
- Public Member Functions inherited from LinearODESolver< PadeApproximant >
 LinearODESolver ()
 
virtual ~LinearODESolver ()
 
virtual void update_solution (arma::mat &init_vecs, arma::mat &output_vecs, const std::vector< unsigned int > &mask=std::vector< unsigned int >(0)) override
 Updates solution of the system with different initial vectors. More...
 
- Public Member Functions inherited from LinearODESolverBase
 LinearODESolverBase ()
 
virtual ~LinearODESolverBase ()
 
void set_system_matrix (const arma::mat &matrix)
 Sets the matrix of ODE system. More...
 
void set_step (double step)
 Sets the step of the numerical method. More...
 

Static Public Attributes

static Input::Type::Record input_type
 
- Static Public Attributes inherited from LinearODESolverBase
static Input::Type::AbstractRecord input_type = AbstractRecord("LinearODESolver", "Solver of a linear system of ODEs.")
 

Protected Member Functions

 PadeApproximant ()
 Hide default constructor. More...
 
void approximate_matrix (arma::mat &matrix)
 
void compute_exp_coefs (unsigned int nominator_degree, unsigned int denominator_degree, std::vector< double > &nominator_coefs, std::vector< double > &denominator_coefs)
 Evaluates nominator and denominator coeficients of PadeApproximant for exponencial function. More...
 
void evaluate_matrix_polynomial (arma::mat &polynomial_matrix, const arma::mat &input_matrix, const std::vector< double > &coefs)
 Evaluates the matrix polynomial by Horner scheme. More...
 

Protected Attributes

int nominator_degree_
 Degree of the polynomial in the nominator. More...
 
int denominator_degree_
 Degree of the polynomial in the denominator. More...
 
arma::mat solution_matrix_
 Solution matrix $ e^{At} $. More...
 
- Protected Attributes inherited from LinearODESolverBase
arma::mat system_matrix_
 the square matrix of ODE system More...
 
arma::vec rhs_
 the column vector of RHS values (not used currently) More...
 
double step_
 the step of the numerical method More...
 
bool step_changed_
 flag is true if the step has been changed More...
 

Detailed Description

This class implements the Pade approximation of exponential function.

The exponential function is considered in the form $ e^{At} $ where $ A $ is a constant matrix. It is then approximated by a fraction of polynomials

\[ e^{At} = \frac{P(t)}{Q(t)},\]

where the degrees of polynomials in nominator and denominator, $ P(t) $ and $ Q(t) $, are set from the input record.

Definition at line 23 of file pade_approximant.hh.

Constructor & Destructor Documentation

PadeApproximant::PadeApproximant ( Input::Record  in_rec)

Constructor from input record.

Definition at line 22 of file pade_approximant.cc.

PadeApproximant::PadeApproximant ( unsigned int  nominator_degree,
unsigned int  denominator_degree 
)

Constructor.

Definition at line 29 of file pade_approximant.cc.

PadeApproximant::~PadeApproximant ( void  )

Destructor.

Definition at line 34 of file pade_approximant.cc.

PadeApproximant::PadeApproximant ( )
inlineprotected

Hide default constructor.

Definition at line 44 of file pade_approximant.hh.

Member Function Documentation

void PadeApproximant::approximate_matrix ( arma::mat &  matrix)
protected

Approximate the matrix function.

Definition at line 51 of file pade_approximant.cc.

Here is the caller graph for this function:

void PadeApproximant::compute_exp_coefs ( unsigned int  nominator_degree,
unsigned int  denominator_degree,
std::vector< double > &  nominator_coefs,
std::vector< double > &  denominator_coefs 
)
protected

Evaluates nominator and denominator coeficients of PadeApproximant for exponencial function.

Parameters
nominator_degreeis the degree of polynomial in the nominator
denominator_degreeis the degree of polynomial in the denominator
nominator_coefsis the vector of coeficients of the polynomial in the nominator
denominator_coefsis the vector of coeficients of the polynomial in the denominator

Definition at line 78 of file pade_approximant.cc.

Here is the caller graph for this function:

void PadeApproximant::evaluate_matrix_polynomial ( arma::mat &  polynomial_matrix,
const arma::mat &  input_matrix,
const std::vector< double > &  coefs 
)
protected

Evaluates the matrix polynomial by Horner scheme.

Parameters
polynomial_matrixis the output matrix
input_matrixis the input matrix (with elements -kt)
coefsis the vector of coeficients of the polynomial

Horner scheme for evaluating polynomial a0 + [a1 + [a2 + [a3 +...]*R(t)]*R(t)]*R(t)

Definition at line 107 of file pade_approximant.cc.

Here is the caller graph for this function:

void PadeApproximant::update_solution ( arma::vec &  init_vec,
arma::vec &  output_vec 
)
overridevirtual

Updates solution of the ODEs system.

Parameters
init_vecis the column initial vector
output_vecis the column output vector containing the result

Implements LinearODESolverBase.

Definition at line 38 of file pade_approximant.cc.

Member Data Documentation

int PadeApproximant::denominator_degree_
protected

Degree of the polynomial in the denominator.

Definition at line 70 of file pade_approximant.hh.

Record PadeApproximant::input_type
static
Initial value:
= Record("PadeApproximant", "Record with an information about pade approximant parameters.")
.declare_key("nominator_degree", Integer(1), Default("2"),
"Polynomial degree of the nominator of Pade approximant.")
.declare_key("denominator_degree", Integer(1), Default("2"),
"Polynomial degree of the nominator of Pade approximant")

Input record for class PadeApproximant.

Definition at line 29 of file pade_approximant.hh.

int PadeApproximant::nominator_degree_
protected

Degree of the polynomial in the nominator.

Definition at line 69 of file pade_approximant.hh.

arma::mat PadeApproximant::solution_matrix_
protected

Solution matrix $ e^{At} $.

Definition at line 72 of file pade_approximant.hh.


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