CYCLUS
Loading...
Searching...
No Matches
uniform_taylor.h
Go to the documentation of this file.
1#ifndef CYCLUS_SRC_UNIFORM_TAYLOR_H_
2#define CYCLUS_SRC_UNIFORM_TAYLOR_H_
3
4#include <boost/lexical_cast.hpp>
5
6#include "use_matrix_lib.h"
7
8namespace cyclus {
9
10/// @class UniformTaylor
11///
12/// A class that solves the matrix exponential
13/// problem using the Taylor Series with Uniformization method.
15 public:
16 /// Solves the matrix exponential problem:
17 ///
18 /// dx(t)
19 /// ----- = A * x(t)
20 /// dt
21 ///
22 /// where A is an nxn Matrix and x(t) is a nx1 Vector. The solution
23 /// to this equation can be determined by calculating:
24 ///
25 /// x(t) = e^(tA) * x(t=0)
26 ///
27 /// @param A the Matrix
28 /// @param x_o the initial condition Vector x(t=0)
29 /// @param t the value for which the solution is being evaluated
30 /// @return the solution Vector x(t)
31 /// @throw <string> if the Uniform Taylor method cannot be used
32 static Vector MatrixExpSolver(const Matrix& A, const Vector& x_o,
33 const double t);
34
35 private:
36 /// Returns the diagonal element in the Matrix A
37 /// that has the largest absolute value.
38 ///
39 /// @param A the Matrix
40 /// @return the diagonal element of A with the largest absolute value
41 static double MaxAbsDiag(const Matrix& A);
42
43 /// Computes the solution Vector x_t using the Taylor Series with
44 /// Uniformization method.
45 ///
46 /// @param B the Matrix B = A + alpha * I
47 /// @param x_o the initial condition Vector
48 /// @param alpha the diagonal element of A with the largest absolute value
49 /// @param t the value for which the solution is being evaluated
50 /// @param tol the accuracy desired
51 /// @return the solution Vector x_t for the given value of t
52 /// @throw <string> if exp(-alpha * t) or exp(alpha * t) exceeds range
53 static Vector GetSolutionVector(const Matrix& B, const Vector& x_o,
54 double alpha, double t, double tol);
55
56 /// Computes the maximum number of terms needed to obtain an accuracy
57 /// of epsilon when using the Taylor Series with Uniformization
58 /// method.
59 /// @param alpha_t the product alpha * t
60 /// @param epsilon the accuracy desired in the series computation
61 /// @return the maximum number of terms needed
62 /// @throw <string> if exp(alpha * t) exceeds range
63 static int MaxNumTerms(long double alpha_t, double epsilon);
64};
65
66} // namespace cyclus
67
68#endif // CYCLUS_SRC_UNIFORM_TAYLOR_H_
A class that solves the matrix exponential problem using the Taylor Series with Uniformization method...
static Vector MatrixExpSolver(const Matrix &A, const Vector &x_o, const double t)
Solves the matrix exponential problem:
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Definition agent.cc:14
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters