|
IPCC
1.0
|
This class include matrix operations, matrix data type and related data. More...
#include "MatrixOperation.h"

Classes | |
| class | CCSR |
| Data and operation representation of CSR(Compressed Sparse Row) More... | |
| class | CDMatrix |
| Data and operation representation of Matrix. More... | |
| struct | CSR_ELEMENT_DATA |
| CSR element data. More... | |
| class | CVector |
| This class for describing vector for Lanczos method. More... | |
| struct | FILL_MATRIX_DATA |
| Hamiltonian building data. More... | |
Public Types | |
| typedef std::vector< double > | double_vector_t |
| typedef std::vector< unsigned int > | uint_vector_t |
| typedef struct CMatrixOperation::CSR_ELEMENT_DATA * | LPCSR_ELEMENT_DATA |
| typedef struct CMatrixOperation::FILL_MATRIX_DATA * | LPFILL_MATRIX_DATA |
Public Member Functions | |
| CMatrixOperation () | |
| Constructor. More... | |
| ~CMatrixOperation () | |
| Destructor. More... | |
Static Public Member Functions | |
| static CMatrixOperation::CCSR * | BuildCSRFromOneDimArray (double *pReal, double *pImaginary, unsigned int nRowOrder, unsigned int nColumnOrder) |
| Building CSR from one dimension array. More... | |
| static CMatrixOperation::CCSR * | BuildCSRFromFileTemp (FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount) |
| Building CSR from file using double, double, double, double order. More... | |
| static CMatrixOperation::CCSR * | BuildCSRFromFile_ (FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount) |
| Building CSR from file using int, int, double, double order. More... | |
| static CMatrixOperation::CCSR * | BuildCSRFromFileUnsortdata (FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount) |
| uilding CSR form file and before building CSR sorting data More... | |
| static void | FreeCSR (CMatrixOperation::CCSR *pCSR) |
| Deallocating CSR memory. More... | |
| static void | DumpCSR (CMatrixOperation::CCSR *pCSR, const char *pstrFileName) |
| For dubugging save CSR information into file. More... | |
| static void | AllocateLocalCSR (CMatrixOperation::CCSR **mine, CMatrixOperation::CCSR **left, CMatrixOperation::CCSR **right, int nLBIndex) |
| static void | FreeLocalCSR (CMatrixOperation::CCSR *mine, CMatrixOperation::CCSR *left, CMatrixOperation::CCSR *right) |
| static void | BuildLocalCSR (CMatrixOperation::CCSR *source, CMatrixOperation::CCSR *mine, CMatrixOperation::CCSR *left, CMatrixOperation::CCSR *right) |
| static void | UpdateLocalCSR (CMatrixOperation::CCSR *source, CMatrixOperation::CCSR *mine, CMatrixOperation::CCSR *left, CMatrixOperation::CCSR *right) |
| static int | Compare (const void *pA, const void *pB) |
| For qick sort compare operation. More... | |
| static void | MVMulEx_AsyncCommWithLocalBlocks (CMatrixOperation::CCSR *mylocalblock, CMatrixOperation::CCSR *leftlocalblock, CMatrixOperation::CCSR *rightlocalblock, CVector *pVector, CVector *pResult, double *X, double *Xrt, double *Xlt) |
| Matrix and vector multiple operation using by block csr. More... | |
| static void | MVMulOptimal (CCSR *pAMatrix, CVector *pVector, CVector *pResult, int nLBIndex) |
| Matrix and vector multiple operation for multiple call. More... | |
| static void | MVMulEx_Optimal (CCSR *pAMatrix, CVector *pVector, CVector *pResult, unsigned int, unsigned int, CVector *, int nSizePHI, int nLBIndex) |
| Matrix and vector multiple operation for 1 layer exchanging communication. More... | |
| static void | MVMulOptimal_Nooffload (CCSR *pAMatrix, CVector *pVector, CVector *pResult, int nLBIndex) |
| Added by jhkang end. More... | |
| static void | MVMul (CCSR *pAMatrix, CVector *pVector, CVector *pResult, int nLBIndex) |
| Matrix and vector multiple operation. More... | |
| static bool | VVDot (CVector *pVector1, CVector *pVector2, CComplex *pResult) |
| Between vectors dot product operation. More... | |
| static void | MVMul (CDMatrix *pMatrix, CVector *pVector, CVector *pResult) |
| Matrix and vector multiple operation for dense matrix. More... | |
| static void | MMMul (CDMatrix *pMatrix, CDMatrix *pMatrixOperand, CDMatrix *pResult) |
| Matrix and matrix multiple operation. More... | |
| static bool | IsSame (double operand1, double operand2, double tol) |
| Compare two double variable. More... | |
| static bool | IsSameA (double operand1, double operand2, double tol) |
| Compare two double variable. More... | |
| static bool | IsSame (CComplex operand1, CComplex operand2, double tol) |
| Compare two vectors with tolerance. More... | |
| static bool | IsSame (CVector *pVector1, CVector *pVector2) |
| Compare two vectors with general tolerance(1e-8) More... | |
| static int | Gram_schmidt (CVector *pVect1, CVector *pVect2) |
| Added by jhkang, matrix operation. More... | |
| static void | AddVectors (CVector *pVector1, CVector *pVector2, CVector *pResult) |
| static void | SubstractVectors (CVector *pVector1, CVector *pVector2, CVector *pResult) |
| static void | ScalarMulVectors (double fValue, CVector *pVector1, CVector *pResult) |
| Added by jhkang end. More... | |
Static Public Attributes | |
| static CComplex * | pValueBuffer = NULL |
| For MPI Optimized operation using. More... | |
| static unsigned int * | pRow = NULL |
| For MPI Optimized operation using. More... | |
| static unsigned int * | pColumn = NULL |
| For MPI Optimized operation using. More... | |
This class include matrix operations, matrix data type and related data.
Definition at line 22 of file MatrixOperation.h.
| typedef std::vector<double> CMatrixOperation::double_vector_t |
Definition at line 26 of file MatrixOperation.h.
| typedef struct CMatrixOperation::CSR_ELEMENT_DATA * CMatrixOperation::LPCSR_ELEMENT_DATA |
| typedef struct CMatrixOperation::FILL_MATRIX_DATA * CMatrixOperation::LPFILL_MATRIX_DATA |
| typedef std::vector<unsigned int> CMatrixOperation::uint_vector_t |
Definition at line 29 of file MatrixOperation.h.
| CMatrixOperation::CMatrixOperation | ( | ) |
Constructor.
CCSR Class member function - End
CMatrixOperation Class member function - End
Definition at line 1836 of file MatrixOperation.cpp.
| CMatrixOperation::~CMatrixOperation | ( | ) |
|
static |
Definition at line 3297 of file MatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CMatrixOperation::CVector::GetAt(), CMatrixOperation::CVector::GetSize(), and CMatrixOperation::CVector::SetAt().

