IPCC  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CMatrixOperation::CDMatrix Class Reference

Data and operation representation of Matrix. More...

#include "MatrixOperation.h"

Collaboration diagram for CMatrixOperation::CDMatrix:
Collaboration graph

Public Types

enum  APPEND_DRIECTION { ROW_DIRECTION, COLUMN_DIRECTION }
 

Public Member Functions

 CDMatrix ()
 Constructor. More...
 
 ~CDMatrix ()
 Destructor. More...
 
bool BuildMatrixFirst (unsigned int nRow, unsigned int nColumn)
 Building matrix elements. More...
 
bool SetElement (unsigned int nRow, unsigned int nColumn, CComplex element)
 Set matrix elements value. More...
 
bool SetElement (unsigned int nRow, unsigned int nColumn, double fRealNumber, double fImageNumber)
 Set matrix elements value. More...
 
void AppendMatrix (APPEND_DRIECTION direction, unsigned int nCount)
 Appending matrix with direction. More...
 
unsigned int GetRowCount ()
 Get matrix row counts. More...
 
unsigned int GetColumnCount ()
 Get matrix column counts. More...
 
bool SetDiagonal (CVector vector)
 Set diagonal elements. More...
 
CComplex GetElement (unsigned int nRowIndex, unsigned int nColumnIndex)
 Get matrix element with row, column index. More...
 
bool SetColumnElement (CVector vector, unsigned int nColumnIndex)
 Set matrix column. More...
 
bool SetRowElement (CVector vector, unsigned int nRowIndex)
 Set matrix element with row, column index. More...
 
bool SetElement (unsigned int nRowStart, unsigned int nColumnStart, unsigned int nSrcRowStart, unsigned int nSrcColumnStart, unsigned int nSrcRowCount, unsigned int nSrcColumnCount, CDMatrix matrix)
 Set elements with arrange information. More...
 
void ScalarMultiple (CComplex Scalar)
 Scalar multiple operation. More...
 
void ScalarMultiple (double fScalar)
 Scalar multiple operation. More...
 
bool GetRowByVector (unsigned int nRowIndex, CMatrixOperation::CVector *pVector)
 Get row elements. More...
 
bool GetColumnByVector (unsigned int nColumnIndex, CMatrixOperation::CVector *pVector)
 Get column elements. More...
 
bool GetSmallMatrix (unsigned int nRowStartIndex, unsigned int nColumnStartIndex, unsigned int nRowCount, unsigned int nColumnCount, CMatrixOperation::CDMatrix *pMatrix)
 Get matrix from large matrix. More...
 
void ScalarDivision (double fScalar)
 Scalar division operation. More...
 
bool TrnasPos ()
 Transpos matrix. More...
 
void operator= (CDMatrix &matrix)
 operation overload for subsitution with reference parameter More...
 
void operator= (CDMatrix *matrix)
 operation overload for subsitution with pointer parameter More...
 
void operator+= (CDMatrix &matrix)
 operation overload for adding with reference parameter More...
 
void operator+= (CDMatrix *matrix)
 operation overload for adding with pointer parameter More...
 

Private Attributes

std::vector< CComplexm_vectValueBuffer
 A member variable for saving none zero elements. More...
 
unsigned int m_nRowCount
 A numbers of row. More...
 
unsigned int m_nColumnCount
 A numbers of column. More...
 

Detailed Description

Data and operation representation of Matrix.

Date
21/Nov/2014

Definition at line 120 of file MatrixOperation.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CMatrixOperation::CDMatrix::CDMatrix ( )

Constructor.


        CVector Class member function - End

        CDMatrix Class member function - Start

Definition at line 571 of file MatrixOperation.cpp.

572 {
573 }
CMatrixOperation::CDMatrix::~CDMatrix ( )

Destructor.

Definition at line 575 of file MatrixOperation.cpp.

576 {
577 }

Member Function Documentation

void CMatrixOperation::CDMatrix::AppendMatrix ( APPEND_DRIECTION  direction,
unsigned int  nCount 
)

Appending matrix with direction.

Parameters
directionAppending direction
nCountAppending size

Definition at line 675 of file MatrixOperation.cpp.

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

