src/Matrix/row_vector.cc
/* The row vector is placed into an array of strings, each string having
   equal length. If the number of vector elements exceeds the number of
   elements we allow on a single printed line, then a new line is begun.
   The number of elements per line is set by PFlgs.VxCols.                  */
The row vector is placed into an array of strings, each string having
equal length. If the number of vector elements exceeds the number of
elements we allow on a single printed line, then a new line is begun.
The number of elements per line is set by PFlgs.VxCols.
The row vector is placed into an array of strings each string having equal length . If the number of vector elements exceeds the number of elements we allow on a single printed line then a new line is begun . The number of elements per line is set by PFlgs . VxCols .
std::vector<std::string> row_vector::printStrings(const MxPrint& PFlgs) const
  {
  std::vector<std::string> PStrings;
  int npts = size();
  if(!npts) return PStrings;
  int ptype = 0;				
  if(PFlgs.MxRIPrnt)				
    {						
    if(is_real())           ptype = 1;		
    else if(is_imaginary()) ptype = 2; 		
    }
  int elen;					
  switch(ptype)					
    {						
    default:					
    case 0: elen = complex::zlength(); break;	
    case 1:					
    case 2: elen = complex::dlength(); break;	
    }
  std::string ezer = std::string(elen, ' ');	
  std::string efmt = complex::dformat();	
  std::string vline;				
  int ncol = PFlgs.VxCols;			
  if(ptype) ncol *=2;				
  int col=0, row=0;				
  for(int pos=0; pos<npts; pos++ )
    {
    if(col == 0) vline = "";
    if(ptype==1)					
      vline += MxModform(efmt.c_str(),getRe(pos)); 	
    else if(ptype==2)					
      vline += MxModform(efmt.c_str(),getIm(pos)); 	
    else  vline += get(pos).printString();         	complex
    col++;
    if(col < ncol)  vline += " ";
    else          { PStrings.push_back(vline); col=0; row++; }
    }
  if(col)					
    {						
    if(row)					
      while(col < ncol)				
       { vline += ezer + " "; col++; }
    PStrings.push_back(vline);			
    }
  return PStrings;
  }
std :: vector < std :: string > row_vector :: printStrings ( const MxPrint & PFlgs ) const { std :: vector < std :: string > PStrings ; int npts = size ( ) ; if ( ! npts ) return PStrings ; int ptype = 0 ; if ( PFlgs . MxRIPrnt ) { if ( is_real ( ) ) ptype = 1 ; else if ( is_imaginary ( ) ) ptype = 2 ; } int elen ; switch ( ptype ) { default : case 0 : elen = complex :: zlength ( ) ; break ; case 1 : case 2 : elen = complex :: dlength ( ) ; break ; } std :: string ezer = std :: string ( elen , ' ' ) ; std :: string efmt = complex :: dformat ( ) ; std :: string vline ; int ncol = PFlgs . VxCols ; if ( ptype ) ncol *= 2 ; int col = 0 , row = 0 ; for ( int pos = 0 ; pos < npts ; pos ++ ) { if ( col == 0 ) vline = " " ; if ( ptype == 1 ) vline += MxModform ( efmt . c_str ( ) , getRe ( pos ) ) ; else if ( ptype == 2 ) vline += MxModform ( efmt . c_str ( ) , getIm ( pos ) ) ; else vline += get ( pos ) . printString ( ) ; col ++ ; if ( col < ncol ) vline += " " ; else { PStrings . push_back ( vline ) ; col = 0 ; row ++ ; } } if ( col ) { if ( row ) while ( col < ncol ) { vline += ezer + " " ; col ++ ; } PStrings . push_back ( vline ) ; } return PStrings ; }
The row vector is placed into an array of strings, each string having
equal length.
The row vector is placed into an array of strings each string having equal length .
// Assume complex elements // See if we want just reals // or just imags printed //   Real elements output //   Imag elements output // A single element length // Get the element length from // class complex. Depend on  // complex class settings //   Element length if complex //   Element length if real //   Element length if imaginary // Invisible element // Real/Imag element format // String for printed line // Columns in output // Twice as many if real/imag // Column index // Output as  // a real element // Output as // an imaginary element // Output as complex // If we have not output all // columns yet //    Fill with blanks if //    previous rows output //    Output last row