|
static |
CMatrixOperation Class member function - End
| mine | Local CSR buffer |
| left | Left node CSR buffer |
| right | right node CSR buffer |
Definition at line 2946 of file MatrixOperation.cpp.
References ERROR_MALLOC, CMPIManager::GetCurrentRank(), CMPIManager::GetLoadBalanceCount(), CMPIManager::GetMPIComm(), and CMPIManager::GetTotalNodeCount().
Referenced by CLanczosLaunching::LaunchingLanczos().


|
static |
Building CSR from file using int, int, double, double order.
| fDataFile | Source file name |
| nRowOrder | The row order of matrix |
| nColumnOrder | The column order of matrix |
| nDataCount | Nonzero value count |
Definition at line 1885 of file MatrixOperation.cpp.
References CMatrixOperation::CCSR::BuildDataBuffer(), CMatrixOperation::CCSR::FinishPush(), CMatrixOperation::CCSR::PushNoneZeroValue(), REPEAT_COUNT, CMatrixOperation::CCSR::SetColumnCount(), and CMatrixOperation::CCSR::SetRowCount().

|
static |
Building CSR from file using double, double, double, double order.
| fDataFile | Source file name |
| nRowOrder | The row order of matrix |
| nColumnOrder | The column order of matrix |
| nDataCount | Nonzero value count |
Definition at line 1853 of file MatrixOperation.cpp.
References CMatrixOperation::CCSR::BuildDataBuffer(), CMatrixOperation::CSR_ELEMENT_DATA::fImaginary, CMatrixOperation::CCSR::FinishPush(), CMatrixOperation::CSR_ELEMENT_DATA::fReal, CMatrixOperation::CSR_ELEMENT_DATA::nColumn, CMatrixOperation::CSR_ELEMENT_DATA::nRow, CMatrixOperation::CCSR::PushNoneZeroValue(), REPEAT_COUNT, CMatrixOperation::CCSR::SetColumnCount(), and CMatrixOperation::CCSR::SetRowCount().

