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

Classes | |
| class | CKNCSR |
| Data and operation representation of CSR(Compressed Sparse Row) More... | |
| class | CKNDMatrix |
| Data and operation representation of Matrix. More... | |
| class | CKNVector |
| This class for describing vector for Lanczos method. More... | |
| struct | CSR_ELEMENT_DATA |
| CSR element data. More... | |
| struct | FILL_MATRIX_DATA |
| Hamiltonian building data. More... | |
Public Types | |
| typedef std::vector< double, boost::alignment::aligned_allocator < double, 64 > > | double_vector_t |
| typedef std::vector< unsigned int, boost::alignment::aligned_allocator < unsigned int, 64 > > | uint_vector_t |
| typedef struct CKNMatrixOperation::CSR_ELEMENT_DATA * | LPCSR_ELEMENT_DATA |
| typedef struct CKNMatrixOperation::FILL_MATRIX_DATA * | LPFILL_MATRIX_DATA |
Public Member Functions | |
| CKNMatrixOperation () | |
| Constructor. More... | |
| ~CKNMatrixOperation () | |
| Destructor. More... | |
Static Public Member Functions | |
| static CKNMatrixOperation::CKNCSR * | BuildCSRFromOneDimArray (double *pReal, double *pImaginary, unsigned int nRowOrder, unsigned int nColumnOrder) |
| Building CSR from one dimension array. More... | |
| static CKNMatrixOperation::CKNCSR * | BuildCSRFromFileTemp (FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount) |
| Building CSR from file using double, double, double, double order. More... | |
| static CKNMatrixOperation::CKNCSR * | BuildCSRFromFile_ (FILE *fDataFile, unsigned int nRowOrder, unsigned int nColumnOrder, int nDataCount) |
| Building CSR from file using int, int, double, double order. More... | |
| static CKNMatrixOperation::CKNCSR * | 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 (CKNMatrixOperation::CKNCSR *pCSR) |
| Deallocating CSR memory. More... | |
| static void | DumpCSR (CKNMatrixOperation::CKNCSR *pCSR, const char *pstrFileName) |
| For dubugging save CSR information into file. More... | |
| static void | AllocateLocalCSR (CKNMatrixOperation::CKNCSR **mine, CKNMatrixOperation::CKNCSR **left, CKNMatrixOperation::CKNCSR **right) |
| static void | FreeLocalCSR (CKNMatrixOperation::CKNCSR *mine, CKNMatrixOperation::CKNCSR *left, CKNMatrixOperation::CKNCSR *right) |
| static void | BuildLocalCSR (CKNMatrixOperation::CKNCSR *source, CKNMatrixOperation::CKNCSR *mine, CKNMatrixOperation::CKNCSR *left, CKNMatrixOperation::CKNCSR *right) |
| static void | UpdateLocalCSR (CKNMatrixOperation::CKNCSR *source, CKNMatrixOperation::CKNCSR *mine, CKNMatrixOperation::CKNCSR *left, CKNMatrixOperation::CKNCSR *right) |
| static int | Compare (const void *pA, const void *pB) |
| For qick sort compare operation. More... | |
| 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. More... | |
| static void | MVMulOptimal (CKNCSR *pAMatrix, CKNVector *pVector, CKNVector *pResult) |
| Matrix and vector multiple operation for multiple call. More... | |
| 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. More... | |
| static void | MVMul (CKNCSR *pAMatrix, CKNVector *pVector, CKNVector *pResult) |
| Matrix and vector multiple operation. More... | |
| static bool | VVDot (CKNVector *pVector1, CKNVector *pVector2, CKNComplex *pResult) |
| Between vectors dot product operation. More... | |
| static void | MVMul (CKNDMatrix *pMatrix, CKNVector *pVector, CKNVector *pResult) |
| Matrix and vector multiple operation for dense matrix. More... | |
| static void | MMMul (CKNDMatrix *pMatrix, CKNDMatrix *pMatrixOperand, CKNDMatrix *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 (CKNComplex operand1, CKNComplex operand2, double tol) |
| Compare two vectors with tolerance. More... | |
| static bool | IsSame (CKNVector *pVector1, CKNVector *pVector2) |
| Compare two vectors with general tolerance(1e-8) More... | |
| static int | Gram_schmidt (CKNVector *pVect1, CKNVector *pVect2) |
| Doing gam schmidt orthogonalization. More... | |
Static Public Attributes | |
| static CKNComplex * | 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 25 of file KNMatrixOperation.h.
| typedef std::vector<double, boost::alignment::aligned_allocator<double, 64> > CKNMatrixOperation::double_vector_t |
Definition at line 29 of file KNMatrixOperation.h.
| typedef std::vector<unsigned int, boost::alignment::aligned_allocator<unsigned int, 64> > CKNMatrixOperation::uint_vector_t |
Definition at line 32 of file KNMatrixOperation.h.
| CKNMatrixOperation::CKNMatrixOperation | ( | ) |
Constructor.
CKNCSR Class member function - End
CKNMatrixOperation Class member function - End
Definition at line 1802 of file KNMatrixOperation.cpp.
| CKNMatrixOperation::~CKNMatrixOperation | ( | ) |
|
static |
CKNMatrixOperation Class member function - End
| mine | Local CSR buffer |
| left | Left node CSR buffer |
| right | right node CSR buffer |
Definition at line 2874 of file KNMatrixOperation.cpp.
References ERROR_MALLOC, CKNMPIManager::GetCurrentRank(), CKNMPIManager::GetLoadBalanceCount(), CKNMPIManager::GetMPIComm(), and CKNMPIManager::GetTotalNodeCount().
Referenced by CKNLanczosLaunching::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 1851 of file KNMatrixOperation.cpp.
References CKNMatrixOperation::CKNCSR::BuildDataBuffer(), CKNMatrixOperation::CKNCSR::FinishPush(), CKNMatrixOperation::CKNCSR::PushNoneZeroValue(), REPEAT_COUNT, CKNMatrixOperation::CKNCSR::SetColumnCount(), and CKNMatrixOperation::CKNCSR::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 1819 of file KNMatrixOperation.cpp.
References CKNMatrixOperation::CKNCSR::BuildDataBuffer(), CKNMatrixOperation::CSR_ELEMENT_DATA::fImaginary, CKNMatrixOperation::CKNCSR::FinishPush(), CKNMatrixOperation::CSR_ELEMENT_DATA::fReal, CKNMatrixOperation::CSR_ELEMENT_DATA::nColumn, CKNMatrixOperation::CSR_ELEMENT_DATA::nRow, CKNMatrixOperation::CKNCSR::PushNoneZeroValue(), REPEAT_COUNT, CKNMatrixOperation::CKNCSR::SetColumnCount(), and CKNMatrixOperation::CKNCSR::SetRowCount().
Referenced by CKNLanczosTest::LargeCSRBuildingViaFileForMPI().


|
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 1917 of file KNMatrixOperation.cpp.
References CKNMatrixOperation::CKNCSR::BuildDataBuffer(), Compare(), CKNMatrixOperation::CKNCSR::FinishPush(), CKNMatrixOperation::CKNCSR::PushNoneZeroValue(), CKNMatrixOperation::CKNCSR::SetColumnCount(), and CKNMatrixOperation::CKNCSR::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 1953 of file KNMatrixOperation.cpp.
References CKNMatrixOperation::CKNCSR::BuildDataBuffer(), CKNMatrixOperation::CKNCSR::FinishPush(), CKNMatrixOperation::CKNCSR::PushNoneZeroValue(), CKNMatrixOperation::CKNCSR::SetColumnCount(), and CKNMatrixOperation::CKNCSR::SetRowCount().
Referenced by CKNLanczosTest::TestCSRBuildingViaArray(), CKNLanczosTest::TestCSRBuildingViaFileLoad(), CKNLanczosTest::TestCSRBuildingViaFileLoad_(), and CKNLanczosTest::TestCSRBuildingViaFileLoadOrigin().


|
static |
| source | Copying source CSR |
| mine | Local CSR buffer |
| left | Left node CSR buffer |
| right | right node CSR buffer |
Definition at line 2933 of file KNMatrixOperation.cpp.
References CKNMatrixOperation::CKNCSR::FinishPush(), CKNMatrixOperation::CKNCSR::GetColumnCount(), CKNMatrixOperation::CKNCSR::GetFirstRowIndex(), CKNComplex::GetImaginaryNumber(), CKNComplex::GetRealNumber(), CKNMatrixOperation::CKNCSR::GetRowCount(), CKNMatrixOperation::CKNCSR::GetValue(), CKNMatrixOperation::CKNCSR::m_vectColumn, CKNMatrixOperation::CKNCSR::m_vectRow, pColumn, pRow, and CKNMatrixOperation::CKNCSR::PushNoneZeroValue().
Referenced by CKNLanczosLaunching::LaunchingLanczos().


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

|
inlinestatic |
For dubugging save CSR information into file.
Definition at line 243 of file KNMatrixOperation.h.
References CKNMatrixOperation::CKNCSR::DumpCSR().
Referenced by CKNLanczosTest::TestCSRBuilding().


|
static |
Deallocating CSR memory.
| pCSR | CSR class pointer that want to deallocating memeory |
Definition at line 2085 of file KNMatrixOperation.cpp.
References CKNMatrixOperation::CKNCSR::Finalize().
Referenced by CKNLanczosTest::CompareWithMatLabSeOrth(), CKNLanczosTest::COmpareWIthMatLabSeOrthMPI(), CKNTBMS_Solver::FinalEvn(), FreeLocalCSR(), CKNLanczosTest::LanczosThread(), CKNLanczosTest::LargeSizeMatrixMPI(), CKNLanczosTest::SolvingLargeSizeHamlitonian(), CKNLanczosTest::TestCSRBuilding(), CKNLanczosTest::TestCSRBuildingViaFileLoad_(), CKNLanczosTest::TestLanczos(), and CKNLanczosTest::TestSimpleLanczos().


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


Doing gam schmidt orthogonalization.
| pVect1 | Orthogonalization standard |
| pVect2 | Orthogonalization target |
Definition at line 2814 of file KNMatrixOperation.cpp.
References GENERAL_TOLERANCE, CKNComplex::GetRealNumber(), IsSameA(), CKNMatrixOperation::CKNVector::MinusVector(), CKNMatrixOperation::CKNVector::Normalize(), CKNMatrixOperation::CKNVector::ScalarMultiple(), and VVDot().
Referenced by CKNLanczosMethod::MergeDegeneratedEigenvalues().


|
static |
Compare two double variable.
| operand1 | First operand |
| operand2 | Second operand |
| tol | Difference tolerance |
Definition at line 2789 of file KNMatrixOperation.cpp.
Referenced by CKNLanczosTest::AuditResult(), CKNLanczosTest::AuditResult_Seorth(), CKNLanczosMethod::DoResidualCheck(), CKNLanczosMethod::IntegrateEigenvalues(), CKNLanczosMethod::IntegrateEigenvaluesEx(), IsSame(), and CKNLanczosMethod::MergeDegeneratedEigenvalues().

|
static |
Compare two vectors with tolerance.
| operand1 | Comparing operand 1 |
| operand2 | Comparing operand 2 |
Definition at line 3190 of file KNMatrixOperation.cpp.
References CKNComplex::GetImaginaryNumber(), and CKNComplex::GetRealNumber().

Compare two vectors with general tolerance(1e-8)
| pVector1 | Comparing vector operand 1 |
| pVector2 | Comparing vector operand 2 |
Definition at line 3206 of file KNMatrixOperation.cpp.
References GENERAL_TOLERANCE, CKNMatrixOperation::CKNVector::GetNorm(), IsSame(), and CKNMatrixOperation::CKNVector::MinusVector().

|
static |
Compare two double variable.
| operand1 | First operand |
| operand2 | Second operand |
| tol | Difference tolerance |
Definition at line 2802 of file KNMatrixOperation.cpp.
Referenced by Gram_schmidt(), and CKNLanczosMethod::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 2758 of file KNMatrixOperation.cpp.
References CKNComplex::Add(), CKNMatrixOperation::CKNDMatrix::BuildMatrixFirst(), CKNMatrixOperation::CKNDMatrix::GetColumnCount(), CKNMatrixOperation::CKNDMatrix::GetElement(), CKNMatrixOperation::CKNDMatrix::GetRowCount(), CKNComplex::MulltiplyComplex(), and CKNMatrixOperation::CKNDMatrix::SetElement().
Referenced by CKNHamiltonianBuilder::BuildACCANeighborFor10Band(), CKNHamiltonianBuilder::FillMatrixFor10Band(), and CKNGeometricShape::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 2134 of file KNMatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CKNMatrixOperation::CKNCSR::GetColumnCount(), CKNMatrixOperation::CKNCSR::GetRowCount(), CKNMatrixOperation::CKNCSR::m_vectColumn, CKNMatrixOperation::CKNCSR::m_vectRow, CKNMatrixOperation::CKNVector::m_vectValueImaginaryBuffer, CKNMatrixOperation::CKNCSR::m_vectValueImaginaryBuffer, CKNMatrixOperation::CKNVector::m_vectValueRealBuffer, CKNMatrixOperation::CKNCSR::m_vectValueRealBuffer, CKNMPIManager::MergeVector(), and CKNMatrixOperation::CKNVector::SetSize().
Referenced by CKNLanczosResultAudit::AuditResult_EV(), CKNLanczosMethod::DoResidualCheck(), CKNLanczosMethod::MergeDegeneratedEigenvalues(), IKNGeometricUnitCellInfo::RotateAxis(), IKNGeometricUnitCellInfo::RotateNeighbor(), and CKNHamiltonianBuilder::RotateTransMatrixFor10Band().


|
static |
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 2731 of file KNMatrixOperation.cpp.
References CKNComplex::Add(), CKNMatrixOperation::CKNVector::GetAt(), CKNMatrixOperation::CKNDMatrix::GetColumnCount(), CKNMatrixOperation::CKNDMatrix::GetElement(), CKNMatrixOperation::CKNDMatrix::GetRowCount(), CKNMatrixOperation::CKNVector::GetSize(), CKNComplex::MulltiplyComplex(), CKNMatrixOperation::CKNVector::SetAt(), and CKNMatrixOperation::CKNVector::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 2211 of file KNMatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CKNMPIManager::GetCurrentRank(), CKNMPIManager::GetMPIComm(), CKNMatrixOperation::CKNCSR::GetRowCount(), CKNMatrixOperation::CKNVector::GetSize(), CKNMPIManager::GetTotalNodeCount(), CKNMatrixOperation::CKNCSR::m_vectColumn, CKNMatrixOperation::CKNCSR::m_vectRow, CKNMatrixOperation::CKNVector::m_vectValueImaginaryBuffer, CKNMatrixOperation::CKNCSR::m_vectValueImaginaryBuffer, CKNMatrixOperation::CKNVector::m_vectValueRealBuffer, CKNMatrixOperation::CKNCSR::m_vectValueRealBuffer, CKNTimeMeasurement::MeasurementEnd(), CKNTimeMeasurement::MeasurementStart(), CKNTimeMeasurement::MV_COMM, pColumn, pRow, and X_largest.

|
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 2452 of file KNMatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CKNMatrixOperation::CKNCSR::GetColumnCount(), CKNMatrixOperation::CKNCSR::GetRowCount(), CKNMPIManager::GetTotalNodeCount(), CKNMatrixOperation::CKNCSR::m_fFirstRowIndex, CKNMatrixOperation::CKNCSR::m_vectColumn, CKNMatrixOperation::CKNCSR::m_vectRow, CKNMatrixOperation::CKNVector::m_vectValueImaginaryBuffer, CKNMatrixOperation::CKNCSR::m_vectValueImaginaryBuffer, CKNMatrixOperation::CKNVector::m_vectValueRealBuffer, CKNMatrixOperation::CKNCSR::m_vectValueRealBuffer, CKNMPIManager::MergeVectorEx_Optimal(), CKNMatrixOperation::CKNCSR::nComponentsFirstUnitCell, and CKNMatrixOperation::CKNCSR::nComponentsLastUnitCell.
Referenced by CKNLanczosMethod::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 2600 of file KNMatrixOperation.cpp.
References ERROR_WRONG_ORDER_OPERATION, CKNMatrixOperation::CKNVector::Finalize(), CKNMatrixOperation::CKNCSR::GetColumnCount(), CKNMatrixOperation::CKNCSR::GetRowCount(), CKNMatrixOperation::CKNCSR::m_fFirstRowIndex, CKNMatrixOperation::CKNCSR::m_vectColumn, CKNMatrixOperation::CKNCSR::m_vectRow, CKNMatrixOperation::CKNVector::m_vectValueImaginaryBuffer, CKNMatrixOperation::CKNCSR::m_vectValueImaginaryBuffer, CKNMatrixOperation::CKNVector::m_vectValueRealBuffer, CKNMatrixOperation::CKNCSR::m_vectValueRealBuffer, CKNMPIManager::MergeVectorOptimal(), and CKNMatrixOperation::CKNVector::SetSize().
Referenced by CKNLanczosMethod::LanczosIterationLoop().


|
static |
| source | Copying source CSR |
| mine | Local CSR buffer |
| left | Left node CSR buffer |
| right | right node CSR buffer |
Definition at line 3050 of file KNMatrixOperation.cpp.
References CKNMatrixOperation::CKNCSR::GetColumnCount(), CKNMatrixOperation::CKNCSR::GetFirstRowIndex(), CKNComplex::GetImaginaryNumber(), CKNComplex::GetRealNumber(), CKNMatrixOperation::CKNCSR::GetRowCount(), CKNMatrixOperation::CKNCSR::GetValue(), CKNMatrixOperation::CKNCSR::m_vectColumn, CKNMatrixOperation::CKNCSR::m_vectRow, pColumn, pRow, CKNMatrixOperation::CKNCSR::SetAt(), CKNComplex::SetImaginaryNumber(), and CKNComplex::SetRealNumber().
Referenced by CKNLanczosLaunching::LaunchingLanczos().


|
static |
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 2691 of file KNMatrixOperation.cpp.
References CKNMPIManager::AllReduceComlex(), ERROR_WRONG_ORDER_OPERATION, CKNMatrixOperation::CKNVector::GetSize(), CKNMatrixOperation::CKNVector::m_vectValueImaginaryBuffer, CKNMatrixOperation::CKNVector::m_vectValueRealBuffer, CKNComplex::SetComplexNumber(), and CKNTimeMeasurement::VV_COMM.
Referenced by Gram_schmidt(), CKNLanczosMethod::LanczosIterationLoop(), and CKNLanczosMethod::MergeDegeneratedEigenvalues().


|
static |
For MPI Optimized operation using.
Definition at line 269 of file KNMatrixOperation.h.
Referenced by BuildLocalCSR(), MVMulEx_AsyncCommWithLocalBlocks(), and UpdateLocalCSR().
|
static |
For MPI Optimized operation using.
Definition at line 268 of file KNMatrixOperation.h.
Referenced by BuildLocalCSR(), MVMulEx_AsyncCommWithLocalBlocks(), and UpdateLocalCSR().
|
static |
For MPI Optimized operation using.
Definition at line 266 of file KNMatrixOperation.h.