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

This class includes functions for matrix debugging. More...

#include "Utility.h"

Collaboration diagram for CUtility:
Collaboration graph

Public Member Functions

 CUtility ()
 
 ~CUtility ()
 

Static Public Member Functions

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. More...
 
static void ShowDoubleArray (double *vector, char *pszDebugMsg, int due)
 Show double array. More...
 
static void ShowDoubleVector (CMatrixOperation::CVector vector, char *pszDebugMsg, int due=-1)
 
static void ShowComplex (CComplex number, char *pszDebugMsg)
 Show vector class. More...
 
static void ShowDouble (double number, char *pszDebugMsg)
 Show one double data. More...
 
static void ShowMsg (char *pszBuffer)
 Show message. More...
 
static void SaveResult (CLanczosMethod::LPEIGENVALUE_RESULT lpResult, int nIndex)
 Show lanczos method result. More...
 
static void SetShow (bool bShow)
 
static void ShowCSR (CMatrixOperation::CCSR *pCSR, char *pszDebugMsg)
 Set show message or not. More...
 
static void ShowCSR (CMatrixOperation::CCSR *pCSR, int startm, int endm, int startn, int endn, char *pszDebugMsg)
 Show CSR matrix partialy. More...
 
static void ShowDenseMatrix (CMatrixOperation::CDMatrix *pMatrix, int startm, int endm, int startn, int endn, char *pszDebugMsg, bool bLineFeed=false, bool bShowImaginary=false)
 Show matrix partialy. More...
 
static void DumpCSR (CMatrixOperation::CCSR *pCSR, char *pszFileName, double fAtomIDStartIndex)
 
static void DumpCSR (CMatrixOperation::CCSR *pCSR, char *pszFileName, double fAtomIDStartIndex, int nRowPerAtom)
 <Added by="" jhkang>=""> More...
 
static void ConvertLower (char *pszBuffer)
 <Added by="" jhkang="" end>=""> More...
 
static void getCurrentTime (char *pszBuffer)
 Get Current time from system. More...
 
static void GetKValues (CCommandFileParser::LPINPUT_CMD_PARAM lpParam, double *pKValue[3])
 Calculate K value with K points. More...
 

Static Private Attributes

static bool m_bShowMsg = false
 Flag for display message. More...
 

Detailed Description

This class includes functions for matrix debugging.

Date
10/July/2014

Definition at line 16 of file Utility.h.

Constructor & Destructor Documentation

CUtility::CUtility ( )

Definition at line 23 of file Utility.cpp.

24 {
25 }
CUtility::~CUtility ( )

Definition at line 27 of file Utility.cpp.

28 {
29 }

Member Function Documentation

void CUtility::ConvertLower ( char *  pszBuffer)
static

<Added by="" jhkang="" end>="">

Convert string to lower case

Parameters
pszBuffer[in/out]Target string to convert to lower case

Definition at line 415 of file Utility.cpp.

Referenced by CMaterialParam::BuildMaterialParam().

416 {
417  int i, nLen;
418 
419  nLen = strlen(pszBuffer);
420  for (i = 0; i < nLen; ++i)
421  {
422  if (pszBuffer[i] < 'Z')
423  pszBuffer[i] += 32;
424  }
425 }

Here is the caller graph for this function:

void CUtility::DumpCSR ( CMatrixOperation::CCSR pCSR,
char *  pszFileName,
double  fAtomIDStartIndex 
)
static

Dump CSR to text file

Parameters
pCSRCSR matrix
pszFileNameSave file name
fAtomIDStartIndexStart index in shape

Definition at line 296 of file Utility.cpp.

References CMPIManager::GetCurrentRank(), CMatrixOperation::CCSR::GetRowCount(), CMPIManager::GetTotalNodeCount(), CMPIManager::IsDeflationRoot(), CMPIManager::IsRootRank(), CMatrixOperation::CCSR::m_vectColumn, CMatrixOperation::CCSR::m_vectRow, CMatrixOperation::CCSR::m_vectValueImaginaryBuffer, CMatrixOperation::CCSR::m_vectValueRealBuffer, CMPIManager::ReceiveDoubleBufferSync(), and CMPIManager::SendDoubleBufferSync().

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