|
static |
uilding CSR form file and before building CSR sorting data
| fDataFile | Source file name |
| nRowOrder | The row order of matrix |
| nColumnOrder | The column order of matrix |
| nDataCount | Nonzero value count |
Definition at line 1951 of file MatrixOperation.cpp.
References CMatrixOperation::CCSR::BuildDataBuffer(), Compare(), CMatrixOperation::CCSR::FinishPush(), CMatrixOperation::CCSR::PushNoneZeroValue(), CMatrixOperation::CCSR::SetColumnCount(), and CMatrixOperation::CCSR::SetRowCount().

|
static |
Building CSR from one dimension array.
| pReal | Real number part of Source of matrix |
| pImaginary | Imaginary number part of Source of matrix |
| nRowOrder | The row order of matrix |
| nColumnOrder | The column order of matrix |
Definition at line 1987 of file MatrixOperation.cpp.
References CMatrixOperation::CCSR::BuildDataBuffer(), CMatrixOperation::CCSR::FinishPush(), CMatrixOperation::CCSR::PushNoneZeroValue(), CMatrixOperation::CCSR::SetColumnCount(), and CMatrixOperation::CCSR::SetRowCount().

|
static |
| source | Copying source CSR |
| mine | Local CSR buffer |
| left | Left node CSR buffer |
| right | right node CSR buffer |
Definition at line 3005 of file MatrixOperation.cpp.
References CMatrixOperation::CCSR::FinishPush(), CMatrixOperation::CCSR::GetColumnCount(), CMatrixOperation::CCSR::GetFirstRowIndex(), CComplex::GetImaginaryNumber(), CComplex::GetRealNumber(), CMatrixOperation::CCSR::GetRowCount(), CMatrixOperation::CCSR::GetValue(), CMatrixOperation::CCSR::m_vectColumn, CMatrixOperation::CCSR::m_vectRow, pColumn, pRow, and CMatrixOperation::CCSR::PushNoneZeroValue().
Referenced by CLanczosLaunching::LaunchingLanczos().


|
static |
For qick sort compare operation.
| pA | Compare target CSR element |
| pB | Compare target CSR element |
Definition at line 1921 of file MatrixOperation.cpp.
References CMatrixOperation::CSR_ELEMENT_DATA::nColumn, and CMatrixOperation::CSR_ELEMENT_DATA::nRow.
Referenced by BuildCSRFromFileUnsortdata().

|
inlinestatic |
For dubugging save CSR information into file.
Definition at line 247 of file MatrixOperation.h.
References CMatrixOperation::CCSR::DumpCSR().

|
static |
Deallocating CSR memory.
| pCSR | CSR class pointer that want to deallocating memeory |
Definition at line 2138 of file MatrixOperation.cpp.
References CMatrixOperation::CCSR::Finalize().
Referenced by CTBMS_Solver::FinalEvn(), CSPLoop::Finalize(), and FreeLocalCSR().


|
static |
| mine | Local CSR buffer |
| left | Left node CSR buffer |
| right | right node CSR buffer |
Definition at line 3238 of file MatrixOperation.cpp.
References FreeCSR().
Referenced by CLanczosLaunching::LaunchingLanczos().


Added by jhkang, matrix operation.
Doing gam schmidt orthogonalization
| pVect1 | Orthogonalization standard |
| pVect2 | Orthogonalization target |
Definition at line 2880 of file MatrixOperation.cpp.
References GENERAL_TOLERANCE, CComplex::GetRealNumber(), IsSameA(), CTimeMeasurement::MeasurementEnd(), CTimeMeasurement::MeasurementStart(), CMatrixOperation::CVector::MinusVector(), CMatrixOperation::CVector::Normalize(), CMatrixOperation::CVector::ScalarMultiple(), CTimeMeasurement::VVDOT, and VVDot().
Referenced by CLanczosMethod::MergeDegeneratedEigenvalues().


|
static |
Compare two double variable.
| operand1 | First operand |
| operand2 | Second operand |
| tol | Difference tolerance |
Definition at line 2855 of file MatrixOperation.cpp.
Referenced by CLanczosMethod::DoResidualCheck(), CLanczosMethod::IntegrateEigenvalues(), CLanczosMethod::IntegrateEigenvaluesEx(), IsSame(), CSPLoop::MapZBandCB(), and CLanczosMethod::MergeDegeneratedEigenvalues().

Compare two vectors with tolerance.
| operand1 | Comparing operand 1 |
| operand2 | Comparing operand 2 |
Definition at line 3262 of file MatrixOperation.cpp.
References CComplex::GetImaginaryNumber(), and CComplex::GetRealNumber().

Compare two vectors with general tolerance(1e-8)
Added by jhkang, Vector operration.
| pVector1 | Comparing vector operand 1 |
| pVector2 | Comparing vector operand 2 |
Definition at line 3278 of file MatrixOperation.cpp.
References GENERAL_TOLERANCE, CMatrixOperation::CVector::GetNorm(), IsSame(), and CMatrixOperation::CVector::MinusVector().