676 {
677  unsigned int nFormerRow = m_nRowCount;
678  unsigned int nFormerColumn = m_nColumnCount;
679  unsigned int i, j;
680  std::vector<CComplex> vectTemp;
681 
682  switch (direction)
683  {
684  case ROW_DIRECTION:
685  m_nRowCount += nCount;
686  break;
687  case COLUMN_DIRECTION:
688  m_nColumnCount += nCount;
689  break;
690  }
691 
692  for (i = 0; i < m_nRowCount * m_nColumnCount; ++i)
693  {
694  CComplex element;
695  vectTemp.push_back(element);
696  }
697 
698  for (i = 0; i < nFormerRow; ++i)
699  {
700  for (j = 0; j < nFormerColumn; ++j)
701  {
702  CComplex element = m_vectValueBuffer[nFormerColumn*i + j];
703  vectTemp[m_nColumnCount*i + j].SetComplexNumber(element.GetRealNumber(), element.GetImaginaryNumber());
704  }
705  }
706 }
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
This class for complex operation and saving value.
Definition: Complex.h:16
double GetImaginaryNumber() const
Get imaginary part.
Definition: Complex.h:25
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

bool CMatrixOperation::CDMatrix::BuildMatrixFirst ( unsigned int  nRow,
unsigned int  nColumn 
)

Building matrix elements.

Parameters
nRowRow size
nColumnColumn size
Returns
Success or fail

Definition at line 584 of file MatrixOperation.cpp.

Referenced by CHamiltonianBuilder::BuildACCANeighborFor10Band(), CZincblendeParam::BuildBondVector(), CZincblendeParam::BuildMatrix(), CHamiltonianBuilder::BuildOffsiteMatrixFor10Band(), CGeometricShape::BuildPEHamiltonian(), CGeometricShape::BuildRotationMatrix(), CHamiltonianBuilder::FillMatrixFor10Band(), CHamiltonianBuilder::InitMatirxsFor10BandFillMatrix(), CMatrixOperation::MMMul(), and CGeometricShape::RotateMatrix().

585 {
586  bool bRtn = false;
587  unsigned int i, j;
588 
589  if (!m_vectValueBuffer.empty())
590  return bRtn;
591 
592  bRtn = true;
593  for (i = 0; i < nRow; i++)
594  {
595  for (j = 0; j < nColumn; j++)
596  {
597  CComplex element;
598  m_vectValueBuffer.push_back(element);
599  }
600  }
601 
602  m_nRowCount = nRow;
603  m_nColumnCount = nColumn;
604 
605  return bRtn;
606 }
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
This class for complex operation and saving value.
Definition: Complex.h:16
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.

Here is the caller graph for this function:

bool CMatrixOperation::CDMatrix::GetColumnByVector ( unsigned int  nColumnIndex,
CMatrixOperation::CVector pVector 
)

Get column elements.

Parameters
nColumnIndexTarget column index
pVector[out]Vector that column saving
Returns
Success or fail

Definition at line 818 of file MatrixOperation.cpp.

References CMatrixOperation::CVector::SetAt(), and CMatrixOperation::CVector::SetSize().

819 {
820  bool bRtn = false;
821  unsigned int i;
822 
823  if (nColumnIndex > m_nColumnCount)
824  return bRtn;
825 
826  pVector->SetSize(m_nRowCount);
827  for (i = 0; i < m_nRowCount; ++i)
828  pVector->SetAt(i, m_vectValueBuffer[i*m_nColumnCount + nColumnIndex]);
829 
830  bRtn = true;
831  return bRtn;
832 }
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.
void SetAt(unsigned int nIndex, CComplex value)
Set element value in specific index, Call by value.
void SetSize(unsigned int nSize)
Set Vector elements size.

Here is the call graph for this function:

unsigned int CMatrixOperation::CDMatrix::GetColumnCount ( )
inline

Get matrix column counts.

Definition at line 132 of file MatrixOperation.h.

References m_nColumnCount.

Referenced by CZincblendeParam::BuildBondVector(), GetSmallMatrix(), CMatrixOperation::CCSR::InsertMatrix(), CMatrixOperation::MMMul(), CMatrixOperation::MVMul(), operator+=(), and operator=().

Here is the caller graph for this function:

CComplex CMatrixOperation::CDMatrix::GetElement ( unsigned int  nRowIndex,
unsigned int  nColumnIndex 
)

Get matrix element with row, column index.

Parameters
nRowIndexTarget row index
nColumnIndexTarget column index
Returns
MAatrix element

Definition at line 734 of file MatrixOperation.cpp.

