Functions to Diagonalize a tri-diagonal matrix and store eigenvectors into vec.
More...
#include "matrixlapack.h"
#include "Common.h"
#include "wrapperMPI.h"
#include "common/setmemory.h"
#include "xsetmem.h"
Go to the source code of this file.
Functions to Diagonalize a tri-diagonal matrix and store eigenvectors into vec.
Definition in file vec12.c.
◆ vec12()
void vec12 |
( |
double |
alpha[], |
|
|
double |
beta[], |
|
|
unsigned int |
ndim, |
|
|
double |
tmp_E[], |
|
|
struct BindStruct * |
X |
|
) |
| |
Diagonalize a tri-diagonal matrix and store eigenvectors into vec.
- Author
- Takahiro Misawa (The University of Tokyo)
-
Youhei Yamaji (The University of Tokyo)
Definition at line 31 of file vec12.c.
References BindStruct::Def, DSEVvector(), DefineList::iCalcType, DefineList::iFlgCalcSpec, DefineList::LanczosTarget, DefineList::nvec, stdoutMPI, and vec.
Referenced by CalcSpectrumByTPQ(), and Lanczos_EigenValue().
38 unsigned int j,k,
nvec;
40 double **tmpA, **tmpvec;
44 tmpA = d_2d_allocate(ndim, ndim);
45 tmpvec = d_2d_allocate(ndim, ndim);
46 tmpr = d_1d_allocate(ndim);
48 #pragma omp parallel for default(none) firstprivate(ndim) private(j,k) shared(tmpA) 49 for(k=0;k<=ndim-1;k++)
50 for(j=0;j<=ndim-1;j++) tmpA[k][j]=0.0;
51 #pragma omp parallel for default(none) firstprivate(ndim, nvec) private(j,k) shared(vec) 53 for(j=1;j<=ndim;j++)
vec[k][j]=0.0;
55 #pragma omp parallel for default(none) firstprivate(ndim, alpha, beta) private(j) shared(tmpA) 56 for(j=0;j<=ndim-2;j++){
57 tmpA[j][j]=
alpha[j+1];
58 tmpA[j][j+1]=
beta[j+1];
59 tmpA[j+1][j]=
beta[j+1];
61 tmpA[ndim-1][ndim-1]=
alpha[ndim];
65 fprintf(
stdoutMPI,
" Lanczos EigenValue in vec12 = %.10lf \n ",tmpr[0]);
70 #pragma omp parallel for default(none) firstprivate(ndim, nvec) private(j,k) shared(tmpvec, vec, tmp_E, tmpr) 73 for (j = 1; j <= ndim; j++)
vec[k][j] = tmpvec[k - 1][j - 1];
77 #pragma omp parallel for default(none) firstprivate(ndim, nvec) private(j,k) shared(tmpvec, vec, tmp_E, tmpr) 80 for (j = 1; j <= ndim; j++)
vec[k][j] = tmpvec[k - 1][j - 1];
83 free_d_2d_allocate(tmpA);
84 free_d_1d_allocate(tmpr);
85 free_d_2d_allocate(tmpvec);
struct DefineList Def
Definision of system (Hamiltonian) etc.
unsigned int nvec
Read from Calcmod in readdef.h.
int DSEVvector(int xNsize, double **A, double *r, double **vec)
obtain eigenvalues and eigenvectors of real symmetric A
int LanczosTarget
Which eigenstate is used to check convergence. Read from Calcmod in readdef.h.
int iFlgCalcSpec
Input parameter CalcSpec in teh CalcMod file.
int iCalcType
Switch for calculation type. 0:Lanczos, 1:TPQCalc, 2:FullDiag.
FILE * stdoutMPI
File pointer to the standard output defined in InitializeMPI()