src/Matrix/row_vector.cc
/*
 * ReadSiemens - read a Siemens pulse profile
 *
 * @fin: file stream of the pulse file
*/
read a Siemens pulse profile
@fin: file stream of the pulse file
read a Siemens pulse profile @fin : file stream of the pulse file
row_vector row_vector::ReadSiemens (ifstream& fin)
{
  vector<string> fields;
  vector<double> pts;
  int i = 0, count = 0, in_data = 0;
  string line;
  while (getline (fin, line)) 
  {
    if (line.find ("Entry_Values") < line.length())
      in_data = 1;
    if (in_data) 
    {
      fields.clear();
      line = row_vector::squeeze (line);
      line = row_vector::trim_all (line);
      i = row_vector::split (line, ' ', fields);
      for (unsigned int j = 0; j < fields.size(); j++) 
      {
		if (is_decimal (fields[j].c_str())) 
        {
		  pts.push_back (atof (fields[j].c_str()));
		  count++;
		}
      }
      if (line.find ("End_Entry") < line.length())
	    in_data = 0;
    }
  }
  if (count % 2 != 0) 
  {
  }
  else 
  {
    int npts = pts.size() / 2;
    row_vector v (npts, 0.0);
    for (int i = 0; i < npts; i++) 
    {
      complex ij = complex_exp(-complexi * DEG2RAD * pts[i + npts]);
      v.put (pts[i] * ij, i);
    }
    return v;
  }
  row_vector nv;
  return nv;      
}
row_vector row_vector :: ReadSiemens ( ifstream & fin ) { vector < string > fields ; vector < double > pts ; int i = 0 , count = 0 , in_data = 0 ; string line ; while ( getline ( fin , line ) ) { if ( line . find ( " " ) < line . length ( ) ) in_data = 1 ; if ( in_data ) { fields . clear ( ) ; line = row_vector :: squeeze ( line ) ; line = row_vector :: trim_all ( line ) ; i = row_vector :: split ( line , ' ' , fields ) ; for ( unsigned int j = 0 ; j < fields . size ( ) ; j ++ ) { if ( is_decimal ( fields [ j ] . c_str ( ) ) ) { pts . push_back ( atof ( fields [ j ] . c_str ( ) ) ) ; count ++ ; } } if ( line . find ( " " ) < line . length ( ) ) in_data = 0 ; } } if ( count % 2 != 0 ) { } else { int npts = pts . size ( ) / 2 ; row_vector v ( npts , 0.0 ) ; for ( int i = 0 ; i < npts ; i ++ ) { complex ij = complex_exp ( - complexi * DEG2RAD * pts [ i + npts ] ) ; v . put ( pts [ i ] * ij , i ) ; } return v ; } row_vector nv ; return nv ; }
ReadSiemens - read a Siemens pulse profile
 @fin: file stream of the pulse file
ReadSiemens - read a Siemens pulse profile @fin : file stream of the pulse file
//eprintf ("unequal number of amplitudes and phases"); /* never get here */