297 {
298  unsigned int i, j, nSize;
299  FILE *out;
300  char szMsg[1024];
301  char szFileName[1024];
302 
303  if (false == CMPIManager::IsDeflationRoot())
304  return;
305 
306 #ifdef _WIN32
307  _mkdir("result");
308  sprintf(szFileName, "result\\%s", pszFileName);
309 #else
310  mkdir("result", 0777);
311  sprintf(szFileName, "result/%s", pszFileName);
312 #endif
313 
314 #ifdef DISABLE_MPI_ROUTINE
315  out = fopen(szFileName, "wt");
316 #else //DISABLE_MPI_ROUTINE
317  MPI_Request req;
318  double fTemp = 1;
319 
321  out = fopen(szFileName, "wt");
322  else
323  {
325  out = fopen(szFileName, "at");
326  }
327 #endif //DISABLE_MPI_ROUTINE
328 
329  if( NULL == out )
330  return;
331 
332  nSize = pCSR->GetRowCount();
333  for(i = 0; i < nSize ; ++ i)
334  {
335  unsigned int nSubStart = pCSR->m_vectRow[i], nSubEnd = pCSR->m_vectRow[i + 1];
336 
337  for (j = nSubStart; j < nSubEnd; ++ j)
338  {
339  sprintf(szMsg, "%05d\t%05d\t%40.30f\t%40.30f\n", i + (int)(fAtomIDStartIndex) + 1,
340  pCSR->m_vectColumn[j] + 1,
341  pCSR->m_vectValueRealBuffer[j],
342  pCSR->m_vectValueImaginaryBuffer[j]);
343  fputs(szMsg, out);
344  }
345  }
346  fclose(out);
347 
348 #ifndef DISABLE_MPI_ROUTINE
351 #endif //DISABLE_MPI_ROUTINE
352 }
double_vector_t m_vectValueImaginaryBuffer
A member variable for saving none zero elements.
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
double_vector_t m_vectValueRealBuffer
A member variable for saving none zero elements.
unsigned int GetRowCount()
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.
Definition: MPIManager.cpp:712
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 SendDoubleBufferSync(int nTargetRank, double *pBuffer, int nSize, MPI_Request *req, MPI_Comm commWorld=MPI_COMM_NULL)
Sending buffer for double data array with sync.
Definition: MPIManager.cpp:685
uint_vector_t m_vectColumn
A member variable for saving column information.
uint_vector_t m_vectRow
A member variable for saving row information.

Here is the call graph for this function:

Here is the caller graph for this function:

void CUtility::DumpCSR ( CMatrixOperation::CCSR pCSR,
char *  pszFileName,
double  fAtomIDStartIndex,
int  nRowPerAtom 
)
static

<Added by="" jhkang>="">

<Added by="" jhkang="" end>="">

Dump CSR to text file

Definition at line 355 of file Utility.cpp.

References CMPIManager::GetCurrentRank(), CMatrixOperation::CCSR::GetRowCount(), CMPIManager::GetTotalNodeCount(), CMPIManager::IsRootRank(), CMatrixOperation::CCSR::m_vectColumn, CMatrixOperation::CCSR::m_vectRow, CMatrixOperation::CCSR::m_vectValueImaginaryBuffer, CMatrixOperation::CCSR::m_vectValueRealBuffer, CMPIManager::ReceiveDoubleBufferSync(), and CMPIManager::SendDoubleBufferSync().

