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

Lanczos method result audit class. More...

#include "KNLanczosResultAudit.h"

Collaboration diagram for CKNLanczosResultAudit:
Collaboration graph

Public Member Functions

 CKNLanczosResultAudit ()
 
 ~CKNLanczosResultAudit ()
 

Static Public Member Functions

static void AuditResult_EV (CKNMatrixOperation::CKNCSR *pCSR, CKNLanczosMethod::LPEIGENVALUE_RESULT lpResult, double fTolerance)
 Audit eigen vector. More...
 
static void AuditResult_WF (CKNLanczosMethod::LPEIGENVALUE_RESULT lpResult, double fTolerance, unsigned int nWaveFunctionSize)
 Audit wave function. More...
 
static void SaveResult (CKNLanczosMethod::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
Author
Kyu Nam Cho(mysto.nosp@m.us@k.nosp@m.orea..nosp@m.ac.k.nosp@m.r), Hoon Ryu(elec1.nosp@m.020@.nosp@m.gmail.nosp@m..com)

Definition at line 19 of file KNLanczosResultAudit.h.

Constructor & Destructor Documentation

CKNLanczosResultAudit::CKNLanczosResultAudit ( )

Definition at line 22 of file KNLanczosResultAudit.cpp.

23 {
24 }
CKNLanczosResultAudit::~CKNLanczosResultAudit ( )

Definition at line 27 of file KNLanczosResultAudit.cpp.

28 {
29 }

Member Function Documentation

void CKNLanczosResultAudit::AuditResult_EV ( CKNMatrixOperation::CKNCSR pCSR,
CKNLanczosMethod::LPEIGENVALUE_RESULT  lpResult,
double  fTolerance 
)
static

Audit eigen vector.

Parameters
pCSRCSR Matrix
lpResultLanczos method result
fToleranceTolerance for error

Definition at line 36 of file KNLanczosResultAudit.cpp.

References CKNMatrixOperation::CKNVector::Finalize(), CKNMatrixOperation::CKNCSR::GetColumnCount(), CKNMatrixOperation::CKNVector::GetNorm(), CKNMatrixOperation::CKNVector::MinusVector(), CKNMatrixOperation::MVMul(), CKNLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CKNLanczosMethod::EIGENVALUE_RESULT::pEigenValues, CKNLanczosMethod::EIGENVALUE_RESULT::pEigenVectorsForAMatrix, CKNMatrixOperation::CKNVector::ScalarMultiple(), CKNMatrixOperation::CKNVector::SetSize(), and CKNIPCCUtility::ShowMsg().

37 {
38  unsigned int i;
39  char szBuffer[1024];
40  bool bPass;
41 
42  if (NULL == lpResult || NULL == lpResult->pEigenVectorsForAMatrix)
43  return;
44 
45  CKNIPCCUtility::ShowMsg("\n----------------------------------------\nEV Result\n\n");
46 
47  for (i = 0; i < lpResult->nEigenValueCount; i++)
48  {
49  bPass = false;
50  CKNMatrixOperation::CKNVector VAX, VRamdaX;
51 
52  VAX.SetSize(pCSR->GetColumnCount());
53  VRamdaX.SetSize(pCSR->GetColumnCount());
54  CKNMatrixOperation::MVMul(pCSR, &lpResult->pEigenVectorsForAMatrix[i], &VAX);
55  VRamdaX = lpResult->pEigenVectorsForAMatrix[i];
56  VRamdaX.ScalarMultiple(lpResult->pEigenValues[i]);
57 
58  VAX.MinusVector(&VRamdaX);
59  double fResult = VAX.GetNorm();
60  if (fabs(fResult) < fTolerance)
61  bPass = true;
62 
63  sprintf(szBuffer, "EV[%2d] [AX - ramdaX: %20.20f] %s \n", i, fResult, bPass ? "OK" : "NG");
64  CKNIPCCUtility::ShowMsg(szBuffer);
65 
66  VAX.Finalize();
67  VRamdaX.Finalize();
68  }
69  CKNIPCCUtility::ShowMsg("----------------------------------------\n");
70 }
void SetSize(unsigned int nSize)
Set Vector elements size.
static void ShowMsg(char *pszBuffer)
Show message.
void ScalarMultiple(CKNComplex Scalar)
Scalar multiple operation.
CKNMatrixOperation::CKNVector * pEigenVectorsForAMatrix
unsigned int GetColumnCount()
Getting row size of matrix.
void MinusVector(CKNVector *vector)
Do minus operation between vectors.
static void MVMul(CKNCSR *pAMatrix, CKNVector *pVector, CKNVector *pResult)
Matrix and vector multiple operation.
void Finalize()
Free allocated memory for vector elements.
double GetNorm(bool bMPI=false)
Getting norm of vector.
This class for describing vector for Lanczos method.

Here is the call graph for this function:

void CKNLanczosResultAudit::AuditResult_WF ( CKNLanczosMethod::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 77 of file KNLanczosResultAudit.cpp.

References CKNMatrixOperation::CKNVector::GetAt(), CKNComplex::GetNorm(), CKNLanczosMethod::EIGENVALUE_RESULT::nEigenValueCount, CKNLanczosMethod::EIGENVALUE_RESULT::pWaveFunctions, CKNComplex::SetComplexNumber(), and CKNIPCCUtility::ShowMsg().

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

Here is the call graph for this function:

static void CKNLanczosResultAudit::SaveResult ( CKNLanczosMethod::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: