IPCC  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
KNMatrixOperation.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include "KNComplex.h"
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <time.h>
15 #include <boost/align/aligned_allocator.hpp>
16 #include <iostream>
17 #include <vector>
18 
26 {
27 public:
28 
29  class CKNDMatrix;
30 
31  typedef std::vector<double, boost::alignment::aligned_allocator<double, 64>> double_vector_t;
32  typedef std::vector<unsigned int, boost::alignment::aligned_allocator<unsigned int, 64>> uint_vector_t;
33 
38  typedef struct{
39  int nRow;
40  int nColumn;
41  double fReal;
42  double fImaginary;
44 
49  typedef struct{
53 
60  class CKNVector{
61  public:
62  CKNVector();
63  ~CKNVector();
64 
65  typedef struct{
66  double fReal;
67  double fImaginary;
69 
70  void SetSize(unsigned int nSize);
71  unsigned int GetSize(){ return m_nValueCount; }
72  void SetAt(unsigned int nIndex, CKNComplex value);
73  void SetAtEx(unsigned int nIndex, CKNComplex *pValue);
74  void SetAt(unsigned int nIndex, double fReal, double fImaginary);
75  CKNComplex GetAt(unsigned int nIndex);
76  CKNComplex* GetAtPt(unsigned int nIndex);
77  void ResetValue();
78 
79  void ScalarMultiple(CKNComplex Scalar);
80  void ScalarMultiple(double fScalar);
81  void ScalarDivision(CKNComplex Scalar);
82  void ScalarDivision(double fScalar);
83  void BuildRandomVector();
84  void Normalize(bool bMPI = false);
85  double GetNorm(bool bMPI = false);
86  void MinusVector(CKNVector *vector);
87  void PlusVector(CKNVector *vector);
88  void ScalarMultiThanMinusVector(double fScalar, CKNVector *vector);
89  void ReorthogonalizationVector(CKNVector *pVector, CKNComplex complex);
90  void Finalize();
91  bool InsertVector(unsigned int nStartIndex, CKNMatrixOperation::CKNVector *pVector);
92  bool Serialize(double *pBuffer, bool bStore);
93 
94  CKNComplex operator*(CKNVector & vector);
95  CKNComplex operator*(CKNVector * vector);
96  CKNVector operator-(CKNVector & vector);
97  CKNVector operator-(CKNVector * vector);
98  CKNVector operator+(CKNVector & vector);
99  CKNVector operator+(CKNVector * vector);
100  void operator=(CKNVector &vector);
101  void operator=(CKNVector *vector);
102 
103  private:
106  unsigned int m_nValueCount;
108 
109  friend class CKNLanczosMethod;
110  friend class CKNMatrixOperation;
111  friend class CKNMPIManager;
112  };
113 
120  class CKNDMatrix{
121  public:
122  CKNDMatrix();
123  ~CKNDMatrix();
124 
126 
127  bool BuildMatrixFirst(unsigned int nRow, unsigned int nColumn);
128  bool SetElement(unsigned int nRow, unsigned int nColumn, CKNComplex element);
129  bool SetElement(unsigned int nRow, unsigned int nColumn, double fRealNumber, double fImageNumber);
130  void AppendMatrix(APPEND_DRIECTION direction, unsigned int nCount);
131  unsigned int GetRowCount(){ return m_nRowCount; }
132  unsigned int GetColumnCount(){ return m_nColumnCount; }
133  bool SetDiagonal(CKNVector vector);
134  CKNComplex GetElement(unsigned int nRowIndex, unsigned int nColumnIndex);
135  bool SetColumnElement(CKNVector vector, unsigned int nColumnIndex);
136  bool SetRowElement(CKNVector vector, unsigned int nRowIndex);
137  bool SetElement(unsigned int nRowStart, unsigned int nColumnStart, unsigned int nSrcRowStart, unsigned int nSrcColumnStart, unsigned int nSrcRowCount, unsigned int nSrcColumnCount, CKNDMatrix matrix);
138  void ScalarMultiple(CKNComplex Scalar);
139  void ScalarMultiple(double fScalar);
140  bool GetRowByVector(unsigned int nRowIndex, CKNMatrixOperation::CKNVector *pVector);
141  bool GetColumnByVector(unsigned int nColumnIndex, CKNMatrixOperation::CKNVector *pVector);
142  bool GetSmallMatrix(unsigned int nRowStartIndex, unsigned int nColumnStartIndex, unsigned int nRowCount, unsigned int nColumnCount, CKNMatrixOperation::CKNDMatrix *pMatrix);
143  void ScalarDivision(double fScalar);
144  bool TrnasPos();
145 
146  void operator=(CKNDMatrix &matrix);
147  void operator=(CKNDMatrix *matrix);
148  void operator+=(CKNDMatrix &matrix);
149  void operator+=(CKNDMatrix *matrix);
150 
151  private:
152  std::vector<CKNComplex> m_vectValueBuffer;
153  unsigned int m_nRowCount;
154  unsigned int m_nColumnCount;
155  };
156 
164  class CKNCSR{
165  public:
166  CKNCSR();
167  ~CKNCSR();
168 
170 
171  unsigned int GetNoneZeroCount(){ return m_nValueCount; }
172  unsigned int GetRowCount(){ return m_nRowCount; };
173  unsigned int GetColumnCount(){ return m_nColumnCount; };
174  unsigned int GetRowIndexNo(unsigned int nIndex);
175  unsigned int GetColIndexNo(unsigned int nIndex);
176  CKNComplex* GetValue(unsigned int nIndex);
177  CKNComplex GetElement(unsigned int nRow, unsigned int nColumn, bool &bResult);
178  void Finalize();
179  void ExpandMatrix(unsigned int nMulti, bool bRow, bool bColumn);
180  bool SetAt(CKNComplex number, unsigned int nRow, unsigned int nColumn);
181  bool InsertRowBefore(unsigned int nRow);
182  bool InsertRowAtEnd();
183  bool InsertColumnBefore(unsigned int nColumn);
184  bool InsertColumnAtEnd();
185  CKNCSR* SplitCSR(int nStart, int nEnd);
186  void BuildDataBuffer();
187  void SetRowCount(unsigned int nRow){ m_nRowCount = nRow; }
188  void SetColumnCount(unsigned int nColumn){ m_nColumnCount = nColumn; }
189  bool InsertMatrix(unsigned int nRow, unsigned int nColumn, unsigned int nRowStart, unsigned int nColumnStart, unsigned int nRowCount, unsigned int nColumnCount, CKNMatrixOperation::CKNDMatrix *pMatrix, bool bCopyZero);
190  bool PushMatrix(unsigned int nRow, unsigned int nColumn, unsigned int nRowStart, unsigned int nColumnStart, unsigned int nRowCount, unsigned int nColumnCount, CKNMatrixOperation::CKNDMatrix *pMatrix, bool bCopyZero);
191  bool PushMatrixConcurrent(unsigned int nRow, CKNMatrixOperation::LPFILL_MATRIX_DATA lpData, bool bCopyZeroOnSite);
192  bool ElementScalarMultiple(unsigned int nRow, unsigned int nColumn, CKNComplex Scalar);
193  bool ElementScalarMultiple(unsigned int nRow, unsigned int nColumn, double fScalar);
194  bool AreaScalarMultiple(unsigned int nRowStart, unsigned int nRowCount, unsigned int nColumnStart, unsigned int nColumnCount, CKNComplex Scalar);
195  bool DiagonalOperation(CKNVector *pOperand, OPERATION_TYPE type, bool bUseSplitVector);
196  void SetFirstRowIndex(double fFirstIndex){ m_fFirstRowIndex = fFirstIndex; };
197  double GetFirstRowIndex(){ return m_fFirstRowIndex; }
198  void PushNoneZeroValue(double fRealValue, double fImaginaryValue, unsigned int nRow, unsigned int nCol);
199  void FinishPush();
200  bool ConvertDoubleArray(unsigned int *pRowPtr, unsigned int *pColIndex, double *pNNZValueReal, double *pNNZValueImaginary, unsigned int nNNZSize, unsigned int nRowSize, unsigned int nColSize, unsigned int nFirstIndex, bool bZerobase);
201  CKNVector operator*(CKNVector & vector);
202  CKNVector operator*(CKNVector * vector);
203 
204  static unsigned int MAX_INDEX;
206  unsigned int nComponentsLastUnitCell;
207 
208  private:
209  void DumpCSR(const char *pstrFileName);
210  void IncreaseNoneZeroCount();
211  bool IsNonzeroElement(unsigned int nRow, unsigned int nColumn, unsigned int &nIndex);
212  unsigned int GetNextNonzeroValueIndex(unsigned int nRow, unsigned int nColumn);
213  bool GetNextRowIndexValue(unsigned int nRowFrom, unsigned int &nValueIndex);
214  void IncreaseRowIndex(unsigned int nRowFrom);
215 
216  unsigned int m_nValueCount;
217  unsigned int m_nValueStackCount;
220  unsigned int m_nRowCount;
221  unsigned int m_nColumnCount;
226 
227  friend class CKNMatrixOperation;
228  friend class CKNIPCCUtility;
229  friend class CKNTBMS_Solver;
230  friend class CKNMatrixOperation;
231  friend class CKNLanczosLaunching;
232  };
233 
234 public:
237 
238  static CKNMatrixOperation::CKNCSR * BuildCSRFromOneDimArray(double *pReal, double *pImaginary, unsigned int nRowOrder, unsigned int nColumnOrder);
239  static CKNMatrixOperation::CKNCSR * BuildCSRFromFileTemp(FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount);
240  static CKNMatrixOperation::CKNCSR * BuildCSRFromFile_(FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount);
241  static CKNMatrixOperation::CKNCSR * BuildCSRFromFileUnsortdata(FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount);
242  static void FreeCSR(CKNMatrixOperation::CKNCSR *pCSR);
243  static void DumpCSR(CKNMatrixOperation::CKNCSR *pCSR, const char *pstrFileName){ pCSR->DumpCSR(pstrFileName); }
244 
249 
250 
251  static int Compare(const void *pA, const void *pB);
253  CKNVector *pVector, CKNVector *pResult,
254  double *X, double *Xrt, double *Xlt);
255  static void MVMulOptimal(CKNCSR *pAMatrix, CKNVector *pVector, CKNVector *pResult);
256  static void MVMulEx_Optimal(CKNCSR *pAMatrix, CKNVector *pVector, CKNVector *pResult, unsigned int, unsigned int, CKNVector*, int);
257  static void MVMul(CKNCSR *pAMatrix, CKNVector *pVector, CKNVector *pResult);
258  static bool VVDot(CKNVector *pVector1, CKNVector *pVector2, CKNComplex *pResult);
259  static void MVMul(CKNDMatrix *pMatrix, CKNVector *pVector, CKNVector *pResult);
260  static void MMMul(CKNDMatrix *pMatrix, CKNDMatrix *pMatrixOperand, CKNDMatrix *pResult);
261  static bool IsSame(double operand1, double operand2, double tol);
262  static bool IsSameA(double operand1, double operand2, double tol);
263  static bool IsSame(CKNComplex operand1, CKNComplex operand2, double tol);
264  static bool IsSame(CKNVector *pVector1, CKNVector *pVector2);
265  static int Gram_schmidt(CKNVector *pVect1, CKNVector *pVect2);
267 
268  static unsigned int *pRow;
269  static unsigned int *pColumn;
270 };
271 
bool SetDiagonal(CKNVector vector)
Set diagonal elements.
~CKNMatrixOperation()
Destructor.
void SetSize(unsigned int nSize)
Set Vector elements size.
MPI Mangement class.
Definition: KNMPIManager.h:21
bool InsertMatrix(unsigned int nRow, unsigned int nColumn, unsigned int nRowStart, unsigned int nColumnStart, unsigned int nRowCount, unsigned int nColumnCount, CKNMatrixOperation::CKNDMatrix *pMatrix, bool bCopyZero)
Set element by reference matrix.
Complex number implementation class.
void ScalarDivision(CKNComplex Scalar)
Scalar division operation.
unsigned int m_nRowCount
A numbers of row.
unsigned int m_nValueCount
A numbers of elements.
void AppendMatrix(APPEND_DRIECTION direction, unsigned int nCount)
Appending matrix with direction.
void ScalarMultiple(CKNComplex Scalar)
Scalar multiple operation.
void Normalize(bool bMPI=false)
Normalize vector with norm.
struct CKNMatrixOperation::CKNVector::VECTOR_ELEMENT * LPVECTOR_ELEMENT
CKNCSR * SplitCSR(int nStart, int nEnd)
Split CSR to MPI slave.
void IncreaseNoneZeroCount()
Increasing saved none zero elements count.
void ReorthogonalizationVector(CKNVector *pVector, CKNComplex complex)
Do reorthogonalization.
unsigned int m_nColumnCount
A numbers of column.
void ScalarMultiThanMinusVector(double fScalar, CKNVector *vector)
Do minus operation after scalar multiple to operand between vectors.
bool GetSmallMatrix(unsigned int nRowStartIndex, unsigned int nColumnStartIndex, unsigned int nRowCount, unsigned int nColumnCount, CKNMatrixOperation::CKNDMatrix *pMatrix)
Get matrix from large matrix.
unsigned int nComponentsFirstUnitCell
Atom counts for interoperaton with previous node.
Data and operation representation of Matrix.
static void FreeCSR(CKNMatrixOperation::CKNCSR *pCSR)
Deallocating CSR memory.
unsigned int GetNoneZeroCount()
Getting numbers of none zero elements.
bool InsertRowAtEnd()
Insert row after last row.
static unsigned int * pRow
For MPI Optimized operation using.
double_vector_t m_vectValueRealBuffer
A member variable for saving none zero elements.
This class includes functions for matrix debugging.
void ExpandMatrix(unsigned int nMulti, bool bRow, bool bColumn)
Expand matrix order.
unsigned int m_nRowCount
A numbers of row.
double m_fFirstRowIndex
First row index in this node.
void operator+=(CKNDMatrix &matrix)
operation overload for adding with reference parameter
static CKNMatrixOperation::CKNCSR * BuildCSRFromFileTemp(FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount)
Building CSR from file using double, double, double, double order.
std::vector< double, boost::alignment::aligned_allocator< double, 64 > > double_vector_t
unsigned int GetColumnCount()
Getting row size of matrix.
Data and operation representation of CSR(Compressed Sparse Row)
bool PushMatrix(unsigned int nRow, unsigned int nColumn, unsigned int nRowStart, unsigned int nColumnStart, unsigned int nRowCount, unsigned int nColumnCount, CKNMatrixOperation::CKNDMatrix *pMatrix, bool bCopyZero)
Set element by reference matrix to end of buffer.
CKNVector operator-(CKNVector &vector)
operation overload for vector minus operation with reference parameter
unsigned int GetRowCount()
Get matrix row counts.
This class for doing Lanczos method.
bool IsNonzeroElement(unsigned int nRow, unsigned int nColumn, unsigned int &nIndex)
Checking given index element has nonzero value or not.
static void MVMulEx_Optimal(CKNCSR *pAMatrix, CKNVector *pVector, CKNVector *pResult, unsigned int, unsigned int, CKNVector *, int)
Matrix and vector multiple operation for 1 layer exchanging communication.
void SetFirstRowIndex(double fFirstIndex)
double_vector_t m_vectValueImaginaryBuffer
A member variable for saving none zero elements.
This class for launching calculation module.
Definition: KNTBMS_Solver.h:20
void ScalarMultiple(CKNComplex Scalar)
Scalar multiple operation.
bool ConvertDoubleArray(unsigned int *pRowPtr, unsigned int *pColIndex, double *pNNZValueReal, double *pNNZValueImaginary, unsigned int nNNZSize, unsigned int nRowSize, unsigned int nColSize, unsigned int nFirstIndex, bool bZerobase)
Convering general CSR format to CSR.
static CKNMatrixOperation::CKNCSR * BuildCSRFromOneDimArray(double *pReal, double *pImaginary, unsigned int nRowOrder, unsigned int nColumnOrder)
Building CSR from one dimension array.
void MinusVector(CKNVector *vector)
Do minus operation between vectors.
uint_vector_t m_vectColumn
A member variable for saving column information.
bool ElementScalarMultiple(unsigned int nRow, unsigned int nColumn, CKNComplex Scalar)
Scalar multiple operation.
void BuildDataBuffer()
Allocating memory for class member variable.
This class includes functions for matrix debugging.
Definition: KNIPCCUtility.h:17
static void MMMul(CKNDMatrix *pMatrix, CKNDMatrix *pMatrixOperand, CKNDMatrix *pResult)
Matrix and matrix multiple operation.
bool AreaScalarMultiple(unsigned int nRowStart, unsigned int nRowCount, unsigned int nColumnStart, unsigned int nColumnCount, CKNComplex Scalar)
Scalar multiple operation to specific area.
unsigned int GetNextNonzeroValueIndex(unsigned int nRow, unsigned int nColumn)
Get next index of given row, column index.
static bool IsSameA(double operand1, double operand2, double tol)
Compare two double variable.
static unsigned int MAX_INDEX
constant variable for row that has no element
static int Compare(const void *pA, const void *pB)
For qick sort compare operation.
static CKNMatrixOperation::CKNCSR * BuildCSRFromFileUnsortdata(FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount)
uilding CSR form file and before building CSR sorting data
unsigned int GetRowIndexNo(unsigned int nIndex)
Getting column size of matrix.
CKNMatrixOperation()
Constructor.
bool SetAt(CKNComplex number, unsigned int nRow, unsigned int nColumn)
Set element to specific index.
void PushNoneZeroValue(double fRealValue, double fImaginaryValue, unsigned int nRow, unsigned int nCol)
Saving none zero value.
bool DiagonalOperation(CKNVector *pOperand, OPERATION_TYPE type, bool bUseSplitVector)
To diagonal element do operation.
static void MVMulEx_AsyncCommWithLocalBlocks(CKNMatrixOperation::CKNCSR *mylocalblock, CKNMatrixOperation::CKNCSR *leftlocalblock, CKNMatrixOperation::CKNCSR *rightlocalblock, CKNVector *pVector, CKNVector *pResult, double *X, double *Xrt, double *Xlt)
Matrix and vector multiple operation using by block csr.
CKNComplex GetAt(unsigned int nIndex)
Get element value from specific index.
unsigned int GetColIndexNo(unsigned int nIndex)
Getting Column information data by index.
bool GetNextRowIndexValue(unsigned int nRowFrom, unsigned int &nValueIndex)
Get row index value finding from nRowFrom to end.
bool TrnasPos()
Transpos matrix.
void IncreaseRowIndex(unsigned int nRowFrom)
Increase m_nRowCount array value + 1 from nRowFrom. It means at m_nRowCount element has been inserted...
bool Serialize(double *pBuffer, bool bStore)
Serialize vector.
bool PushMatrixConcurrent(unsigned int nRow, CKNMatrixOperation::LPFILL_MATRIX_DATA lpData, bool bCopyZeroOnSite)
Pushing matrix into CSR several sub matrixs.
CKNComplex operator*(CKNVector &vector)
operation overload for dot product with reference parameter
bool InsertRowBefore(unsigned int nRow)
Insert row before specific row index.
bool SetElement(unsigned int nRow, unsigned int nColumn, CKNComplex element)
Set matrix elements value.
This class include matrix operations, matrix data type and related data.
static void UpdateLocalCSR(CKNMatrixOperation::CKNCSR *source, CKNMatrixOperation::CKNCSR *mine, CKNMatrixOperation::CKNCSR *left, CKNMatrixOperation::CKNCSR *right)
unsigned int nComponentsLastUnitCell
Atom counts for interoperaton with next node.
static void MVMul(CKNCSR *pAMatrix, CKNVector *pVector, CKNVector *pResult)
Matrix and vector multiple operation.
unsigned int GetColumnCount()
Get matrix column counts.
double GetFirstRowIndex()
Set first row index.
static void MVMulOptimal(CKNCSR *pAMatrix, CKNVector *pVector, CKNVector *pResult)
Matrix and vector multiple operation for multiple call.
struct CKNMatrixOperation::FILL_MATRIX_DATA * LPFILL_MATRIX_DATA
void operator=(CKNDMatrix &matrix)
operation overload for subsitution with reference parameter
double_vector_t m_vectValueImaginaryBuffer
A member variable for saving none zero elements.
bool InsertColumnBefore(unsigned int nColumn)
Insert column before specific column index.
void SetAtEx(unsigned int nIndex, CKNComplex *pValue)
Set element value in specific index, Call by reference.
CKNMatrixOperation::CKNVector operator/(CKNMatrixOperation::CKNVector &vector, const double fScalar)
Operation overload for between vectors dot product operation.
void Finalize()
Free allocated memory for vector elements.
void BuildRandomVector()
Building vector that has random value elements.
CKNComplex m_rtnTemp
Temporary variable for return value.
void ScalarDivision(double fScalar)
Scalar division operation.
bool SetRowElement(CKNVector vector, unsigned int nRowIndex)
Set matrix element with row, column index.
double GetNorm(bool bMPI=false)
Getting norm of vector.
unsigned int m_nColumnCount
A numbers of column.
CKNVector operator*(CKNVector &vector)
operation overload for matrix and vector multiple operation with reference parameter ...
CKNComplex m_rtnTemp
Temporary variable for return.
CKNComplex GetElement(unsigned int nRowIndex, unsigned int nColumnIndex)
Get matrix element with row, column index.
CKNComplex * GetValue(unsigned int nIndex)
Getting none zero element value by index.
void ResetValue()
Reset every element to zero.
void DumpCSR(const char *pstrFileName)
For debugging save CSR into file.
double_vector_t m_vectValueRealBuffer
A member variable for saving none zero elements.
static void BuildLocalCSR(CKNMatrixOperation::CKNCSR *source, CKNMatrixOperation::CKNCSR *mine, CKNMatrixOperation::CKNCSR *left, CKNMatrixOperation::CKNCSR *right)
CKNComplex * GetAtPt(unsigned int nIndex)
Get element value from specific index.
void SetAt(unsigned int nIndex, CKNComplex value)
Set element value in specific index, Call by value.
bool SetColumnElement(CKNVector vector, unsigned int nColumnIndex)
Set matrix column.
void operator=(CKNVector &vector)
operation overload for subsitution with reference parameter
unsigned int GetSize()
Return Vector elements size.
static unsigned int * pColumn
For MPI Optimized operation using.
bool InsertColumnAtEnd()
Insert column after last column.
static CKNComplex * pValueBuffer
For MPI Optimized operation using.
CKNComplex GetElement(unsigned int nRow, unsigned int nColumn, bool &bResult)
Get Element by index.
This class for complex operation and saving value.
Definition: KNComplex.h:18
void PlusVector(CKNVector *vector)
Do plus operation between vectors.
void FinishPush()
Insert end index of none zero value index.
std::vector< CKNComplex > m_vectValueBuffer
A member variable for saving none zero elements.
bool GetColumnByVector(unsigned int nColumnIndex, CKNMatrixOperation::CKNVector *pVector)
Get column elements.
static void DumpCSR(CKNMatrixOperation::CKNCSR *pCSR, const char *pstrFileName)
For dubugging save CSR information into file.
void SetRowCount(unsigned int nRow)
Settting row size of matrix.
unsigned int m_nValueStackCount
Currently saved none zero value count.
std::vector< unsigned int, boost::alignment::aligned_allocator< unsigned int, 64 > > uint_vector_t
static void AllocateLocalCSR(CKNMatrixOperation::CKNCSR **mine, CKNMatrixOperation::CKNCSR **left, CKNMatrixOperation::CKNCSR **right)
CKNMatrixOperation::CKNVector operator*(const double fScalar, CKNMatrixOperation::CKNVector &vector)
Operation overload for matrix and vector multiple operation.
void Finalize()
Deallocating memory for member variable.
bool GetRowByVector(unsigned int nRowIndex, CKNMatrixOperation::CKNVector *pVector)
Get row elements.
CKNVector operator+(CKNVector &vector)
operation overload for vector plus operation with reference parameter
void SetColumnCount(unsigned int nColumn)
Settting column size of matrix.
uint_vector_t m_vectRow
A member variable for saving row information.
static bool IsSame(double operand1, double operand2, double tol)
Compare two double variable.
static int Gram_schmidt(CKNVector *pVect1, CKNVector *pVect2)
Doing gam schmidt orthogonalization.
bool InsertVector(unsigned int nStartIndex, CKNMatrixOperation::CKNVector *pVector)
struct CKNMatrixOperation::CSR_ELEMENT_DATA * LPCSR_ELEMENT_DATA
bool BuildMatrixFirst(unsigned int nRow, unsigned int nColumn)
Building matrix elements.
static CKNMatrixOperation::CKNCSR * BuildCSRFromFile_(FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount)
Building CSR from file using int, int, double, double order.
CKNMatrixOperation::CKNDMatrix * pMatrix
Hamiltonian building data.
unsigned int m_nValueCount
Numbers of none zero elements.
This class for describing vector for Lanczos method.
static bool VVDot(CKNVector *pVector1, CKNVector *pVector2, CKNComplex *pResult)
Between vectors dot product operation.
static void FreeLocalCSR(CKNMatrixOperation::CKNCSR *mine, CKNMatrixOperation::CKNCSR *left, CKNMatrixOperation::CKNCSR *right)