356 {
357  unsigned int i, j, nSize;
358  FILE *out;
359  char szMsg[1024];
360  char szFileName[1024];
361 
362 #ifdef _WIN32
363  _mkdir("result");
364  sprintf(szFileName, "result\\%s", pszFileName);
365 #else
366  mkdir("result", 0777);
367  sprintf(szFileName, "result/%s", pszFileName);
368 #endif
369 
370 #ifdef DISABLE_MPI_ROUTINE
371  out = fopen(szFileName, "wt");
372 #else //DISABLE_MPI_ROUTINE
373  MPI_Request req;
374  double fTemp = 1;
375 
377  out = fopen(szFileName, "wt");
378  else
379  {
381  out = fopen(szFileName, "at");
382  }
383 #endif //DISABLE_MPI_ROUTINE
384 
385  if( NULL == out )
386  return;
387 
388  nSize = pCSR->GetRowCount();
389  for(i = 0; i < nSize ; ++ i)
390  {
391  unsigned int nSubStart = pCSR->m_vectRow[i], nSubEnd = pCSR->m_vectRow[i + 1];
392 
393  for (j = nSubStart; j < nSubEnd; ++ j)
394  {
395  sprintf(szMsg, "%05d\t%05d\t%40.30f\t%40.30f\n", i + (int)(fAtomIDStartIndex*nRowPerAtom) + 1,
396  pCSR->m_vectColumn[j] + 1,
397  pCSR->m_vectValueRealBuffer[j],
398  pCSR->m_vectValueImaginaryBuffer[j]);
399  fputs(szMsg, out);
400  }
401  }
402  fclose(out);
403 
404 #ifndef DISABLE_MPI_ROUTINE
407 #endif //DISABLE_MPI_ROUTINE
408 }
double_vector_t m_vectValueImaginaryBuffer
A member variable for saving none zero elements.
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
double_vector_t m_vectValueRealBuffer
A member variable for saving none zero elements.
unsigned int GetRowCount()
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.
Definition: MPIManager.cpp:712
static int GetTotalNodeCount()
Definition: MPIManager.h:42
static int GetCurrentRank()
Definition: MPIManager.h:40
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.
Definition: MPIManager.cpp:685
uint_vector_t m_vectColumn
A member variable for saving column information.
uint_vector_t m_vectRow
A member variable for saving row information.

Here is the call graph for this function:

void CUtility::getCurrentTime ( char *  pszBuffer)
static

Get Current time from system.

Parameters
pszBuffer[out]Charater buffer that want to save string that include time information

Definition at line 430 of file Utility.cpp.

431 {
432  time_t timer;
433  struct tm *t;
434 
435  timer = time(NULL);
436  t = localtime(&timer);
437 
438  sprintf(pszBuffer, "%d:%d:%d", t->tm_hour, t->tm_min, t->tm_sec);
439 }
void CUtility::GetKValues ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
double *  pKValue[3] 
)
static

Calculate K value with K points.

Parameters
lpParamOption parameters for program launching
pKValue[out]Buffer for saving k values

Definition at line 445 of file Utility.cpp.

References CCommandFileParser::INPUT_CMD_PARAM::fKPoints, CCommandFileParser::INPUT_CMD_PARAM::fKValueFinal, and CCommandFileParser::INPUT_CMD_PARAM::fKValueInit.

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

446 {
447  double fInterval[3];
448  unsigned int i, j;
449 
450  for( i = 0; i < 3; ++i)
451  {
452  double *pfKValueUnit = NULL;
453  pKValue[i] = (double*)malloc(sizeof(double)*(unsigned int)lpParam->fKPoints);
454  pfKValueUnit = pKValue[i];
455  fInterval[i] = (lpParam->fKValueFinal[i] - lpParam->fKValueInit[i]) / (lpParam->fKPoints - 1);
456  pfKValueUnit[0] = lpParam->fKValueInit[i];
457  if (lpParam->fKPoints > 1 )
458  pfKValueUnit[(int)lpParam->fKPoints-1] = lpParam->fKValueFinal[i];
459  for( j = 1; j < (unsigned int)lpParam->fKPoints-1 ; ++j )
460  pfKValueUnit[j] = pfKValueUnit[j-1] + fInterval[i];
461  }
462 }
double fKValueFinal[3]
Final k point value.
double fKValueInit[3]
Init k point value.

Here is the caller graph for this function:

void CUtility::SaveResult ( CLanczosMethod::LPEIGENVALUE_RESULT  lpResult,
int  nIndex 
)
static

Show lanczos method result.

Parameters
lpResultCalculated eigenvalue result
nIndexThe index that want to save result

Definition at line 273 of file Utility.cpp.

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

274 {
275  char szBuffer[1024];
276  FILE *fpResult;
277  unsigned int i;
278 
279  sprintf(szBuffer, "lanczosresult_%d.txt", nIndex);
280  if (NULL != (fpResult = fopen(szBuffer, "wt")))
281  {
282  for (i = 0; i < lpResult->nEigenValueCount; i++)
283  {
284  sprintf(szBuffer, "%f\n", lpResult->pEigenValues[i]);
285  fputs(szBuffer, fpResult);
286  }
287  fclose(fpResult);
288  }
289 }
static void CUtility::SetShow ( bool  bShow)
inlinestatic

Definition at line 29 of file Utility.h.

References m_bShowMsg.

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

29 { m_bShowMsg = bShow; };
static bool m_bShowMsg
Flag for display message.
Definition: Utility.h:42

Here is the caller graph for this function:

void CUtility::ShowComplex ( CComplex  number,
char *  pszDebugMsg 
)
static

Show vector class.

Show complex class

Parameters
numberThe complex number that was wanted to show
pszDebugMsgText that was show first at matrix display

Definition at line 243 of file Utility.cpp.

References CComplex::GetImaginaryNumber(), and CComplex::GetRealNumber().

244 {
245  char szDebug[1024];
246 
247  sprintf(szDebug, " %20.20f + %20.20f i\n", number.GetRealNumber(), number.GetImaginaryNumber());
248 
249  ShowMsg(pszDebugMsg);
250  ShowMsg("\n");
251  ShowMsg(szDebug);
252 }
double GetImaginaryNumber() const
Get imaginary part.
Definition: Complex.h:25
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

void CUtility::ShowCSR ( CMatrixOperation::CCSR pCSR,
char *  pszDebugMsg 
)
static

Set show message or not.

Show CSR matrix partialy

Parameters
pCSRThe matrix that was wanted to show
pszDebugMsgText that was show first at matrix display

Definition at line 158 of file Utility.cpp.

References DUMY_STRING_FOR_COMPLEX_SHOWING, CMatrixOperation::CCSR::GetColumnCount(), CMatrixOperation::CCSR::GetElement(), CComplex::GetImaginaryNumber(), CComplex::GetRealNumber(), and CMatrixOperation::CCSR::GetRowCount().

159 {
160  bool bExisted;
161  unsigned int iMax, jMax;
162 
163 #ifdef _WIN32
164  iMax = min(10, pCSR->GetRowCount());
165  jMax = min(10, pCSR->GetColumnCount());
166 #else
167  iMax = std::min(10, (int)pCSR->GetRowCount());
168  jMax = std::min(10, (int)pCSR->GetColumnCount());
169 #endif
170 
171  ShowMsg(pszDebugMsg);
172  ShowMsg("\n");
173  ShowMsg("\n");
174 
175  for (unsigned int i = 0; i < iMax; i++)
176  {
177  char szRow[1024] = "";
178  for (unsigned int j = 0; j < jMax; j++)
179  {
180  char szCol[1024];
181  CComplex element = pCSR->GetElement(i, j, bExisted);
182 
183  if (bExisted)
184  sprintf(szCol, "%3.3f:%3.3f |\t\t", element.GetRealNumber(), element.GetImaginaryNumber());
185  else
186  sprintf(szCol, "%s |\t\t", DUMY_STRING_FOR_COMPLEX_SHOWING);
187  strcat(szRow, szCol);
188  }
189  strcat(szRow, "\n");
190  ShowMsg(szRow);
191  }
192 }
unsigned int GetRowCount()
#define DUMY_STRING_FOR_COMPLEX_SHOWING
Definition: Utility.cpp:18
unsigned int GetColumnCount()
Getting row size of matrix.
This class for complex operation and saving value.
Definition: Complex.h:16
double GetImaginaryNumber() const
Get imaginary part.
Definition: Complex.h:25
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
CComplex GetElement(unsigned int nRow, unsigned int nColumn, bool &bResult)
Get Element by index.
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

void CUtility::ShowCSR ( CMatrixOperation::CCSR pCSR,
int  startm,
int  endm,
int  startn,
int  endn,
char *  pszDebugMsg 
)
static

Show CSR matrix partialy.

Parameters
pCSRThe matrix that was wanted to show
pszDebugMsgText that was show first at matrix display
startmStart row index that was wanted to show
endmEnd row index that was wanted to show
startnStart column index that was wanted to show
endnEnd column index that was wanted to show

Definition at line 127 of file Utility.cpp.

References DUMY_STRING_FOR_COMPLEX_SHOWING, CMatrixOperation::CCSR::GetElement(), CComplex::GetImaginaryNumber(), and CComplex::GetRealNumber().

128 {
129  bool bExisted;
130 
131  ShowMsg(pszDebugMsg);
132  ShowMsg("\n");
133  ShowMsg("\n");
134 
135  for (unsigned int i = startm; i <= (unsigned int)endm; i++)
136  {
137  char szRow[1024] = "";
138  for (unsigned int j = startn; j <= (unsigned int)endn; j++)
139  {
140  char szCol[1024];
141  CComplex element = pCSR->GetElement(i, j, bExisted);
142 
143  if (bExisted)
144  sprintf(szCol, "%3.3f:%3.3f |\t\t", element.GetRealNumber(), element.GetImaginaryNumber());
145  else
146  sprintf(szCol, "%s |\t\t", DUMY_STRING_FOR_COMPLEX_SHOWING);
147  strcat(szRow, szCol);
148  }
149  strcat(szRow, "\n");
150  ShowMsg(szRow);
151  }
152 }
#define DUMY_STRING_FOR_COMPLEX_SHOWING
Definition: Utility.cpp:18
This class for complex operation and saving value.
Definition: Complex.h:16
double GetImaginaryNumber() const
Get imaginary part.
Definition: Complex.h:25
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
CComplex GetElement(unsigned int nRow, unsigned int nColumn, bool &bResult)
Get Element by index.
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

void CUtility::ShowDenseMatrix ( CMatrixOperation::CDMatrix pMatrix,
int  startm,
int  endm,
int  startn,
int  endn,
char *  pszDebugMsg,
bool  bLineFeed = false,
bool  bShowImaginary = false 
)
static

Show matrix partialy.

Parameters
pMatrixThe matrix that was wanted to show
startmStart row index that was wanted to show
endmEnd row index that was wanted to show
startnStart column index that was wanted to show
endnEnd column index that was wanted to show
pszDebugMsgText that was show first at matrix display
bLineFeedHas linefeed between row or not
bShowImaginaryDetermine show imaginary part or not

Definition at line 89 of file Utility.cpp.

References CMatrixOperation::CDMatrix::GetElement(), CComplex::GetImaginaryNumber(), and CComplex::GetRealNumber().

90 {
91  ShowMsg(pszDebugMsg);
92  ShowMsg("\n");
93  ShowMsg("\n");
94 
95  for (int i = startm; i <= endm; i++)
96  {
97  char szRow[1024] = "";
98  for (int j = startn; j <= endn; j++)
99  {
100  char szCol[1024];
101  CComplex temppNumber = pMatrix->GetElement(i, j);
102 
103  sprintf(szCol, "%10.10f ", temppNumber.GetRealNumber());
104  strcat(szRow, szCol);
105  if (bShowImaginary)
106  {
107  sprintf(szCol, "+ %10.10f i ", temppNumber.GetImaginaryNumber());
108  strcat(szRow, szCol);
109  }
110  strcat(szRow, "\t");
111  }
112  if (bLineFeed)
113  strcat(szRow, "\n");
114  strcat(szRow, "\n");
115  ShowMsg(szRow);
116  }
117 }
CComplex GetElement(unsigned int nRowIndex, unsigned int nColumnIndex)
Get matrix element with row, column index.
This class for complex operation and saving value.
Definition: Complex.h:16
double GetImaginaryNumber() const
Get imaginary part.
Definition: Complex.h:25
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