Referenced by CZincblendeParam::CalculateLatticeCoonstants(), CHamiltonianBuilder::FillMatrixFor10Band(), CMatrixOperation::CCSR::InsertMatrix(), CMatrixOperation::MMMul(), CMatrixOperation::MVMul(), operator+=(), operator=(), CMatrixOperation::CCSR::PushMatrix(), CMatrixOperation::CCSR::PushMatrixConcurrent(), CMatrixOperation::CCSR::PushMatrixConcurrentPE(), SetElement(), and CUtility::ShowDenseMatrix().

735 {
736  return m_vectValueBuffer[m_nColumnCount*nRowIndex + nColumnIndex];
737 }
unsigned int m_nColumnCount
A numbers of column.
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.

Here is the caller graph for this function:

bool CMatrixOperation::CDMatrix::GetRowByVector ( unsigned int  nRowIndex,
CMatrixOperation::CVector pVector 
)

Get row elements.

Parameters
nRowIndexTarget row index
pVector[out]Vector that column saving
Returns
Success or fail

Definition at line 839 of file MatrixOperation.cpp.

References CMatrixOperation::CVector::SetAt(), and CMatrixOperation::CVector::SetSize().

Referenced by CHamiltonianBuilder::BuildOffsiteMatrixFor10Band().

840 {
841  bool bRtn = false;
842  unsigned int i;
843 
844  if (nRowIndex > m_nRowCount)
845  return bRtn;
846 
847  pVector->SetSize(m_nColumnCount);
848  for (i = 0; i < m_nColumnCount; ++i)
849  pVector->SetAt(i, m_vectValueBuffer[nRowIndex*m_nColumnCount + i]);
850 
851  bRtn = true;
852  return bRtn;
853 }
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.
void SetAt(unsigned int nIndex, CComplex value)
Set element value in specific index, Call by value.
void SetSize(unsigned int nSize)
Set Vector elements size.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int CMatrixOperation::CDMatrix::GetRowCount ( )
inline

Get matrix row counts.

Definition at line 131 of file MatrixOperation.h.

References m_nRowCount.

Referenced by CZincblendeParam::BuildBondVector(), GetSmallMatrix(), CMatrixOperation::CCSR::InsertMatrix(), CMatrixOperation::MMMul(), CMatrixOperation::MVMul(), operator+=(), and operator=().

Here is the caller graph for this function:

bool CMatrixOperation::CDMatrix::GetSmallMatrix ( unsigned int  nRowStartIndex,
unsigned int  nColumnStartIndex,
unsigned int  nRowCount,
unsigned int  nColumnCount,
CMatrixOperation::CDMatrix pMatrix 
)

Get matrix from large matrix.

Parameters
nRowStartIndexStart index of target row
nColumnStartIndexStart index of target column
nRowCountCopy size or row
nColumnCountCopy size of column
pMatrixSource matrix
Returns
Success or fail

Definition at line 863 of file MatrixOperation.cpp.

References GetColumnCount(), GetRowCount(), and SetElement().

Referenced by CHamiltonianBuilder::FillMatrixFor10Band().

864 {
865  bool bRtn = false;
866  unsigned int i, j;
867 
868  if (nRowStartIndex + nRowCount > m_nRowCount)
869  return bRtn;
870 
871  if (nColumnCount + nColumnCount > m_nColumnCount)
872  return bRtn;
873 
874  if (pMatrix->GetColumnCount() < nColumnCount || pMatrix->GetRowCount() < nRowCount)
875  return bRtn;
876 
877 
878  for (i = nRowStartIndex; i < nRowStartIndex + nRowCount; i++)
879  {
880  for (j = nColumnStartIndex; j < nColumnStartIndex + nColumnCount; j++)
881  {
882  pMatrix->SetElement(i - nRowStartIndex, j - nColumnStartIndex, m_vectValueBuffer[i*m_nColumnCount + j]);
883  }
884  }
885 
886  bRtn = true;
887  return bRtn;
888 }
unsigned int GetRowCount()
Get matrix row counts.
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
bool SetElement(unsigned int nRow, unsigned int nColumn, CComplex element)
Set matrix elements value.
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.
unsigned int GetColumnCount()
Get matrix column counts.

Here is the call graph for this function:

Here is the caller graph for this function:

void CMatrixOperation::CDMatrix::operator+= ( CDMatrix matrix)

operation overload for adding with reference parameter

Parameters
matrixMatrix operand

Definition at line 912 of file MatrixOperation.cpp.

References GetColumnCount(), GetElement(), and GetRowCount().