|
static |
Compare two double variable.
| operand1 | First operand |
| operand2 | Second operand |
| tol | Difference tolerance |
Definition at line 2868 of file MatrixOperation.cpp.
Referenced by Gram_schmidt(), and CLanczosMethod::MergeDegeneratedEigenvalues().

|
static |
Matrix and matrix multiple operation.
| pMatrix | Matrix class pointer that want to operation |
| pMatrixOperand | Matrix class pointer that want to operation |
| pResult | Matrix class pointer that saving operation result |
Definition at line 2824 of file MatrixOperation.cpp.
References CComplex::Add(), CMatrixOperation::CDMatrix::BuildMatrixFirst(), CMatrixOperation::CDMatrix::GetColumnCount(), CMatrixOperation::CDMatrix::GetElement(), CMatrixOperation::CDMatrix::GetRowCount(), CComplex::MulltiplyComplex(), and CMatrixOperation::CDMatrix::SetElement().
Referenced by CHamiltonianBuilder::BuildACCANeighborFor10Band(), CHamiltonianBuilder::FillMatrixFor10Band(), and CGeometricShape::RotateMatrix().


|
static |
Matrix and vector multiple operation.
| pAMatrix | Matrix class pointer that want to operation |
| pVector | Vector class pointer that want to operation |
| pResult | Vector class pointer that saving operation result |
Definition at line 2187 of file MatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CMatrixOperation::CCSR::GetColumnCount(), CMatrixOperation::CCSR::GetRowCount(), CMatrixOperation::CCSR::m_vectColumn, CMatrixOperation::CCSR::m_vectRow, CMatrixOperation::CVector::m_vectValueImaginaryBuffer, CMatrixOperation::CCSR::m_vectValueImaginaryBuffer, CMatrixOperation::CVector::m_vectValueRealBuffer, CMatrixOperation::CCSR::m_vectValueRealBuffer, CMPIManager::MergeVector(), and CMatrixOperation::CVector::SetSize().
Referenced by CLanczosResultAudit::AuditResult_EV(), CLanczosMethod::DoResidualCheck(), CLanczosMethod::MergeDegeneratedEigenvalues(), IGeometricUnitCellInfo::RotateAxis(), IGeometricUnitCellInfo::RotateNeighbor(), and CHamiltonianBuilder::RotateTransMatrixFor10Band().


Matrix and vector multiple operation for dense matrix.
| pAMatrix | Matrix class pointer that want to operation |
| pVector | Vector class pointer that want to operation |
| pResult | Vector class pointer that saving operation result |
Definition at line 2797 of file MatrixOperation.cpp.
References CComplex::Add(), CMatrixOperation::CVector::GetAt(), CMatrixOperation::CDMatrix::GetColumnCount(), CMatrixOperation::CDMatrix::GetElement(), CMatrixOperation::CDMatrix::GetRowCount(), CMatrixOperation::CVector::GetSize(), CComplex::MulltiplyComplex(), CMatrixOperation::CVector::SetAt(), and CMatrixOperation::CVector::SetSize().

|
static |
Matrix and vector multiple operation using by block csr.
| pAMatrix | Matrix class pointer that want to operation |
| pVector | Vector class pointer that want to operation |
| pResult | Vector class pointer that saving operation result |
Definition at line 2264 of file MatrixOperation.cpp.
|
static |
Matrix and vector multiple operation for 1 layer exchanging communication.
| pAMatrix | Matrix class pointer that want to operation |
| pVector | Vector class pointer that want to operation |
| pResult | Vector class pointer that saving operation result |
| nSizeFromPrevRank | Exchanging size with previous node |
| nSizeFromNextRank | Exchanging size with next node |
| VTemp | Mering buffer MVMul vector operand |
| nSizePHI | Ratio for MIC operation |
Definition at line 2504 of file MatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CMatrixOperation::CCSR::GetColumnCount(), CMatrixOperation::CCSR::GetRowCount(), CMPIManager::GetTotalNodeCount(), CMatrixOperation::CCSR::m_fFirstRowIndex, CMatrixOperation::CCSR::m_vectColumn, CMatrixOperation::CCSR::m_vectRow, CMatrixOperation::CVector::m_vectValueImaginaryBuffer, CMatrixOperation::CCSR::m_vectValueImaginaryBuffer, CMatrixOperation::CVector::m_vectValueRealBuffer, CMatrixOperation::CCSR::m_vectValueRealBuffer, CMPIManager::MergeVectorEx_Optimal(), CMatrixOperation::CCSR::nComponentsFirstUnitCell, and CMatrixOperation::CCSR::nComponentsLastUnitCell.
Referenced by CLanczosMethod::LanczosIterationLoop().


