src/HSLib/SpinOp.cc
/* These functions allow for simple mathematical operations between two spin
   operators.  This includes addition, subtraction, multiplication. There is
   one unary function as well, negation.
 
   Operator Arguments      Result        Operator Arguments    Result
   -------- --------- -----------------  -------- --------- -------------------   
      -        SOp    Returns -SOp          -=    SOp,SOp1  SOp1 subt. from SOp
      +     SOp,SOp1  Returns SOp+SOp1       *    SOp1,SOp2 Returns SOp1*SOp2 
     +=     SOp,SOp1  SOp1 added to SOp     *=    SOp,SOp1  SOp mult into SOp1
      -     SOp1,SOp2 Returns SOp1-SOp2                                      */
These functions allow for simple mathematical operations between two spin
operators.  This includes addition, subtraction, multiplication. There is
one unary function as well, negation.


These functions allow for simple mathematical operations between two spin operators . This includes addition subtraction multiplication . There is one unary function as well negation .
spin_op spin_op::operator- () const
  {
  spin_op SOp(*this);				
  if(mx.rows() > 1) SOp.mx = mx.operator- (); 	
  if(pr!=NULL) SOp.pr[0]= (pr[0]).operator- ();	
  return SOp;					
  }
spin_op spin_op :: operator - ( ) const { spin_op SOp ( * this ) ; if ( mx . rows ( ) > 1 ) SOp . mx = mx . operator - ( ) ; if ( pr != NULL ) SOp . pr [ 0 ] = ( pr [ 0 ] ) . operator - ( ) ; return SOp ; }
These functions allow for simple mathematical operations between two spin
operators.
These functions allow for simple mathematical operations between two spin operators .
// Begin with copy of input SOp // Negate full mx (if exists) // Negate 1st single spin array  // if subspace arrays exist