913 {
914  if (matrix.GetColumnCount() != GetColumnCount() || matrix.GetRowCount() != GetRowCount())
915  return;
916 
917  unsigned int i, j;
918 
919  for (i = 0; i < m_nRowCount; ++i)
920  {
921  for (j = 0; j < m_nColumnCount; ++j)
922  {
923  m_vectValueBuffer[m_nColumnCount*i + j] = m_vectValueBuffer[m_nColumnCount*i + j] + matrix.GetElement(i, j);
924  }
925  }
926 }
unsigned int GetRowCount()
Get matrix row counts.
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.
unsigned int GetColumnCount()
Get matrix column counts.

Here is the call graph for this function:

void CMatrixOperation::CDMatrix::operator+= ( CDMatrix matrix)

operation overload for adding with pointer parameter

Parameters
matrixMatrix operand

Definition at line 904 of file MatrixOperation.cpp.

905 {
906  operator+=((*matrix));
907 }
void operator+=(CDMatrix &matrix)
operation overload for adding with reference parameter
void CMatrixOperation::CDMatrix::operator= ( CDMatrix matrix)

operation overload for subsitution with reference parameter

Parameters
matrixMatrix operand

Definition at line 939 of file MatrixOperation.cpp.

References GetColumnCount(), GetElement(), and GetRowCount().

940 {
941  unsigned int i, j;
942 
943  BuildMatrixFirst(matrix.GetRowCount(), matrix.GetColumnCount());
944 
945  for (i = 0; i < m_nRowCount; i++)
946  {
947  for (j = 0; j < m_nColumnCount; j++)
948  {
949  SetElement(i, j, matrix.GetElement(i, j));
950  }
951  }
952 }
bool BuildMatrixFirst(unsigned int nRow, unsigned int nColumn)
Building matrix elements.
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
bool SetElement(unsigned int nRow, unsigned int nColumn, CComplex element)
Set matrix elements value.

Here is the call graph for this function:

void CMatrixOperation::CDMatrix::operator= ( CDMatrix matrix)

operation overload for subsitution with pointer parameter

Parameters
matrixMatrix operand

Definition at line 931 of file MatrixOperation.cpp.

932 {
933  operator=((*matrix));
934 }
void operator=(CDMatrix &matrix)
operation overload for subsitution with reference parameter
void CMatrixOperation::CDMatrix::ScalarDivision ( double  fScalar)

Scalar division operation.

Parameters
fScalarScalar factor

Definition at line 893 of file MatrixOperation.cpp.

Referenced by CHamiltonianBuilder::FillMatrixFor10Band().

894 {
895  unsigned int nCount = m_vectValueBuffer.size(), i;
896 
897  for (i = 0; i < nCount; ++i)
898  m_vectValueBuffer[i].Division(2.0);
899 }
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.

Here is the caller graph for this function:

void CMatrixOperation::CDMatrix::ScalarMultiple ( CComplex  Scalar)

Scalar multiple operation.

Parameters
fScalarScalar value that want to use in operation

Definition at line 786 of file MatrixOperation.cpp.

Referenced by CZincblendeParam::BuildBondVector().

787 {
788  unsigned int i;
789 
790  for (i = 0; i < m_vectValueBuffer.size(); i++)
791  {
792  m_vectValueBuffer[i] = m_vectValueBuffer[i] * Scalar;
793  }
794 }
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.

Here is the caller graph for this function:

void CMatrixOperation::CDMatrix::ScalarMultiple ( double  fScalar)

Scalar multiple operation.

Parameters
fScalarScalar value that want to use in operation

Definition at line 799 of file MatrixOperation.cpp.

800 {
801  double fReal, fImaginary;
802  unsigned int i;
803 
804  for (i = 0; i < m_vectValueBuffer.size(); i++)
805  {
806  fReal = m_vectValueBuffer[i].GetRealNumber();
807  fImaginary = m_vectValueBuffer[i].GetImaginaryNumber();
808  m_vectValueBuffer[i].SetComplexNumber(fScalar*fReal, fScalar*fImaginary);
809  }
810 }
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.
bool CMatrixOperation::CDMatrix::SetColumnElement ( CVector  vector,
unsigned int  nColumnIndex 
)

Set matrix column.

Parameters
vectorSource vector
nColumnIndexTarget column index
Returns
Success or fail

Definition at line 744 of file MatrixOperation.cpp.

References CMatrixOperation::CVector::GetAt(), and CMatrixOperation::CVector::GetSize().

