lambda-lanczos 2.0.0
|
Calculation engine for Lanczos exponentiation. More...
#include <exponentiator.hpp>
Public Member Functions | |
Exponentiator (std::function< void(const std::vector< T > &, std::vector< T > &)> mv_mul, size_t matrix_size) | |
Constructs Lanczos exponetiation engine. More... | |
size_t | run (const T &a, const std::vector< T > &input, std::vector< T > &output) const |
Apply matrix exponentiation exp(a*A) to input and store the result into output . More... | |
size_t | taylor_run (const T &a, const std::vector< T > &input, std::vector< T > &output) |
Public Attributes | |
std::function< void(const std::vector< T > &in, std::vector< T > &out)> | mv_mul |
Matrix-vector multiplication routine. More... | |
size_t | matrix_size |
Dimension of the matrix to be exponentiated. More... | |
size_t | max_iteration |
Iteration limit of Lanczos algorithm, set to matrix_size automatically. More... | |
real_t< T > | eps = std::numeric_limits<real_t<T>>::epsilon() * 1e2 |
Convergence threshold of Lanczos iteration. More... | |
bool | full_orthogonalize = false |
Flag to execute explicit Lanczos-vector orthogonalization. More... | |
size_t | initial_vector_size = 200 |
(Not necessary to change) More... | |
Private Types | |
template<typename n_type > | |
using | real_t = util::real_t< n_type > |
See util::real_t for details. More... | |
Calculation engine for Lanczos exponentiation.
|
private |
See util::real_t for details.
|
inline |
Constructs Lanczos exponetiation engine.
mv_mul | Matrix-vector multiplication routine. See mv_mul for details. |
matrix_size | The size of your matrix, i.e. if your matrix is n by n, matrix_size should be n. |
|
inline |
Apply matrix exponentiation exp(a*A) to input
and store the result into output
.
|
inline |
real_t<T> lambda_lanczos::Exponentiator< T >::eps = std::numeric_limits<real_t<T>>::epsilon() * 1e2 |
Convergence threshold of Lanczos iteration.
eps
= 1e-14 means that the eigenvalue will be calculated with 14 digits of precision.
Default value is system-dependent. On usual 64-bit systems:
type (including complex one) | size (system-dep.) | eps |
---|---|---|
float | 4 bytes | 1e-6 |
double | 8 bytes | 1e-14 |
long double | 16 bytes | 1e-21 |
bool lambda_lanczos::Exponentiator< T >::full_orthogonalize = false |
Flag to execute explicit Lanczos-vector orthogonalization.
size_t lambda_lanczos::Exponentiator< T >::initial_vector_size = 200 |
(Not necessary to change)
This variable specifies the initial reserved size of Lanczos vectors. Controlling this variable might affect reserving efficiency, but that would be very small compared to matrix-vector-multiplication cost.
size_t lambda_lanczos::Exponentiator< T >::matrix_size |
Dimension of the matrix to be exponentiated.
size_t lambda_lanczos::Exponentiator< T >::max_iteration |
Iteration limit of Lanczos algorithm, set to matrix_size
automatically.
std::function<void(const std::vector<T>& in, std::vector<T>& out)> lambda_lanczos::Exponentiator< T >::mv_mul |
Matrix-vector multiplication routine.
This must be a function to calculate A*in
and store the result into out
, where A
is the matrix to be exponentiated. You can assume the output vector out
has been initialized with zeros before the mv_mul
is called.