IPCC  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CLanczosMethod Class Reference

This class for doing Lanczos method. More...

#include "LanczosMethod.h"

Collaboration diagram for CLanczosMethod:
Collaboration graph

Classes

struct  EIGENVALUE_RESULT
 Structure for engienvalue computing. More...
 
struct  RESULT_SORT_DATA
 Structure for eigenvalue result sorting. More...
 

Public Types

typedef struct
CLanczosMethod::EIGENVALUE_RESULT
LPEIGENVALUE_RESULT
 
typedef struct
CLanczosMethod::RESULT_SORT_DATA
LPRESULT_SORT_DATA
 

Public Member Functions

 CLanczosMethod ()
 Constructor. More...
 
 ~CLanczosMethod ()
 Destructor. More...
 
LPEIGENVALUE_RESULT DoLanczosMethod (CMatrixOperation::CCSR *pAMatrix, unsigned int nIterationCount, unsigned int nEigenValueCheckInterval, unsigned int nEigenValueCount, double fEigenvalueMin, double fEignevalueMax, double fConvergenceTolerance, bool bReorthogonalization, bool bCalcuEigVector, bool bWaveFunction, double load_in_MIC, CMatrixOperation::CCSR *pmylocalblock=NULL, CMatrixOperation::CCSR *leftlocalblock=NULL, CMatrixOperation::CCSR *rightlocalblock=NULL)
 Doing lanczos method. More...
 
void SetLBIndex (int nLBIndex)
 
int GetLBIndex ()
 
void SortSolution (LPEIGENVALUE_RESULT lpResult)
 Sorting computing eigenvalue. More...
 
void MergeDegeneratedEigenvalues (CLanczosMethod::LPEIGENVALUE_RESULT lpResult, unsigned int nFindingDegeneratedEVCount, CMatrixOperation::CCSR *pA, CMatrixOperation::CCSR *pLocalBlock, CMatrixOperation::CCSR *pLeftBlock, CMatrixOperation::CCSR *pRightBlock)
 Merging eigenvalue into mater group. More...
 
void RecalcuWaveFunction (CLanczosMethod::LPEIGENVALUE_RESULT lpResult)
 Recalculating wavefunction after merging degenerated eigenvalues. More...
 

Static Public Member Functions

static void SaveLanczosResult (CLanczosMethod::LPEIGENVALUE_RESULT lpResult, bool bCalcuEigenvalue, bool bWaveFunction, double *pKValue, int nRepeatCount)
 Saving Lanczos computation result into file. More...
 
static void ShowLanczosResult (CLanczosMethod::LPEIGENVALUE_RESULT lpResult, bool bCalculateEigenVectors, bool bCalculateWaveFunction, double *pKValue, int nRepeatCount)
 Showing calculating result into screen. More...
 
static void ShowLanczosWorkingTime ()
 Showing operation time into screen. More...
 
static void ReleaseResult (LPEIGENVALUE_RESULT lpResult, bool bReleaseStruct)
 Release memory for lanczos method result. More...
 
static void StopIteration ()
 Stop lanczos iteration on going state. More...
 
static bool IsAbort ()
 
static void AppendEigenValue (LPEIGENVALUE_RESULT lpResult, double fEigenValue, unsigned int nFindIteration=DEGENERATED_INDEX, bool bInsertFirst=false)
 Checking is aborting computation flag. More...
 
static void AppendEigenVector (LPEIGENVALUE_RESULT lpResult, CMatrixOperation::CVector *pEigenVector, bool bInsertFirst=false)
 Appending eigenvector into master group if degenerated eigenvalue is finded. More...
 
static bool CheckingCalculationCondition (bool bCalcuEigenValue, bool bCalcuWaveFunction, unsigned int nDeflationGroup)
 Checking pre conditions for Lanczos method operation. More...
 
static int ResultCompare (const void *pA, const void *pB)
 Comparing computing result function for quick sorting. More...
 

Private Member Functions

void InitLanczosVector ()
 Init lanczos vectors. More...
 
void FinalLanczosVector ()
 Deallocating lanczos vectors. More...
 
void InitLanczosIterationVariables (CComplex **pAlpha, double **pAlphaReal, double **pBeta, double **pWj, double **pWjm1, double **pWjp1, CMatrixOperation::CVector **pW)
 Init omega, alpha, beta array. More...
 
void FinalizeLanczosInterationVariable (CComplex *pAlpha, double *pAlphaReal, double *pBeta, double *pWj, double *pWjm1, double *pWjp1, CMatrixOperation::CVector *pW)
 Deallocating omega, alpha, beta. More...
 
LPEIGENVALUE_RESULT LanczosIteration ()
 Doing lanczos basic iteration. More...
 
void LanczosIterationLoop (LPEIGENVALUE_RESULT lpResult, CMatrixOperation::CVector *V1, unsigned int nIterationCount, CComplex *pAlpha, double *pAlphaReal, double *pBeta, double *pWj, double *pWjm1, double *pWjp1, bool bMakeEigvVector=false)
 Doing lanczos basic iteration. More...
 
bool CheckAndDoSelectiveReorthogonalization (int nIterationCount, double *pAlpha, double *pBeta, double *pWj, double *pWjm1, double *pWjp1, double fANorm)
 Check current state need selective reorthogonalization and do it. More...
 
void CalculateEigenVector (LPEIGENVALUE_RESULT lpResult, CMatrixOperation::CVector V, unsigned int nIterationIndex)
 Calculate Eigen vector of A Matrix. More...
 
void DoSelectiveReorthogonalization (unsigned int nIterationCount)
 Do selective reorthogonalization. More...
 
bool DoEigenValueSolving (int nIterationCount, double *pAlpha, double *pBeta, double fANorm, LPEIGENVALUE_RESULT lpResult, bool bFinal)
 Every user set iteration count calculate eigenvalues. More...
 
int EigenValueSolver (unsigned int nIterationCount, double *pAlpha, double *pBeta, double *pEigenValues, double *pEigenVectors)
 EigenValue Solving. More...
 
int ConvergenceChecking (int nEigenValueCount, double *pEigenValues, double *pEiegnVectors, double *pConvergedEigenValues, double *pConvergedEigenVectors, double fANorm, double *pBeta, int nIterationCount)
 Checking convergence criteria. More...
 
int ConvergenceCheckingEx (int nEigenValueCount, double *pEigenValues, double *pEiegnVectors, bool *pbValidEigenValue, double fANorm, double *pBeta, int nIterationCount)
 Checking convergence criteria. More...
 
int RangeChecking (int nEigenValueCount, double *pEigenValues, double *pEiegnVectors, double *pRangeCheckingEigenValues, double *pRangeCheckingVectors, int nIterationCount)
 Checking eigenvalue range. More...
 
int SpuriousRitzValueChecking (int nEigenValueCount, double *pEigenValues, double *pEigenVectors, double *pNonSpuriousValues, double *pNonSpuriousVectors, double fANorm, int nIterationCount)
 Checking spurious values. More...
 
int DistinguishClusterOfEigenvalue (int nEigenValueCount, double *pEigenValues, double *pEigenVectors, double *pNonClustersValues, double *pNonClustersVectors, int nIterationCount)
 Distinguish clusters values. More...
 
int DistinguishClusterOfEigenvalueEx (int nEigenValueCount, double *pEigenValues, double *pEigenVectors, bool *pbValidEigenValues, int nIterationCount)
 Distinguish clusters values. More...
 
double * BuildTMatrix (unsigned int nOrder, double *pAlpha, double *pBeta)
 Building T matrix for solving eigenvalue. More...
 
void InitVariables ()
 Deallocating member variables. More...
 
