lambda-lanczos 2.0.0
Loading...
Searching...
No Matches
lambda_lanczos::Exponentiator< T > Class Template Reference

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...
 

Detailed Description

template<typename T>
class lambda_lanczos::Exponentiator< T >

Calculation engine for Lanczos exponentiation.

Member Typedef Documentation

◆ real_t

template<typename T >
template<typename n_type >
using lambda_lanczos::Exponentiator< T >::real_t = util::real_t<n_type>
private

See util::real_t for details.

Constructor & Destructor Documentation

◆ Exponentiator()

template<typename T >
lambda_lanczos::Exponentiator< T >::Exponentiator ( std::function< void(const std::vector< T > &, std::vector< T > &)>  mv_mul,
size_t  matrix_size 
)
inline

Constructs Lanczos exponetiation engine.

Parameters
mv_mulMatrix-vector multiplication routine. See mv_mul for details.
matrix_sizeThe size of your matrix, i.e. if your matrix is n by n, matrix_size should be n.

Member Function Documentation

◆ run()

template<typename T >
size_t lambda_lanczos::Exponentiator< T >::run ( const T &  a,
const std::vector< T > &  input,
std::vector< T > &  output 
) const
inline

Apply matrix exponentiation exp(a*A) to input and store the result into output.

Returns
Lanczos-iteration count

◆ taylor_run()

template<typename T >
size_t lambda_lanczos::Exponentiator< T >::taylor_run ( const T &  a,
const std::vector< T > &  input,
std::vector< T > &  output 
)
inline

Member Data Documentation

◆ eps

template<typename T >
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

◆ full_orthogonalize

template<typename T >
bool lambda_lanczos::Exponentiator< T >::full_orthogonalize = false

Flag to execute explicit Lanczos-vector orthogonalization.

◆ initial_vector_size

template<typename T >
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.

◆ matrix_size

template<typename T >
size_t lambda_lanczos::Exponentiator< T >::matrix_size

Dimension of the matrix to be exponentiated.

◆ max_iteration

template<typename T >
size_t lambda_lanczos::Exponentiator< T >::max_iteration

Iteration limit of Lanczos algorithm, set to matrix_size automatically.

◆ mv_mul

template<typename T >
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.


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