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

Lanczos method result audit class. More...

#include "LanczosResultAudit.h"

Collaboration diagram for CLanczosResultAudit:
Collaboration graph

Public Member Functions

 CLanczosResultAudit ()
 
 ~CLanczosResultAudit ()
 

Static Public Member Functions

static void AuditResult_EV (CMatrixOperation::CCSR *pCSR, CLanczosMethod::LPEIGENVALUE_RESULT lpResult, double fTolerance, int nLBIndex)
 Audit eigen vector. More...
 
static void AuditResult_WF (CLanczosMethod::LPEIGENVALUE_RESULT lpResult, double fTolerance, unsigned int nWaveFunctionSize)
 Audit wave function. More...
 
static void SaveResult (CLanczosMethod::LPEIGENVALUE_RESULT lpResult, bool bCalcuEigenvalue, bool bWaveFunction, double *pKValue, int nRepeatCount)
 Save eigen values and eigen vector to file. More...
 

Detailed Description

Lanczos method result audit class.

Date
27/May/2014

Definition at line 17 of file LanczosResultAudit.h.

Constructor & Destructor Documentation

CLanczosResultAudit::CLanczosResultAudit ( )

Definition at line 21 of file LanczosResultAudit.cpp.

22 {
23 }
CLanczosResultAudit::~CLanczosResultAudit ( )

Definition at line 26 of file LanczosResultAudit.cpp.

27 {
28 }

Member Function Documentation

void CLanczosResultAudit::AuditResult_EV ( CMatrixOperation::CCSR pCSR,
CLanczosMethod::LPEIGENVALUE_RESULT  lpResult,
double  fTolerance,
int  nLBIndex 
)
static

Audit eigen vector.

Parameters
pCSRCSR Matrix
lpResultLanczos method result
fToleranceTolerance for error

Definition at line 35 of file LanczosResultAudit.cpp.

References CMatrixOperation::CVector::Finalize(), CMatrixOperation::CCSR::GetColumnCount(), CMatrixOperation::CVector::GetNorm(), CMatrixOperation::CVector::MinusVector(), CMatrixOperation::MVMul(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pEigenValues, CLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, CMatrixOperation::CVector::ScalarMultiple(), CMatrixOperation::CVector::SetSize(), and CUtility::ShowMsg().

36 {
37  unsigned int i;
38  char szBuffer[1024];
39  bool bPass;
40 
41  if (NULL == lpResult || NULL == lpResult->pEigenVectorsForAMatrix)
42  return;
43 
44  CUtility::ShowMsg("\n----------------------------------------\nEV Result\n\n");
45 
46  for (i = 0; i < lpResult->nEigenValueCount; i++)
47  {
48  bPass = false;
49  CMatrixOperation::CVector VAX, VRamdaX;
50 
51  VAX.SetSize(pCSR->GetColumnCount());
52  VRamdaX.SetSize(pCSR->GetColumnCount());
53  CMatrixOperation::MVMul(pCSR, &lpResult->pEigenVectorsForAMatrix[i], &VAX, nLBIndex);
54  VRamdaX = lpResult->pEigenVectorsForAMatrix[i];
55  VRamdaX.ScalarMultiple(lpResult->pEigenValues[i]);
56 
57  VAX.MinusVector(&VRamdaX);
58  double fResult = VAX.GetNorm();
59  if (fabs(fResult) < fTolerance)
60  bPass = true;
61 
62  sprintf(szBuffer, "EV[%2d] [AX - ramdaX: %20.20f] %s \n", i, fResult, bPass ? "OK" : "NG");
63  CUtility::ShowMsg(szBuffer);
64 
65  VAX.Finalize();
66  VRamdaX.Finalize();
67  }
68  CUtility::ShowMsg("----------------------------------------\n");
69 }
static void MVMul(CCSR *pAMatrix, CVector *pVector, CVector *pResult, int nLBIndex)
Matrix and vector multiple operation.
void ScalarMultiple(CComplex Scalar)
Scalar multiple operation.
unsigned int GetColumnCount()
Getting row size of matrix.
CMatrixOperation::CVector * pEigenVectorsForAMatrix
Definition: LanczosMethod.h:33
This class for describing vector for Lanczos method.
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
double GetNorm(bool bMPI=false)
Getting norm of vector.
void MinusVector(CVector *vector)
Do minus operation between vectors.
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 CLanczosResultAudit::AuditResult_WF ( CLanczosMethod::LPEIGENVALUE_RESULT  lpResult,
double  fTolerance,
unsigned int  nWaveFunctionSize 
)
static

Audit wave function.

Parameters
lpResultLanczos method result
fToleranceTolerance for error
nWaveFunctionSizeWave function counts

Definition at line 76 of file LanczosResultAudit.cpp.

References CMatrixOperation::CVector::GetAt(), CComplex::GetNorm(), CLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions, CComplex::SetComplexNumber(), and CUtility::ShowMsg().

77 {
78  unsigned int i, j;
79  char szBuffer[1024];
80  bool bPass;
81  CComplex tempResult;
82 
83  if (NULL == lpResult || NULL == lpResult->pWaveFunctions)
84  return;
85 
86  CUtility::ShowMsg("\n----------------------------------------\nWavefunction Result\n\n");
87 
88  for (i = 0; i < lpResult->nEigenValueCount; i++)
89  {
90  bPass = false;
91 
92  tempResult.SetComplexNumber(0, 0);
93  for (j = 0; j < nWaveFunctionSize; j++)
94  {
95  tempResult = tempResult + lpResult->pWaveFunctions[i].GetAt(j);
96  }
97 
98  if (fabs(1 - tempResult.GetNorm()) < fTolerance)
99  bPass = true;
100 
101  sprintf(szBuffer, "WF[%2d] sum: [ %20.20f ] %s\n", i, tempResult.GetNorm(), bPass ? "OK" : "NG");
102  CUtility::ShowMsg(szBuffer);
103  }
104  CUtility::ShowMsg("----------------------------------------\n");
105 }
CComplex GetAt(unsigned int nIndex)
Get element value from specific index.
double GetNorm()
Get norm of complex number.
Definition: Complex.h:32
void SetComplexNumber(double fReal, double fImaginaray)
Set Complex number using real part and imaginary part.
Definition: Complex.cpp:58
This class for complex operation and saving value.
Definition: Complex.h:16
CMatrixOperation::CVector * pWaveFunctions
Definition: LanczosMethod.h:38
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34

Here is the call graph for this function:

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

Save eigen values and eigen vector to file.


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