src/Matrix/h_matrix.cc
// Input            hmx : A h_matrix (this)
//		     mx : A second matrix
// Output           mx1 : The result of adding hmx & mx
// Note			: This function avoids any matrix
//			  copying if it can help it
Input            hmx : A h_matrix (this)
mx : A second matrix
Output           mx1 : The result of adding hmx & mx
Note                   : This function avoids any matrix
copying if it can help it
Input hmx : A h_matrix ( this ) mx : A second matrix Output mx1 : The result of adding hmx & mx Note : This function avoids any matrix copying if it can help it
_matrix* h_matrix::add_two(_matrix* mx)
  {
  if((mx->stored_type()) == h_matrix_type)	 
    { 
    if(rows_ != mx->rows())			
      {
      HMxerror(17, 1);				
      HMxerror(6, "mx1 + mx2", 1);		
      HMxfatal(3, "add_two");			
      }
    else
      {
      complex *a=&((h_matrix*)mx)->data[size-1];
      complex *b = &data[size-1];		
      for(; b>=data; b--,a--)			
        (*a) += (*b);
      return mx;
      }
    }
  return add(mx); 				
  }
_matrix * h_matrix :: add_two ( _matrix * mx ) { if ( ( mx -> stored_type ( ) ) == h_matrix_type ) { if ( rows_ != mx -> rows ( ) ) { HMxerror ( 17 , 1 ) ; HMxerror ( 6 , " " , 1 ) ; HMxfatal ( 3 , " " ) ; } else { complex * a = & ( ( h_matrix * ) mx ) -> data [ size - 1 ] ; complex * b = & data [ size - 1 ] ; for ( ; b >= data ; b -- , a -- ) ( * a ) += ( * b ) ; return mx ; } } return add ( mx ) ; }
Input            hmx : A h_matrix (this)
mx : A second matrix
Output           mx1 : The result of adding hmx & mx
Note                   : This function avoids any matrix
copying if it can help it
Input hmx : A h_matrix ( this ) mx : A second matrix Output mx1 : The result of adding hmx & mx Note : This function avoids any matrix copying if it can help it
// Add h_matrix into h_matrix // Insure matrix dimensions match // Dimension problems // Bad use of function  // Array dimensions mismatched // Pointer to last element of mx // Pointer to last element of hmx // Perform addition elementwise // If add hmx & !hmx, type changes.