|
static |
Matrix and vector multiple operation for multiple call.
| pAMatrix | Matrix class pointer that want to operation |
| pVector | Vector class pointer that want to operation |
| pResult | Vector class pointer that saving operation result |
Definition at line 2658 of file MatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CMatrixOperation::CVector::Finalize(), CMatrixOperation::CCSR::GetColumnCount(), CMatrixOperation::CCSR::GetRowCount(), CMatrixOperation::CCSR::m_fFirstRowIndex, CMatrixOperation::CCSR::m_vectColumn, CMatrixOperation::CCSR::m_vectRow, CMatrixOperation::CVector::m_vectValueImaginaryBuffer, CMatrixOperation::CCSR::m_vectValueImaginaryBuffer, CMatrixOperation::CVector::m_vectValueRealBuffer, CMatrixOperation::CCSR::m_vectValueRealBuffer, CMPIManager::MergeVectorOptimal(), and CMatrixOperation::CVector::SetSize().
Referenced by CLanczosMethod::LanczosIterationLoop().


|
static |
Added by jhkang end.
Definition at line 3336 of file MatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CMatrixOperation::CVector::Finalize(), CMatrixOperation::CCSR::GetColumnCount(), CMatrixOperation::CCSR::GetRowCount(), CMatrixOperation::CCSR::m_fFirstRowIndex, CMatrixOperation::CCSR::m_vectColumn, CMatrixOperation::CCSR::m_vectRow, CMatrixOperation::CVector::m_vectValueImaginaryBuffer, CMatrixOperation::CCSR::m_vectValueImaginaryBuffer, CMatrixOperation::CVector::m_vectValueRealBuffer, CMatrixOperation::CCSR::m_vectValueRealBuffer, CMPIManager::MergeVectorOptimal(), and CMatrixOperation::CVector::SetSize().

|
static |
Added by jhkang end.
Definition at line 3325 of file MatrixOperation.cpp.
References CMatrixOperation::CVector::GetAt(), CComplex::GetImaginaryNumber(), CComplex::GetRealNumber(), CMatrixOperation::CVector::GetSize(), and CMatrixOperation::CVector::SetAt().

|
static |
Definition at line 3311 of file MatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CMatrixOperation::CVector::GetAt(), CMatrixOperation::CVector::GetSize(), and CMatrixOperation::CVector::SetAt().

|
static |
| source | Copying source CSR |
| mine | Local CSR buffer |
| left | Left node CSR buffer |
| right | right node CSR buffer |
Definition at line 3122 of file MatrixOperation.cpp.
References CMatrixOperation::CCSR::GetColumnCount(), CMatrixOperation::CCSR::GetFirstRowIndex(), CComplex::GetImaginaryNumber(), CComplex::GetRealNumber(), CMatrixOperation::CCSR::GetRowCount(), CMatrixOperation::CCSR::GetValue(), CMatrixOperation::CCSR::m_vectColumn, CMatrixOperation::CCSR::m_vectRow, pColumn, pRow, CMatrixOperation::CCSR::SetAt(), CComplex::SetImaginaryNumber(), and CComplex::SetRealNumber().
Referenced by CLanczosLaunching::LaunchingLanczos().


Between vectors dot product operation.
| pVector1 | Vector class pointer that want to operation |
| pVector2 | Vector class pointer that want to operation |
| pResult | A result of operation |
Definition at line 2757 of file MatrixOperation.cpp.
References CMPIManager::AllReduceComlex(), ERROR_WRONG_ORDER_OPERATION, CMatrixOperation::CVector::GetSize(), CMatrixOperation::CVector::m_vectValueImaginaryBuffer, CMatrixOperation::CVector::m_vectValueRealBuffer, CComplex::SetComplexNumber(), and CTimeMeasurement::VV_COMM.
Referenced by Gram_schmidt(), CLanczosMethod::LanczosIterationLoop(), and CLanczosMethod::MergeDegeneratedEigenvalues().


|
static |
For MPI Optimized operation using.
Definition at line 280 of file MatrixOperation.h.
Referenced by BuildLocalCSR(), and UpdateLocalCSR().
|
static |
For MPI Optimized operation using.
Definition at line 279 of file MatrixOperation.h.
Referenced by BuildLocalCSR(), and UpdateLocalCSR().
|
static |
For MPI Optimized operation using.
Definition at line 278 of file MatrixOperation.h.