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);
294 unsigned int i, j, nSize;
297 #ifdef DISABLE_MPI_ROUTINE
298 out = fopen(pszFileName,
"wb");
299 #else //DISABLE_MPI_ROUTINE
304 out = fopen(pszFileName,
"wb");
308 out = fopen(pszFileName,
"ab");
310 #endif //DISABLE_MPI_ROUTINE
316 for (i = 0; i < nSize; ++i)
320 for (j = nSubStart; j < nSubEnd; ++j)
323 int nTemp = i + (int)(fAtomIDStartIndex * 10);
324 fwrite(&nTemp,
sizeof(
int), 1, out);
326 fTemp = pCSR->m_vectValueBuffer[j].GetRealNumber();
327 fwrite(&fTemp,
sizeof(
double), 1, out);
328 fTemp = pCSR->m_vectValueBuffer[j].GetImaginaryNumber();
329 fwrite(&fTemp,
sizeof(
double), 1, out);
334 #ifndef DISABLE_MPI_ROUTINE
337 #endif //DISABLE_MPI_ROUTINE
342 unsigned int i, j, nSize;
345 char szFileName[1024];
349 sprintf(szFileName,
"result\\%s", pszFileName);
351 mkdir(
"result", 0777);
352 sprintf(szFileName,
"result/%s", pszFileName);
355 #ifdef DISABLE_MPI_ROUTINE
356 out = fopen(szFileName,
"wt");
357 #else //DISABLE_MPI_ROUTINE
362 out = fopen(szFileName,
"wt");
366 out = fopen(szFileName,
"at");
368 #endif //DISABLE_MPI_ROUTINE
374 for(i = 0; i < nSize ; ++ i)
378 for (j = nSubStart; j < nSubEnd; ++ j)
380 sprintf(szMsg,
"%05d\t%05d\t%40.30f\t%40.30f\n", i + (
int)(fAtomIDStartIndex*10) + 1,
382 pCSR->m_vectValueBuffer[j].GetRealNumber(),
383 pCSR->m_vectValueBuffer[j].GetImaginaryNumber());
389 #ifndef DISABLE_MPI_ROUTINE
392 #endif //DISABLE_MPI_ROUTINE
double GetImaginaryNumber() const
Get imaginary part.
Data and operation representation of Matrix.
double GetRealNumber() const
Get real part.
unsigned int GetColumnCount()
Getting row size of matrix.
Data and operation representation of CSR(Compressed Sparse Row)
static void DumpCSRBinary(CKNMatrixOperation::CKNCSR *pCSR, char *pszFileName, double fAtomIDStartIndex)
Dump CSR to binary file.
static void SaveResult(CKNLanczosMethod::LPEIGENVALUE_RESULT lpResult, int nIndex)
Show lanczos method result.
static int GetTotalNodeCount()
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.
uint_vector_t m_vectColumn
A member variable for saving column information.
static void ShowDoubleVector(CKNMatrixOperation::CKNVector vector, char *pszDebugMsg, int due=-1)
CKNComplex GetAt(unsigned int nIndex)
Get element value from specific index.
Structure for engienvalue computing.
static void ShowDoubleArray(double *vector, char *pszDebugMsg, int due)
Show double array.
static void ShowMsg(char *pszBuffer)
Show message.
This class includes functions for matrix debugging.
static int GetCurrentRank()
CKNComplex GetElement(unsigned int nRowIndex, unsigned int nColumnIndex)
Get matrix element with row, column index.
static void ShowDouble(double number, char *pszDebugMsg)
Show one double data.
static void ShowCSR(CKNMatrixOperation::CKNCSR *pCSR, char *pszDebugMsg)
Set show message or not.
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 DumpCSR(CKNMatrixOperation::CKNCSR *pCSR, char *pszFileName, double fAtomIDStartIndex)
Dump CSR to text file.
static void ShowComplex(CKNComplex number, char *pszDebugMsg)
Show vector class.
static bool IsRootRank()
Get Total node count.
#define DUMY_STRING_FOR_COMPLEX_SHOWING
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.
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.
This class for describing vector for Lanczos method.
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.