src/Matrix/complex.cc
// Input                ostr : An output stream
//                      z    : A complex number, won't be changed
// Output               ostr : The modified output stream containing
//                             complex number z in the format set
//                             in complex_setf function
Input                ostr : An output stream
z    : A complex number, won't be changed
Output               ostr : The modified output stream containing
complex number z in the format set
in complex_setf function
Input ostr : An output stream z : A complex number won ' t be changed Output ostr : The modified output stream containing complex number z in the format set in complex_setf function
string complex::printString() const
  {
  string PS;				
  if(complex::_phase)				
    { 
    double p = phase(*this);			
    double n = norm(*this);			
    if(complex::_math)				
      { 					
      if(n==0) 					
        PS = _zzer				
           + string(_digits+7, ' ');		
      else
	{
	PS = MxModform(_form.c_str(),n)		
	   + "*exp(";				
	if(p==0)				
         PS += _zzer;				
        else					
         PS+=MxModform(_form.c_str(),p);	
        PS += "i)";				
	}
      return PS;				
      }						
    else					
      {						
               PS =  "[";			
      if(n==0) PS += _zzer;
      else     PS += MxModform(complex::_form.c_str(),n);
               PS += ",";
      if(p==0) PS += _zzer;
      else     PS += MxModform(complex::_form.c_str(),p);
               PS += "]";
      return PS;				
      }						
    }
  if(complex::_math) 				
    {						
    if(re==0) PS = _zzer;			
    else      PS =  MxModform(_form.c_str(),re);
    if(im>=0) PS += "+";
    else      PS += "-";
    if(im==0) PS += _zzer;
    else      PS += MxModform(_form.c_str(),fabs(im));
              PS += "i";
    }
  else						
    {						
              PS =  "(";			
    if(re==0) PS += _zzer;
    else      PS += MxModform(_form.c_str(),re);
              PS += ",";
    if(im==0) PS += _zzer;
    else      PS += MxModform(_form.c_str(),im);
              PS += ")"; 
    }
  return PS;
  }
string complex :: printString ( ) const { string PS ; if ( complex :: _phase ) { double p = phase ( * this ) ; double n = norm ( * this ) ; if ( complex :: _math ) { if ( n == 0 ) PS = _zzer + string ( _digits + 7 , ' ' ) ; else { PS = MxModform ( _form . c_str ( ) , n ) + " " ; if ( p == 0 ) PS += _zzer ; else PS += MxModform ( _form . c_str ( ) , p ) ; PS += " " ; } return PS ; } else { PS = " " ; if ( n == 0 ) PS += _zzer ; else PS += MxModform ( complex :: _form . c_str ( ) , n ) ; PS += " " ; if ( p == 0 ) PS += _zzer ; else PS += MxModform ( complex :: _form . c_str ( ) , p ) ; PS += " " ; return PS ; } } if ( complex :: _math ) { if ( re == 0 ) PS = _zzer ; else PS = MxModform ( _form . c_str ( ) , re ) ; if ( im >= 0 ) PS += " " ; else PS += " " ; if ( im == 0 ) PS += _zzer ; else PS += MxModform ( _form . c_str ( ) , fabs ( im ) ) ; PS += " " ; } else { PS = " " ; if ( re == 0 ) PS += _zzer ; else PS += MxModform ( _form . c_str ( ) , re ) ; PS += " " ; if ( im == 0 ) PS += _zzer ; else PS += MxModform ( _form . c_str ( ) , im ) ; PS += " " ; } return PS ; }
Input                ostr : An output stream
z    : A complex number, won't be changed
Output               ostr : The modified output stream containing
complex number z in the format set
in complex_setf function
Input ostr : An output stream z : A complex number won ' t be changed Output ostr : The modified output stream containing complex number z in the format set in complex_setf function
// Our print string //            Set Output String Using R and Phi //   _math==TRUE: R*exp(i*phi)    _math==FALSE: [R,phi] // Here _math=T=_phase // Get complex phase // Get complex norm // Here _math=TRUE=_phase // Format: R*exp(i*phi) // Length: 2*digits+7 //    Set norm (zero) //    Set phase (empty) //    Set norm	 //    phase header //    If phase is zero //    we write exactly 0 //    If phase not zero //   we write the number //    phase end // We are done if writing // as R*exp(i*phi) // Here _math=F, phase=T // Format: [R,phi] // Length: 2*digits+3 // We are done if // as [R, phi] //                Set Output String Using a and b //         _math==TRUE: Re+iIm    _math==FALSE: (Re,Im) // Here _math=T, phase=F // Format: re + im i // Length: 2*digits+2  // Here _math = FALSE = _phase // Format: (re,im) // Length: 2*digits+3