745 {
746  bool bRtn = false;
747  unsigned int i;
748 
749  if (vector.GetSize() > m_nRowCount)
750  return bRtn;
751 
752  for (i = 0; i < vector.GetSize(); ++i)
753  {
754  SetElement(i, nColumnIndex, vector.GetAt(i));
755  }
756 
757  bRtn = true;
758  return bRtn;
759 }
unsigned int m_nRowCount
A numbers of row.
bool SetElement(unsigned int nRow, unsigned int nColumn, CComplex element)
Set matrix elements value.

Here is the call graph for this function:

bool CMatrixOperation::CDMatrix::SetDiagonal ( CVector  vector)

Set diagonal elements.

Parameters
vectorSource vector
Returns
Success or fail

Definition at line 712 of file MatrixOperation.cpp.

References CMatrixOperation::CVector::GetAt(), and CMatrixOperation::CVector::GetSize().

Referenced by CHamiltonianBuilder::BuildHonsiteBasicMatrixFor10Band().

713 {
714  unsigned int i;
715  bool bRtn = false;
716 
717  if (vector.GetSize() != m_nRowCount || vector.GetSize() != m_nColumnCount)
718  return bRtn;
719 
720  for (i = 0; i < m_nRowCount; ++i)
721  {
722  SetElement(i, i, vector.GetAt(i));
723  }
724 
725  bRtn = true;
726  return bRtn;
727 }
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
bool SetElement(unsigned int nRow, unsigned int nColumn, CComplex element)
Set matrix elements value.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CMatrixOperation::CDMatrix::SetElement ( unsigned int  nRow,
unsigned int  nColumn,
CComplex  element 
)

Set matrix elements value.

Parameters
nRowTarget row index
nColumnTarget column index
elementValue that want to set
Returns
Success or fail

Definition at line 614 of file MatrixOperation.cpp.

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

Referenced by CHamiltonianBuilder::BuildACCANeighborFor10Band(), CZincblendeParam::BuildBondVector(), CGeometricShape::BuildPEHamiltonian(), CGeometricShape::BuildRotationMatrix(), CHamiltonianBuilder::FillMatrixFor10Band(), GetSmallMatrix(), CHamiltonianBuilder::InitMatirxsFor10BandFillMatrix(), CMatrixOperation::MMMul(), and CGeometricShape::RotateMatrix().

615 {
616  return SetElement(nRow, nColumn, element.GetRealNumber(), element.GetImaginaryNumber());
617 }
bool SetElement(unsigned int nRow, unsigned int nColumn, CComplex element)
Set matrix elements value.
double GetImaginaryNumber() const
Get imaginary part.
Definition: Complex.h:25
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

Here is the caller graph for this function:

bool CMatrixOperation::CDMatrix::SetElement ( unsigned int  nRow,
unsigned int  nColumn,
double  fRealNumber,
double  fImageNumber 
)

Set matrix elements value.

Parameters
nRowTarget row index
nColumnTarget column index
fRealNumberReal number that want to set
fImageNumberImaginary number that want to set
Returns
Success or fail

Definition at line 626 of file MatrixOperation.cpp.

627 {
628  bool bRtn = false;
629 
630  if (nRow > m_nRowCount || nColumn > m_nColumnCount)
631  return bRtn;
632 
633  m_vectValueBuffer[m_nColumnCount*nRow + nColumn].SetComplexNumber(fRealNumber, fImageNumber);
634 
635  bRtn = true;
636  return bRtn;
637 }
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.
bool CMatrixOperation::CDMatrix::SetElement ( unsigned int  nRowStart,
unsigned int  nColumnStart,
unsigned int  nSrcRowStart,
unsigned int  nSrcColumnStart,
unsigned int  nSrcRowCount,
unsigned int  nSrcColumnCount,
CDMatrix  matrix 
)

Set elements with arrange information.

Parameters
nRowStartTarget row index want to set data
nColumnStartTarget column index want to set data
nSrcRowStartStart row index of source that want to copy
nSrcColumnStartStart column index of source that want to copy
nSrcRowCountRow count that want to copy
nSrcColumnCountColumn count that want to copy
matrixSource matrix
Returns
Success or fail

Definition at line 649 of file MatrixOperation.cpp.

References GetElement().

