src/Matrix/n_matrix.cc
// Input                nmx     : A n_matrix (this)
// Output               hmx     : A new h_matrix matrix whose
//                                elements are the same as nmx
// Note                         : This will allocate NEW memory
// Note                         : This may result in a partial
//                                loss of nmx "non-hermitian" elements
Input                nmx     : A n_matrix (this)
Output               hmx     : A new h_matrix matrix whose
elements are the same as nmx
Note                         : This will allocate NEW memory
Note                         : This may result in a partial
loss of nmx "non-hermitian" elements
Input nmx : A n_matrix ( this ) Output hmx : A new h_matrix matrix whose elements are the same as nmx Note : This will allocate NEW memory Note : This may result in a partial loss of nmx " non - hermitian " elements
h_matrix* n_matrix::HMX()
  {
  if(rows_ != cols_) 				
    {
    NMxerror(14,1);				
    NMxfatal(70);				
    }
  h_matrix* hmx = new h_matrix(rows_,rows_);	
  complex *nij = data;				
  complex *hij = ((h_matrix*)hmx)->data;	
  int i,j;
  for(i=0; i<rows_; i++, nij+=i)
    {
    (*hij) = zRe(*nij);				
    hij++;
    nij++;
    for(j=i+1; j<rows_; j++, hij++, nij++)
      (*hij) = (*nij);				
    }
  return hmx;
  }
h_matrix * n_matrix :: HMX ( ) { if ( rows_ != cols_ ) { NMxerror ( 14 , 1 ) ; NMxfatal ( 70 ) ; } h_matrix * hmx = new h_matrix ( rows_ , rows_ ) ; complex * nij = data ; complex * hij = ( ( h_matrix * ) hmx ) -> data ; int i , j ; for ( i = 0 ; i < rows_ ; i ++ , nij += i ) { ( * hij ) = zRe ( * nij ) ; hij ++ ; nij ++ ; for ( j = i + 1 ; j < rows_ ; j ++ , hij ++ , nij ++ ) ( * hij ) = ( * nij ) ; } return hmx ; }
Input                nmx     : A n_matrix (this)
Output               hmx     : A new h_matrix matrix whose
elements are the same as nmx
Note                         : This will allocate NEW memory
Note                         : This may result in a partial
loss of nmx "non-hermitian" elements
Input nmx : A n_matrix ( this ) Output hmx : A new h_matrix matrix whose elements are the same as nmx Note : This will allocate NEW memory Note : This may result in a partial loss of nmx " non - hermitian " elements
// Array nmx MUST be square //    Bad rectangular array use //    Cannot convert to Hermitian // Start with an empty h_matrix // Start of data in nmx: <i|nmx|j>-><0|nmx|0> // Start of data in hmx: <i|hmx|j>-><0|hmx|0> // <i|hmx|i> = Re<i|nmx|i> // <i|hmx|j> = <i|nmx|j>, upper triangle