void CUtility::ShowDouble ( double  number,
char *  pszDebugMsg 
)
static

Show one double data.

Parameters
numberThe number that was wanted to show
pszDebugMsgText that was show first at matrix display

Definition at line 258 of file Utility.cpp.

259 {
260  char szDebug[1024];
261 
262  sprintf(szDebug, " %20.20f \n", number);
263 
264  ShowMsg(pszDebugMsg);
265  ShowMsg("\n");
266  ShowMsg(szDebug);
267 }
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
void CUtility::ShowDoubleArray ( double *  vector,
char *  pszDebugMsg,
int  due 
)
static

Show double array.

Parameters
vectorThe vector that was wanted to show
pszDebugMsgText that was show first at matrix display
dueDebugger show vector element unti this index

Definition at line 199 of file Utility.cpp.

200 {
201  char szDebug[1024] = "";
202  int i;
203 
204  ShowMsg(pszDebugMsg);
205  ShowMsg("\n");
206 
207  for (i = 0; i < due; i++)
208  {
209  sprintf(szDebug, "%5d: %20.20f\n", i, vector[i]);
210  ShowMsg(szDebug);
211  }
212 }
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
void CUtility::ShowDoubleMatrix ( double *  pMatrix,
int  m,
int  n,
int  startm,
int  endm,
int  startn,
int  endn,
char *  pszDebugMsg 
)
static

Show matrix in output debugging windows - Visual studio and Windows DebugView only.

Parameters
pMatrixThe matrix that was wanted to show
mNumbers of row
nNumbers of column
startmStart row index that was wanted to show
endmEnd row index that was wanted to show
startnStart column index that was wanted to show
endnEnd column index that was wanted to show
pszDebugMsgText that was show first at matrix display

Definition at line 59 of file Utility.cpp.

60 {
61  ShowMsg(pszDebugMsg);
62  ShowMsg("\n");
63  ShowMsg("\n");
64 
65  for (int i = startm; i < endm; i++)
66  {
67  char szRow[1024] = "";
68  for (int j = startn; j < endn; j++)
69  {
70  char szCol[1024];
71 
72  sprintf(szCol, "%20.20f ", pMatrix[i*m + j]);
73  strcat(szRow, szCol);
74  }
75  strcat(szRow, "\n");
76  ShowMsg(szRow);
77  }
78 }
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
void CUtility::ShowDoubleVector ( CMatrixOperation::CVector  vector,
char *  pszDebugMsg,
int  due = -1 
)
static
Parameters
vectorThe vector that was wanted to show
pszDebugMsgText that was show first at matrix display
dueDebugger show vector element unti this index

Definition at line 219 of file Utility.cpp.

References CMatrixOperation::CVector::GetAt(), CComplex::GetImaginaryNumber(), CComplex::GetRealNumber(), and CMatrixOperation::CVector::GetSize().

220 {
221  char szDebug[1024] = "";
222  int i, nSize;
223 
224  if (-1 == due)
225  nSize = vector.GetSize();
226  else
227  nSize = due;
228 
229  ShowMsg(pszDebugMsg);
230  ShowMsg("\n");
231 
232  for (i = 0; i < nSize; i++)
233  {
234  sprintf(szDebug, "%5d: %20.20f + %20.20f i\n", i, vector.GetAt(i).GetRealNumber(), vector.GetAt(i).GetImaginaryNumber());
235  ShowMsg(szDebug);
236  }
237 }
unsigned int GetSize()
Return Vector elements size.
CComplex GetAt(unsigned int nIndex)
Get element value from specific index.
double GetImaginaryNumber() const
Get imaginary part.
Definition: Complex.h:25
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

void CUtility::ShowMsg ( char *  pszBuffer)
static

Member Data Documentation

bool CUtility::m_bShowMsg = false
staticprivate

Flag for display message.

Definition at line 42 of file Utility.h.

Referenced by SetShow().


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