void ExtractDoubleValues (double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
 Extract value by condition that described in filter. More...
 
void ExtractDoubleVector (unsigned int nVectorsize, double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
 Extract vectors by condition that described in filter. More...
 
bool InitializeTemporaryArrayAndVector (int nIterationCount)
 Initialize temporary eigenvalue arrays and vectors. More...
 
void FinalizeTemporaryArrayAndVector ()
 Finalize temporary eigenvalue arrays and vectors. More...
 
void IntegrateEigenvalues (int nIterationCount, LPEIGENVALUE_RESULT lpResult, unsigned int nCalculatedEigenValueCount, double *pCalcuResult_Value, double *pCalcuResult_Vector)
 Integrating computing solution during Lanczos method operation. More...
 
void IntegrateEigenvaluesEx (int nIterationCount, LPEIGENVALUE_RESULT lpResult, unsigned int nCalculatedEigenValueCount, unsigned int nCalculatedEigenValueCountBeforeConvergenceCheck, double *pCalcuResult_Value, double *pCalcuResult_Vector, bool *pbValidEigenValue)
 Integrating computing solution during Lanczos method operation. More...
 
void BuildWaveFunction (LPEIGENVALUE_RESULT lpResult)
 Building wavefunction. More...
 
void DoResidualCheck (CMatrixOperation::CCSR *pAMatrix, LPEIGENVALUE_RESULT lpResult)
 Residual checking. More...
 

Private Attributes

CMatrixOperation::CVectorm_pV
 A member variable for saveing lanczos vectors. More...
 
CMatrixOperation::CCSRm_pAMatrix
 A member variable for reference Hemiltonian matrix. More...
 
CMatrixOperation::CCSRm_pAMyLocalBlock
 A member variable for reference Hemiltonian matrix. More...
 
CMatrixOperation::CCSRm_pALeftBlock
 A member variable for reference Hemiltonian matrix. More...
 
CMatrixOperation::CCSRm_pARightBoloc
 A member variable for reference Hemiltonian matrix. More...
 
unsigned int m_nMatrixSize
 A size of Hemiltonian matrix. More...
 
unsigned int m_nIterationCount
 A counts of lanczos interation. More...
 
unsigned int m_nEigenValueCheckInterval
 A interval for checking T matrix eigenvlaue. More...
 
unsigned int m_nEigenValueCount
 A numbers of eigenvlaue that want to calculation. More...
 
double m_fEigenvalueMin
 Minimum range of eigenvalue. More...
 
double m_fEignevalueMax
 Maxinum range of eigenvalue. More...
 
bool m_bReorthogonalization
 Option for doing or not re-orthogonalization. More...
 
bool m_bCalcuEigenvector
 Option for doing or not calculating eigen vector. More...
 
double m_fConvergenceTolerance
 Convergence checking tolerance. More...
 
double * m_pEigenValues
 A temporary eigenvalue array for eig solver. More...
 
double * m_pEigenVectors
 A temporary eigenvector array for eig solver. More...
 
double * m_pConvergedEigenValues
 A temporary eigenvalue array for converged check function. More...
 
double * m_pConvergedEigenVectors
 A temporary eigenvector array for converged check function. More...
 
double * m_pRangeCheckedEigenValues
 A temporary eigenvalue array for range check function. More...
 
double * m_pRangeCheckedEigenVectors
 A temporary eigenvector array for range check function. More...
 
double * m_pNoneSpuriousValues
 A temporary eigenvalue array for spurious value check function. More...
 
double * m_pNoneSpuriousVectors
 A temporary eigenvector array for spurious value check function. More...
 
double * m_pNonClustersValues
 A temporary eigenvalue array for cluster check function. More...
 
double * m_pNonClustersVectors
 A temporary eigenvector array for cluster check function. More...
 
int * m_pRangecheckedIndex
 A temporary index array for range check function. More...
 
int * m_pNonSpuriousValueIndex
 A temporary index array for Spurious check function. More...
 
int * m_pConvergedIndex
 A temporary index array for converged check function. More...
 
int * m_pNonClustersValueIndex
 A temporary index array for cluster check function. More...
 
bool * m_pCheckNonClusterValue
 A temporary check index array for cluster check function. More...
 
double m_floadMIC
 Computing ratio of CPU vs. MIC. More...
 
int m_nLBIndex
 

Static Private Attributes

static bool m_bStop = false
 Determind stop iteration before end of iteration count. More...
 

Detailed Description

This class for doing Lanczos method.

Date
27/May/2014

Definition at line 18 of file LanczosMethod.h.

Member Typedef Documentation

Constructor & Destructor Documentation

CLanczosMethod::CLanczosMethod ( )

Constructor.

Definition at line 31 of file LanczosMethod.cpp.

32 {
33  m_pV = NULL;
34  m_pAMatrix = NULL;
35  m_pAMyLocalBlock = NULL;
36  m_pALeftBlock = NULL;
37  m_pARightBoloc = NULL;
38  m_nMatrixSize = 0;
41  m_fEigenvalueMin = 0;
42  m_fEignevalueMax = 0;
43  m_bReorthogonalization = false;
44  m_bCalcuEigenvector = false;
45  //m_nPrevIterationCount = 0;
46 
47  m_pEigenValues = NULL;
48  m_pEigenVectors = NULL;
53  m_pNoneSpuriousValues = NULL;
55  m_pNonClustersValues = NULL;
56  m_pNonClustersVectors = NULL;
57 
58  m_pRangecheckedIndex = NULL;
60  m_pConvergedIndex = NULL;
63  m_floadMIC = 0.0;
64 }
CMatrixOperation::CCSR * m_pALeftBlock
A member variable for reference Hemiltonian matrix.
unsigned int m_nEigenValueCheckInterval
A interval for checking T matrix eigenvlaue.
double * m_pEigenVectors
A temporary eigenvector array for eig solver.
double * m_pNonClustersVectors
A temporary eigenvector array for cluster check function.
CMatrixOperation::CCSR * m_pARightBoloc
A member variable for reference Hemiltonian matrix.
double * m_pNoneSpuriousVectors
A temporary eigenvector array for spurious value check function.
CMatrixOperation::CVector * m_pV
A member variable for saveing lanczos vectors.
bool m_bCalcuEigenvector
Option for doing or not calculating eigen vector.
double * m_pConvergedEigenValues
A temporary eigenvalue array for converged check function.
double * m_pNoneSpuriousValues
A temporary eigenvalue array for spurious value check function.
CMatrixOperation::CCSR * m_pAMatrix
A member variable for reference Hemiltonian matrix.
int * m_pNonClustersValueIndex
A temporary index array for cluster check function.
unsigned int m_nMatrixSize
A size of Hemiltonian matrix.
double * m_pEigenValues
A temporary eigenvalue array for eig solver.
int * m_pNonSpuriousValueIndex
A temporary index array for Spurious check function.
double m_fEignevalueMax
Maxinum range of eigenvalue.
double m_floadMIC
Computing ratio of CPU vs. MIC.
double * m_pRangeCheckedEigenValues
A temporary eigenvalue array for range check function.
bool m_bReorthogonalization
Option for doing or not re-orthogonalization.
int * m_pRangecheckedIndex
A temporary index array for range check function.
double * m_pConvergedEigenVectors
A temporary eigenvector array for converged check function.
bool * m_pCheckNonClusterValue
A temporary check index array for cluster check function.
double m_fEigenvalueMin
Minimum range of eigenvalue.
double * m_pNonClustersValues
A temporary eigenvalue array for cluster check function.
int * m_pConvergedIndex
A temporary index array for converged check function.
unsigned int m_nIterationCount
A counts of lanczos interation.
CMatrixOperation::CCSR * m_pAMyLocalBlock
A member variable for reference Hemiltonian matrix.
double * m_pRangeCheckedEigenVectors
A temporary eigenvector array for range check function.
CLanczosMethod::~CLanczosMethod ( )

Destructor.

Definition at line 66 of file LanczosMethod.cpp.

67 {
69 }
void FinalizeTemporaryArrayAndVector()
Finalize temporary eigenvalue arrays and vectors.

Member Function Documentation

void CLanczosMethod::AppendEigenValue ( LPEIGENVALUE_RESULT  lpResult,
double  fEigenValue,
unsigned int  nFindIteration = DEGENERATED_INDEX,
bool  bInsertFirst = false 
)
static

Checking is aborting computation flag.

Appending eigenvalue into master group if degenerated eigenvalue is finded

Parameters
lpResultStrcuture that include eigen values and eigen vectors
fEigenValueNew eigenvalue that has degeneracy
nFindIterationIteration number that degenerated eigenvalue finding
bInsertFirstInserting new eigenvalue at front of list

Definition at line 1972 of file LanczosMethod.cpp.

References CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, and CLanczosMethod::EIGENVALUE_RESULT::pEigenValues.

1973 {
1974  int i;
1975 
1976  lpResult->nEigenValueCount++;
1977  lpResult->pEigenValues = (double*)realloc(lpResult->pEigenValues, sizeof(double) * lpResult->nEigenValueCount);
1978  if (bInsertFirst)
1979  {
1980  for( i = lpResult->nEigenValueCount - 1 ; i > 0 ; --i )
1981  lpResult->pEigenValues[i] = lpResult->pEigenValues[i-1];
1982 
1983  lpResult->pEigenValues[0] = fEigenValue;
1984  }
1985  else
1986  lpResult->pEigenValues[lpResult->nEigenValueCount-1] = fEigenValue;
1987 
1988  lpResult->pEigenValueFoundIteration = (unsigned int*)realloc(lpResult->pEigenValueFoundIteration, sizeof(unsigned int)*lpResult->nEigenValueCount);
1989  if (bInsertFirst)
1990  {
1991  for( i = lpResult->nEigenValueCount - 1 ; i > 0 ; --i )
1992  lpResult->pEigenValueFoundIteration[i] = lpResult->pEigenValueFoundIteration[i-1];
1993 
1994  lpResult->pEigenValueFoundIteration[0] = nFindIteration;
1995  }
1996  else
1997  lpResult->pEigenValueFoundIteration[lpResult->nEigenValueCount-1] = nFindIteration;
1998 }
void CLanczosMethod::AppendEigenVector ( LPEIGENVALUE_RESULT  lpResult,
CMatrixOperation::CVector pEigenVector,
bool  bInsertFirst = false 
)
static

Appending eigenvector into master group if degenerated eigenvalue is finded.

Parameters
lpResultStrcuture that include eigen values and eigen vectors
pEigenVectorNew eigenvector that corresponds degenerated eigenvalue
bInsertFirstInserting new eigenvalue at front of list

Definition at line 2005 of file LanczosMethod.cpp.

References CMatrixOperation::CVector::Finalize(), CMatrixOperation::CVector::GetSize(), CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, CLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions, and CMatrixOperation::CVector::SetSize().

2006 {
2007  unsigned int i, nNewIndex;
2009  CMatrixOperation::CVector *pEigenVectorsForAMatrix = new CMatrixOperation::CVector[lpResult->nEigenValueCount];
2011  CMatrixOperation::CVector *pWaveFunctions = NULL;
2012  unsigned int nAdjust = 0;
2013 
2014 
2015  if (bInsertFirst)
2016  nAdjust = 1;
2017 
2019  if( NULL != lpResult->pWaveFunctions )
2020  pWaveFunctions = new CMatrixOperation::CVector[lpResult->nEigenValueCount];
2022 
2023  for( i = 0 + nAdjust; i < lpResult->nEigenValueCount - 1 + nAdjust; ++ i)
2024  {
2025  pEigenVectorsForAMatrix[i].SetSize(lpResult->pEigenVectorsForAMatrix[i-nAdjust].GetSize());
2026  pEigenVectorsForAMatrix[i] = lpResult->pEigenVectorsForAMatrix[i-nAdjust];
2027 
2028  if( NULL != lpResult->pWaveFunctions )
2029  {
2030  pWaveFunctions[i].SetSize(lpResult->pWaveFunctions[i-nAdjust].GetSize());
2031  pWaveFunctions[i] = lpResult->pWaveFunctions[i-nAdjust];
2032 
2033  if (bInsertFirst)
2034  pWaveFunctions[0].SetSize(pEigenVector->GetSize()/10);
2035  else
2036  pWaveFunctions[lpResult->nEigenValueCount-1].SetSize(pEigenVector->GetSize()/10);
2037  }
2038  }
2039 
2040  if (NULL != lpResult->pWaveFunctions)
2041  {
2042  for (i = 0; i < lpResult->nEigenValueCount -1; i++)
2043  lpResult->pWaveFunctions[i].Finalize();
2044 
2045  delete[] lpResult->pWaveFunctions;
2046  lpResult->pWaveFunctions = NULL;
2047  lpResult->pWaveFunctions = pWaveFunctions;
2048  }
2049 
2050  if (NULL != lpResult->pEigenVectorsForAMatrix)
2051  {
2052  for (i = 0; i < lpResult->nEigenValueCount-1; i++)
2053  lpResult->pEigenVectorsForAMatrix[i].Finalize();
2054 
2055  delete[] lpResult->pEigenVectorsForAMatrix;
2056  lpResult->pEigenVectorsForAMatrix = NULL;
2057  lpResult->pEigenVectorsForAMatrix = pEigenVectorsForAMatrix;
2058 
2059  if (bInsertFirst)
2060  nNewIndex = 0;
2061  else
2062  nNewIndex = lpResult->nEigenValueCount-1;
2063 
2064  lpResult->pEigenVectorsForAMatrix[nNewIndex].SetSize(pEigenVector->GetSize());
2065  lpResult->pEigenVectorsForAMatrix[nNewIndex] = *pEigenVector;
2066  }
2067 }
unsigned int GetSize()
Return Vector elements size.
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
This class for describing vector for Lanczos method.
void SetSize(unsigned int nSize)
Set Vector elements size.
void Finalize()
Free allocated memory for vector elements.

Here is the call graph for this function:

double * CLanczosMethod::BuildTMatrix ( unsigned int  nOrder,
double *  pAlpha,
double *  pBeta 
)
private

Building T matrix for solving eigenvalue.

Parameters
nOrderT matrix size
pAlphaAlpha array that are calcuated during lanczos iteration
pBetaBeta array that are calcuated during lanczos iteration

Definition at line 1410 of file LanczosMethod.cpp.

References ERROR_MALLOC, CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), and CTimeMeasurement::MeasurementStart().

1411 {
1413  double *pTMatrix = (double*)malloc(sizeof(double)*nOrder*nOrder);
1415 
1416  unsigned int k;
1417 
1418  if (NULL == pTMatrix)
1419  {
1420  throw ERROR_MALLOC;
1421  return NULL;
1422  }
1423 
1424  memset(pTMatrix, 0, sizeof(double)*nOrder*nOrder);
1425 
1426  for (k = 1; k <= nOrder; k++)
1427  {
1428  pTMatrix[((k - 1) * nOrder) + (k - 1)] = pAlpha[k];
1429  if (k != nOrder)
1430  pTMatrix[(k - 1)*nOrder + k] = pBeta[k + 1];
1431  if (k != 1)
1432  pTMatrix[(k - 1)*nOrder + (k - 2)] = pBeta[k];
1433  }
1434 
1435  return pTMatrix;
1436 }
const unsigned long ERROR_MALLOC
Error code that means error occur during memory allocation.
Definition: Global.h:62
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.

Here is the call graph for this function:

void CLanczosMethod::BuildWaveFunction ( LPEIGENVALUE_RESULT  lpResult)
private

Building wavefunction.

Parameters
lpResultCalculated eigenvalue result

Definition at line 1574 of file LanczosMethod.cpp.

References CComplex::GetAbsolute(), CMatrixOperation::CVector::GetAt(), CMPIManager::GetCurrentLoadBalanceCount(), CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, CLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions, CMatrixOperation::CVector::SetAt(), and CMatrixOperation::CVector::SetSize().

1575 {
1577  return;
1578 
1579  unsigned int i, j, nIndex = 0;
1580  CComplex tempResult, complexNumber;
1581  double fTempResult;
1582 
1584  lpResult->pWaveFunctions = new CMatrixOperation::CVector[lpResult->nEigenValueCount];
1586  for (i = 0; i < lpResult->nEigenValueCount; i++)
1587  {
1588  nIndex = 0;
1589  fTempResult = 0.;
1590  lpResult->pWaveFunctions[i].SetSize(CMPIManager::GetCurrentLoadBalanceCount(m_nLBIndex) / 10);
1592  {
1593  complexNumber = lpResult->pEigenVectorsForAMatrix[i].GetAt(j);
1594  double absoluteValue = complexNumber.GetAbsolute();
1595  fTempResult += (absoluteValue*absoluteValue);
1596  if (9 == j % 10)
1597  {
1598  lpResult->pWaveFunctions[i].SetAt(nIndex++, fTempResult, 0);
1599  fTempResult = 0.;
1600  }
1601  }
1602  }
1603 }
double GetAbsolute()
Get Absolute value of complex number.
Definition: Complex.cpp:23
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static int GetCurrentLoadBalanceCount(int nLBIndex)
Get Current node's rank load balancing number.
Definition: MPIManager.cpp:608
unsigned int m_nMatrixSize
A size of Hemiltonian matrix.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
This class for describing vector for Lanczos method.
This class for complex operation and saving value.
Definition: Complex.h:16

Here is the call graph for this function:

void CLanczosMethod::CalculateEigenVector ( LPEIGENVALUE_RESULT  lpResult,
CMatrixOperation::CVector  V,
unsigned int  nIterationIndex 
)
private

Calculate Eigen vector of A Matrix.

Parameters
lpResult[out]: Calculated eigenvectors, eigenvectors and its count
VVector for calculating eigenvector
nIterationIndexCurrent iteration count index

< Follow eigen value count calculate A Matrix Eigen vector

Definition at line 701 of file LanczosMethod.cpp.

References CMatrixOperation::CVector::GetAt(), CMPIManager::GetCurrentLoadBalanceCount(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectors, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, and CMatrixOperation::CVector::SetAt().

702 {
703  unsigned int i, k, nRepeatCount;
704 
706  for (i = 0; i < lpResult->nEigenValueCount; i++)
707  {
708  if (nIterationIndex > lpResult->pEigenValueFoundIteration[i])
709  continue;
710 
711 #ifdef DISABLE_MPI_ROUTINE
712  nRepeatCount = m_nMatrixSize;
713 #else //DISABLE_MPI_ROUTINE
715 #endif
716 
717  for (k = 0; k < nRepeatCount; k++)
718  {
719  CComplex temp = lpResult->pEigenVectorsForAMatrix[i].GetAt(k);
720  temp = temp + V.GetAt(k) * lpResult->pEigenVectors[i][nIterationIndex - 1];
721  lpResult->pEigenVectorsForAMatrix[i].SetAt(k, temp);
722  }
723  }
724 }
static int GetCurrentLoadBalanceCount(int nLBIndex)
Get Current node's rank load balancing number.
Definition: MPIManager.cpp:608
CComplex GetAt(unsigned int nIndex)
Get element value from specific index.
unsigned int m_nMatrixSize
A size of Hemiltonian matrix.
This class for complex operation and saving value.
Definition: Complex.h:16

Here is the call graph for this function:

bool CLanczosMethod::CheckAndDoSelectiveReorthogonalization ( int  nIterationCount,
double *  pAlpha,
double *  pBeta,
double *  pWj,
double *  pWjm1,
double *  pWjp1,
double  fANorm 
)
private

Check current state need selective reorthogonalization and do it.

Parameters
nIterationCountIteration count until eigenvalue solving
pAlphaAlpha array that are calcuated during lanczos iteration
pBetaBeta array that are calcuated during lanczos iteration
pWjvector for selective reorthogonalization
pWjm1vector for selective reorthogonalization
pWjp1vector for selective reorthogonalization
fANormanorm value
Returns
Do selective reorthogonalization or not

Currently isn't implement.

Definition at line 736 of file LanczosMethod.cpp.

737 {
738  bool bDoSelectiveReorthogonalization = false;
739 
741  return bDoSelectiveReorthogonalization;
742 }
bool CLanczosMethod::CheckingCalculationCondition ( bool  bCalcuEigenValue,
bool  bCalcuWaveFunction,
unsigned int  nDeflationGroup 
)
static

Checking pre conditions for Lanczos method operation.

Parameters
bCalcuEigenValueCalculating eigenvector flag
bCalcuWaveFunctionCalculating wavefunction flag
nDeflationGroupDegenerated eigenvalue group count
Returns
Can compute Lanczos method or not

Definition at line 2504 of file LanczosMethod.cpp.

Referenced by InitEnvironment(), and CTBMS_Solver::Launching_TBMS_Solver().

2505 {
2506  bool bRtn = false;
2507 
2508  if( true == bCalcuWaveFunction )
2509  if( false == bCalcuEigenValue )
2510  return bRtn;
2511 
2512  if( nDeflationGroup > 1 && false == bCalcuEigenValue )
2513  return bRtn;
2514 
2515  bRtn = true;
2516  return bRtn;
2517 }

Here is the caller graph for this function:

int CLanczosMethod::ConvergenceChecking ( int  nEigenValueCount,
double *  pEigenValues,
double *  pEiegnVectors,
double *  pConvergedEigenValues,
double *  pConvergedEigenVectors,
double  fANorm,
double *  pBeta,
int  nIterationCount 
)
private

Checking convergence criteria.

Parameters
nEigenValueCountThe numbers of eigenvalue that was calculated by before processing
pEigenValuesEigenvalues that was calculated by before processing
pEigneVectorsEigenvectors that was calculated by before processing
[out]pConvergedEigenValuesConverged eigenvalues
[out]pConvergedEigenVectorsConverged eigenvectors
fANormanorm value
pBetaBeta array that are calcuated during lanczos iteration
nIterationCountIteration count until eigenvalue solving
Returns
The numbers of converged eigenvalues

Definition at line 1181 of file LanczosMethod.cpp.

References ERROR_MALLOC.

1182 {
1183  if (0 == nEigenValueCount)
1184  return 0;
1185 
1186  if (NULL == pConvergedEigenValues || NULL == pConvergedEigenVectors || NULL == m_pConvergedIndex)
1187  throw ERROR_MALLOC;
1188 
1189  double fTotal = m_fConvergenceTolerance;
1190  double fResidual;
1191  int i, nConvergedCount = 0;
1192 
1193  for (i = 0; i < nEigenValueCount; i++)
1194  {
1195  fResidual = fabs(pBeta[nIterationCount + 1] * pEiegnVectors[i*nIterationCount + nIterationCount - 1]);
1196 
1197  if (fResidual < fTotal)
1198  m_pConvergedIndex[nConvergedCount++] = i;
1199  }
1200 
1201  ExtractDoubleValues(pConvergedEigenValues, pEigenValues, nEigenValueCount, m_pConvergedIndex, nConvergedCount, false);
1202  ExtractDoubleVector(nIterationCount, pConvergedEigenVectors, pEiegnVectors, nEigenValueCount, m_pConvergedIndex, nConvergedCount, false);
1203 
1204  return nConvergedCount;
1205 }
const unsigned long ERROR_MALLOC
Error code that means error occur during memory allocation.
Definition: Global.h:62
double m_fConvergenceTolerance
Convergence checking tolerance.
void ExtractDoubleValues(double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
Extract value by condition that described in filter.
void ExtractDoubleVector(unsigned int nVectorsize, double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
Extract vectors by condition that described in filter.
int * m_pConvergedIndex
A temporary index array for converged check function.
int CLanczosMethod::ConvergenceCheckingEx ( int  nEigenValueCount,
double *  pEigenValues,
double *  pEiegnVectors,
bool *  pbValidEigenValue,
double  fANorm,
double *  pBeta,
int  nIterationCount 
)
private

Checking convergence criteria.

Parameters
nEigenValueCountThe numbers of eigenvalue that was calculated by before processing
pEigenValuesEigenvalues that was calculated by before processing
pEigneVectorsEigenvectors that was calculated by before processing
pbValidEigenValueArray for checking valid eigen value
fANormanorm value
pBetaBeta array that are calcuated during lanczos iteration
nIterationCountIteration count until eigenvalue solving
Returns
The numbers of converged eigenvalues

Definition at line 1144 of file LanczosMethod.cpp.

1145 {
1146  if (0 == nEigenValueCount)
1147  return 0;
1148 
1149  double fTotal = m_fConvergenceTolerance;
1150  double fResidual;
1151  int i, nConvergedCount = nEigenValueCount;
1152 
1153  for (i = 0; i < nEigenValueCount; i++)
1154  {
1155  if (false == pbValidEigenValue[i])
1156  continue;
1157 
1158  fResidual = fabs(pBeta[nIterationCount + 1] * pEiegnVectors[i*nIterationCount + nIterationCount - 1]);
1159 
1160  if (fResidual >= fTotal)
1161  {
1162  pbValidEigenValue[i] = false;
1163  nConvergedCount--;
1164  }
1165  }
1166 
1167  return nConvergedCount;
1168 }
double m_fConvergenceTolerance
Convergence checking tolerance.
int CLanczosMethod::DistinguishClusterOfEigenvalue ( int  nEigenValueCount,
double *  pEigenValues,
double *  pEigenVectors,
double *  pNonClustersValues,
double *  pNonClustersVectors,
int  nIterationCount 
)
private

Distinguish clusters values.

Parameters
nEigenValueCountThe numbers of eigenvalue that was calculated by before processing
pEigenValuesEigenvalues that was calculated by before processing
pEigneVectorsEigenvectors that was calculated by before processing
[out]pNonClustersValuesNon clusters eigenvalues
[out]pNonClustersVectorsNon clusters eigenvectors
nIterationCountIteration count until eigenvalue solving
Returns
The numbers of non clusters eigenvalues

Definition at line 1314 of file LanczosMethod.cpp.

References ERROR_MALLOC.

1315 {
1316  double eps = 1e-8;
1317  int i, j, nNonClustersValue = 0;
1318 
1319  if (0 == nEigenValueCount)
1320  return 0;
1321 
1322  if (NULL == pNonClustersValues || NULL == m_pCheckNonClusterValue || NULL == m_pNonClustersValueIndex)
1323  throw ERROR_MALLOC;
1324 
1325  for (i = 0; i < nEigenValueCount; i++)
1326  m_pCheckNonClusterValue[i] = true;
1327 
1328  for (i = 0; i < nEigenValueCount - 1; i++)
1329  {
1330  if (!m_pCheckNonClusterValue[i])
1331  continue;
1332 
1333  for (j = i + 1; j < nEigenValueCount; j++)
1334  {
1335  if (fabs(pEigenValues[i] - pEigenValues[j]) < eps)
1336  {
1337  m_pCheckNonClusterValue[j] = false;
1338  }
1339  }
1340  }
1341 
1342  for (i = 0; i < nEigenValueCount; i++)
1343  {
1344  if (m_pCheckNonClusterValue[i])
1345  m_pNonClustersValueIndex[nNonClustersValue++] = i;
1346  }
1347 
1348  ExtractDoubleValues(pNonClustersValues, pEigenValues, nEigenValueCount, m_pNonClustersValueIndex, nNonClustersValue, false);
1349  if (NULL != pNonClustersVectors)
1350  ExtractDoubleVector(nIterationCount, pNonClustersVectors, pEigenVectors, nEigenValueCount, m_pNonClustersValueIndex, nNonClustersValue, false);
1351 
1352  return nNonClustersValue;
1353 }
const unsigned long ERROR_MALLOC
Error code that means error occur during memory allocation.
Definition: Global.h:62
int * m_pNonClustersValueIndex
A temporary index array for cluster check function.
bool * m_pCheckNonClusterValue
A temporary check index array for cluster check function.
void ExtractDoubleValues(double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
Extract value by condition that described in filter.
void ExtractDoubleVector(unsigned int nVectorsize, double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
Extract vectors by condition that described in filter.
int CLanczosMethod::DistinguishClusterOfEigenvalueEx ( int  nEigenValueCount,
double *  pEigenValues,
double *  pEigenVectors,
bool *  pbValidEigenValues,
int  nIterationCount 
)
private

Distinguish clusters values.

Parameters
nEigenValueCountThe numbers of eigenvalue that was calculated by before processing
pEigenValuesEigenvalues that was calculated by before processing
pEigneVectorsEigenvectors that was calculated by before processing
pbValidEigenValue: Array for checking valid eigen value
nIterationCountIteration count until eigenvalue solving
Returns
The numbers of non clusters eigenvalues

Definition at line 1276 of file LanczosMethod.cpp.

1277 {
1278  double eps = 1e-8;
1279  int i, j, nNonClustersValue = nEigenValueCount;
1280 
1281  if (0 == nEigenValueCount)
1282  return 0;
1283 
1284  for (i = 0; i < nEigenValueCount - 1; i++)
1285  {
1286  if (!pbValidEigenValues[i])
1287  continue;
1288 
1289  for (j = i + 1; j < nEigenValueCount; j++)
1290  {
1291  if (!pbValidEigenValues[j])
1292  continue;
1293 
1294  if (fabs(pEigenValues[i] - pEigenValues[j]) < eps)
1295  {
1296  pbValidEigenValues[j] = false;
1297  nNonClustersValue--;
1298  }
1299  }
1300  }
1301 
1302  return nNonClustersValue;
1303 }
bool CLanczosMethod::DoEigenValueSolving ( int  nIterationCount,
double *  pAlpha,
double *  pBeta,
double  fANorm,
LPEIGENVALUE_RESULT  lpResult,
bool  bFinal 
)
private

Every user set iteration count calculate eigenvalues.

Parameters
nIterationCountIteration count until eigenvalue solving
pAlphaAlpha array that are calcuated during lanczos iteration
pBetaBeta array that are calcuated during lanczos iteration
fANormanorm value
[out]lpResultCalculated eigenvalues, eigenvectors and its numbers
bFinalIt is or not final iteration
Returns
Computation success or not

< For test inverse iteration

Definition at line 909 of file LanczosMethod.cpp.

References DO_NOT_CONVERGENCE_CHECKING, ERROR_MALLOC, FREE_MEM, inverse_iter(), CMPIManager::IsRootRank(), CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), and CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount.

910 {
911  double *pCalcuResult_Value = NULL;
912  double *pCalcuResult_Vector = NULL;
913  int nConvergedEigenvalueCount = 0;
914  int nRangecheckedEigenvalueCount = 0;
915  int nNonSpuriousRitzValueCount = 0;
916  int nNonClustersValueCount = 0;
917  unsigned int nCalculatedEigenValueCount = 0, nCalculatedEigenValueCountBeforeConvergenceCheck;
918  bool bRtn = false;
919  bool *pValidEigenValue = NULL;
920  unsigned int i;
921 
922  if (NULL == lpResult)
923  throw ERROR_MALLOC;
924 
926  return false;
927 
928  nCalculatedEigenValueCount = EigenValueSolver(nIterationCount, pAlpha, pBeta, m_pEigenValues, m_pEigenVectors);
929  pCalcuResult_Value = m_pEigenValues;
930  pCalcuResult_Vector = m_pEigenVectors;
931  nCalculatedEigenValueCountBeforeConvergenceCheck = nCalculatedEigenValueCount;
932 
935  m_pEigenVectors = (double*)malloc(sizeof(double)*nCalculatedEigenValueCount*nIterationCount);
937  for (i = 0; i < nCalculatedEigenValueCount; ++i)
938  {
940  double *pEigenVector = (double*)malloc(sizeof(double)*nIterationCount);
942 
943  if (NULL == pEigenVector)
944  continue;
945 
946  inverse_iter(pAlpha + 1, pBeta + 2, pEigenVector, nIterationCount, m_pEigenValues[i]);
947  memcpy(m_pEigenVectors + nIterationCount * i, pEigenVector, sizeof(double)*nIterationCount);
948 
949  FREE_MEM(pEigenVector);
950  }
951 
953  pValidEigenValue = (bool*)malloc(sizeof(bool)*nCalculatedEigenValueCount);
955  for (i = 0; i < nCalculatedEigenValueCount; ++i)
956  pValidEigenValue[i] = true;
957 
959  {
960  nCalculatedEigenValueCount = ConvergenceCheckingEx(nCalculatedEigenValueCount, m_pEigenValues, m_pEigenVectors,
961  pValidEigenValue, fANorm, pBeta, nIterationCount);
962  }
963 
964  {
965  nCalculatedEigenValueCount = DistinguishClusterOfEigenvalueEx(nCalculatedEigenValueCount, m_pEigenValues, m_pEigenVectors,
966  pValidEigenValue, nIterationCount);
967  }
968 
969  if (nCalculatedEigenValueCount > 0)
970  {
971  IntegrateEigenvaluesEx(nIterationCount, lpResult, nCalculatedEigenValueCount, nCalculatedEigenValueCountBeforeConvergenceCheck, m_pEigenValues, m_pEigenVectors, pValidEigenValue);
972  }
973 
974  FREE_MEM(pValidEigenValue);
975 
976  if (lpResult->nEigenValueCount >= m_nEigenValueCount || true == bFinal)
977  bRtn = true;
978 
979  return bRtn;
980 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
const unsigned long ERROR_MALLOC
Error code that means error occur during memory allocation.
Definition: Global.h:62
double * m_pEigenVectors
A temporary eigenvector array for eig solver.
double m_fConvergenceTolerance
Convergence checking tolerance.
void inverse_iter(double *alpha, double *beta, double *app_evc, int iter, double app_eva)
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
int ConvergenceCheckingEx(int nEigenValueCount, double *pEigenValues, double *pEiegnVectors, bool *pbValidEigenValue, double fANorm, double *pBeta, int nIterationCount)
Checking convergence criteria.
#define DO_NOT_CONVERGENCE_CHECKING
Convergernece checking option default value.
Definition: Global.h:45
double * m_pEigenValues
A temporary eigenvalue array for eig solver.
int EigenValueSolver(unsigned int nIterationCount, double *pAlpha, double *pBeta, double *pEigenValues, double *pEigenVectors)
EigenValue Solving.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
unsigned int m_nEigenValueCount
A numbers of eigenvlaue that want to calculation.
int DistinguishClusterOfEigenvalueEx(int nEigenValueCount, double *pEigenValues, double *pEigenVectors, bool *pbValidEigenValues, int nIterationCount)
Distinguish clusters values.
void IntegrateEigenvaluesEx(int nIterationCount, LPEIGENVALUE_RESULT lpResult, unsigned int nCalculatedEigenValueCount, unsigned int nCalculatedEigenValueCountBeforeConvergenceCheck, double *pCalcuResult_Value, double *pCalcuResult_Vector, bool *pbValidEigenValue)
Integrating computing solution during Lanczos method operation.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19

Here is the call graph for this function:

CLanczosMethod::LPEIGENVALUE_RESULT CLanczosMethod::DoLanczosMethod ( CMatrixOperation::CCSR pAMatrix,
unsigned int  nIterationCount,
unsigned int  nEigenValueCheckInterval,
unsigned int  nEigenValueCount,
double  fEigenvalueMin,
double  fEignevalueMax,
double  fConvergenceTolerance,
bool  bReorthogonalization,
bool  bCalcuEigVector,
bool  bWaveFunction,
double  load_in_MIC,
CMatrixOperation::CCSR pmylocalblock = NULL,
CMatrixOperation::CCSR leftlocalblock = NULL,
CMatrixOperation::CCSR rightlocalblock = NULL 
)

Doing lanczos method.

Parameters
pAMatrixThe matrix that was wanted to get eigenvalues
nIterationCountLanczos iteration numbers that want to running
nEigenValueCheckIntervalEigen value will be calculated every eigen value check interval * n
nEigenValueCountHow many eigenvalue will be get by this operation
fEigenvalueMinThe minimum value of eigenvalue
fEigenvalueMaxThe maximum value of eigenvalue
bReorthogonalizationDo reorthogonalization or not
bCalcuEigVectorDo calculate eigen vector or not
bWaveFunctionDo calculate wavefunction or not
load_in_MICMIC load number
mylocalblockThe block matrix of my rank
leftlocalblockThe block matrix of left neighbor core
rightlocalblockThe block matrix of right neighbor core
Returns
Calculated eigenvectors, eigenvectors and its count

Definition at line 129 of file LanczosMethod.cpp.

References ERROR_MALLOC, and CMatrixOperation::CCSR::GetColumnCount().

Referenced by CTBMS_Solver::Launching_TBMS_Solver(), CLanczosLaunching::LaunchingLanczos(), and CSPLoop::SolveSchroedinger().

130 {
131  LPEIGENVALUE_RESULT lpRtn = NULL;
132 
133  if (NULL == pAMatrix)
134  {
135  throw ERROR_MALLOC;
136  return NULL;
137  }
138 
139  InitVariables();
140 
141  m_pAMatrix = pAMatrix;
142  m_pAMyLocalBlock = pmylocalblock;
143  m_pALeftBlock = leftlocalblock;
144  m_pARightBoloc = rightlocalblock;
145  m_nMatrixSize = pAMatrix->GetColumnCount();
146  m_nIterationCount = nIterationCount;
147  m_nEigenValueCheckInterval = nEigenValueCheckInterval;
148  m_nEigenValueCount = nEigenValueCount;
149  m_fEigenvalueMin = fEigenvalueMin;
150  m_fEignevalueMax = fEignevalueMax;
151  m_bReorthogonalization = bReorthogonalization;
152  m_bCalcuEigenvector = bCalcuEigVector;
153  m_fConvergenceTolerance = fConvergenceTolerance;
154 
155 #ifdef USE_XEONPHI
156  m_floadMIC = load_in_MIC;
157 #else
158  m_floadMIC = 0;
159 #endif
160 
161  lpRtn = LanczosIteration();
162 
163  if( bCalcuEigVector )
164  DoResidualCheck(pAMatrix, lpRtn);
165 
166  //if (bWaveFunction && CMPIManager::IsRootRank())
167  if (bWaveFunction)
168  BuildWaveFunction(lpRtn);
169 
170  //m_nPrevIterationCount = nIterationCount;
171 
172  return lpRtn;
173 }
CMatrixOperation::CCSR * m_pALeftBlock
A member variable for reference Hemiltonian matrix.
LPEIGENVALUE_RESULT LanczosIteration()
Doing lanczos basic iteration.
unsigned int m_nEigenValueCheckInterval
A interval for checking T matrix eigenvlaue.
const unsigned long ERROR_MALLOC
Error code that means error occur during memory allocation.
Definition: Global.h:62
double m_fConvergenceTolerance
Convergence checking tolerance.
CMatrixOperation::CCSR * m_pARightBoloc
A member variable for reference Hemiltonian matrix.
void BuildWaveFunction(LPEIGENVALUE_RESULT lpResult)
Building wavefunction.
bool m_bCalcuEigenvector
Option for doing or not calculating eigen vector.
CMatrixOperation::CCSR * m_pAMatrix
A member variable for reference Hemiltonian matrix.
unsigned int GetColumnCount()
Getting row size of matrix.
unsigned int m_nMatrixSize
A size of Hemiltonian matrix.
double m_fEignevalueMax
Maxinum range of eigenvalue.
double m_floadMIC
Computing ratio of CPU vs. MIC.
void DoResidualCheck(CMatrixOperation::CCSR *pAMatrix, LPEIGENVALUE_RESULT lpResult)
Residual checking.
bool m_bReorthogonalization
Option for doing or not re-orthogonalization.
unsigned int m_nEigenValueCount
A numbers of eigenvlaue that want to calculation.
struct CLanczosMethod::EIGENVALUE_RESULT * LPEIGENVALUE_RESULT
void InitVariables()
Deallocating member variables.
double m_fEigenvalueMin
Minimum range of eigenvalue.
unsigned int m_nIterationCount
A counts of lanczos interation.
CMatrixOperation::CCSR * m_pAMyLocalBlock
A member variable for reference Hemiltonian matrix.

Here is the call graph for this function:

Here is the caller graph for this function:

void CLanczosMethod::DoResidualCheck ( CMatrixOperation::CCSR pAMatrix,
LPEIGENVALUE_RESULT  lpResult 
)
private

Residual checking.

Parameters
pAMatrixThe matrix that was wanted to get eigenvalues
lpResultCalculated eigenvalue result

Definition at line 1609 of file LanczosMethod.cpp.

References CMPIManager::BroadcastDouble(), CMatrixOperation::CVector::Finalize(), GENERAL_TOLERANCE, CMatrixOperation::CCSR::GetColumnCount(), CMPIManager::GetCurrentLoadBalanceCount(), CMatrixOperation::CVector::GetNorm(), CMPIManager::IsRootRank(), CMatrixOperation::IsSame(), CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CMatrixOperation::CVector::MinusVector(), CTimeMeasurement::MVMUL, CMatrixOperation::MVMul(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, CLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions, CMatrixOperation::CVector::ScalarMultiple(), CMatrixOperation::CVector::SetSize(), and SHOW_SIMPLE_MSG.

1610 {
1611  int i, j;
1612  CMatrixOperation::CVector vectorResult1, vectorResult2;
1613  CComplex result;
1614  double fEigenValue;
1615  double fNorm = 0.0;
1616  std::vector<bool> vectorResidualCheck;
1617  bool bFoundNoAnswer = false;
1618  std::vector<int> vectorResidualAnswer;
1619  int nResidualAnswerCount = 0;
1620 
1621  SHOW_SIMPLE_MSG("-Residual Checking...\n");
1622 
1623 #ifdef DISABLE_MPI_ROUTINE
1624  vectorResult1.SetSize(pAMatrix->GetColumnCount());
1625  vectorResult2.SetSize(pAMatrix->GetColumnCount());
1626 #else //DISABLE_MPI_ROUTINE
1629 #endif //DISABLE_MPI_ROUTINE
1630  for( i = 0 ; i < lpResult->nEigenValueCount ; ++i )
1631  {
1633  CMatrixOperation::MVMul(pAMatrix, &lpResult->pEigenVectorsForAMatrix[i], &vectorResult1, m_nLBIndex);
1635  vectorResult2 = lpResult->pEigenVectorsForAMatrix[i];
1637  fEigenValue = lpResult->pEigenValues[i];
1638  CMPIManager::BroadcastDouble(&fEigenValue, 1);
1639  vectorResult2.ScalarMultiple(fEigenValue);
1640  //CMatrixOperation::VVDot(&vectorResult1, &vectorResult2, &result);
1641  vectorResult1.MinusVector(&vectorResult2);
1642 #ifdef DISABLE_MPI_ROUTINE
1643  fNorm = vectorResult1.GetNorm();
1644 #else //DISABLE_MPI_ROUTINE
1645  fNorm = vectorResult1.GetNorm(true);
1646 #endif //DISABLE_MPI_ROUTINE
1647 
1649  vectorResidualCheck.push_back(true);
1650  else
1651  {
1652  vectorResidualCheck.push_back(false);
1653  bFoundNoAnswer = true;
1654  }
1655  }
1656 
1657  if (!bFoundNoAnswer)
1658  {
1659  vectorResult1.Finalize();
1660  vectorResult2.Finalize();
1661  return;
1662  }
1663 
1664  for( i = 0 ; i < lpResult->nEigenValueCount ; ++ i )
1665  {
1666  if( vectorResidualCheck[i] )
1667  {
1668  vectorResidualAnswer.push_back(i);
1669  nResidualAnswerCount++;
1670  }
1671  }
1672 
1673  for( i = 0 ; i < nResidualAnswerCount; ++ i )
1674  {
1675  if( i == vectorResidualAnswer[i] )
1676  continue;
1677  if( NULL != lpResult->pEigenValues )
1678  lpResult->pEigenValues[i] = lpResult->pEigenValues[vectorResidualAnswer[i]];
1679  lpResult->pEigenValueFoundIteration[i] = lpResult->pEigenValueFoundIteration[vectorResidualAnswer[i]];
1680  lpResult->pEigenVectorsForAMatrix[i] = lpResult->pEigenVectorsForAMatrix[vectorResidualAnswer[i]];
1681 
1682  if( NULL != lpResult->pWaveFunctions )
1683  lpResult->pWaveFunctions[i] = lpResult->pWaveFunctions[vectorResidualAnswer[i]];
1684  }
1685 
1686  lpResult->nEigenValueCount = nResidualAnswerCount;
1687 
1688  vectorResult1.Finalize();
1689  vectorResult2.Finalize();
1690 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
#define GENERAL_TOLERANCE
General tolerance definition.
Definition: Global.h:47
static void MVMul(CCSR *pAMatrix, CVector *pVector, CVector *pResult, int nLBIndex)
Matrix and vector multiple operation.
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static int GetCurrentLoadBalanceCount(int nLBIndex)
Get Current node's rank load balancing number.
Definition: MPIManager.cpp:608
void ScalarMultiple(CComplex Scalar)
Scalar multiple operation.
unsigned int GetColumnCount()
Getting row size of matrix.
static bool IsSame(double operand1, double operand2, double tol)
Compare two double variable.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
This class for describing vector for Lanczos method.
This class for complex operation and saving value.
Definition: Complex.h:16
double GetNorm(bool bMPI=false)
Getting norm of vector.
void MinusVector(CVector *vector)
Do minus operation between vectors.
static void BroadcastDouble(double *pValue, unsigned int nSize, int nRootRank=0, MPI_Comm comm=MPI_COMM_NULL)
Broadcst boolean value.
Definition: MPIManager.cpp:486
void SetSize(unsigned int nSize)
Set Vector elements size.
#define SHOW_SIMPLE_MSG(message)
Definition: Global.h:40
void Finalize()
Free allocated memory for vector elements.

Here is the call graph for this function:

void CLanczosMethod::DoSelectiveReorthogonalization ( unsigned int  nIterationCount)
private

Do selective reorthogonalization.

Parameters
nIterationCountIteration count until eigenvalue solving

Currently isn't implement.

Definition at line 747 of file LanczosMethod.cpp.

748 {
750  return;
751 }
int CLanczosMethod::EigenValueSolver ( unsigned int  nIterationCount,
double *  pAlpha,
double *  pBeta,
double *  pEigenValues,
double *  pEigenVectors 
)
private

EigenValue Solving.

Parameters
nIterationCountIteration count until eigenvalue solving
pAlphaAlpha array that are calcuated during lanczos iteration
pBetaBeta array that are calcuated during lanczos iteration
[out]pEigenValuesCalculated eigenvalue will be stored.
[out]pEigenVectorsCalculated eigenvectors will be stored.
Returns
The numbers of calculated eigenvalues

< Only for dstebz_

For finding optimized lwork value calling dsyevx function using lwork set -1

Definition at line 1364 of file LanczosMethod.cpp.

References CTimeMeasurement::EVALUE_FREE_MEM, CTimeMeasurement::EVALUE_MALLOC, FREE_MEM, CTimeMeasurement::MeasurementEnd(), and CTimeMeasurement::MeasurementStart().

1365 {
1366  MKL_INT n, lda, ldz, il, iu, lwork;
1367  MKL_INT nFoundEigenValueCount;
1368  MKL_INT info;
1369  double vl, vu;
1370  double abstol = 1.0e-8;
1371  double *work;
1373  //MKL_INT *iwork = (MKL_INT*)malloc(sizeof(MKL_INT)* 5 * nIterationCount);
1374  MKL_INT *iwork = (MKL_INT*)malloc(sizeof(MKL_INT)* 10 * nIterationCount);
1375  MKL_INT *ifail = (MKL_INT*)malloc(sizeof(MKL_INT)* nIterationCount);
1377  int nsplit = 0; /* number of diagonal blocks in matrix */
1378  int *iblock = (int *)malloc(sizeof(int)*nIterationCount);
1379  int *isplit = (int *)malloc(sizeof(int)*nIterationCount);
1380 
1381  //work = (double*)malloc(sizeof(double)*nIterationCount*4);
1382  work = (double*)malloc(sizeof(double)*nIterationCount * 10);
1384  n = ldz = lda = nIterationCount;
1385  il = 1;
1386  iu = nIterationCount;
1387  vl = m_fEigenvalueMin;
1388  vu = m_fEignevalueMax;
1389 
1391  lwork = -1;
1392  dstebz("V", "E", &n, &vl, &vu, &il, &iu, &abstol, pAlpha + 1, pBeta + 2, &nFoundEigenValueCount, &nsplit, pEigenValues, iblock, isplit, work, iwork, &info);
1393 
1395  FREE_MEM(iwork);
1396  FREE_MEM(work);
1397  FREE_MEM(ifail);
1398  FREE_MEM(iblock);
1399  FREE_MEM(isplit);
1401 
1402  return nFoundEigenValueCount;
1403 }
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
double m_fEignevalueMax
Maxinum range of eigenvalue.
double m_fEigenvalueMin
Minimum range of eigenvalue.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19

Here is the call graph for this function:

void CLanczosMethod::ExtractDoubleValues ( double *  pTarget,
double *  pSource,
unsigned int  nSrcCount,
int *  pFilter,
unsigned int  nFilterCount,
bool  bExclusive 
)
private

Extract value by condition that described in filter.

Parameters
[out]pTargetTarget buffer that save extracted values
pSourceSource buffer that has original values
nSrcCountSource buffer size
pFilterBuffer that have extract condition information(index data)
nFilterCountCondition buffer size
bExclusiveUsing filter for exclusive or not

Definition at line 1465 of file LanczosMethod.cpp.

1466 {
1467  unsigned int i;
1468 
1469  if (bExclusive)
1470  {
1471  int nSrcIndex = 0;
1472  int nTargetIndex = 0;
1473  for (i = 0; i < nSrcCount; i++)
1474  {
1475  if (i != pFilter[nSrcIndex])
1476  pTarget[nTargetIndex++] = pSource[i];
1477  else
1478  nSrcIndex++;
1479  }
1480  }
1481  else
1482  {
1483  for (i = 0; i < nFilterCount; i++)
1484  pTarget[i] = pSource[pFilter[i]];
1485  }
1486 }
void CLanczosMethod::ExtractDoubleVector ( unsigned int  nVectorsize,
double *  pTarget,
double *  pSource,
unsigned int  nSrcCount,
int *  pFilter,
unsigned int  nFilterCount,
bool  bExclusive 
)
private

Extract vectors by condition that described in filter.

Parameters
nVectorsizeHanding vector size
[out]pTargetTarget buffer that save extracted vectors
pSourceSource buffer that has original vectors
nSrcCountSource buffer size
pFilterBuffer that have extract condition information(index data)
nFilterCountCondition buffer size
bExclusiveUsing filter for exclusive or not

Definition at line 1497 of file LanczosMethod.cpp.

1498 {
1499  unsigned int i;
1500 
1501  if (bExclusive)
1502  {
1503  int nSrcIndex = 0;
1504  int nTargetIndex = 0;
1505  for (i = 0; i < nSrcCount; i++)
1506  {
1507  if (i != pFilter[nSrcIndex])
1508  memcpy(pTarget + (nTargetIndex*nVectorsize), pSource + (i * nVectorsize), sizeof(double)* nVectorsize);
1509  else
1510  nSrcIndex++;
1511  }
1512  }
1513  else
1514  {
1515  for (i = 0; i < nFilterCount; i++)
1516  memcpy(pTarget + (i*nVectorsize), pSource + (pFilter[i] * nVectorsize), sizeof(double)* nVectorsize);
1517  }
1518 }
void CLanczosMethod::FinalizeLanczosInterationVariable ( CComplex pAlpha,
double *  pAlphaReal,
double *  pBeta,
double *  pWj,
double *  pWjm1,
double *  pWjp1,
CMatrixOperation::CVector pW 
)
private

Deallocating omega, alpha, beta.

Parameters
pAlphaAlpha array double pointer that deallocating memory
pBetaBeta array double pointer that deallocating memory
pWjvector for selective reorthogonalization
pWjm1vector for selective reorthogonalization
pWjp1vector for selective reorthogonalization
pWOmega array double pointer that deallocating memory

Definition at line 673 of file LanczosMethod.cpp.

References FREE_MEM, CTimeMeasurement::FREE_MEM, CMPIManager::IsRootRank(), CTimeMeasurement::MeasurementEnd(), and CTimeMeasurement::MeasurementStart().

674 {
677  {
678  FREE_MEM(pWj);
679  FREE_MEM(pWjm1);
680  FREE_MEM(pWjp1);
681  }
682 
683  delete[] pAlpha;
684  pAlpha = NULL;
685 
686  free(pAlphaReal);
687  pAlphaReal = NULL;
688 
689  free(pBeta);
690  pBeta = NULL;
692 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
bool m_bReorthogonalization
Option for doing or not re-orthogonalization.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19

Here is the call graph for this function:

void CLanczosMethod::FinalizeTemporaryArrayAndVector ( )
private

Finalize temporary eigenvalue arrays and vectors.

Definition at line 94 of file LanczosMethod.cpp.

References FREE_MEM.

95 {
111 }
double * m_pEigenVectors
A temporary eigenvector array for eig solver.
double * m_pNonClustersVectors
A temporary eigenvector array for cluster check function.
double * m_pNoneSpuriousVectors
A temporary eigenvector array for spurious value check function.
double * m_pConvergedEigenValues
A temporary eigenvalue array for converged check function.
double * m_pNoneSpuriousValues
A temporary eigenvalue array for spurious value check function.
int * m_pNonClustersValueIndex
A temporary index array for cluster check function.
double * m_pEigenValues
A temporary eigenvalue array for eig solver.
int * m_pNonSpuriousValueIndex
A temporary index array for Spurious check function.
double * m_pRangeCheckedEigenValues
A temporary eigenvalue array for range check function.
int * m_pRangecheckedIndex
A temporary index array for range check function.
double * m_pConvergedEigenVectors
A temporary eigenvector array for converged check function.
bool * m_pCheckNonClusterValue
A temporary check index array for cluster check function.
double * m_pNonClustersValues
A temporary eigenvalue array for cluster check function.
int * m_pConvergedIndex
A temporary index array for converged check function.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19
double * m_pRangeCheckedEigenVectors
A temporary eigenvector array for range check function.
void CLanczosMethod::FinalLanczosVector ( )
private

Deallocating lanczos vectors.

Definition at line 623 of file LanczosMethod.cpp.

References CTimeMeasurement::FREE_MEM, CTimeMeasurement::MeasurementEnd(), and CTimeMeasurement::MeasurementStart().

624 {
625  unsigned int i;
626  if (false == m_bReorthogonalization)
627  return;
629  for (i = 0; i < m_nIterationCount + 2; i++)
630  m_pV[i].Finalize();
631 
632  delete[] m_pV;
633  m_pV = NULL;
635 }
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
CMatrixOperation::CVector * m_pV
A member variable for saveing lanczos vectors.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
bool m_bReorthogonalization
Option for doing or not re-orthogonalization.
unsigned int m_nIterationCount
A counts of lanczos interation.

Here is the call graph for this function:

int CLanczosMethod::GetLBIndex ( )
inline

Definition at line 56 of file LanczosMethod.h.

References m_nLBIndex.

Referenced by CSPLoop::executeSPLoop().

56 { return m_nLBIndex; };

Here is the caller graph for this function:

bool CLanczosMethod::InitializeTemporaryArrayAndVector ( int  nIterationCount)
private

Initialize temporary eigenvalue arrays and vectors.

Parameters
nIterationCountLanczos iteration count
Returns
Success or fail

Definition at line 75 of file LanczosMethod.cpp.

References ALLOC_WITH_NULL_INIT, CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), and CTimeMeasurement::MeasurementStart().

76 {
77  bool bRtn = true;
78  /*if (nIterationCount == m_nPrevIterationCount)
79  return bRtn;*/
80 
81  //if (0 != m_nPrevIterationCount)
83 
84  bRtn = false;
85 
87  ALLOC_WITH_NULL_INIT(m_pEigenValues, double, nIterationCount);
89 
90  bRtn = true;
91  return bRtn;
92 }
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
#define ALLOC_WITH_NULL_INIT(pointer, data_type, data_size)
Definition: Global.h:34
void FinalizeTemporaryArrayAndVector()
Finalize temporary eigenvalue arrays and vectors.
double * m_pEigenValues
A temporary eigenvalue array for eig solver.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.

Here is the call graph for this function:

void CLanczosMethod::InitLanczosIterationVariables ( CComplex **  pAlpha,
double **  pAlphaReal,
double **  pBeta,
double **  pWj,
double **  pWjm1,
double **  pWjp1,
CMatrixOperation::CVector **  pW 
)
private

Init omega, alpha, beta array.

Parameters
pAlphaAlpha array double pointer that allocating memory for return
pBetaBeta array double pointer that allocating memory for return
pWOmega array pointer that allocating memory for return
pWjvector for selective reorthogonalization
pWjm1vector for selective reorthogonalization
pWjp1vector for selective reorthogonalization

Definition at line 645 of file LanczosMethod.cpp.

References CMPIManager::IsRootRank(), CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), and CTimeMeasurement::MeasurementStart().

646 {
648  *pAlpha = new CComplex[m_nIterationCount + 2];
649  *pAlphaReal = (double*)malloc(sizeof(double)*(m_nIterationCount + 5));
650  *pBeta = (double*)malloc(sizeof(double)*(m_nIterationCount + 5));
651 
653  {
654  *pWj = (double*)malloc(sizeof(double)*(m_nIterationCount + 3));
655  *pWjm1 = (double*)malloc(sizeof(double)*(m_nIterationCount + 3));
656  *pWjp1 = (double*)malloc(sizeof(double)*(m_nIterationCount + 3));
657 
658  memset(*pWj, 0, sizeof(double)*(m_nIterationCount + 3));
659  memset(*pWjm1, 0, sizeof(double)*(m_nIterationCount + 3));
660  memset(*pWjp1, 0, sizeof(double)*(m_nIterationCount + 3));
661  }
663 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
bool m_bReorthogonalization
Option for doing or not re-orthogonalization.
This class for complex operation and saving value.
Definition: Complex.h:16
unsigned int m_nIterationCount
A counts of lanczos interation.

Here is the call graph for this function:

void CLanczosMethod::InitLanczosVector ( )
private

Init lanczos vectors.

Definition at line 604 of file LanczosMethod.cpp.

References CMPIManager::GetCurrentLoadBalanceCount(), CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), and CTimeMeasurement::MeasurementStart().

605 {
606  unsigned int i;
607 
608  if (false == m_bReorthogonalization)
609  return;
610 
614  for (i = 0; i < m_nIterationCount + 2; i++)
615 #ifdef DISABLE_MPI_ROUTINE
616  m_pV[i].SetSize(m_nMatrixSize);
617 #else //DISABLE_MPI_ROUTINE
619 #endif //DISABLE_MPI_ROUTINE
620 
621 }
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static int GetCurrentLoadBalanceCount(int nLBIndex)
Get Current node's rank load balancing number.
Definition: MPIManager.cpp:608
CMatrixOperation::CVector * m_pV
A member variable for saveing lanczos vectors.
unsigned int m_nMatrixSize
A size of Hemiltonian matrix.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
This class for describing vector for Lanczos method.
bool m_bReorthogonalization
Option for doing or not re-orthogonalization.
unsigned int m_nIterationCount
A counts of lanczos interation.
void SetSize(unsigned int nSize)
Set Vector elements size.

Here is the call graph for this function:

void CLanczosMethod::InitVariables ( )
private

Deallocating member variables.

Definition at line 1438 of file LanczosMethod.cpp.

References CTimeMeasurement::FREE_MEM, CTimeMeasurement::MeasurementEnd(), and CTimeMeasurement::MeasurementStart().

1439 {
1440  if (NULL != m_pV)
1441  {
1443  delete m_pV;
1445  m_pV = NULL;
1446  }
1447 
1448  m_pAMatrix = NULL;
1449  m_nMatrixSize = 0;
1450  m_nIterationCount = 0;
1452  m_nEigenValueCount = 0;
1453  m_bReorthogonalization = false;
1454  m_nLBIndex = 0;
1455 }
unsigned int m_nEigenValueCheckInterval
A interval for checking T matrix eigenvlaue.
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
CMatrixOperation::CVector * m_pV
A member variable for saveing lanczos vectors.
CMatrixOperation::CCSR * m_pAMatrix
A member variable for reference Hemiltonian matrix.
unsigned int m_nMatrixSize
A size of Hemiltonian matrix.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
bool m_bReorthogonalization
Option for doing or not re-orthogonalization.
unsigned int m_nEigenValueCount
A numbers of eigenvlaue that want to calculation.
unsigned int m_nIterationCount
A counts of lanczos interation.

Here is the call graph for this function:

void CLanczosMethod::IntegrateEigenvalues ( int  nIterationCount,
LPEIGENVALUE_RESULT  lpResult,
unsigned int  nCalculatedEigenValueCount,
double *  pCalcuResult_Value,
double *  pCalcuResult_Vector 
)
private

Integrating computing solution during Lanczos method operation.

Parameters
nIterationCountIterationCount until now
lpResultAlready calculated eigenvalue result
nCalculatedEigenValueCountLast time calculated eigenvalue count
pCalcuResult_ValueLast time calculated eigenvalues
pCalcuResult_VectorLast time calculated eigenvectors

Definition at line 1094 of file LanczosMethod.cpp.

References GENERAL_TOLERANCE, CMatrixOperation::IsSame(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCountForMemeory, CLanczosMethod::EIGENVALUE_RESULT::nMaxEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, and CLanczosMethod::EIGENVALUE_RESULT::pEigenVectors.

1095 {
1096  unsigned int i, j;
1097  bool bSame = false;
1098 
1099  for (i = 0; i < nCalculatedEigenValueCount; i++)
1100  {
1101  bSame = false;
1102  for (j = 0; j < lpResult->nEigenValueCount; j++)
1103  {
1104  if (CMatrixOperation::IsSame(pCalcuResult_Value[i], lpResult->pEigenValues[j], GENERAL_TOLERANCE))
1105  {
1106  bSame = true;
1107  break;
1108  }
1109  }
1110 
1111  if (!bSame)
1112  {
1113  if (lpResult->nEigenValueCountForMemeory == lpResult->nEigenValueCount)
1114  {
1115  lpResult->pEigenValues = (double*)realloc(lpResult->pEigenValues, sizeof(double)*(lpResult->nEigenValueCount * 2));
1116  lpResult->nEigenValueCountForMemeory = lpResult->nEigenValueCount * 2;
1117  lpResult->pEigenValueFoundIteration = (unsigned int*)realloc(lpResult->pEigenValueFoundIteration, sizeof(unsigned int)*(lpResult->nEigenValueCount * 2));
1118  //lpResult->pEigenVectors = (double*)realloc(lpResult->pEigenVectors, sizeof(double)*lpResult->nEigenValueCount * 2 * m_nIterationCount);
1119  lpResult->nEigenValueCountForMemeory = lpResult->nEigenValueCount * 2;
1120  }
1121  lpResult->pEigenValues[lpResult->nEigenValueCount] = pCalcuResult_Value[i];
1122  lpResult->pEigenValueFoundIteration[lpResult->nEigenValueCount] = nIterationCount;
1123 #ifdef _WIN32
1124  lpResult->nMaxEigenValueFoundIteration = max((int)lpResult->nMaxEigenValueFoundIteration, (int)nIterationCount);
1125 #else //_WIN32
1126  lpResult->nMaxEigenValueFoundIteration = std::max((int)lpResult->nMaxEigenValueFoundIteration, (int)nIterationCount);
1127 #endif//
1128  memcpy(lpResult->pEigenVectors + (lpResult->nEigenValueCount*m_nIterationCount), pCalcuResult_Vector + (i * nIterationCount), sizeof(double)* nIterationCount);
1129  lpResult->nEigenValueCount++;
1130  }
1131  }
1132 }
#define GENERAL_TOLERANCE
General tolerance definition.
Definition: Global.h:47
static bool IsSame(double operand1, double operand2, double tol)
Compare two double variable.
unsigned int m_nIterationCount
A counts of lanczos interation.

Here is the call graph for this function:

void CLanczosMethod::IntegrateEigenvaluesEx ( int  nIterationCount,
LPEIGENVALUE_RESULT  lpResult,
unsigned int  nCalculatedEigenValueCount,
unsigned int  nCalculatedEigenValueCountBeforeConvergenceCheck,
double *  pCalcuResult_Value,
double *  pCalcuResult_Vector,
bool *  pbValidEigenValue 
)
private

Integrating computing solution during Lanczos method operation.

Parameters
nIterationCountIterationCount until now
lpResultAlready calculated eigenvalue result
nCalculatedEigenValueCountConverged check passwd eigen value
nCalculatedEigenValueCountLast time calculated eigenvalue count
pCalcuResult_ValueLast time calculated eigenvalues
pCalcuResult_VectorLast time calculated eigenvectors
pbValidEigenValueArray for checking valid eigen value

Definition at line 991 of file LanczosMethod.cpp.

References GENERAL_TOLERANCE, CMatrixOperation::IsSame(), CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::nEigenVectorSize, CLanczosMethod::EIGENVALUE_RESULT::nMaxEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, and CLanczosMethod::EIGENVALUE_RESULT::pEigenVectors.

992 {
993  unsigned int i, j;
994  bool bSame = false;
995 
996  lpResult->nEigenVectorSize = nIterationCount;
997  if (0 == lpResult->nEigenValueCount)
998  {
999  //Initialize lpReulst members
1001  lpResult->pEigenValues = (double*)malloc(sizeof(double)*nCalculatedEigenValueCount);
1002  lpResult->pEigenVectors = (double**)malloc(sizeof(double*)*nCalculatedEigenValueCount);
1003 
1004  for (i = 0; i < nCalculatedEigenValueCount; i++)
1005  {
1006  lpResult->pEigenVectors[i] = (double*)malloc(sizeof(double)*nIterationCount);
1007  }
1008 
1009  lpResult->pEigenValueFoundIteration = (unsigned int*)malloc(sizeof(unsigned int)*nCalculatedEigenValueCount);
1011  }
1012  else
1013  {
1014  int nSameCount = 0;
1015  for (i = 0; i < nCalculatedEigenValueCountBeforeConvergenceCheck; i++)
1016  {
1017  if (false == pbValidEigenValue[i])
1018  continue;
1019  for (j = 0; j < lpResult->nEigenValueCount; j++)
1020  {
1021  if (CMatrixOperation::IsSame(pCalcuResult_Value[i], lpResult->pEigenValues[j], GENERAL_TOLERANCE))
1022  {
1023  nSameCount++;
1024  continue;
1025  }
1026  }
1027  }
1028 
1029  if (0 == nCalculatedEigenValueCount - nSameCount)
1030  {
1031  for (i = 0; i < lpResult->nEigenValueCount ; i++)
1032  lpResult->pEigenVectors[i] = (double*)realloc(lpResult->pEigenVectors[i], sizeof(double)*nIterationCount);
1033  }
1034  else
1035  {
1036  int nAddSize = nCalculatedEigenValueCount - nSameCount;
1037  lpResult->pEigenValues = (double*)realloc(lpResult->pEigenValues, sizeof(double)*(lpResult->nEigenValueCount + nAddSize));
1038  lpResult->pEigenVectors = (double**)realloc(lpResult->pEigenVectors, sizeof(double*)*(lpResult->nEigenValueCount + nAddSize));
1039  for (i = lpResult->nEigenValueCount; i < (lpResult->nEigenValueCount + nAddSize); ++i)
1040  lpResult->pEigenVectors[i] = NULL;
1041  for (i = 0; i < (lpResult->nEigenValueCount + nAddSize); i++)
1042  lpResult->pEigenVectors[i] = (double*)realloc(lpResult->pEigenVectors[i], sizeof(double)*nIterationCount);
1043  lpResult->pEigenValueFoundIteration = (unsigned int*)realloc(lpResult->pEigenValueFoundIteration, sizeof(unsigned int)*(lpResult->nEigenValueCount + nAddSize));
1044  }
1045  }
1046 
1047  for (i = 0; i < nCalculatedEigenValueCountBeforeConvergenceCheck; i++)
1048  {
1049  if (false == pbValidEigenValue[i])
1050  continue;
1051 
1052  bSame = false;
1053  for (j = 0; j < lpResult->nEigenValueCount; j++)
1054  {
1055  if (CMatrixOperation::IsSame(pCalcuResult_Value[i], lpResult->pEigenValues[j], GENERAL_TOLERANCE))
1056  {
1057  bSame = true;
1058  break;
1059  }
1060  }
1061 
1062  if (!bSame)
1063  {
1064  lpResult->pEigenValues[lpResult->nEigenValueCount] = pCalcuResult_Value[i];
1065  lpResult->pEigenValueFoundIteration[lpResult->nEigenValueCount] = nIterationCount;
1066 #ifdef _WIN32
1067  lpResult->nMaxEigenValueFoundIteration = max((int)lpResult->nMaxEigenValueFoundIteration, (int)nIterationCount);
1068 #else //_WIN32
1069  lpResult->nMaxEigenValueFoundIteration = std::max((int)lpResult->nMaxEigenValueFoundIteration, (int)nIterationCount);
1070 #endif//
1071  memcpy(lpResult->pEigenVectors[lpResult->nEigenValueCount], pCalcuResult_Vector + (i * nIterationCount), sizeof(double)* nIterationCount);
1072  lpResult->nEigenValueCount++;
1073  }
1074 // else
1075 // {
1076 // lpResult->pEigenValueFoundIteration[j] = nIterationCount;
1077 // memcpy(lpResult->pEigenVectors[j], pCalcuResult_Vector + (i * nIterationCount), sizeof(double)* nIterationCount);
1078 //#ifdef _WIN32
1079 // lpResult->nMaxEigenValueFoundIteration = max((int)lpResult->nMaxEigenValueFoundIteration, (int)nIterationCount);
1080 //#else //_WIN32
1081 // lpResult->nMaxEigenValueFoundIteration = std::max((int)lpResult->nMaxEigenValueFoundIteration, (int)nIterationCount);
1082 //#endif //_WIN32
1083 // }
1084  }
1085 }
#define GENERAL_TOLERANCE
General tolerance definition.
Definition: Global.h:47
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static bool IsSame(double operand1, double operand2, double tol)
Compare two double variable.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.

Here is the call graph for this function:

static bool CLanczosMethod::IsAbort ( )
inlinestatic

Definition at line 65 of file LanczosMethod.h.

References m_bStop.

65 { return m_bStop; };
static bool m_bStop
Determind stop iteration before end of iteration count.
CLanczosMethod::LPEIGENVALUE_RESULT CLanczosMethod::LanczosIteration ( )
private

Doing lanczos basic iteration.

Returns
Calculated eigenvectors, eigenvectors and its count

Definition at line 178 of file LanczosMethod.cpp.

References CMPIManager::BroadcastLanczosResult(), CMatrixOperation::CVector::Finalize(), CMPIManager::GetCurrentLoadBalanceCount(), CMPIManager::GetLanczosGroupIndex(), CMPIManager::IsMultiLevelMPI(), CMPIManager::IsRootRank(), m_bStop, CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CLanczosMethod::EIGENVALUE_RESULT::nDegeneratedEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::nMaxEigenValueFoundIteration, CMatrixOperation::CVector::Normalize(), CLanczosMethod::EIGENVALUE_RESULT::pDegeneratedIndex, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectors, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, CLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions, CMatrixOperation::CVector::SetAt(), and CMatrixOperation::CVector::SetSize().

179 {
180  CComplex *pAlpha = NULL;
181  double *pAlphaReal = NULL;
182  double *pBeta = NULL;
183  double *pWj = NULL;
184  double *pWjm1 = NULL;
185  double *pWjp1 = NULL;
186  CMatrixOperation::CVector *pW = NULL;
188  double *pCalculatedEigenVector = NULL;
189  unsigned int i;
190 
192  LPEIGENVALUE_RESULT lpResult = (LPEIGENVALUE_RESULT)malloc(sizeof(EIGENVALUE_RESULT));
194 
195  InitLanczosIterationVariables(&pAlpha, &pAlphaReal, &pBeta, &pWj, &pWjm1, &pWjp1, &pW);
197 
198  pAlphaReal[0] = pBeta[0] = pBeta[1] = 0;
199 
200 #ifdef DISABLE_MPI_ROUTINE
202  V1.SetAt(0, 1, 0);
203 #else //DISABLE_MPI_ROUTINE
206  {
207  /*V1.BuildRandomVector();
208  V1.Normalize(true);*/
211  }
212  else
213  {
215  V1.SetAt(0, 1, 0);
216  }
217 #endif //DISABLE_MPI_ROUTINE
218 
219  lpResult->nEigenValueCount = 0;
220  lpResult->pEigenValues = NULL;
221  lpResult->pDegeneratedIndex = NULL;
222  lpResult->pEigenVectors = NULL;
223  lpResult->nEigenValueCount = 0;
224  lpResult->pEigenValueFoundIteration = NULL;
225  lpResult->pEigenVectorsForAMatrix = NULL;
226  lpResult->pWaveFunctions = NULL;
227  lpResult->nMaxEigenValueFoundIteration = 0;
228  lpResult->nDegeneratedEigenValueCount = 0;
229 
231  {
232  m_pV[1] = V1;
233 
234  pWj[2] = 0;
235  pWj[3] = 0;
236  }
237 
239  LanczosIterationLoop(lpResult, &V1, m_nIterationCount, pAlpha, pAlphaReal, pBeta, pWj, pWjm1, pWjp1);
241  {
242  V1.Finalize();
244  FinalizeLanczosInterationVariable(pAlpha, pAlphaReal, pBeta, pWj, pWjm1, pWjp1, pW);
245 
246  return lpResult;
247  }
248 
251  {
252 
253 #ifndef DISABLE_MPI_ROUTINE
254  CMPIManager::BroadcastLanczosResult(lpResult, lpResult->nMaxEigenValueFoundIteration);
255 #endif
256  if (lpResult->nEigenValueCount > 0)
257  {
259  lpResult->pEigenVectorsForAMatrix = new CMatrixOperation::CVector[lpResult->nEigenValueCount];
261  for (i = 0; i < lpResult->nEigenValueCount; i++)
262 #ifdef DISABLE_MPI_ROUTINE
263  lpResult->pEigenVectorsForAMatrix[i].SetSize(m_nMatrixSize);
264 #else //DISABLE_MPI_ROUTINE
265  lpResult->pEigenVectorsForAMatrix[i].SetSize(CMPIManager::GetCurrentLoadBalanceCount(m_nLBIndex));
266 #endif
267 
269  {
270  for (i = 1; i <= lpResult->nMaxEigenValueFoundIteration; i++)
271  CalculateEigenVector(lpResult, m_pV[i], i);
272  }
273  else
274  LanczosIterationLoop(lpResult, &V1, lpResult->nMaxEigenValueFoundIteration, pAlpha, pAlphaReal, pBeta, pWj, pWjm1, pWjp1, true);
275  }
276 
278  return lpResult;
279 
280  for (i = 0; i < lpResult->nEigenValueCount; ++i)
281 #ifndef DISABLE_MPI_ROUTINE
282  lpResult->pEigenVectorsForAMatrix[i].Normalize(true);
283 #else //DISABLE_MPI_ROUTINE
284  lpResult->pEigenVectorsForAMatrix[i].Normalize();
285 #endif //DISABLE_MPI_ROUTINE
286  }
287 
288  V1.Finalize();
289 
291  FinalizeLanczosInterationVariable(pAlpha, pAlphaReal, pBeta, pWj, pWjm1, pWjp1, pW);
292 
293  return lpResult;
294 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
void InitLanczosVector()
Init lanczos vectors.
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
void CalculateEigenVector(LPEIGENVALUE_RESULT lpResult, CMatrixOperation::CVector V, unsigned int nIterationIndex)
Calculate Eigen vector of A Matrix.
static int GetCurrentLoadBalanceCount(int nLBIndex)
Get Current node's rank load balancing number.
Definition: MPIManager.cpp:608
CMatrixOperation::CVector * m_pV
A member variable for saveing lanczos vectors.
bool m_bCalcuEigenvector
Option for doing or not calculating eigen vector.
static void BroadcastLanczosResult(CLanczosMethod::LPEIGENVALUE_RESULT lpResult, int nIterationCount)
Broadcast Lanczos result.
Definition: MPIManager.cpp:524
void FinalizeLanczosInterationVariable(CComplex *pAlpha, double *pAlphaReal, double *pBeta, double *pWj, double *pWjm1, double *pWjp1, CMatrixOperation::CVector *pW)
Deallocating omega, alpha, beta.
static bool m_bStop
Determind stop iteration before end of iteration count.
static unsigned int GetLanczosGroupIndex()
Definition: MPIManager.h:80
unsigned int m_nMatrixSize
A size of Hemiltonian matrix.
static bool IsMultiLevelMPI()
Get MPI_Comm.
Definition: MPIManager.h:65
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
This class for describing vector for Lanczos method.
void LanczosIterationLoop(LPEIGENVALUE_RESULT lpResult, CMatrixOperation::CVector *V1, unsigned int nIterationCount, CComplex *pAlpha, double *pAlphaReal, double *pBeta, double *pWj, double *pWjm1, double *pWjp1, bool bMakeEigvVector=false)
Doing lanczos basic iteration.
bool m_bReorthogonalization
Option for doing or not re-orthogonalization.
This class for complex operation and saving value.
Definition: Complex.h:16
void InitLanczosIterationVariables(CComplex **pAlpha, double **pAlphaReal, double **pBeta, double **pWj, double **pWjm1, double **pWjp1, CMatrixOperation::CVector **pW)
Init omega, alpha, beta array.
struct CLanczosMethod::EIGENVALUE_RESULT * LPEIGENVALUE_RESULT
void SetAt(unsigned int nIndex, CComplex value)
Set element value in specific index, Call by value.
void FinalLanczosVector()
Deallocating lanczos vectors.
unsigned int m_nIterationCount
A counts of lanczos interation.
void SetSize(unsigned int nSize)
Set Vector elements size.
void Finalize()
Free allocated memory for vector elements.

Here is the call graph for this function:

void CLanczosMethod::LanczosIterationLoop ( CLanczosMethod::LPEIGENVALUE_RESULT  lpResult,
CMatrixOperation::CVector V1,
unsigned int  nIterationCount,
CComplex pAlpha,
double *  pAlphaReal,
double *  pBeta,
double *  pWj,
double *  pWjm1,
double *  pWjp1,
bool  bMakeEigvVector = false 
)
private

Doing lanczos basic iteration.

Parameters
lpResult[out]: Calculated eigenvectors, eigenvectors and its count
V1Initial V vector
nIterationCountIteration count until eigenvalue solving
pAlpahAlpah array that are calcuated during lanczos iteration
pAlphaRealAlpha array real part that are calcuated during lanczos iteration
pBetaBeta array that are calcuated during lanczos iteration
pWjvector for selective reorthogonalization
pWjm1vector for selective reorthogonalization
pWjp1vector for selective reorthogonalization
bMakeEigVectgorOption for calculate eigenvector or not

aj <- wj*vj

bj+1 <- ||wj||

vj+1 <- wj/bj+1

< After doing selective reorthogonalization calculate vj+1 value

Definition at line 308 of file LanczosMethod.cpp.

References CMPIManager::BroadcastBool(), CTimeMeasurement::COMM, CTimeMeasurement::EVALUE, CMatrixOperation::CVector::Finalize(), CMPIManager::GetCurrentLoadBalanceCount(), CMPIManager::GetCurrentRank(), CMPIManager::GetMPIComm(), CMatrixOperation::CVector::GetNorm(), CComplex::GetRealNumber(), CMPIManager::GetTotalNodeCount(), CMPIManager::IsRootRank(), m_bStop, CMatrixOperation::CVector::m_vectValueImaginaryBuffer, CMatrixOperation::CVector::m_vectValueRealBuffer, CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CTimeMeasurement::MVMUL, CMatrixOperation::MVMulEx_Optimal(), CMatrixOperation::MVMulOptimal(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CMatrixOperation::CVector::ScalarDivision(), CMatrixOperation::CVector::ScalarMultiThanMinusVector(), CMatrixOperation::CVector::SetSize(), CUtility::ShowMsg(), CTimeMeasurement::VVDOT, and CMatrixOperation::VVDot().

309 {
310 // CMatrixOperation::CVector vector1, vector2;
311  CMatrixOperation::CVector Vj, Vjp1, Vjm1, W, VTemp;
312  double fANorm = 0;
313  int nEigenvalueSolvingCount = 0;
314  int nEigenvalueSolvingFinal = m_nIterationCount / m_nEigenValueCheckInterval;
315  unsigned int j;
316  unsigned int nSizePHI;
317  char szMsg[1024];
318 
319  Vj = *V1;
320 
321 #ifdef DISABLE_MPI_ROUTINE
322  Vjp1 = *V1;
323  Vjm1 = *V1;
324  W = *V1;
325 #else
329 
332  int tag = 1002;
333  unsigned int nSizeFromPrevRank, nSizeFromNextRank;
334  unsigned int nSizetoPrevRank, nSizetoNextRank;
335  MPI_Status stat_sr[2];
336  MPI_Request req_sr[2];
337 
338  nSizetoPrevRank = m_pAMatrix->nComponentsFirstUnitCell;
339  nSizetoNextRank = m_pAMatrix->nComponentsLastUnitCell;
340 
341  //printf("Rank %d: Preparing to get sizes. PrevRank %d, NextRank %d\n", CMPIManager::GetCurrentRank(), nPrevRank, nNextRank);
342 
344  MPI_Irecv(&nSizeFromPrevRank, 1, MPI_INT, nPrevRank, tag, CMPIManager::GetMPIComm(), &req_sr[0]);
345  MPI_Isend(&nSizetoNextRank, 1, MPI_INT, nNextRank, tag, CMPIManager::GetMPIComm(), &req_sr[1]);
346  MPI_Waitall(2, req_sr, stat_sr); // now Brt has B of right neighbor
347 
348  MPI_Irecv(&nSizeFromNextRank, 1, MPI_INT, nNextRank, tag, CMPIManager::GetMPIComm(), &req_sr[0]);
349  MPI_Isend(&nSizetoPrevRank, 1, MPI_INT, nPrevRank, tag, CMPIManager::GetMPIComm(), &req_sr[1]);
350  MPI_Waitall(2, req_sr, stat_sr);
352 
353  //printf("Rank %d: P=%d, M=%d, N=%d\n", CMPIManager::GetCurrentRank(), nSizeFromPrevRank, CMPIManager::GetCurrentLoadBalanceCount(), nSizeFromNextRank);
354 #endif
355 
356 #ifdef USE_XEONPHI
357 
358  nSizePHI = (int)(((double)CMPIManager::GetCurrentLoadBalanceCount(m_nLBIndex)) * m_floadMIC / 100.0);
359  m_floadMIC = ((double)nSizePHI) / ((double)CMPIManager::GetCurrentLoadBalanceCount(m_nLBIndex))*100.0;
360 
361  //double *phi_input_real = Vj.m_vectValueRealBuffer.data();
362  //double *phi_input_imaginary = Vj.m_vectValueImaginaryBuffer.data();
363  //unsigned int phi_input_real_size = Vj.m_vectValueRealBuffer.size();
364  //unsigned int phi_input_imaginary_size = Vj.m_vectValueImaginaryBuffer.size();
365 
366  double *phi_output_real = W.m_vectValueRealBuffer.data();
367  double *phi_output_imaginary = W.m_vectValueImaginaryBuffer.data();
368  unsigned int phi_output_real_size = nSizePHI;
369  unsigned int phi_output_imaginary_size = nSizePHI;
370  //unsigned int output_real_size = W.m_vectValueRealBuffer.size();
371  //unsigned int output_imaginary_size = W.m_vectValueImaginaryBuffer.size();
372 
373  //#pragma offload_transfer target(mic:phi_tid) nocopy(input_real[0:input_real_size] : ALLOC)
374  //#pragma offload_transfer target(mic:phi_tid) nocopy(input_imaginary[0:input_imaginary_size] : ALLOC)
375 
376  if(phi_output_real_size != 0)
377  sprintf(szMsg, "-[Rank %03d] MIC-load adjusted to %.1f(%%). DOF(MIC, Total) = (%d, %d)\n", CMPIManager::GetCurrentRank(), m_floadMIC, nSizePHI, CMPIManager::GetCurrentLoadBalanceCount(m_nLBIndex));
378  else
379  sprintf(szMsg, "-[Rank %03d] MIC-load should be larger\n", CMPIManager::GetCurrentRank());
380  CUtility::ShowMsg(szMsg);
381 
382 #pragma offload_transfer target(mic:phi_tid) nocopy(phi_output_real[0:phi_output_real_size] : ALLOC)
383 #pragma offload_transfer target(mic:phi_tid) nocopy(phi_output_imaginary[0:phi_output_imaginary_size] : ALLOC)
384 
385 #else
386 
387  nSizePHI = 0;
388  m_floadMIC = 0.0;
389 
390 #endif
391 
392  // if(CMPIManager::GetTotalNodeCount() <= 3)
393  VTemp.SetSize(m_nMatrixSize);
394  // else
395  //VTemp.SetSize(nSizeFromPrevRank+nSizeFromNextRank+CMPIManager::GetCurrentLoadBalanceCount());
396 
397 #ifdef USE_XEONPHI
398 
399  double *phi_vtemp_real = VTemp.m_vectValueRealBuffer.data();
400  double *phi_vtemp_imaginary = VTemp.m_vectValueImaginaryBuffer.data();
401  unsigned int phi_vtemp_size = VTemp.m_vectValueRealBuffer.size();
402 
403 #pragma offload_transfer target(mic:phi_tid) nocopy(phi_vtemp_real[0:phi_vtemp_size] : ALLOC)
404 #pragma offload_transfer target(mic:phi_tid) nocopy(phi_vtemp_imaginary[0:phi_vtemp_size] : ALLOC)
405 //#pragma offload_transfer target(mic:phi_tid) in(vtemp_real[0:vtemp_size] : REUSE)
406 //#pragma offload_transfer target(mic:phi_tid) in(vtemp_imaginary[0:vtemp_size] : REUSE)
407 
408  // X_largest = CMPIManager::GetLoadBalanceCount(0);
409  // for(int i = 1; i < CMPIManager::GetTotalNodeCount(); i++)
410  // {
411  // unsigned int Btemp = CMPIManager::GetLoadBalanceCount(i);
412  // if(Btemp > X_largest)
413  // X_largest = Btemp;
414  // }
415 
416  // CTimeMeasurement::MeasurementStart(CTimeMeasurement::MALLOC);
417  // double *X = (double *)_mm_malloc(X_largest * 2 * sizeof(double), 64);
418  // double *Xrt = (double *)_mm_malloc(X_largest * 2 * sizeof(double), 64);
419  // double *Xlt = (double *)_mm_malloc(X_largest * 2 * sizeof(double), 64);
420  //#pragma offload_transfer target(mic:phi_tid) nocopy(X[0:X_largest * 2] : align(64) ALLOC)
421  //#pragma offload_transfer target(mic:phi_tid) nocopy(Xrt[0:X_largest * 2] : align(64) ALLOC)
422  //#pragma offload_transfer target(mic:phi_tid) nocopy(Xlt[0:X_largest * 2] : align(64) ALLOC)
423  // double *X = new double[X_largest*2];
424  // double *Xrt = new double[X_largest*2];
425  // double *Xlt = new double[X_largest*2];
426  //#pragma offload_transfer target(mic:phi_tid) nocopy(X[0:X_largest * 2] : ALLOC)
427  //#pragma offload_transfer target(mic:phi_tid) nocopy(Xrt[0:X_largest * 2] : ALLOC)
428  //#pragma offload_transfer target(mic:phi_tid) nocopy(Xlt[0:X_largest * 2] : ALLOC)
429  // CTimeMeasurement::MeasurementEnd(CTimeMeasurement::MALLOC);
430 
431 #endif
432 
433  int nSize;
434 #ifdef DISABLE_MPI_ROUTINE
435  nSize = m_nMatrixSize;
436 #else
438 #endif
439 
440  for (j = 1; j <= nIterationCount; j++)
441  {
442  if (0 == j % 500 && CMPIManager::IsRootRank())
443  {
444  sprintf(szMsg, "[#%8d] Lanczos interation going on\n", j);
445  CUtility::ShowMsg(szMsg);
446  }
447 
448  if (bMakeEigvVector)
449  CalculateEigenVector(lpResult, Vj, j);
450 
451 #ifdef DISABLE_MPI_ROUTINE
452  if (j == 1)
453  CUtility::ShowMsg("-Using MVMulOptimal with no offload\n");
457 #else //DISABLE_MPI_ROUTINE
458  /* /// Using Normal MV Mul
459  if (j == 1)
460  if(CMPIManager::IsRootRank())
461  CUtility::ShowMsg("-Using MVMul\n");
462  CTimeMeasurement::MeasurementStart(CTimeMeasurement::MVMUL);
463  CMatrixOperation::MVMul(m_pAMatrix, &Vj, &W, m_nLBIndex);
464  CTimeMeasurement::MeasurementEnd(CTimeMeasurement::MVMUL);
465  */
466 
467  /* /// Using Async block communication
468  if(CMPIManager::GetTotalNodeCount() <= 2)
469  {
470  CTimeMeasurement::MeasurementStart(CTimeMeasurement::MVMUL);
471  CMatrixOperation::MVMulOptimal(m_pAMatrix, &Vj, &W, m_nLBIndex); /// wj <- Avj
472  CTimeMeasurement::MeasurementEnd(CTimeMeasurement::MVMUL);
473  if (j == 1)
474  if(CMPIManager::IsRootRank())
475  CUtility::ShowMsg("-Using MVMulOptimal\n");
476  }
477  else
478  {
479  CTimeMeasurement::MeasurementStart(CTimeMeasurement::MVMUL);
480  CMatrixOperation::MVMulEx_AsyncCommWithLocalBlocks(m_pAMyLocalBlock, m_pALeftBlock, m_pARightBoloc, &Vj, &W, X, Xrt, Xlt, m_nLBIndex);
481  CTimeMeasurement::MeasurementEnd(CTimeMeasurement::MVMUL);
482  if (j == 1)
483  if(CMPIManager::IsRootRank())
484  CUtility::ShowMsg("-Using MVMulEx_AsyncCommWithLocalBlocks\n");
485  }
486  */
487 
488  if (j == 1)
489  {
491  {
492  if (nSizePHI != 0)
493  sprintf(szMsg, "-Using MVMulEx_Optimal with %.1f(%%) offload\n", m_floadMIC);
494  else
495  sprintf(szMsg, "-Using MVMulEx_Optimal with no offload\n");
496  CUtility::ShowMsg(szMsg);
497  }
498  }
499 
501  CMatrixOperation::MVMulEx_Optimal(m_pAMatrix, &Vj, &W, nSizeFromPrevRank, nSizeFromNextRank, &VTemp, nSizePHI, m_nLBIndex);
503 
504 #endif //DISABLE_MPI_ROUTINE
505 
506  if (1 != j)
507  W.ScalarMultiThanMinusVector(pBeta[j], &Vjm1);
508 
510  CMatrixOperation::VVDot(&W, &Vj, &pAlpha[j]);
512  pAlphaReal[j] = pAlpha[j].GetRealNumber();
513  W.ScalarMultiThanMinusVector(pAlphaReal[j], &Vj);
514 
515 #ifdef DISABLE_MPI_ROUTINE
516  pBeta[j + 1] = W.GetNorm();
517 #else
518  pBeta[j + 1] = W.GetNorm(true);
519 #endif
520  Vjp1 = W;
521  Vjp1.ScalarDivision(pBeta[j + 1]);
522 
523  if (m_bReorthogonalization && false == bMakeEigvVector)
524  {
526  {
527  if (1 == j && fANorm < fabs(pAlphaReal[1]) + pBeta[2])
528  fANorm = fabs(pAlphaReal[1]) + pBeta[2];
529  else if (fANorm < fabs(pAlphaReal[j]) + pBeta[j + 1] + pBeta[j])
530  fANorm = fabs(pAlphaReal[j]) + pBeta[j + 1] + pBeta[j];
531  }
532 
533  m_pV[j + 1] = Vjp1;
534  if (CheckAndDoSelectiveReorthogonalization(j-1, pAlphaReal+1, pBeta+2, pWj, pWjm1, pWjp1, fANorm))
535  {
536  Vj = m_pV[j];
537  Vjp1 = m_pV[j + 1];
538  }
539  }
540 
542  break;
543 
544  if (0 == j % m_nEigenValueCheckInterval && false == bMakeEigvVector)
545  {
546  bool bFound = false;
547  int nPrevEVCount = lpResult->nEigenValueCount;
548 
550  {
552  bFound = DoEigenValueSolving(j, pAlphaReal, pBeta, fANorm, lpResult, ++nEigenvalueSolvingCount == nEigenvalueSolvingFinal);
554  }
555  else
556  {
557  bFound = true; // Can't alloc memeory, temporary code
558  CUtility::ShowMsg("\n[Warning] For memory allocation bug, can't calculate eigenvalue anymore!.\n\n");
559  }
560 
562 
564  if (bFound)
565  break;
566  }
567 
568  Vjm1 = Vj;
569  Vj = Vjp1;
570  }
571 
572 #ifdef USE_XEONPHI
573 
574 //#pragma offload_transfer target(mic:phi_tid) nocopy(input_real : FREE)
575 //#pragma offload_transfer target(mic:phi_tid) nocopy(input_imaginary : FREE)
576 
577 #pragma offload_transfer target(mic:phi_tid) nocopy(phi_output_real : FREE)
578 #pragma offload_transfer target(mic:phi_tid) nocopy(phi_output_imaginary : FREE)
579 #pragma offload_transfer target(mic:phi_tid) nocopy(phi_vtemp_real : FREE)
580 #pragma offload_transfer target(mic:phi_tid) nocopy(phi_vtemp_imaginary : FREE)
581 
582  // CTimeMeasurement::MeasurementStart(CTimeMeasurement::FREE_MEM);
583  // _mm_free(X);
584  // _mm_free(Xrt);
585  // _mm_free(Xlt);
586  // delete [] X;
587  // delete [] Xrt;
588  // delete [] Xlt;
589  //#pragma offload_transfer target(mic:phi_tid) nocopy(X : FREE)
590  //#pragma offload_transfer target(mic:phi_tid) nocopy(Xrt : FREE)
591  //#pragma offload_transfer target(mic:phi_tid) nocopy(Xlt : FREE)
592  // CTimeMeasurement::MeasurementEnd(CTimeMeasurement::FREE_MEM);
593 
594 #endif
595 
596  Vj.Finalize();
597  Vjp1.Finalize();
598  Vjm1.Finalize();
599  W.Finalize();
600 
601 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
unsigned int nComponentsLastUnitCell
Atom counts for interoperaton with next node.
unsigned int m_nEigenValueCheckInterval
A interval for checking T matrix eigenvlaue.
static void BroadcastBool(bool *boolValue, int nRootRank=0)
Broadcst boolean value.
Definition: MPIManager.cpp:470
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
double_vector_t m_vectValueRealBuffer
A member variable for saving none zero elements.
void CalculateEigenVector(LPEIGENVALUE_RESULT lpResult, CMatrixOperation::CVector V, unsigned int nIterationIndex)
Calculate Eigen vector of A Matrix.
static void MVMulEx_Optimal(CCSR *pAMatrix, CVector *pVector, CVector *pResult, unsigned int, unsigned int, CVector *, int nSizePHI, int nLBIndex)
Matrix and vector multiple operation for 1 layer exchanging communication.
static int GetCurrentLoadBalanceCount(int nLBIndex)
Get Current node's rank load balancing number.
Definition: MPIManager.cpp:608
bool InitializeTemporaryArrayAndVector(int nIterationCount)
Initialize temporary eigenvalue arrays and vectors.
CMatrixOperation::CVector * m_pV
A member variable for saveing lanczos vectors.
static int GetTotalNodeCount()
Definition: MPIManager.h:42
CMatrixOperation::CCSR * m_pAMatrix
A member variable for reference Hemiltonian matrix.
static bool m_bStop
Determind stop iteration before end of iteration count.
void FinalizeTemporaryArrayAndVector()
Finalize temporary eigenvalue arrays and vectors.
bool DoEigenValueSolving(int nIterationCount, double *pAlpha, double *pBeta, double fANorm, LPEIGENVALUE_RESULT lpResult, bool bFinal)
Every user set iteration count calculate eigenvalues.
static int GetCurrentRank()
Definition: MPIManager.h:40
bool CheckAndDoSelectiveReorthogonalization(int nIterationCount, double *pAlpha, double *pBeta, double *pWj, double *pWjm1, double *pWjp1, double fANorm)
Check current state need selective reorthogonalization and do it.
double_vector_t m_vectValueImaginaryBuffer
A member variable for saving none zero elements.
unsigned int m_nMatrixSize
A size of Hemiltonian matrix.
static void MVMulOptimal(CCSR *pAMatrix, CVector *pVector, CVector *pResult, int nLBIndex)
Matrix and vector multiple operation for multiple call.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
static MPI_Comm GetMPIComm()
Definition: MPIManager.h:64
double m_floadMIC
Computing ratio of CPU vs. MIC.
This class for describing vector for Lanczos method.
bool m_bReorthogonalization
Option for doing or not re-orthogonalization.
void ScalarDivision(CComplex Scalar)
Scalar division operation.
unsigned int nComponentsFirstUnitCell
Atom counts for interoperaton with previous node.
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
static bool VVDot(CVector *pVector1, CVector *pVector2, CComplex *pResult)
Between vectors dot product operation.
double GetNorm(bool bMPI=false)
Getting norm of vector.
unsigned int m_nIterationCount
A counts of lanczos interation.
void SetSize(unsigned int nSize)
Set Vector elements size.
double GetRealNumber() const
Get real part.
Definition: Complex.h:24
void Finalize()
Free allocated memory for vector elements.
void ScalarMultiThanMinusVector(double fScalar, CVector *vector)
Do minus operation after scalar multiple to operand between vectors.

Here is the call graph for this function:

void CLanczosMethod::MergeDegeneratedEigenvalues ( CLanczosMethod::LPEIGENVALUE_RESULT  lpResult,
unsigned int  nFindingDegeneratedEVCount,
CMatrixOperation::CCSR pA,
CMatrixOperation::CCSR pLocalBlock,
CMatrixOperation::CCSR pLeftBlock,
CMatrixOperation::CCSR pRightBlock 
)

Merging eigenvalue into mater group.

Parameters
lpResultStrcuture that include eigen values and eigen vectors
nFindingDegeneratedEVCountDegenerated eigenvalue computing group
pAProblem matrix
pLocalBlockThe block matrix of my rank
pLeftBlockThe block matrix of left neighbor core
pRightBlockThe block matrix of right neighbor core

< Gather Eigenvalues to master group

< Checking orthgonality of eigenvectors that corresponded to degenerated eigenvalue

< Receive command from deflation master

Definition at line 2077 of file LanczosMethod.cpp.

References CMPIManager::BarrierAllComm(), CMPIManager::BroadcastDouble(), CMPIManager::BroadcastInt(), CHECK_EV_ORTH, CHECK_EV_ORTH_SIMPLE, COMMAND_SIZE, DO_ORTHGONAL, CMPIManager::ExchangeCommand(), EXIT_MPI_WAIT, CMatrixOperation::CVector::Finalize(), FREE_MEM, CMPIManager::GatherEVFromDeflationGroup(), CMPIManager::GatherEVIterationFromDeflationGroup(), GENERAL_TOLERANCE, CMPIManager::GetCurrentLoadBalanceCount(), CMPIManager::GetCurrentRank(), CMPIManager::GetDeflationComm(), CMPIManager::GetEigenvalueCountFromDeflationGroup(), CMPIManager::GetLanczosComputComm(), CMPIManager::GetLanczosGroupIndex(), CMatrixOperation::CVector::GetNorm(), CComplex::GetRealNumber(), CMatrixOperation::CVector::GetSize(), CMPIManager::GetTotalNodeCount(), CMatrixOperation::Gram_schmidt(), CMPIManager::IsDeflationRoot(), CMPIManager::IsLanczosComputeRoot(), CMPIManager::IsRootRank(), CMatrixOperation::IsSame(), CMatrixOperation::IsSameA(), CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CMatrixOperation::CVector::MinusVector(), CTimeMeasurement::MVMUL, CMatrixOperation::MVMul(), CLanczosMethod::EIGENVALUE_RESULT::nDegeneratedEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, NOT_SEND_BACK_EV, CLanczosMethod::EIGENVALUE_RESULT::pDegeneratedEigenValues, CLanczosMethod::EIGENVALUE_RESULT::pDegeneratedIndex, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectors, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, CMPIManager::ReceiveVectorSync(), CMatrixOperation::CVector::ScalarMultiple(), SEND_BACK_EV, SEND_EV_TO_MASTER, CMPIManager::SendVectorSync(), CMatrixOperation::CVector::SetSize(), TOLERANE_M_10_9, CTimeMeasurement::VVDOT, and CMatrixOperation::VVDot().

Referenced by CTBMS_Solver::Launching_TBMS_Solver(), CLanczosLaunching::LaunchingLanczos(), and CSPLoop::SolveSchroedinger().

2078 {
2079  unsigned int i, j, *pTargetDeflationGroup = NULL, k;
2080  unsigned int *pTargetDeflationEV = NULL, *pEVFindIteration = NULL;
2081  int *pEigenValueCount = NULL;
2082  double *pEVTotal = NULL;
2083  int nEVTotalCount = 0;
2084  MPI_Request req[2];
2085  double Command[COMMAND_SIZE];
2086  bool bKeepWait = true;
2087  unsigned int nTargetGroup;
2088  CComplex complexResult;
2089 
2090 
2093  {
2094  pEigenValueCount = CMPIManager::GetEigenvalueCountFromDeflationGroup(nFindingDegeneratedEVCount, lpResult->nEigenValueCount);
2095 
2097  {
2098  int nDeflationStartIndex, nDeflationIndex, nTargetIndex;
2099 
2100  for( i = 0; i < nFindingDegeneratedEVCount ; ++ i)
2101  nEVTotalCount += pEigenValueCount[i];
2102 
2104  pEVTotal = (double*)malloc(sizeof(double)*nEVTotalCount);
2105  pTargetDeflationGroup = (unsigned int*)malloc(sizeof(unsigned int)*nEVTotalCount);
2106  pTargetDeflationEV = (unsigned int*)malloc(sizeof(unsigned int)*nEVTotalCount);
2107  pEVFindIteration = (unsigned int*)malloc(sizeof(unsigned int)*nEVTotalCount);
2109 
2110  nDeflationStartIndex = 0;
2111  nDeflationIndex = 0;
2112 
2113  for( i = 0; i < nFindingDegeneratedEVCount ; ++ i)
2114  {
2115  nTargetIndex = 0;
2116  for( j = nDeflationStartIndex ; j < nDeflationStartIndex + pEigenValueCount[i] ; ++j )
2117  {
2118  pTargetDeflationGroup[j] = nDeflationIndex;
2119  pTargetDeflationEV[j] = nTargetIndex++;
2120  }
2121 
2122  nDeflationStartIndex += pEigenValueCount[i];
2123  nDeflationIndex++;
2124  }
2125  }
2126 
2127  CMPIManager::GatherEVFromDeflationGroup(nFindingDegeneratedEVCount, pEVTotal, pEigenValueCount, lpResult->pEigenValues, lpResult->nEigenValueCount);
2128  CMPIManager::GatherEVIterationFromDeflationGroup(nFindingDegeneratedEVCount, (int*)pEVFindIteration, pEigenValueCount, (int*)lpResult->pEigenValueFoundIteration, lpResult->nEigenValueCount);
2129  }
2130 
2131  for( i = 0 ; i < lpResult->nEigenValueCount ; ++ i )
2132  FREE_MEM(lpResult->pEigenVectors[i]);
2133  FREE_MEM(lpResult->pEigenVectors);
2134 
2135 
2137  {
2139  {
2140  int nStartIndex = lpResult->nEigenValueCount;
2141 
2142  lpResult->nDegeneratedEigenValueCount = 0;
2144  lpResult->pDegeneratedEigenValues = (double*)malloc(sizeof(double)*(nEVTotalCount-lpResult->nEigenValueCount));
2146  for( i = pEigenValueCount[0] ; i < nEVTotalCount ; ++i )
2147  {
2148  bool bNewEigenValue = true;
2149 
2151  for( j = 0 ; j < nStartIndex ; ++j )
2152  {
2153  if (CMatrixOperation::IsSameA(pEVTotal[i], lpResult->pEigenValues[j], TOLERANE_M_10_9))
2154  {
2155  bool bDoOrthgonal = false;
2156  CMatrixOperation::CVector vectorFromDeflation;
2157  std::vector<unsigned int> vectorOrthgonalTarget;
2158 
2159  vectorOrthgonalTarget.push_back(j);
2160  bNewEigenValue = false;
2161 
2162  Command[0] = CHECK_EV_ORTH;
2163  Command[1] = (double)pTargetDeflationGroup[i];
2164  Command[2] = (double)pTargetDeflationEV[i];
2165 
2167  Command[2] = j;
2169 
2171  CMPIManager::ReceiveVectorSync(pTargetDeflationGroup[i], &vectorFromDeflation, vectorFromDeflation.GetSize(), &req[0], CMPIManager::GetDeflationComm());
2172 
2174  CMatrixOperation::VVDot(&lpResult->pEigenVectorsForAMatrix[j], &vectorFromDeflation, &complexResult);
2176 
2177  bDoOrthgonal = CMatrixOperation::IsSameA(fabs(complexResult.GetRealNumber()), 1, GENERAL_TOLERANCE);
2178  bDoOrthgonal = !bDoOrthgonal;
2179 
2180  if( bDoOrthgonal )
2181  {
2182  for( k = nStartIndex ; k < lpResult->nEigenValueCount ; ++k )
2183  {
2184  if (CMatrixOperation::IsSameA(pEVTotal[i], lpResult->pEigenValues[k], TOLERANE_M_10_9))
2185  {
2186  Command[0] = CHECK_EV_ORTH_SIMPLE;
2187  Command[1] = (double)k;
2189 
2191  CMatrixOperation::VVDot(&lpResult->pEigenVectorsForAMatrix[k], &vectorFromDeflation, &complexResult);
2193  if (CMatrixOperation::IsSameA(fabs(complexResult.GetRealNumber()), 1, GENERAL_TOLERANCE))
2194  {
2195  bDoOrthgonal = false;
2196  break;
2197  }
2198  else
2199  vectorOrthgonalTarget.push_back(k);
2200  }
2201  }
2202  }
2203 
2204  Command[0] = DO_ORTHGONAL;
2205  Command[2] = j;
2206  Command[1] = bDoOrthgonal ? 1 : 0;
2207 
2209  if( bDoOrthgonal )
2210  {
2211  int nOrthogonalTarget;
2212  int *pOrthgonalTarget = NULL;
2213  double fEigenValue;
2214 
2215  nOrthogonalTarget = vectorOrthgonalTarget.size();
2216  CMPIManager::BroadcastInt(&nOrthogonalTarget, 1);
2217 
2219  pOrthgonalTarget = (int*)malloc(sizeof(int)*nOrthogonalTarget);
2221  for( k = 0 ; k < nOrthogonalTarget ; ++ k )
2222  pOrthgonalTarget[k] = vectorOrthgonalTarget[k];
2223  CMPIManager::BroadcastInt(pOrthgonalTarget, nOrthogonalTarget);
2224 
2225  for( k = 0 ; k < nOrthogonalTarget ; ++ k )
2226  CMatrixOperation::Gram_schmidt(&lpResult->pEigenVectorsForAMatrix[pOrthgonalTarget[k]], &vectorFromDeflation);
2227 
2229  CMatrixOperation::VVDot(&lpResult->pEigenVectorsForAMatrix[j], &vectorFromDeflation, &complexResult);
2231  FREE_MEM(pOrthgonalTarget);
2232 
2233  if( complexResult == 0.0 )
2234  {
2235  CMatrixOperation::CVector vectorTemp, vectorTemp2;
2236  vectorTemp.SetSize(vectorFromDeflation.GetSize());
2237  vectorTemp2.SetSize(vectorFromDeflation.GetSize());
2238 
2240  CMatrixOperation::MVMul(pA, &vectorFromDeflation, &vectorTemp, m_nLBIndex);
2242 
2243  vectorTemp2 = vectorFromDeflation;
2244 
2246  fEigenValue = lpResult->pEigenValues[j];
2247  CMPIManager::BroadcastDouble(&fEigenValue, 1);
2248 
2249  vectorTemp2.ScalarMultiple(fEigenValue);
2250  vectorTemp2.MinusVector(&vectorTemp);
2251 
2252  double fNorm = vectorTemp2.GetNorm(true);
2253 
2255  {
2256  Command[0] = SEND_BACK_EV;
2257  Command[1] = (double)pTargetDeflationGroup[i];
2258  Command[2] = lpResult->nDegeneratedEigenValueCount+1;
2259  lpResult->pDegeneratedEigenValues[lpResult->nDegeneratedEigenValueCount++] = complexResult.GetRealNumber();
2262  CMPIManager::SendVectorSync(pTargetDeflationGroup[i], &vectorFromDeflation, vectorFromDeflation.GetSize(), &req[1], CMPIManager::GetDeflationComm());
2263  AppendEigenValue(lpResult, pEVTotal[i]);
2264  AppendEigenVector(lpResult, &vectorFromDeflation);
2265  break;
2266  }
2267  else
2268  {
2269  Command[0] = NOT_SEND_BACK_EV;
2271  }
2272  }
2273  else
2274  {
2275  Command[0] = NOT_SEND_BACK_EV;
2277  }
2278  }
2279  vectorFromDeflation.Finalize();
2280  }
2281  }
2282 
2283  if(bNewEigenValue)
2284  {
2285  CMatrixOperation::CVector vectorFromDeflation;
2286 
2287  Command[0] = SEND_EV_TO_MASTER;
2288  Command[1] = (double)pTargetDeflationGroup[i];
2289  Command[2] = (double)pTargetDeflationEV[i];
2290 
2293 
2295  CMPIManager::ReceiveVectorSync(pTargetDeflationGroup[i], &vectorFromDeflation, vectorFromDeflation.GetSize(), &req[0], CMPIManager::GetDeflationComm());
2296 
2297  AppendEigenValue(lpResult, pEVTotal[i], pEVFindIteration[i], true);
2298  AppendEigenVector(lpResult, &vectorFromDeflation, true);
2299 
2300  nStartIndex++;
2301  }
2302  }
2303 
2304  lpResult->pDegeneratedEigenValues = (double*)realloc(lpResult->pDegeneratedEigenValues, sizeof(double)*lpResult->nDegeneratedEigenValueCount);
2305 
2306  Command[0] = EXIT_MPI_WAIT;
2307  Command[1] = -1;
2310  }
2311  else
2312  {
2313  while(bKeepWait)
2314  {
2316 
2317  switch((int)Command[0])
2318  {
2319  case EXIT_MPI_WAIT:
2320  bKeepWait = false;
2321  break;
2322  case SEND_EV_TO_MASTER:
2323  {
2324  CMatrixOperation::CVector vectorFromDeflation;
2326 
2327  nTargetGroup = (unsigned int)Command[1];
2328  nTargetGroup = CMPIManager::GetTotalNodeCount() * nTargetGroup + CMPIManager::GetCurrentRank();
2329 
2330  CMPIManager::ReceiveVectorSync(nTargetGroup, &vectorFromDeflation, vectorFromDeflation.GetSize(), &req[0], MPI_COMM_WORLD);
2331 
2332  lpResult->nEigenValueCount++;
2333  AppendEigenVector(lpResult, &vectorFromDeflation, true);
2334  }
2335  break;
2336  case CHECK_EV_ORTH:
2337  {
2338  CMatrixOperation::CVector vectorFromDeflation;
2340 
2341  nTargetGroup = (unsigned int)Command[1];
2342  nTargetGroup = CMPIManager::GetTotalNodeCount() * nTargetGroup + CMPIManager::GetCurrentRank();
2343 
2344  CMPIManager::ReceiveVectorSync(nTargetGroup, &vectorFromDeflation, vectorFromDeflation.GetSize(), &req[0], MPI_COMM_WORLD);
2346  CMatrixOperation::VVDot(&lpResult->pEigenVectorsForAMatrix[(int)Command[2]], &vectorFromDeflation, &complexResult);
2348 
2349  while(1)
2350  {
2352  if( DO_ORTHGONAL == (int)Command[0] )
2353  break;
2354  else if( CHECK_EV_ORTH_SIMPLE == (int)Command[0] )
2355  {
2357  CMatrixOperation::VVDot(&lpResult->pEigenVectorsForAMatrix[(int)Command[1]], &vectorFromDeflation, &complexResult);
2359  }
2360  }
2361 
2362  if( DO_ORTHGONAL == (int)Command[0] && 1 == (int)Command[1])
2363  {
2364 
2365  int nOrthogonalTarget;
2366  int *pOrthgonalTarget = NULL;
2367  double fEigenValue;
2368 
2369  CMPIManager::BroadcastInt(&nOrthogonalTarget, 1);
2370 
2372  pOrthgonalTarget = (int*)malloc(sizeof(int)*nOrthogonalTarget);
2374  CMPIManager::BroadcastInt(pOrthgonalTarget, nOrthogonalTarget);
2375 
2376 
2377  for( k = 0 ; k < nOrthogonalTarget ; ++ k )
2378  CMatrixOperation::Gram_schmidt(&lpResult->pEigenVectorsForAMatrix[pOrthgonalTarget[k]], &vectorFromDeflation);
2379 
2381  CMatrixOperation::VVDot(&lpResult->pEigenVectorsForAMatrix[(int)Command[2]], &vectorFromDeflation, &complexResult);
2383  FREE_MEM(pOrthgonalTarget);
2384 
2385  if( complexResult == 0.0 )
2386  {
2387  CMatrixOperation::CVector vectorTemp, vectorTemp2;
2388  vectorTemp.SetSize(vectorFromDeflation.GetSize());
2389  vectorTemp2.SetSize(vectorFromDeflation.GetSize());
2390 
2392  CMatrixOperation::MVMul(pA, &vectorFromDeflation, &vectorTemp, m_nLBIndex);
2394 
2395  vectorTemp2 = vectorFromDeflation;
2396  CMPIManager::BroadcastDouble(&fEigenValue, 1);
2397  vectorTemp2.ScalarMultiple(fEigenValue);
2398  vectorTemp2.MinusVector(&vectorTemp);
2399  double fNorm = vectorTemp2.GetNorm(true);
2400  }
2401 
2403  if( SEND_BACK_EV == (int)Command[0] )
2404  {
2405  CMPIManager::SendVectorSync(nTargetGroup, &vectorFromDeflation, vectorFromDeflation.GetSize(), &req[1], MPI_COMM_WORLD);
2406  lpResult->nEigenValueCount++;
2407  lpResult->nDegeneratedEigenValueCount++;
2408  AppendEigenVector(lpResult, &vectorFromDeflation);
2409  }
2410  }
2411 
2412  vectorFromDeflation.Finalize();
2413  }
2414  break;
2415  }
2416  }
2417  }
2418  }
2419  else
2420  {
2421  int nSentEVIndex = -1;
2422 
2424  lpResult->pDegeneratedIndex = (int*)malloc(sizeof(int)*lpResult->nEigenValueCount);
2426  for( i = 0 ; i < lpResult->nEigenValueCount ; ++i)
2427  lpResult->pDegeneratedIndex[i] = -1;
2428 
2430  {
2432  while(bKeepWait)
2433  {
2435  switch((int)Command[0])
2436  {
2437  case EXIT_MPI_WAIT:
2439  bKeepWait = false;
2440  break;
2441  case CHECK_EV_ORTH:
2442  case SEND_EV_TO_MASTER:
2443  nTargetGroup = (unsigned int)Command[1];
2444  if (nTargetGroup == CMPIManager::GetLanczosGroupIndex())
2445  {
2447  nSentEVIndex = (int)Command[2];
2449  }
2450  break;
2451  case SEND_BACK_EV:
2452  nTargetGroup = (unsigned int)Command[1];
2453  if (nTargetGroup == CMPIManager::GetLanczosGroupIndex())
2454  {
2455  lpResult->pDegeneratedIndex[nSentEVIndex] = (unsigned int)Command[2];
2458  }
2459  break;
2460  }
2461  }
2462  }
2463  else
2464  {
2465  while(bKeepWait)
2466  {
2468  switch((int)Command[0])
2469  {
2470  case EXIT_MPI_WAIT:
2471  bKeepWait = false;
2472  break;
2473  case SEND_EV_TO_MASTER:
2474  case CHECK_EV_ORTH:
2475  {
2476  int nLanczosGroupSize = CMPIManager::GetTotalNodeCount();
2477  nSentEVIndex = (int)Command[2];
2479  }
2480  break;
2481  case SEND_BACK_EV:
2482  lpResult->pDegeneratedIndex[nSentEVIndex] = (unsigned int)Command[2];
2484  break;
2485  }
2486  }
2487  }
2488  }
2489 
2491 
2492  FREE_MEM(pEVTotal);
2493  FREE_MEM(pEigenValueCount);
2494  FREE_MEM(pEVFindIteration);
2495  FREE_MEM(pTargetDeflationGroup);
2496 }
static void GatherEVIterationFromDeflationGroup(int nSourceCount, int *pReceiveBuffer, int *pSourceCount, int *pSendBuffer, int nSendCount)
Gather eigenvalue from deflation group.
Definition: MPIManager.h:74
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
static void ReceiveVectorSync(int nSourceRank, CMatrixOperation::CVector *pVector, int nSize, MPI_Request *req, MPI_Comm commWorld=MPI_COMM_NULL)
Receiving Vector with sync.
Definition: MPIManager.cpp:858
#define GENERAL_TOLERANCE
General tolerance definition.
Definition: Global.h:47
unsigned int GetSize()
Return Vector elements size.
#define CHECK_EV_ORTH_SIMPLE
Definition: Global.h:108
static void MVMul(CCSR *pAMatrix, CVector *pVector, CVector *pResult, int nLBIndex)
Matrix and vector multiple operation.
static MPI_Comm GetDeflationComm()
Getting Lanczos computing group MPI_Comm.
Definition: MPIManager.h:77
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
#define TOLERANE_M_10_9
10^-9
Definition: Global.h:48
#define SEND_BACK_EV
Definition: Global.h:105
static int GetCurrentLoadBalanceCount(int nLBIndex)
Get Current node's rank load balancing number.
Definition: MPIManager.cpp:608
static MPI_Comm GetLanczosComputComm()
Definition: MPIManager.h:76
static int GetTotalNodeCount()
Definition: MPIManager.h:42
void ScalarMultiple(CComplex Scalar)
Scalar multiple operation.
#define EXIT_MPI_WAIT
Command for Deflation Lanczos.
Definition: Global.h:102
static void AppendEigenValue(LPEIGENVALUE_RESULT lpResult, double fEigenValue, unsigned int nFindIteration=DEGENERATED_INDEX, bool bInsertFirst=false)
Checking is aborting computation flag.
static unsigned int GetLanczosGroupIndex()
Definition: MPIManager.h:80
static bool IsDeflationRoot()
Checking is root rank of Lanczos computation.
Definition: MPIManager.h:69
static int GetCurrentRank()
Definition: MPIManager.h:40
#define NOT_SEND_BACK_EV
Definition: Global.h:106
static bool IsSame(double operand1, double operand2, double tol)
Compare two double variable.
static void ExchangeCommand(double *pfCommand, MPI_Comm comm)
Gather eigenvalue finding iteration number from deflation group.
Definition: MPIManager.cpp:826
static int * GetEigenvalueCountFromDeflationGroup(int nDeflationGroupCount, int nLocalEVCount)
Checking is root rank of Deflation computation.
Definition: MPIManager.cpp:744
CMatrixOperation::CVector * pEigenVectorsForAMatrix
Definition: LanczosMethod.h:33
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
static void BroadcastInt(int *pValue, unsigned int nSize, int nRootRank=0, MPI_Comm comm=MPI_COMM_NULL)
Broadcst boolean value.
Definition: MPIManager.cpp:506
This class for describing vector for Lanczos method.
#define CHECK_EV_ORTH
Definition: Global.h:103
static bool IsSameA(double operand1, double operand2, double tol)
Compare two double variable.
unsigned int * pEigenValueFoundIteration
Definition: LanczosMethod.h:37
This class for complex operation and saving value.
Definition: Complex.h:16
#define DO_ORTHGONAL
Definition: Global.h:104
static bool IsLanczosComputeRoot()
Barrier current deflation group.
Definition: MPIManager.h:68
#define SEND_EV_TO_MASTER
Definition: Global.h:107
static int Gram_schmidt(CVector *pVect1, CVector *pVect2)
Added by jhkang, matrix operation.
static bool VVDot(CVector *pVector1, CVector *pVector2, CComplex *pResult)
Between vectors dot product operation.
static void GatherEVFromDeflationGroup(int nSourceCount, double *pReceiveBuffer, int *pSourceCount, double *pSendBuffer, int nSendCount)
Definition: MPIManager.h:73
double GetNorm(bool bMPI=false)
Getting norm of vector.
void MinusVector(CVector *vector)
Do minus operation between vectors.
static void BroadcastDouble(double *pValue, unsigned int nSize, int nRootRank=0, MPI_Comm comm=MPI_COMM_NULL)
Broadcst boolean value.
Definition: MPIManager.cpp:486
static void AppendEigenVector(LPEIGENVALUE_RESULT lpResult, CMatrixOperation::CVector *pEigenVector, bool bInsertFirst=false)
Appending eigenvector into master group if degenerated eigenvalue is finded.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19
void SetSize(unsigned int nSize)
Set Vector elements size.
static void BarrierAllComm()
Is Multilevel MPI Setting.
Definition: MPIManager.cpp:733
#define COMMAND_SIZE
Definition: Global.h:110
double GetRealNumber() const
Get real part.
Definition: Complex.h:24
static void SendVectorSync(int nTargetRank, CMatrixOperation::CVector *pVector, int nSize, MPI_Request *req, MPI_Comm commWorld=MPI_COMM_NULL)
Getting Deflation computing group MPI_Comm.
Definition: MPIManager.cpp:838
void Finalize()
Free allocated memory for vector elements.

Here is the call graph for this function:

Here is the caller graph for this function:

int CLanczosMethod::RangeChecking ( int  nEigenValueCount,
double *  pEigenValues,
double *  pEiegnVectors,
double *  pRangeCheckingEigenValues,
double *  pRangeCheckingVectors,
int  nIterationCount 
)
private

Checking eigenvalue range.

Parameters
nEigenValueCountThe numbers of eigenvalue that was calculated by before processing
pEigenValuesEigenvalues that was calculated by before processing
pEigneVectorsEigenvectors that was calculated by before processing
[out]pRangeCheckingEigenValuesRangechcked eigenvalues
[out]pRangeCheckingVectorsRangechcked eigenvectors
nIterationCountIteration count until eigenvalue solving
Returns
The numbers of rangechecked eigenvalues

Definition at line 1216 of file LanczosMethod.cpp.

References ERROR_MALLOC.

1217 {
1218  int i, nRangecheckedCount = 0;
1219 
1220  if (NULL == pRangeCheckingEigenValues || NULL == pRangeCheckingVectors || NULL == m_pRangecheckedIndex)
1221  throw ERROR_MALLOC;
1222 
1223  for (i = 0; i < nEigenValueCount; i++)
1224  {
1225  if (pEigenValues[i] >= m_fEigenvalueMin && pEigenValues[i] <= m_fEignevalueMax)
1226  m_pRangecheckedIndex[nRangecheckedCount++] = i;
1227  }
1228 
1229  ExtractDoubleValues(pRangeCheckingEigenValues, pEigenValues, nEigenValueCount, m_pRangecheckedIndex, nRangecheckedCount, false);
1230  ExtractDoubleVector(nIterationCount, pRangeCheckingVectors, pEiegnVectors, nEigenValueCount, m_pRangecheckedIndex, nRangecheckedCount, false);
1231 
1232  return nRangecheckedCount;
1233 }
const unsigned long ERROR_MALLOC
Error code that means error occur during memory allocation.
Definition: Global.h:62
double m_fEignevalueMax
Maxinum range of eigenvalue.
int * m_pRangecheckedIndex
A temporary index array for range check function.
void ExtractDoubleValues(double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
Extract value by condition that described in filter.
void ExtractDoubleVector(unsigned int nVectorsize, double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
Extract vectors by condition that described in filter.
double m_fEigenvalueMin
Minimum range of eigenvalue.
void CLanczosMethod::RecalcuWaveFunction ( CLanczosMethod::LPEIGENVALUE_RESULT  lpResult)

Recalculating wavefunction after merging degenerated eigenvalues.

Parameters
lpResultStrcuture that include eigen values and eigen vectors

Definition at line 1937 of file LanczosMethod.cpp.

References CComplex::GetAbsolute(), CMatrixOperation::CVector::GetAt(), CMPIManager::GetCurrentLoadBalanceCount(), CMPIManager::IsDeflationRoot(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, CLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions, and CMatrixOperation::CVector::SetAt().

Referenced by CTBMS_Solver::Launching_TBMS_Solver(), CLanczosLaunching::LaunchingLanczos(), and CSPLoop::SolveSchroedinger().

1938 {
1939 
1941  return;
1942 
1943  unsigned int i, j, nIndex = 0;
1944  CComplex tempResult, complexNumber;
1945  double fTempResult;
1946 
1947  for (i = 0; i < lpResult->nEigenValueCount; i++)
1948  {
1949  nIndex = 0;
1950  fTempResult = 0.;
1952  {
1953  complexNumber = lpResult->pEigenVectorsForAMatrix[i].GetAt(j);
1954  double absoluteValue = complexNumber.GetAbsolute();
1955  fTempResult += (absoluteValue*absoluteValue);
1956  if (9 == j % 10)
1957  {
1958  lpResult->pWaveFunctions[i].SetAt(nIndex++, fTempResult, 0);
1959  fTempResult = 0.;
1960  }
1961  }
1962  }
1963 
1964 }
double GetAbsolute()
Get Absolute value of complex number.
Definition: Complex.cpp:23
static int GetCurrentLoadBalanceCount(int nLBIndex)
Get Current node's rank load balancing number.
Definition: MPIManager.cpp:608
CComplex GetAt(unsigned int nIndex)
Get element value from specific index.
static bool IsDeflationRoot()
Checking is root rank of Lanczos computation.
Definition: MPIManager.h:69
CMatrixOperation::CVector * pEigenVectorsForAMatrix
Definition: LanczosMethod.h:33
This class for complex operation and saving value.
Definition: Complex.h:16
CMatrixOperation::CVector * pWaveFunctions
Definition: LanczosMethod.h:38
void SetAt(unsigned int nIndex, CComplex value)
Set element value in specific index, Call by value.

Here is the call graph for this function:

Here is the caller graph for this function:

void CLanczosMethod::ReleaseResult ( LPEIGENVALUE_RESULT  lpResult,
bool  bReleaseStruct 
)
static

Release memory for lanczos method result.

Parameters
lpResultRelease target strcutre address
bReleaseStructRelease structure self or not

Definition at line 1524 of file LanczosMethod.cpp.

References CMatrixOperation::CVector::Finalize(), FREE_MEM, CTimeMeasurement::FREE_MEM, CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CLanczosMethod::EIGENVALUE_RESULT::nDegeneratedEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectors, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, and CLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions.

Referenced by CTBMS_Solver::Launching_TBMS_Solver(), and CSPLoop::SolveSchroedinger().

1525 {
1526  unsigned int i;
1527  if (NULL == lpResult)
1528  return;
1529 
1531 
1532  FREE_MEM(lpResult->pEigenValues);
1533  FREE_MEM(lpResult->pEigenValueFoundIteration);
1534 
1535  if (NULL != lpResult->pWaveFunctions)
1536  {
1537  for (i = 0; i < lpResult->nEigenValueCount / 10; i++)
1538  lpResult->pWaveFunctions[i].Finalize();
1539 
1540  delete[] lpResult->pWaveFunctions;
1541  lpResult->pWaveFunctions = NULL;
1542  }
1543 
1544  if (NULL != lpResult->pEigenVectorsForAMatrix)
1545  {
1546  for (i = 0; i < lpResult->nEigenValueCount; i++)
1547  lpResult->pEigenVectorsForAMatrix[i].Finalize();
1548 
1549  delete[] lpResult->pEigenVectorsForAMatrix;
1550  lpResult->pEigenVectorsForAMatrix = NULL;
1551  }
1552 
1553  if( NULL != lpResult->pEigenVectors)
1554  {
1555  for (i = 0; i < lpResult->nEigenValueCount - lpResult->nDegeneratedEigenValueCount ; i++)
1556  FREE_MEM(lpResult->pEigenVectors[i]);
1557 
1558  FREE_MEM(lpResult->pEigenVectors);
1559  }
1560 
1561  if (bReleaseStruct)
1562  FREE_MEM(lpResult);
1564 }
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19

Here is the call graph for this function:

Here is the caller graph for this function:

int CLanczosMethod::ResultCompare ( const void *  pA,
const void *  pB 
)
static

Comparing computing result function for quick sorting.

Parameters
pAComparing result A
pBComparing result B
Returns
Comparing result

Definition at line 2524 of file LanczosMethod.cpp.

References CLanczosMethod::RESULT_SORT_DATA::fEigenValue, and CLanczosMethod::RESULT_SORT_DATA::nEigenValueFoundIteration.

Referenced by SortSolution().

2525 {
2528 
2529 
2530  if (lpA->fEigenValue > lpB->fEigenValue)
2531  return 1;
2532  else if(lpA->fEigenValue < lpB->fEigenValue)
2533  return -1;
2534  else
2535  {
2536  if( (unsigned int)lpA->nEigenValueFoundIteration > (unsigned int)lpB->nEigenValueFoundIteration )
2537  return 1;
2538  else
2539  return -1;
2540  }
2541 
2542  return -1;
2543 }
Structure for eigenvalue result sorting.
Definition: LanczosMethod.h:47
struct CLanczosMethod::RESULT_SORT_DATA * LPRESULT_SORT_DATA

Here is the caller graph for this function:

void CLanczosMethod::SaveLanczosResult ( CLanczosMethod::LPEIGENVALUE_RESULT  lpResult,
bool  bCalcuEigenvalue,
bool  bWaveFunction,
double *  pKValue,
int  nRepeatCount 
)
static

Saving Lanczos computation result into file.

Parameters
lpResultLanczos method result
nMatrixSizeHamiltonian matrix size
bCalcuEigenvalueFlag for result including eigenvector or not
bWaveFunctionFlag for result including wavefunction or not
pKValueK points
nRepeatCountLanczos method repeat count

Definition at line 1700 of file LanczosMethod.cpp.

References CMPIManager::Barrier(), DEGENERATED_INDEX, CTimeMeasurement::FILEIO, CMatrixOperation::CVector::GetAt(), CMPIManager::GetCurrentRank(), CComplex::GetImaginaryNumber(), CComplex::GetRealNumber(), CMatrixOperation::CVector::GetSize(), CMPIManager::GetTotalNodeCount(), CMPIManager::IsDeflationRoot(), CMPIManager::IsRootRank(), CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, and CLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions.

Referenced by CTBMS_Solver::Launching_TBMS_Solver(), and CLanczosLaunching::LaunchingLanczos().

1701 {
1702  if (NULL == lpResult)
1703  return;
1704 
1706  FILE *out;
1707  char szFileName[1024], szBuffer[1024];
1708  std::string writeString;
1709  unsigned int i, j, k;
1710  char szFileOpt[3] = "wt";
1711  double fK[3];
1712 
1713  if( 0 != nRepeatCount )
1714  strcpy(szFileOpt, "at");
1715 
1716  if( NULL == pKValue )
1717  {
1718  fK[0] = 0; fK[1] = 0; fK[2] = 0;
1719  }
1720  else
1721  {
1722  fK[0] = pKValue[0]; fK[1] = pKValue[1]; fK[2] = pKValue[2];
1723  }
1724 
1725 #ifdef _WIN32
1726  _mkdir("result");
1727 #else
1728  mkdir("result", 0777);
1729 #endif
1730 
1732  {
1733 #ifdef _WIN32
1734  if (NULL != (out = fopen("result\\eigenvalues.txt", szFileOpt)))
1735 #else //_WIN32
1736  if (NULL != (out = fopen("result/eigenvalues.txt", szFileOpt)))
1737 #endif //_WIN32
1738  {
1739  if( NULL != pKValue )
1740  sprintf(szBuffer, "---[ev #%d %8.6f %8.6f %8.6f]---\n\n", nRepeatCount, pKValue[0], pKValue[1], pKValue[2]);
1741  else
1742  sprintf(szBuffer, "---[ev]---\n\n");
1743 
1744  fputs(szBuffer, out);
1745  for (i = 0; i < lpResult->nEigenValueCount; i++)
1746  {
1747 
1748  if( DEGENERATED_INDEX != lpResult->pEigenValueFoundIteration[i] )
1749  sprintf(szBuffer, "[ev %2d] %18.16f - Iteration [#%7d]\n", i, lpResult->pEigenValues[i], lpResult->pEigenValueFoundIteration[i]);
1750  else
1751  sprintf(szBuffer, "[ev %2d] %18.16f - Degenerated eigenvalue\n", i, lpResult->pEigenValues[i]);
1752 
1753  fputs(szBuffer, out);
1754  }
1755 
1756  /*nEigenValueCount = i;
1757  if( lpResult->nDegeneratedEigenValueCount > 0 )
1758  {
1759  for(i = 0; i < lpResult->nDegeneratedEigenValueCount; ++i)
1760  {
1761  sprintf(szBuffer, "[ev %2d] %18.16f - Degenerated eigenvalue\n", nEigenValueCount + i, lpResult->pDegeneratedEigenValues[i]);
1762  fputs(szBuffer, out);
1763  }
1764  }*/
1765 
1766  fputs("\n\n", out);
1767  fclose(out);
1768  }
1769  }
1770 
1771  if (bCalcuEigenvalue && NULL != lpResult->pEigenVectorsForAMatrix)
1772  {
1774  {
1775  for (j = 0; j < lpResult->nEigenValueCount; j++)
1776  {
1777 #ifdef _WIN32
1778  sprintf(szFileName, "result\\eigenvector_%02d_%02d.txt", nRepeatCount, j);
1779 #else //_WIN32
1780  sprintf(szFileName, "result/eigenvector_%02d_%02d.txt", nRepeatCount, j);
1781 #endif //_WIN32
1782  for (k = 0; k < CMPIManager::GetTotalNodeCount(); ++k)
1783  {
1784  if (k == CMPIManager::GetCurrentRank())
1785  {
1786  if (NULL != (out = fopen(szFileName, "at")))
1787  {
1788 
1789  for (i = 0; i < lpResult->pEigenVectorsForAMatrix[j].GetSize(); i++)
1790  {
1791  sprintf(szBuffer, "%16.16f %16.16f\n",
1792  lpResult->pEigenVectorsForAMatrix[j].GetAt(i).GetRealNumber(),
1794 
1795  writeString += szBuffer;
1796 
1797  if (i % 100)
1798  {
1799  fputs(writeString.c_str(), out);
1800  writeString.clear();
1801  }
1802  }
1803 
1804  if (!writeString.empty())
1805  {
1806  fputs(writeString.c_str(), out);
1807  writeString.clear();
1808  }
1809 
1810  fclose(out);
1811  }
1812  }
1813 #ifndef DISABLE_MPI_ROUTINE
1815 #endif //DISABLE_MPI_ROUTINE
1816  }
1817  }
1818  }
1819  }
1820 
1821  if (bWaveFunction && NULL != lpResult->pWaveFunctions)
1822  {
1824  {
1825  for (j = 0; j < lpResult->nEigenValueCount; j++)
1826  {
1827 #ifdef _WIN32
1828  sprintf(szFileName, "result\\wavefunction_%02d_%02d.txt", nRepeatCount, j);
1829 #else //_WIN32
1830  sprintf(szFileName, "result/wavefunction_%02d_%02d.txt", nRepeatCount, j);
1831 #endif //_WIN32
1832  for (k = 0; k < CMPIManager::GetTotalNodeCount(); ++k)
1833  {
1834  if (k == CMPIManager::GetCurrentRank())
1835  {
1836  if (NULL != (out = fopen(szFileName, "at")))
1837  {
1838  for (i = 0; i < lpResult->pWaveFunctions[j].GetSize(); i++)
1839  {
1840  sprintf(szBuffer, "%16.16f\n",
1841  lpResult->pWaveFunctions[j].GetAt(i).GetRealNumber());
1842 
1843  writeString += szBuffer;
1844 
1845  if (i % 100)
1846  {
1847  fputs(writeString.c_str(), out);
1848  writeString.clear();
1849  }
1850  }
1851 
1852  if (!writeString.empty())
1853  {
1854  fputs(writeString.c_str(), out);
1855  writeString.clear();
1856  }
1857  fclose(out);
1858  }
1859  }
1860 #ifndef DISABLE_MPI_ROUTINE
1862 #endif //DISABLE_MPI_ROUTINE
1863  }
1864  }
1865  }
1866  }
1867 
1869 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
unsigned int GetSize()
Return Vector elements size.
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
CComplex GetAt(unsigned int nIndex)
Get element value from specific index.
static int GetTotalNodeCount()
Definition: MPIManager.h:42
static bool IsDeflationRoot()
Checking is root rank of Lanczos computation.
Definition: MPIManager.h:69
static int GetCurrentRank()
Definition: MPIManager.h:40
static void Barrier()
Definition: MPIManager.h:67
CMatrixOperation::CVector * pEigenVectorsForAMatrix
Definition: LanczosMethod.h:33
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
unsigned int * pEigenValueFoundIteration
Definition: LanczosMethod.h:37
CMatrixOperation::CVector * pWaveFunctions
Definition: LanczosMethod.h:38
double GetImaginaryNumber() const
Get imaginary part.
Definition: Complex.h:25
#define DEGENERATED_INDEX
Definition: Global.h:56
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

Here is the caller graph for this function:

void CLanczosMethod::SetLBIndex ( int  nLBIndex)
inline

Definition at line 55 of file LanczosMethod.h.

References m_nLBIndex.

Referenced by CSPLoop::BuildHamiltonian(), CTBMS_Solver::Launching_TBMS_Solver(), and CLanczosLaunching::LaunchingLanczos().

55 { m_nLBIndex = nLBIndex; };

Here is the caller graph for this function:

void CLanczosMethod::ShowLanczosResult ( CLanczosMethod::LPEIGENVALUE_RESULT  lpResult,
bool  bCalculateEigenVectors,
bool  bCalculateWaveFunction,
double *  pKValue,
int  nRepeatCount 
)
static

Showing calculating result into screen.

Parameters
lpResultStrcuture that include eigen values and eigen vectors
lpParamStrcuture that include options parameter for program launching
lpMapInfoStructure that include Atom map
pKValueK values that current stage
nRepeatCountNumber of repeat

Definition at line 1878 of file LanczosMethod.cpp.

References DEGENERATED_INDEX, CMPIManager::IsDeflationRoot(), CMPIManager::IsRootRank(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, and CUtility::ShowMsg().

Referenced by CTBMS_Solver::Launching_TBMS_Solver(), CLanczosLaunching::LaunchingLanczos(), and CSPLoop::SolveSchroedinger().

1879 {
1880  char szMsg[1024];
1881  int i;
1882 
1884  return;
1885 
1886  if (NULL != lpResult)
1887  {
1888  CUtility::ShowMsg("\n--------------------------------------------------\nEigen values\n\n");
1889  for (i = 0; i < (int)lpResult->nEigenValueCount; ++i)
1890  {
1891  if( DEGENERATED_INDEX != lpResult->pEigenValueFoundIteration[i] )
1892  sprintf(szMsg, "[ev %2d] %18.16f - Iteration [#%7d]\n", i, lpResult->pEigenValues[i], lpResult->pEigenValueFoundIteration[i]);
1893  else
1894  sprintf(szMsg, "[ev %2d] %18.16f - Degenerated eigenvalue\n", i, lpResult->pEigenValues[i]);
1895  CUtility::ShowMsg(szMsg);
1896  }
1897  CUtility::ShowMsg("--------------------------------------------------\n");
1898  }
1899 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
static bool IsDeflationRoot()
Checking is root rank of Lanczos computation.
Definition: MPIManager.h:69
unsigned int * pEigenValueFoundIteration
Definition: LanczosMethod.h:37
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
#define DEGENERATED_INDEX
Definition: Global.h:56

Here is the call graph for this function:

Here is the caller graph for this function:

void CLanczosMethod::ShowLanczosWorkingTime ( )
static

Showing operation time into screen.

Definition at line 1901 of file LanczosMethod.cpp.

References CTimeMeasurement::COMM, CTimeMeasurement::EVALUE, CTimeMeasurement::EVALUE_FREE_MEM, CTimeMeasurement::EVALUE_MALLOC, CTimeMeasurement::FILEIO, CTimeMeasurement::FREE_MEM, CTimeMeasurement::GetTakeTime(), CMPIManager::GetTotalNodeCount(), CTimeMeasurement::GetTotalTakeTime(), CMPIManager::IsDeflationRoot(), CMPIManager::IsRootRank(), CTimeMeasurement::MALLOC, CTimeMeasurement::MV_COMM, CTimeMeasurement::MV_FREE_MEM, CTimeMeasurement::MV_MALLOC, CTimeMeasurement::MVMUL, CUtility::ShowMsg(), CTimeMeasurement::VV_COMM, and CTimeMeasurement::VVDOT.

Referenced by CSPLoop::executeSPLoop(), CTBMS_Solver::Launching_TBMS_Solver(), and CLanczosLaunching::LaunchingLanczos().

1902 {
1903  char szMsg[1024];
1904  int i;
1905 
1907  return;
1908 
1914  double fComputingTime = CTimeMeasurement::GetTotalTakeTime() - fEvalTime - fCommTime - fMemTime - fMVMulTime - fVVTime - CTimeMeasurement::GetTakeTime(CTimeMeasurement::FILEIO);
1915 
1916 #ifdef DOING_MEASUREMENT
1917  CUtility::ShowMsg("\n--------------------------------------\nTime evaluation\n\n");
1918  sprintf(szMsg, "%d nodes used\nTotal time [ %f\tsec ]\nComputing [ %lf\tsec ]\nEvalue takes [ %lf\tsec ]\nMPI takes [ %lf\tsec ]\nMVMul takes [ %lf\tsec ]\nVVDot takes [ %lf\tsec ]\nMem Op takes [ %lf\tsec ]\nResult written [ %lf\tsec ]\n",
1921  fComputingTime,
1922  fEvalTime,
1923  fCommTime,
1924  fMVMulTime,
1925  fVVTime,
1926  fMemTime,
1928 
1929  CUtility::ShowMsg(szMsg);
1930  CUtility::ShowMsg("--------------------------------------\n");
1931 #endif //DOING_MEASUREMENT
1932 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
static int GetTotalNodeCount()
Definition: MPIManager.h:42
static double GetTotalTakeTime()
static bool IsDeflationRoot()
Checking is root rank of Lanczos computation.
Definition: MPIManager.h:69
static double GetTakeTime(MEASUREMENT_INDEX index)
Get taken time for part.
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34

Here is the call graph for this function:

Here is the caller graph for this function:

void CLanczosMethod::SortSolution ( LPEIGENVALUE_RESULT  lpResult)

Sorting computing eigenvalue.

Parameters
lpResultComputing result for sorting

Definition at line 2548 of file LanczosMethod.cpp.

References CLanczosMethod::RESULT_SORT_DATA::fEigenValue, CMatrixOperation::CVector::Finalize(), FREE_MEM, CMPIManager::GetCurrentLoadBalanceCount(), CMPIManager::IsRootRank(), CTimeMeasurement::MALLOC, CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::RESULT_SORT_DATA::nEigenValueFoundIteration, CLanczosMethod::RESULT_SORT_DATA::nOriginalIndex, CLanczosMethod::EIGENVALUE_RESULT::pEigenValueFoundIteration, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, CLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions, ResultCompare(), and CMatrixOperation::CVector::SetSize().

Referenced by CTBMS_Solver::Launching_TBMS_Solver(), and CSPLoop::SolveSchroedinger().

2549 {
2550 
2551  LPRESULT_SORT_DATA lpData = NULL;
2552  int *pOrder = NULL;
2553  unsigned int i;
2554  CMatrixOperation::CVector *pVectorEV = NULL, *pVectorWF = NULL;
2555 
2556  if (lpResult->nEigenValueCount <= 1 || false == CMPIManager::IsRootRank())
2557  return;
2558 
2560  pOrder = (int*)malloc(sizeof(int)*lpResult->nEigenValueCount*2);
2561  if( NULL != lpResult->pEigenVectorsForAMatrix )
2562  pVectorEV = new CMatrixOperation::CVector[lpResult->nEigenValueCount];
2563  if( NULL != lpResult->pWaveFunctions )
2564  pVectorWF = new CMatrixOperation::CVector[lpResult->nEigenValueCount];
2566 
2568  {
2570  lpData = (LPRESULT_SORT_DATA)malloc(sizeof(RESULT_SORT_DATA)*lpResult->nEigenValueCount);
2572 
2573  for( i = 0 ; i < lpResult->nEigenValueCount ; ++ i )
2574  {
2575  lpData[i].fEigenValue = lpResult->pEigenValues[i];
2576  lpData[i].nEigenValueFoundIteration = lpResult->pEigenValueFoundIteration[i];
2577  lpData[i].nOriginalIndex = i;
2578  }
2579 
2580  qsort(lpData, lpResult->nEigenValueCount, sizeof(RESULT_SORT_DATA), CLanczosMethod::ResultCompare);
2581 
2582  for( i = 0 ; i < lpResult->nEigenValueCount ; ++ i )
2583  {
2584  pOrder[i*2] = i;
2585  pOrder[i*2+1] = lpData[i].nOriginalIndex;
2586  lpResult->pEigenValues[i] = lpData[i].fEigenValue;
2587  lpResult->pEigenValueFoundIteration[i] = lpData[i].nEigenValueFoundIteration;
2588  }
2589  }
2590 
2591  /*if( CMPIManager::IsMultiLevelMPI() )
2592  CMPIManager::BroadcastInt(pOrder, lpResult->nEigenValueCount*2);*/
2593 
2594  for( i = 0; i < lpResult->nEigenValueCount ; ++ i)
2595  {
2596  if( NULL != lpResult->pEigenVectorsForAMatrix )
2597  {
2599  pVectorEV[i] = lpResult->pEigenVectorsForAMatrix[i];
2600  }
2601  if( NULL != lpResult->pWaveFunctions )
2602  {
2604  pVectorWF[i] = lpResult->pWaveFunctions[i];
2605  }
2606  }
2607 
2608  for( i = 0; i < lpResult->nEigenValueCount ; ++ i)
2609  {
2610  if( NULL != lpResult->pEigenVectorsForAMatrix )
2611  lpResult->pEigenVectorsForAMatrix[pOrder[i*2]] = pVectorEV[pOrder[i*2+1]];
2612  if( NULL != lpResult->pWaveFunctions )
2613  lpResult->pWaveFunctions[pOrder[i*2]] = pVectorWF[pOrder[i*2+1]];
2614  }
2615 
2616  for( i = 0; i < lpResult->nEigenValueCount ; ++ i)
2617  {
2618  if( NULL != lpResult->pEigenVectorsForAMatrix )
2619  pVectorEV[i].Finalize();
2620  if( NULL != lpResult->pWaveFunctions )
2621  pVectorWF[i].Finalize();
2622  }
2623  if( NULL != lpResult->pEigenVectorsForAMatrix )
2624  delete[] pVectorEV;
2625  if( NULL != lpResult->pWaveFunctions )
2626  delete[] pVectorWF;
2627 
2628  FREE_MEM(lpData);
2629  FREE_MEM(pOrder);
2630 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
static void MeasurementEnd(MEASUREMENT_INDEX index)
Measurement end for part.
struct CLanczosMethod::RESULT_SORT_DATA * LPRESULT_SORT_DATA
static int GetCurrentLoadBalanceCount(int nLBIndex)
Get Current node's rank load balancing number.
Definition: MPIManager.cpp:608
static int ResultCompare(const void *pA, const void *pB)
Comparing computing result function for quick sorting.
static void MeasurementStart(MEASUREMENT_INDEX index)
Measurement start for part.
This class for describing vector for Lanczos method.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19
void SetSize(unsigned int nSize)
Set Vector elements size.
void Finalize()
Free allocated memory for vector elements.

Here is the call graph for this function:

Here is the caller graph for this function:

int CLanczosMethod::SpuriousRitzValueChecking ( int  nEigenValueCount,
double *  pEigenValues,
double *  pEigenVectors,
double *  pNonSpuriousValues,
double *  pNonSpuriousVectors,
double  fANorm,
int  nIterationCount 
)
private

Checking spurious values.

Parameters
nEigenValueCountThe numbers of eigenvalue that was calculated by before processing
pEigenValuesEigenvalues that was calculated by before processing
pEigneVectorsEigenvectors that was calculated by before processing
[out]pNonSpuriousValuesNon Spurious eigenvalues
[out]pNonSpuriousVectorsNon Spurious eigenvectors
fANormanorm value
nIterationCountIteration count until eigenvalue solving
Returns
The numbers of non spurious eigenvalues

Definition at line 1245 of file LanczosMethod.cpp.

References ERROR_MALLOC.

1246 {
1247  if (0 == nEigenValueCount)
1248  return 0;
1249 
1250  if (NULL == pNonSpuriousValues || NULL == pNonSpuriousVectors || NULL == m_pNonSpuriousValueIndex)
1251  throw ERROR_MALLOC;
1252 
1253  double eps = 1e-8;
1254  double fTotal = eps;
1255  int i, nNonSpuriousValue = 0;
1256 
1257  for (i = 0; i < nEigenValueCount; i++)
1258  {
1259  if (fabs(pEigenVectors[i*nIterationCount]) > fTotal)
1260  m_pNonSpuriousValueIndex[nNonSpuriousValue++] = i;
1261  }
1262 
1263  ExtractDoubleValues(pNonSpuriousValues, pEigenValues, nEigenValueCount, m_pNonSpuriousValueIndex, nNonSpuriousValue, false);
1264  ExtractDoubleVector(nIterationCount, pNonSpuriousVectors, pEigenVectors, nEigenValueCount, m_pNonSpuriousValueIndex, nNonSpuriousValue, false);
1265 
1266  return nNonSpuriousValue;
1267 }
const unsigned long ERROR_MALLOC
Error code that means error occur during memory allocation.
Definition: Global.h:62
int * m_pNonSpuriousValueIndex
A temporary index array for Spurious check function.
void ExtractDoubleValues(double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
Extract value by condition that described in filter.
void ExtractDoubleVector(unsigned int nVectorsize, double *pTarget, double *pSource, unsigned int nSrcCount, int *pFilter, unsigned int nFilterCount, bool bExclusive)
Extract vectors by condition that described in filter.
void CLanczosMethod::StopIteration ( )
static

Stop lanczos iteration on going state.

Definition at line 1566 of file LanczosMethod.cpp.

References m_bStop.

1567 {
1568  CLanczosMethod::m_bStop = true;
1569 }
static bool m_bStop
Determind stop iteration before end of iteration count.

Member Data Documentation

bool CLanczosMethod::m_bCalcuEigenvector
private

Option for doing or not calculating eigen vector.

Definition at line 113 of file LanczosMethod.h.

bool CLanczosMethod::m_bReorthogonalization
private

Option for doing or not re-orthogonalization.

Definition at line 112 of file LanczosMethod.h.

bool CLanczosMethod::m_bStop = false
staticprivate

Determind stop iteration before end of iteration count.

Definition at line 133 of file LanczosMethod.h.

Referenced by IsAbort(), LanczosIteration(), LanczosIterationLoop(), and StopIteration().

double CLanczosMethod::m_fConvergenceTolerance
private

Convergence checking tolerance.

Definition at line 114 of file LanczosMethod.h.

double CLanczosMethod::m_fEigenvalueMin
private

Minimum range of eigenvalue.

Definition at line 110 of file LanczosMethod.h.

double CLanczosMethod::m_fEignevalueMax
private

Maxinum range of eigenvalue.

Definition at line 111 of file LanczosMethod.h.

double CLanczosMethod::m_floadMIC
private

Computing ratio of CPU vs. MIC.

Definition at line 130 of file LanczosMethod.h.

unsigned int CLanczosMethod::m_nEigenValueCheckInterval
private

A interval for checking T matrix eigenvlaue.

Definition at line 108 of file LanczosMethod.h.

unsigned int CLanczosMethod::m_nEigenValueCount
private

A numbers of eigenvlaue that want to calculation.

Definition at line 109 of file LanczosMethod.h.

unsigned int CLanczosMethod::m_nIterationCount
private

A counts of lanczos interation.

Definition at line 107 of file LanczosMethod.h.

int CLanczosMethod::m_nLBIndex
private

Definition at line 131 of file LanczosMethod.h.

Referenced by GetLBIndex(), and SetLBIndex().

unsigned int CLanczosMethod::m_nMatrixSize
private

A size of Hemiltonian matrix.

Definition at line 106 of file LanczosMethod.h.

CMatrixOperation::CCSR* CLanczosMethod::m_pALeftBlock
private

A member variable for reference Hemiltonian matrix.

Definition at line 104 of file LanczosMethod.h.

CMatrixOperation::CCSR* CLanczosMethod::m_pAMatrix
private

A member variable for reference Hemiltonian matrix.

Definition at line 102 of file LanczosMethod.h.

CMatrixOperation::CCSR* CLanczosMethod::m_pAMyLocalBlock
private

A member variable for reference Hemiltonian matrix.

Definition at line 103 of file LanczosMethod.h.

CMatrixOperation::CCSR* CLanczosMethod::m_pARightBoloc
private

A member variable for reference Hemiltonian matrix.

Definition at line 105 of file LanczosMethod.h.

bool* CLanczosMethod::m_pCheckNonClusterValue
private

A temporary check index array for cluster check function.

Definition at line 129 of file LanczosMethod.h.

double* CLanczosMethod::m_pConvergedEigenValues
private

A temporary eigenvalue array for converged check function.

Definition at line 117 of file LanczosMethod.h.

double* CLanczosMethod::m_pConvergedEigenVectors
private

A temporary eigenvector array for converged check function.

Definition at line 118 of file LanczosMethod.h.

int* CLanczosMethod::m_pConvergedIndex
private

A temporary index array for converged check function.

Definition at line 127 of file LanczosMethod.h.

double* CLanczosMethod::m_pEigenValues
private

A temporary eigenvalue array for eig solver.

Definition at line 115 of file LanczosMethod.h.

double* CLanczosMethod::m_pEigenVectors
private

A temporary eigenvector array for eig solver.

Definition at line 116 of file LanczosMethod.h.

int* CLanczosMethod::m_pNonClustersValueIndex
private

A temporary index array for cluster check function.

Definition at line 128 of file LanczosMethod.h.

double* CLanczosMethod::m_pNonClustersValues
private

A temporary eigenvalue array for cluster check function.

Definition at line 123 of file LanczosMethod.h.

double* CLanczosMethod::m_pNonClustersVectors
private

A temporary eigenvector array for cluster check function.

Definition at line 124 of file LanczosMethod.h.

double* CLanczosMethod::m_pNoneSpuriousValues
private

A temporary eigenvalue array for spurious value check function.

Definition at line 121 of file LanczosMethod.h.

double* CLanczosMethod::m_pNoneSpuriousVectors
private

A temporary eigenvector array for spurious value check function.

Definition at line 122 of file LanczosMethod.h.

int* CLanczosMethod::m_pNonSpuriousValueIndex
private

A temporary index array for Spurious check function.

Definition at line 126 of file LanczosMethod.h.

double* CLanczosMethod::m_pRangeCheckedEigenValues
private

A temporary eigenvalue array for range check function.

Definition at line 119 of file LanczosMethod.h.

double* CLanczosMethod::m_pRangeCheckedEigenVectors
private

A temporary eigenvector array for range check function.

Definition at line 120 of file LanczosMethod.h.

int* CLanczosMethod::m_pRangecheckedIndex
private

A temporary index array for range check function.

Definition at line 125 of file LanczosMethod.h.

CMatrixOperation::CVector* CLanczosMethod::m_pV
private

A member variable for saveing lanczos vectors.

Definition at line 101 of file LanczosMethod.h.


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