HΦ
3.2.0
|
Calculate eigenvalues by the Lanczos method. More...
#include "Common.h"
#include "common/setmemory.h"
#include "mltply.h"
#include "vec12.h"
#include "bisec.h"
#include "FileIO.h"
#include "matrixlapack.h"
#include "Lanczos_EigenValue.h"
#include "wrapperMPI.h"
#include "CalcTime.h"
Go to the source code of this file.
Functions | |
int | Lanczos_EigenValue (struct BindStruct *X) |
Main function for calculating eigen values by Lanczos method. The energy convergence is judged by the level of target energy determined by \( \verb|k_exct| \). . More... | |
int | Lanczos_GetTridiagonalMatrixComponents (struct BindStruct *X, double *_alpha, double *_beta, double complex *tmp_v1, unsigned long int *liLanczos_step) |
Calculate tridiagonal matrix components by Lanczos method. More... | |
int | ReadInitialVector (struct BindStruct *X, double complex *_v0, double complex *_v1, unsigned long int *liLanczosStp_vec) |
Read initial vectors for the restart calculation. More... | |
int | OutputLanczosVector (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1, unsigned long int liLanczosStp_vec) |
Output initial vectors for the restart calculation. More... | |
void | SetInitialVector (struct BindStruct *X, double complex *tmp_v0, double complex *tmp_v1) |
Set initial vector to start the calculation for Lanczos method. . More... | |
int | ReadTMComponents (struct BindStruct *X, double *_dnorm, unsigned long int *_i_max, int iFlg) |
Read tridiagonal matrix components obtained by the Lanczos method. . More... | |
int | OutputTMComponents (struct BindStruct *X, double *_alpha, double *_beta, double _dnorm, int liLanczosStp) |
Output tridiagonal matrix components obtained by the Lanczos method. More... | |
int Lanczos_EigenValue | ( | struct BindStruct * | X | ) |
Main function for calculating eigen values by Lanczos method.
The energy convergence is judged by the level of target energy determined by \( \verb|k_exct| \).
.
X | [in] Struct to give the information for calculating the eigen values. |
-2 | Fail to read the initial vectors or triangular matrix components. |
-1 | Fail to obtain the eigen values with in the \( \verb| Lanczos_max |\) step |
0 | Succeed to calculate the eigen values. |
Definition at line 50 of file Lanczos_EigenValue.c.
References alpha, beta, DefineList::CDataFileHead, cFileNameLanczosStep, cFileNameTimeKeep, BindStruct::Check, childfopenMPI(), cLanczos_EigenValueFinish, cLanczos_EigenValueStart, cLanczos_EigenValueStep, cLogLanczos_EigenValueEnd, cLogLanczos_EigenValueNotConverged, cLogLanczos_EigenValueStart, D_FileNameMax, BindStruct::Def, DSEVvalue(), eps_Lanczos, CheckList::idim_max, DefineList::iReStart, LargeList::itr, DefineList::k_exct, DefineList::Lanczos_max, DefineList::Lanczos_restart, DefineList::LanczosTarget, BindStruct::Large, mfint, mltply(), DefineList::NsiteMPI, OutputLanczosVector(), OutputTMComponents(), BindStruct::Phys, LargeList::prdct, ReadInitialVector(), ReadTMComponents(), SetInitialVector(), StartTimer(), stdoutMPI, StopTimer(), SumMPI_dc(), SumMPI_li(), PhysList::Target_CG_energy, PhysList::Target_energy, TimeKeeper(), TimeKeeperWithStep(), TRUE, v0, v1, and vec12().
Referenced by CalcByLanczos().
int Lanczos_GetTridiagonalMatrixComponents | ( | struct BindStruct * | X, |
double * | _alpha, | ||
double * | _beta, | ||
double complex * | tmp_v1, | ||
unsigned long int * | liLanczos_step | ||
) |
Calculate tridiagonal matrix components by Lanczos method.
X | [in] Struct to give the information to calculate triangular matrix components. |
_alpha | [in,out] Triangular matrix components. |
_beta | [in,out] Triangular matrix components. |
tmp_v1 | [in, out] A temporary vector to calculate triangular matrix components. |
liLanczos_step | [in] The max iteration step. |
Definition at line 324 of file Lanczos_EigenValue.c.
References alpha, beta, c_Lanczos_SpectrumStep, DefineList::CDataFileHead, cFileNameLanczosStep, cFileNameTimeKeep, BindStruct::Check, D_FileNameMax, BindStruct::Def, CheckList::idim_max, DefineList::Lanczos_restart, BindStruct::Large, mltply(), LargeList::prdct, stdoutMPI, SumMPI_dc(), SumMPI_li(), TimeKeeperWithStep(), TRUE, v0, and v1.
Referenced by CalcSpectrumByTPQ().
int OutputLanczosVector | ( | struct BindStruct * | X, |
double complex * | tmp_v0, | ||
double complex * | tmp_v1, | ||
unsigned long int | liLanczosStp_vec | ||
) |
Output initial vectors for the restart calculation.
X | [in] Give the dimension for the vector _v0 and _v1. |
tmp_v0 | [in] The outputted vector for recalculation \( v_0 \). |
tmp_v1 | [in] The outputted vector for recalculation \( v_1 \). |
liLanczosStp_vec | [in] The step for finishing the iteration. |
-1 | Fail to output the vector. |
0 | Succeed to output the vector. |
Definition at line 466 of file Lanczos_EigenValue.c.
References c_OutputSpectrumRecalcvecEnd, c_OutputSpectrumRecalcvecStart, DefineList::CDataFileHead, cFileNameOutputRestartVec, cFileNameTimeKeep, BindStruct::Check, childfopenALL(), D_FileNameMax, BindStruct::Def, CheckList::idim_max, myrank, stdoutMPI, and TimeKeeper().
Referenced by Lanczos_EigenValue().
int OutputTMComponents | ( | struct BindStruct * | X, |
double * | _alpha, | ||
double * | _beta, | ||
double | _dnorm, | ||
int | liLanczosStp | ||
) |
Output tridiagonal matrix components obtained by the Lanczos method.
X | [in] Give the input file name. |
_alpha | [in] The array of tridiagonal matrix components. |
_beta | [in] The array of tridiagonal matrix components. |
_dnorm | [in] The norm. |
liLanczosStp | [in] The iteration step. |
FALSE | Fail to open the file for the output. |
TRUE | Succeed to open the file for the output. |
Definition at line 697 of file Lanczos_EigenValue.c.
References DefineList::CDataFileHead, cFileNameTridiagonalMatrixComponents, childfopenMPI(), D_FileNameMax, BindStruct::Def, FALSE, and TRUE.
Referenced by CalcSpectrumByTPQ(), and Lanczos_EigenValue().
int ReadInitialVector | ( | struct BindStruct * | X, |
double complex * | _v0, | ||
double complex * | _v1, | ||
unsigned long int * | liLanczosStp_vec | ||
) |
Read initial vectors for the restart calculation.
X | [in] Give the dimension for the vector _v0 and _v1. |
_v0 | [out] The inputted vector for recalculation \( v_0 \). |
_v1 | [out] The inputted vector for recalculation \( v_1 \). |
liLanczosStp_vec | [in] The max iteration step. |
-1 | Fail to read the initial vector. |
0 | Succeed to read the initial vector. |
Definition at line 428 of file Lanczos_EigenValue.c.
References c_InputSpectrumRecalcvecEnd, c_InputSpectrumRecalcvecStart, DefineList::CDataFileHead, cFileNameOutputRestartVec, cFileNameTimeKeep, BindStruct::Check, childfopenALL(), D_FileNameMax, BindStruct::Def, CheckList::idim_max, myrank, stdoutMPI, and TimeKeeper().
Referenced by Lanczos_EigenValue().
int ReadTMComponents | ( | struct BindStruct * | X, |
double * | _dnorm, | ||
unsigned long int * | _i_max, | ||
int | iFlg | ||
) |
Read tridiagonal matrix components obtained by the Lanczos method.
.
X | [in] Give the iteration number for the recalculation and the input file name. |
_dnorm | [out] Get the norm. |
_i_max | [in] The iteration step for the input data. |
iFlg | [in] Flag for the recalculation. |
FALSE | Fail to read the file. |
TRUE | Succeed to read the file. |
Definition at line 624 of file Lanczos_EigenValue.c.
References alpha, beta, DefineList::CDataFileHead, cFileNameTridiagonalMatrixComponents, childfopenMPI(), D_FileNameMax, BindStruct::Def, FALSE, fgetsMPI(), DefineList::Lanczos_max, DefineList::LanczosTarget, DefineList::nvec, TRUE, and vec.
Referenced by CalcSpectrumByTPQ(), and Lanczos_EigenValue().
void SetInitialVector | ( | struct BindStruct * | X, |
double complex * | tmp_v0, | ||
double complex * | tmp_v1 | ||
) |
Set initial vector to start the calculation for Lanczos method.
.
X | [in, out] Get the information of reading initisl vectors. Input: idim_max, iFlgMPI, k_exct, iInitialVecType. Output: Large.iv. |
tmp_v0 | [out] The initial vector whose components are zero. |
tmp_v1 | [out] The initial vector whose components are randomly given when initial_mode=1, otherwise, iv-th component is only given. |
Definition at line 499 of file Lanczos_EigenValue.c.
References BcastMPI_li(), BindStruct::Check, BindStruct::Def, CheckList::idim_max, DefineList::iFlgMPI, DefineList::iInitialVecType, DefineList::initial_iv, initial_mode, LargeList::iv, DefineList::k_exct, BindStruct::Large, myrank, nproc, nthreads, stdoutMPI, SumMPI_dc(), and SumMPI_li().
Referenced by Lanczos_EigenValue().