IPCC  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CKNMatrixOperation::CKNDMatrix Class Reference

Data and operation representation of Matrix. More...

#include "KNMatrixOperation.h"

Collaboration diagram for CKNMatrixOperation::CKNDMatrix:
Collaboration graph

Public Types

enum  APPEND_DRIECTION { ROW_DIRECTION, COLUMN_DIRECTION }
 

Public Member Functions

 CKNDMatrix ()
 Constructor. More...
 
 ~CKNDMatrix ()
 Destructor. More...
 
bool BuildMatrixFirst (unsigned int nRow, unsigned int nColumn)
 Building matrix elements. More...
 
bool SetElement (unsigned int nRow, unsigned int nColumn, CKNComplex 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 (CKNVector vector)
 Set diagonal elements. More...
 
CKNComplex GetElement (unsigned int nRowIndex, unsigned int nColumnIndex)
 Get matrix element with row, column index. More...
 
bool SetColumnElement (CKNVector vector, unsigned int nColumnIndex)
 Set matrix column. More...
 
bool SetRowElement (CKNVector 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, CKNDMatrix matrix)
 Set elements with arrange information. More...
 
void ScalarMultiple (CKNComplex Scalar)
 Scalar multiple operation. More...
 
void ScalarMultiple (double fScalar)
 Scalar multiple operation. More...
 
bool GetRowByVector (unsigned int nRowIndex, CKNMatrixOperation::CKNVector *pVector)
 Get row elements. More...
 
bool GetColumnByVector (unsigned int nColumnIndex, CKNMatrixOperation::CKNVector *pVector)
 Get column elements. More...
 
bool GetSmallMatrix (unsigned int nRowStartIndex, unsigned int nColumnStartIndex, unsigned int nRowCount, unsigned int nColumnCount, CKNMatrixOperation::CKNDMatrix *pMatrix)
 Get matrix from large matrix. More...
 
void ScalarDivision (double fScalar)
 Scalar division operation. More...
 
bool TrnasPos ()
 Transpos matrix. More...
 
void operator= (CKNDMatrix &matrix)
 operation overload for subsitution with reference parameter More...
 
void operator= (CKNDMatrix *matrix)
 operation overload for subsitution with pointer parameter More...
 
void operator+= (CKNDMatrix &matrix)
 operation overload for adding with reference parameter More...
 
void operator+= (CKNDMatrix *matrix)
 operation overload for adding with pointer parameter More...
 

Private Attributes

std::vector< CKNComplexm_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
Author
Kyu Nam Cho(mysto.nosp@m.us@k.nosp@m.orea..nosp@m.ac.k.nosp@m.r), Hoon Ryu(elec1.nosp@m.020@.nosp@m.gmail.nosp@m..com)

Definition at line 120 of file KNMatrixOperation.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CKNMatrixOperation::CKNDMatrix::CKNDMatrix ( )

Constructor.


        CKNVector Class member function - End

        CKNDMatrix Class member function - Start

Definition at line 572 of file KNMatrixOperation.cpp.

573 {
574 }
CKNMatrixOperation::CKNDMatrix::~CKNDMatrix ( )

Destructor.

Definition at line 576 of file KNMatrixOperation.cpp.

577 {
578 }

Member Function Documentation

void CKNMatrixOperation::CKNDMatrix::AppendMatrix ( APPEND_DRIECTION  direction,
unsigned int  nCount 
)

Appending matrix with direction.

Parameters
directionAppending direction
nCountAppending size

Definition at line 676 of file KNMatrixOperation.cpp.

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

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

Here is the call graph for this function:

bool CKNMatrixOperation::CKNDMatrix::BuildMatrixFirst ( unsigned int  nRow,
unsigned int  nColumn 
)

Building matrix elements.

Parameters
nRowRow size
nColumnColumn size
Returns
Success or fail

Definition at line 585 of file KNMatrixOperation.cpp.

Referenced by CKNHamiltonianBuilder::BuildACCANeighborFor10Band(), CKNZincblendeParam::BuildBondVector(), CKNZincblendeParam::BuildMatrix(), CKNHamiltonianBuilder::BuildOffsiteMatrixFor10Band(), CKNGeometricShape::BuildRotationMatrix(), CKNHamiltonianBuilder::FillMatrixFor10Band(), CKNHamiltonianBuilder::InitMatirxsFor10BandFillMatrix(), CKNMatrixOperation::MMMul(), and CKNGeometricShape::RotateMatrix().

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

Here is the caller graph for this function:

bool CKNMatrixOperation::CKNDMatrix::GetColumnByVector ( unsigned int  nColumnIndex,
CKNMatrixOperation::CKNVector pVector 
)

Get column elements.

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

Definition at line 819 of file KNMatrixOperation.cpp.

References CKNMatrixOperation::CKNVector::SetAt(), and CKNMatrixOperation::CKNVector::SetSize().

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

Here is the call graph for this function:

unsigned int CKNMatrixOperation::CKNDMatrix::GetColumnCount ( )
inline

Get matrix column counts.

Definition at line 132 of file KNMatrixOperation.h.

References m_nColumnCount.

Referenced by CKNZincblendeParam::BuildBondVector(), GetSmallMatrix(), CKNMatrixOperation::CKNCSR::InsertMatrix(), CKNMatrixOperation::MMMul(), CKNMatrixOperation::MVMul(), operator+=(), and operator=().

Here is the caller graph for this function:

CKNComplex CKNMatrixOperation::CKNDMatrix::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 735 of file KNMatrixOperation.cpp.

Referenced by CKNZincblendeParam::CalculateLatticeCoonstants(), CKNHamiltonianBuilder::FillMatrixFor10Band(), CKNMatrixOperation::CKNCSR::InsertMatrix(), CKNMatrixOperation::MMMul(), CKNMatrixOperation::MVMul(), operator+=(), operator=(), CKNMatrixOperation::CKNCSR::PushMatrix(), CKNMatrixOperation::CKNCSR::PushMatrixConcurrent(), SetElement(), CKNMatrixDebug::ShowDenseMatrix(), and CKNIPCCUtility::ShowDenseMatrix().

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

Here is the caller graph for this function:

bool CKNMatrixOperation::CKNDMatrix::GetRowByVector ( unsigned int  nRowIndex,
CKNMatrixOperation::CKNVector pVector 
)

Get row elements.

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

Definition at line 840 of file KNMatrixOperation.cpp.

References CKNMatrixOperation::CKNVector::SetAt(), and CKNMatrixOperation::CKNVector::SetSize().

Referenced by CKNHamiltonianBuilder::BuildOffsiteMatrixFor10Band().

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

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int CKNMatrixOperation::CKNDMatrix::GetRowCount ( )
inline

Get matrix row counts.

Definition at line 131 of file KNMatrixOperation.h.

References m_nRowCount.

Referenced by CKNZincblendeParam::BuildBondVector(), GetSmallMatrix(), CKNMatrixOperation::CKNCSR::InsertMatrix(), CKNMatrixOperation::MMMul(), CKNMatrixOperation::MVMul(), operator+=(), and operator=().

Here is the caller graph for this function:

bool CKNMatrixOperation::CKNDMatrix::GetSmallMatrix ( unsigned int  nRowStartIndex,
unsigned int  nColumnStartIndex,
unsigned int  nRowCount,
unsigned int  nColumnCount,
CKNMatrixOperation::CKNDMatrix 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 864 of file KNMatrixOperation.cpp.

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

Referenced by CKNHamiltonianBuilder::FillMatrixFor10Band().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNMatrixOperation::CKNDMatrix::operator+= ( CKNDMatrix matrix)

operation overload for adding with reference parameter

Parameters
matrixMatrix operand

Definition at line 913 of file KNMatrixOperation.cpp.

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

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

Here is the call graph for this function:

void CKNMatrixOperation::CKNDMatrix::operator+= ( CKNDMatrix matrix)

operation overload for adding with pointer parameter

Parameters
matrixMatrix operand

Definition at line 905 of file KNMatrixOperation.cpp.

906 {
907  operator+=((*matrix));
908 }
void operator+=(CKNDMatrix &matrix)
operation overload for adding with reference parameter
void CKNMatrixOperation::CKNDMatrix::operator= ( CKNDMatrix matrix)

operation overload for subsitution with reference parameter

Parameters
matrixMatrix operand

Definition at line 940 of file KNMatrixOperation.cpp.

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

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

Here is the call graph for this function:

void CKNMatrixOperation::CKNDMatrix::operator= ( CKNDMatrix matrix)

operation overload for subsitution with pointer parameter

Parameters
matrixMatrix operand

Definition at line 932 of file KNMatrixOperation.cpp.

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

Scalar division operation.

Parameters
fScalarScalar factor

Definition at line 894 of file KNMatrixOperation.cpp.

Referenced by CKNHamiltonianBuilder::FillMatrixFor10Band().

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

Here is the caller graph for this function:

void CKNMatrixOperation::CKNDMatrix::ScalarMultiple ( CKNComplex  Scalar)

Scalar multiple operation.

Parameters
fScalarScalar value that want to use in operation

Definition at line 787 of file KNMatrixOperation.cpp.

Referenced by CKNZincblendeParam::BuildBondVector().

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

Here is the caller graph for this function:

void CKNMatrixOperation::CKNDMatrix::ScalarMultiple ( double  fScalar)

Scalar multiple operation.

Parameters
fScalarScalar value that want to use in operation

Definition at line 800 of file KNMatrixOperation.cpp.

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

Set matrix column.

Parameters
vectorSource vector
nColumnIndexTarget column index
Returns
Success or fail

Definition at line 745 of file KNMatrixOperation.cpp.

References CKNMatrixOperation::CKNVector::GetAt(), and CKNMatrixOperation::CKNVector::GetSize().

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

Here is the call graph for this function:

bool CKNMatrixOperation::CKNDMatrix::SetDiagonal ( CKNVector  vector)

Set diagonal elements.

Parameters
vectorSource vector
Returns
Success or fail

Definition at line 713 of file KNMatrixOperation.cpp.

References CKNMatrixOperation::CKNVector::GetAt(), and CKNMatrixOperation::CKNVector::GetSize().

Referenced by CKNHamiltonianBuilder::BuildHonsiteBasicMatrixFor10Band().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool CKNMatrixOperation::CKNDMatrix::SetElement ( unsigned int  nRow,
unsigned int  nColumn,
CKNComplex  element 
)

Set matrix elements value.

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

Definition at line 615 of file KNMatrixOperation.cpp.

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

Referenced by CKNHamiltonianBuilder::BuildACCANeighborFor10Band(), CKNZincblendeParam::BuildBondVector(), CKNGeometricShape::BuildRotationMatrix(), CKNHamiltonianBuilder::FillMatrixFor10Band(), GetSmallMatrix(), CKNHamiltonianBuilder::InitMatirxsFor10BandFillMatrix(), CKNMatrixOperation::MMMul(), and CKNGeometricShape::RotateMatrix().

616 {
617  return SetElement(nRow, nColumn, element.GetRealNumber(), element.GetImaginaryNumber());
618 }
double GetImaginaryNumber() const
Get imaginary part.
Definition: KNComplex.h:27
double GetRealNumber() const
Get real part.
Definition: KNComplex.h:26
bool SetElement(unsigned int nRow, unsigned int nColumn, CKNComplex element)
Set matrix elements value.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CKNMatrixOperation::CKNDMatrix::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 627 of file KNMatrixOperation.cpp.

628 {
629  bool bRtn = false;
630 
631  if (nRow > m_nRowCount || nColumn > m_nColumnCount)
632  return bRtn;
633 
634  m_vectValueBuffer[m_nColumnCount*nRow + nColumn].SetComplexNumber(fRealNumber, fImageNumber);
635 
636  bRtn = true;
637  return bRtn;
638 }
unsigned int m_nRowCount
A numbers of row.
unsigned int m_nColumnCount
A numbers of column.
std::vector< CKNComplex > m_vectValueBuffer
A member variable for saving none zero elements.
bool CKNMatrixOperation::CKNDMatrix::SetElement ( unsigned int  nRowStart,
unsigned int  nColumnStart,
unsigned int  nSrcRowStart,
unsigned int  nSrcColumnStart,
unsigned int  nSrcRowCount,
unsigned int  nSrcColumnCount,
CKNDMatrix  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 650 of file KNMatrixOperation.cpp.

References GetElement().

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

Here is the call graph for this function:

bool CKNMatrixOperation::CKNDMatrix::SetRowElement ( CKNVector  vector,
unsigned int  nRowIndex 
)

Set matrix element with row, column index.

Parameters
vectorSource vector
nRowIndexTarget row index
Returns
Success or fail

Definition at line 767 of file KNMatrixOperation.cpp.

References CKNMatrixOperation::CKNVector::GetAt(), and CKNMatrixOperation::CKNVector::GetSize().

Referenced by CKNZincblendeParam::BuildMatrix().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool CKNMatrixOperation::CKNDMatrix::TrnasPos ( )

Transpos matrix.

Definition at line 955 of file KNMatrixOperation.cpp.

Referenced by CKNHamiltonianBuilder::BuildACCANeighborFor10Band(), CKNGeometricShape::BuildRotationMatrix(), CKNHamiltonianBuilder::FillMatrixFor10Band(), and CKNGeometricShape::RotateMatrix().

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

Here is the caller graph for this function:

Member Data Documentation

unsigned int CKNMatrixOperation::CKNDMatrix::m_nColumnCount
private

A numbers of column.

Definition at line 154 of file KNMatrixOperation.h.

Referenced by GetColumnCount().

unsigned int CKNMatrixOperation::CKNDMatrix::m_nRowCount
private

A numbers of row.

Definition at line 153 of file KNMatrixOperation.h.

Referenced by GetRowCount().

std::vector<CKNComplex> CKNMatrixOperation::CKNDMatrix::m_vectValueBuffer
private

A member variable for saving none zero elements.

Definition at line 152 of file KNMatrixOperation.h.


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