Flow123d  release_2.2.0-26-ge868538
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private 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 Types

typedef LinearODESolverBase FactoryBaseType
 

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...
 
bool evaluate_time_constraint (double &time_constraint) override
 Estimate upper bound for time step. Return true if constraint was set. 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 Member Functions

static const Input::Type::Recordget_input_type ()
 
- Static Public Member Functions inherited from LinearODESolverBase
static Input::Type::Abstractget_input_type ()
 

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...
 
bool system_matrix_changed_
 Indicates that the system_matrix_ was recently updated. More...
 

Static Private Attributes

static const int registrar
 Registrar of class to factory. 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 34 of file pade_approximant.hh.

Member Typedef Documentation

Definition at line 37 of file pade_approximant.hh.

Constructor & Destructor Documentation

PadeApproximant::PadeApproximant ( Input::Record  in_rec)

Constructor from input record.

Definition at line 55 of file pade_approximant.cc.

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

Constructor.

Definition at line 64 of file pade_approximant.cc.

PadeApproximant::~PadeApproximant ( void  )

Destructor.

Definition at line 69 of file pade_approximant.cc.

PadeApproximant::PadeApproximant ( )
inlineprotected

Hide default constructor.

Definition at line 59 of file pade_approximant.hh.

Member Function Documentation

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

Approximate the matrix function.

Definition at line 86 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 113 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 142 of file pade_approximant.cc.

Here is the caller graph for this function:

bool PadeApproximant::evaluate_time_constraint ( double &  time_constraint)
inlineoverridevirtual

Estimate upper bound for time step. Return true if constraint was set.

Implements LinearODESolverBase.

Definition at line 55 of file pade_approximant.hh.

const Record & PadeApproximant::get_input_type ( )
static

Input record for class PadeApproximant.

Definition at line 34 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 73 of file pade_approximant.cc.

Member Data Documentation

int PadeApproximant::denominator_degree_
protected

Degree of the polynomial in the denominator.

Definition at line 85 of file pade_approximant.hh.

int PadeApproximant::nominator_degree_
protected

Degree of the polynomial in the nominator.

Definition at line 84 of file pade_approximant.hh.

const int PadeApproximant::registrar
staticprivate
Initial value:
=
Input::register_class< PadeApproximant, Input::Record >("PadeApproximant") +

Registrar of class to factory.

Definition at line 91 of file pade_approximant.hh.

arma::mat PadeApproximant::solution_matrix_
protected

Solution matrix $ e^{At} $.

Definition at line 87 of file pade_approximant.hh.


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