16 #include "CalcSpectrumByLanczos.h" 17 #include "Lanczos_EigenValue.h" 19 #include "wrapperMPI.h" 20 #include "common/setmemory.h" 45 double complex *tmp_v1,
48 double complex *dcSpectrum,
49 double complex *dcomega
55 unsigned long int liLanczosStp_vec=0;
85 fprintf(
stdoutMPI,
" Error: Fail to read TMcomponents\n");
94 if(liLanczosStp_vec !=liLanczosStp){
95 fprintf(
stdoutMPI,
" Error: Input files for vector and TMcomponents are incoorect.\n");
96 fprintf(
stdoutMPI,
" Error: Input vector %ld th stps, TMcomponents %ld th stps.\n", liLanczosStp_vec, liLanczosStp);
112 fprintf(
stdoutMPI,
" Start: Calculate tridiagonal matrix components.\n");
122 fprintf(
stdoutMPI,
" End: Calculate tridiagonal matrix components.\n\n");
129 fprintf(
stdoutMPI,
" Start: Caclulate spectrum from tridiagonal matrix components.\n");
132 for( i = 0 ; i < Nomega; i++) {
139 dcSpectrum[i] = dnorm * dcSpectrum[i];
142 fprintf(
stdoutMPI,
" End: Caclulate spectrum from tridiagonal matrix components.\n\n");
173 double complex dcomega,
174 double complex *dcSpectrum,
175 unsigned long int ilLanczosStp
178 unsigned long int istp=2;
181 double complex dcbn, dcan;
182 double complex dcDeltahn;
185 if(ilLanczosStp < 1){
186 fprintf(
stdoutMPI,
"Error: LanczosStep must be greater than 1.\n");
190 dcb0 = dcomega-tmp_alpha[1];
191 if(ilLanczosStp ==1) {
195 *dcSpectrum = dnorm / (dcb0);
199 dcbn = dcomega-tmp_alpha[2];
200 dcan = -pow(tmp_beta[1],2);
202 dcDeltahn = dcan*dcDn;
205 for(istp=2; istp<=ilLanczosStp; istp++){
206 dcbn = dcomega-tmp_alpha[istp+1];
207 dcan =-pow(tmp_beta[istp],2);
208 dcDn = (dcbn+dcan*dcDn);
213 dcDeltahn = (dcbn*dcDn-1.0)*dcDeltahn;
215 if(cabs(dcDeltahn/dch)<cabs(dcb0)*
eps)
break;
217 *dcSpectrum = dnorm/(dch);
void exitMPI(int errorcode)
MPI Abortation wrapper.
struct DefineList Def
Definision of system (Hamiltonian) etc.
void StartTimer(int n)
function for initializing elapse time [start]
void StopTimer(int n)
function for calculating elapse time [elapse time=StartTimer-StopTimer]
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.
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.
int CalcSpectrumByLanczos(struct EDMainCalStruct *X, double complex *tmp_v1, double dnorm, int Nomega, double complex *dcSpectrum, double complex *dcomega)
A main function to calculate spectrum by continued fraction expansions.
int Lanczos_restart
Number of iterations performed in the restart computation.
const char * c_GetTridiagonalStart
const char * c_CalcSpectrumFromTridiagonalEnd
int ReadInitialVector(struct BindStruct *X, double complex *_v0, double complex *_v1, unsigned long int *liLanczosStp_vec)
Read initial vectors for the restart calculation.
const char * cFileNameTimeKeep
int OutputTMComponents(struct BindStruct *X, double *_alpha, double *_beta, double _dnorm, int liLanczosStp)
Output tridiagonal matrix components obtained by the Lanczos method.
int GetSpectrumByTridiagonalMatrixComponents(double *tmp_alpha, double *tmp_beta, double dnorm, double complex dcomega, double complex *dcSpectrum, unsigned long int ilLanczosStp)
Calculate the spectrum by using tridiagonal matrix components obtained by the Lanczos_GetTridiagonalM...
int iFlgCalcSpec
Input parameter CalcSpec in teh CalcMod file.
const char * c_CalcSpectrumFromTridiagonalStart
const char * c_GetTridiagonalEnd
int ReadTMComponents(struct BindStruct *X, double *_dnorm, unsigned long int *_i_max, int iFlg)
Read tridiagonal matrix components obtained by the Lanczos method. .
struct BindStruct Bind
Binded struct.
int TimeKeeper(struct BindStruct *X, const char *cFileName, const char *cTimeKeeper_Message, const char *cWriteType)
Functions for writing a time log.
unsigned int Lanczos_max
Maximum number of iterations.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()