650 {
651  bool bRtn = false;
652  unsigned int i, j;
653 
654  if (nRowStart > m_nRowCount || nRowStart + nSrcRowCount > m_nRowCount
655  || nColumnStart > m_nColumnCount || nColumnStart + nSrcColumnCount > m_nColumnCount)
656  return bRtn;
657 
658  for (i = 0; i < nSrcRowCount; i++)
659  {
660  for (j = 0; j < nSrcColumnCount; j++)
661  {
662  CComplex complexNumber = matrix.GetElement(nSrcRowStart + i, nSrcColumnStart + j);
663  m_vectValueBuffer[m_nColumnCount*(nRowStart + i) + (nColumnStart + j)] = complexNumber;
664  }
665  }
666 
667  bRtn = true;
668  return bRtn;
669 }
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
This class for complex operation and saving value.
Definition: Complex.h:16
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.

Here is the call graph for this function:

bool CMatrixOperation::CDMatrix::SetRowElement ( CVector  vector,
unsigned int  nRowIndex 
)

Set matrix element with row, column index.

Parameters
vectorSource vector
nRowIndexTarget row index
Returns
Success or fail

Definition at line 766 of file MatrixOperation.cpp.

References CMatrixOperation::CVector::GetAt(), and CMatrixOperation::CVector::GetSize().

Referenced by CZincblendeParam::BuildMatrix().

767 {
768  bool bRtn = false;
769  unsigned int i;
770 
771  if (vector.GetSize() > m_nColumnCount)
772  return bRtn;
773 
774  for (i = 0; i < vector.GetSize(); ++i)
775  {
776  SetElement(nRowIndex, i, vector.GetAt(i));
777  }
778 
779  bRtn = true;
780  return bRtn;
781 }
unsigned int m_nColumnCount
A numbers of column.
bool SetElement(unsigned int nRow, unsigned int nColumn, CComplex element)
Set matrix elements value.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CMatrixOperation::CDMatrix::TrnasPos ( )

Transpos matrix.

Definition at line 954 of file MatrixOperation.cpp.

Referenced by CHamiltonianBuilder::BuildACCANeighborFor10Band(), CGeometricShape::BuildRotationMatrix(), CHamiltonianBuilder::FillMatrixFor10Band(), and CGeometricShape::RotateMatrix().

955 {
956  bool bRtn = false;
957  unsigned int i, j, nTemp;
958  CComplex tempNumber;
959 
960 
962  {
963  for (i = 0; i < m_nRowCount; ++i)
964  {
965  for (j = 0; j < m_nColumnCount; ++j)
966  {
967  if (j <= i)
968  continue;
969 
970  tempNumber = m_vectValueBuffer[i*m_nColumnCount + j];
971  m_vectValueBuffer[i*m_nColumnCount + j] = m_vectValueBuffer[j*m_nColumnCount + i];
972  m_vectValueBuffer[j*m_nColumnCount + i] = tempNumber;
973  }
974  }
975  }
976  else
977  {
978  std::vector<CComplex> tempVector;
979 
980  for (i = 0; i < m_nColumnCount; i++)
981  {
982  for (j = 0; j < m_nRowCount; j++)
983  {
984  CComplex element;
985  tempVector.push_back(element);
986  }
987  }
988 
989 
990  for (i = 0; i < m_nRowCount; ++i)
991  for (j = 0; j < m_nColumnCount; ++j)
992  tempVector[j*m_nRowCount + i] = m_vectValueBuffer[i*m_nColumnCount + j];
993 
994  nTemp = m_vectValueBuffer.size();
995  for (i = 0; i < nTemp; ++i)
996  m_vectValueBuffer[i] = tempVector[i];
997 
998  nTemp = m_nRowCount;
999  m_nRowCount = m_nColumnCount;
1000  m_nColumnCount = nTemp;
1001  }
1002 
1003  bRtn = true;
1004  return bRtn;
1005 }
unsigned int m_nColumnCount
A numbers of column.
unsigned int m_nRowCount
A numbers of row.
This class for complex operation and saving value.
Definition: Complex.h:16
std::vector< CComplex > m_vectValueBuffer
A member variable for saving none zero elements.

Here is the caller graph for this function:

Member Data Documentation

unsigned int CMatrixOperation::CDMatrix::m_nColumnCount
private

A numbers of column.

Definition at line 154 of file MatrixOperation.h.

Referenced by GetColumnCount().

unsigned int CMatrixOperation::CDMatrix::m_nRowCount
private

A numbers of row.

Definition at line 153 of file MatrixOperation.h.

Referenced by GetRowCount().

std::vector<CComplex> CMatrixOperation::CDMatrix::m_vectValueBuffer
private

A member variable for saving none zero elements.

Definition at line 152 of file MatrixOperation.h.


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