16 #include <sys/types.h>
19 #define DUMY_STRING_FOR_COMPLEX_SHOWING "\t\t\t"
37 if (
false == m_bShowMsg)
40 #if _MFC_VER == 0x0C00
41 OutputDebugStringA(pszBuffer);
42 #else// _MFC_VER == 0x0C00
43 printf(
"%s", pszBuffer);
44 #endif //_MFC_VER == 0x0C00
46 printf(
"%s", pszBuffer);
66 for (
int i = startm; i < endm; i++)
68 char szRow[1024] =
"";
69 for (
int j = startn; j < endn; j++)
73 sprintf(szCol,
"%20.20f ", pMatrix[i*m + j]);
96 for (
int i = startm; i <= endm; i++)
98 char szRow[1024] =
"";
99 for (
int j = startn; j <= endn; j++)
105 strcat(szRow, szCol);
109 strcat(szRow, szCol);
132 ShowMsg(pszDebugMsg);
136 for (
unsigned int i = startm; i <= (
unsigned int)endm; i++)
138 char szRow[1024] =
"";
139 for (
unsigned int j = startn; j <= (
unsigned int)endn; j++)
148 strcat(szRow, szCol);
162 unsigned int iMax, jMax;
172 ShowMsg(pszDebugMsg);
176 for (
unsigned int i = 0; i < iMax; i++)
178 char szRow[1024] =
"";
179 for (
unsigned int j = 0; j < jMax; j++)
188 strcat(szRow, szCol);
202 char szDebug[1024] =
"";
205 ShowMsg(pszDebugMsg);
208 for (i = 0; i < due; i++)
210 sprintf(szDebug,
"%5d: %20.20f\n", i, vector[i]);
222 char szDebug[1024] =
"";
230 ShowMsg(pszDebugMsg);
233 for (i = 0; i < nSize; i++)
250 ShowMsg(pszDebugMsg);
263 sprintf(szDebug,
" %20.20f \n", number);
265 ShowMsg(pszDebugMsg);
280 sprintf(szBuffer,
"lanczosresult_%d.txt", nIndex);
281 if (NULL != (fpResult = fopen(szBuffer,
"wt")))
286 fputs(szBuffer, fpResult);
299 unsigned int i, j, nSize;
302 #ifdef DISABLE_MPI_ROUTINE
303 out = fopen(pszFileName,
"wb");
304 #else //DISABLE_MPI_ROUTINE
309 out = fopen(pszFileName,
"wb");
313 out = fopen(pszFileName,
"ab");
315 #endif //DISABLE_MPI_ROUTINE
321 for (i = 0; i < nSize; ++i)
325 for (j = nSubStart; j < nSubEnd; ++j)
328 int nTemp = i + (int)(fAtomIDStartIndex * 10);
329 fwrite(&nTemp,
sizeof(
int), 1, out);
332 fwrite(&fTemp,
sizeof(
double), 1, out);
334 fwrite(&fTemp,
sizeof(
double), 1, out);
339 #ifndef DISABLE_MPI_ROUTINE
342 #endif //DISABLE_MPI_ROUTINE
352 unsigned int i, j, nSize;
355 char szFileName[1024];
362 sprintf(szFileName,
"result\\%s", pszFileName);
364 mkdir(
"result", 0777);
365 sprintf(szFileName,
"result/%s", pszFileName);
368 #ifdef DISABLE_MPI_ROUTINE
369 out = fopen(szFileName,
"wt");
370 #else //DISABLE_MPI_ROUTINE
375 out = fopen(szFileName,
"wt");
379 out = fopen(szFileName,
"at");
381 #endif //DISABLE_MPI_ROUTINE
387 for(i = 0; i < nSize ; ++ i)
391 for (j = nSubStart; j < nSubEnd; ++ j)
393 sprintf(szMsg,
"%05d\t%05d\t%40.30f\t%40.30f\n", i + (
int)(fAtomIDStartIndex*10) + 1,
402 #ifndef DISABLE_MPI_ROUTINE
405 #endif //DISABLE_MPI_ROUTINE
415 nLen = strlen(pszBuffer);
416 for (i = 0; i < nLen; ++i)
418 if (pszBuffer[i] <
'Z')
double GetImaginaryNumber() const
Get imaginary part.
static void ShowMsg(char *pszBuffer)
Show message.
Data and operation representation of Matrix.
double_vector_t m_vectValueRealBuffer
A member variable for saving none zero elements.
double GetRealNumber() const
Get real part.
static void ShowComplex(CKNComplex number, char *pszDebugMsg)
Show vector class.
unsigned int GetColumnCount()
Getting row size of matrix.
Data and operation representation of CSR(Compressed Sparse Row)
static void ShowDenseMatrix(CKNMatrixOperation::CKNDMatrix *pMatrix, int startm, int endm, int startn, int endn, char *pszDebugMsg, bool bLineFeed=false, bool bShowImaginary=false)
Show matrix partialy.
double_vector_t m_vectValueImaginaryBuffer
A member variable for saving none zero elements.
static int GetTotalNodeCount()
static void SaveResult(CKNLanczosMethod::LPEIGENVALUE_RESULT lpResult, int nIndex)
Show lanczos method result.
uint_vector_t m_vectColumn
A member variable for saving column information.
static void ShowDouble(double number, char *pszDebugMsg)
Show one double data.
static void ConvertLower(char *pszBuffer)
Convert string to lower case.
static bool m_bShowMsg
Flag for display message.
static void ShowDoubleMatrix(double *pMatrix, int m, int n, int startm, int endm, int startn, int endn, char *pszDebugMsg)
Show matrix in output debugging windows - Visual studio and Windows DebugView only.
static void ShowCSR(CKNMatrixOperation::CKNCSR *pCSR, char *pszDebugMsg)
Set show message or not.
CKNComplex GetAt(unsigned int nIndex)
Get element value from specific index.
static void DumpCSR(CKNMatrixOperation::CKNCSR *pCSR, char *pszFileName, double fAtomIDStartIndex)
Dump CSR to text file.
Structure for engienvalue computing.
#define DUMY_STRING_FOR_COMPLEX_SHOWING
This class includes functions for matrix debugging.
static int GetCurrentRank()
static void ShowDoubleArray(double *vector, char *pszDebugMsg, int due)
Show double array.
CKNComplex GetElement(unsigned int nRowIndex, unsigned int nColumnIndex)
Get matrix element with row, column index.
unsigned int GetRowCount()
unsigned int nEigenValueCount
unsigned int GetSize()
Return Vector elements size.
CKNComplex GetElement(unsigned int nRow, unsigned int nColumn, bool &bResult)
Get Element by index.
This class for complex operation and saving value.
static void DumpCSRBinary(CKNMatrixOperation::CKNCSR *pCSR, char *pszFileName, double fAtomIDStartIndex)
Dump CSR to binary file.
static bool IsRootRank()
Get Total node count.
static void ShowDoubleVector(CKNMatrixOperation::CKNVector vector, char *pszDebugMsg, int due=-1)
uint_vector_t m_vectRow
A member variable for saving row information.
static void SendDoubleBufferSync(int nTargetRank, double *pBuffer, int nSize, MPI_Request *req, MPI_Comm commWorld=MPI_COMM_NULL)
Sending buffer for double data array with sync.
This class for describing vector for Lanczos method.
static bool IsDeflationRoot()
Checking is root rank of Lanczos computation.
static void ReceiveDoubleBufferSync(int nSourceRank, double *pBuffer, int nSize, MPI_Request *req, MPI_Comm commWorld=MPI_COMM_NULL)
Receivinging buffer for double data array with sync.