Flow123d
release_2.2.0-33-g759111d
|
This class implements the Pade approximation of exponential function. More...
#include <pade_approximant.hh>
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::Record & | get_input_type () |
Static Public Member Functions inherited from LinearODESolverBase | |
static Input::Type::Abstract & | get_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 . 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... | |
This class implements the Pade approximation of exponential function.
The exponential function is considered in the form where is a constant matrix. It is then approximated by a fraction of polynomials
where the degrees of polynomials in nominator and denominator, and , are set from the input record.
Definition at line 34 of file pade_approximant.hh.
Definition at line 37 of file pade_approximant.hh.
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.
|
inlineprotected |
Hide default constructor.
Definition at line 59 of file pade_approximant.hh.
|
protected |
Approximate the matrix function.
Definition at line 86 of file pade_approximant.cc.
|
protected |
Evaluates nominator and denominator coeficients of PadeApproximant for exponencial function.
nominator_degree | is the degree of polynomial in the nominator |
denominator_degree | is the degree of polynomial in the denominator |
nominator_coefs | is the vector of coeficients of the polynomial in the nominator |
denominator_coefs | is the vector of coeficients of the polynomial in the denominator |
Definition at line 113 of file pade_approximant.cc.
|
protected |
Evaluates the matrix polynomial by Horner scheme.
polynomial_matrix | is the output matrix |
input_matrix | is the input matrix (with elements -kt) |
coefs | is 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.
|
inlineoverridevirtual |
Estimate upper bound for time step. Return true if constraint was set.
Implements LinearODESolverBase.
Definition at line 55 of file pade_approximant.hh.
|
static |
Input record for class PadeApproximant.
Definition at line 34 of file pade_approximant.cc.
|
overridevirtual |
Updates solution of the ODEs system.
init_vec | is the column initial vector |
output_vec | is the column output vector containing the result |
Implements LinearODESolverBase.
Definition at line 73 of file pade_approximant.cc.
|
protected |
Degree of the polynomial in the denominator.
Definition at line 85 of file pade_approximant.hh.
|
protected |
Degree of the polynomial in the nominator.
Definition at line 84 of file pade_approximant.hh.
|
staticprivate |
Registrar of class to factory.
Definition at line 91 of file pade_approximant.hh.
|
protected |
Solution matrix .
Definition at line 87 of file pade_approximant.hh.