Пример #1
0
void OrbElemRinex :: dumpTerse(ostream& s) const
throw(InvalidRequest )
{

    // Check if the subframes have been loaded before attempting
    // to dump them.
    if (!dataLoaded())
    {
        InvalidRequest exc("No data in the object");
        GPSTK_THROW(exc);
    }

    ios::fmtflags oldFlags = s.flags();

    s.setf(ios::fixed, ios::floatfield);
    s.setf(ios::right, ios::adjustfield);
    s.setf(ios::uppercase);
    s.precision(0);
    s.fill(' ');

    SVNumXRef svNumXRef;
    int NAVSTARNum = 0;
    try
    {
        NAVSTARNum = svNumXRef.getNAVSTAR(satID.id, ctToe );


        s << setw(2) << " " << NAVSTARNum << "  ";
    }
    catch(NoNAVSTARNumberFound)
    {
        s << "  XX  ";
    }

    s << setw(2) << satID.id << " ! ";

    string tform = "%3j %02H:%02M:%02S";

    s << printTime(beginValid, tform) << " ! ";
    s << printTime(ctToe, tform) << " ! ";
    s << printTime(endValid, tform) << " !  ";

    s << setw(4) << setprecision(1) << getAccuracy() << "  ! ";
    s << "0x" << setfill('0') << hex << setw(3) << IODC << " ! ";
    s << "0x" << setfill('0')  << setw(2) << health;
    s << setfill(' ') << dec;
    s << "   " << setw(2) << health << " ! ";

    s << endl;
    s.flags(oldFlags);

} // end of dumpTerse()
Пример #2
0
void  field_value_t::print_value(ostream & os)
{
    assert (_pfield_desc);

    if (_null_flag) {
	os << "(null)";
	return;
    }

    switch (_pfield_desc->type()) {
    case SQL_BIT:
	os <<_value._bit;
	break;
    case SQL_SMALLINT:
	os <<_value._smallint;
	break;
    case SQL_CHAR:
	os <<_value._char;
	break;
    case SQL_INT:
	os << _value._int;
	break;
    case SQL_FLOAT:
	os << fixed;
	os.precision(2);
	os << _value._float;
	break;
    case SQL_LONG:
	os << _value._long;
	break;
    case SQL_TIME:
        char mstr[32];
        _value._time->string(mstr,32);
	os << mstr;
	break;
    case SQL_VARCHAR:
    case SQL_FIXCHAR:
	//os << "\"";
	for (uint i=0; i<_real_size; i++) {
	    if (_value._string[i]) os << _value._string[i];
	}
	//os << "\"";
	break;
    case SQL_NUMERIC:
    case SQL_SNUMERIC: {
	for (uint i=0; i<_real_size; i++) {
	    if (_value._string[i]) os << _value._string[i];
	}
	break;
    }
    }
}
Пример #3
0
void BrcClockCorrection::dump(ostream& s) const
{
    const ios::fmtflags oldFlags = s.flags();
    s.setf(ios::fixed, ios::floatfield);
    s.setf(ios::right, ios::adjustfield);
    s.setf(ios::uppercase);
    s.precision(0);
    s.fill(' ');

    s << "****************************************************************"
      << "************" << endl
      << "Broadcast Ephemeris (Engineering Units)" << endl
      << endl
      << "PRN : " << setw(2) << PRNID << endl
      << endl;

    s << "              Week(10bt)     SOW     DOW   UTD     SOD"
      << "  MM/DD/YYYY   HH:MM:SS\n";
    s << "Clock Epoch:  ";

    timeDisplay(s, getEpochTime());
    s << endl;

    s.setf(ios::scientific, ios::floatfield);
    s.precision(11);

    s << endl
      << "           CLOCK"
      << endl
      << endl
      << "Bias T0:     " << setw(18) << af0 << " sec" << endl
      << "Drift:       " << setw(18) << af1 << " sec/sec" << endl
      << "Drift rate:  " << setw(18) << af2 << " sec/(sec**2)" << endl;

    s << "****************************************************************"
      << "************" << endl;

    s.flags(oldFlags);
}
Пример #4
0
void Scalene::WriteArea(ostream &outs) const
{
    float s = 0.5 * (side1 + side2 + side3);
    float a = sqrt(s * (s - side1) * (s - side2) * (s - side3));

    outs.setf(ios::showpoint);
    outs.setf(ios::fixed);
    outs.precision(2);

    outs << "The area of a scalene with sides of " <<
            side1 << ", " << side2 << ", and " << side3 <<
            " is " << a;
}
Пример #5
0
int freqest(const FrequencyData& fd, const peakdata::Scan& scanIn, peakdata::Scan& scanOut,
            const Configuration& config, const string& outputDirectory, ostream& report)
{
    // instantiate FrequencyEstimator

    auto_ptr<FrequencyEstimator> fe;

    if (config.freqest_type == config.freqest_type_physical)
    {
        FrequencyEstimatorPhysicalModel::Config fepmConfig;
        fepmConfig.windowRadius = config.freqest_physical_window_radius;
        fepmConfig.iterationCount = config.freqest_physical_iteration_count;
        fepmConfig.outputDirectory = outputDirectory;
        fe = FrequencyEstimatorPhysicalModel::create(fepmConfig);
    }
    else if (config.freqest_type == config.freqest_type_parabola)
    {
        fe = FrequencyEstimatorSimple::create(FrequencyEstimatorSimple::Parabola); 
    }
    else if (config.freqest_type == config.freqest_type_lorentzian)
    {
        fe = FrequencyEstimatorSimple::create(FrequencyEstimatorSimple::Lorentzian); 
    }
    else
    {
        throw runtime_error("Unknown frequency estimator type.");
    }

    if (!fe.get())
        throw runtime_error("Error instantiating frequency estimator.");

    // fill in metadata

    scanOut.scanNumber = scanIn.scanNumber; 
    scanOut.retentionTime = scanIn.retentionTime;
    scanOut.observationDuration = scanIn.observationDuration;
    scanOut.calibrationParameters = scanIn.calibrationParameters;
    scanOut.peakFamilies.clear();

    // run the estimator on each envelope in the scan

    cerr << "Running " << config.freqest_type << " frequency estimator..." << flush;
    transform(scanIn.peakFamilies.begin(), scanIn.peakFamilies.end(),
              back_inserter(scanOut.peakFamilies), EnvelopeEstimator(*fe, fd));
    cerr << "done.\n";

    report.precision(12);
    report << scanOut << endl;
    
    return 0;
}
Пример #6
0
   void CNavGGTO::dumpBody(ostream& s) const
      throw( InvalidRequest )
   {
      if (!dataLoaded())
      {
         InvalidRequest exc("Required data not stored.");
         GPSTK_THROW(exc);
      }
    
      s << endl
        << "           GPS/GNSS TIME OFFSET PARAMETERS"
        << endl
        << "Parameter        Value" << endl;

      s.setf(ios::fixed, ios::floatfield);
      s.setf(ios::right, ios::adjustfield);
      s.setf(ios::uppercase);
      s.precision(0);
      s.fill(' ');

      s << "GNSS_ID:          " << GNSS_ID; 
      if (GNSS_ID==NO_DATA_AVAIL) 
      { 
         s << ", NO DATA AVAILABLE" << endl;
         return;
      }
      else if (GNSS_ID==GALILEO_ID) s << ", Galileo";
      else if (GNSS_ID==GLONASS_ID) s << ", GLONASS";
      else s << ", other GNSS";
      s << endl;        

      s.setf(ios::scientific, ios::floatfield);
      s.precision(8);
      s << "A(0GGTO):         " << A0GGTO << " sec" <<endl;
      s << "A(1GGTO):         " << A1GGTO << " sec/sec" << endl;
      s << "A(2GGTO):         " << A2GGTO << " sec/sec**2" << endl;
      
   } // end of dumpBody()   
Пример #7
0
int detect(const FrequencyData& fd, peakdata::Scan& scan, const Configuration& config, 
           ostream& report, ostream* log = 0)
{
    cerr << "Running peak detector..." << flush;
    auto_ptr<PeakDetector> pd = createPeakDetector(config, log);
    pd->findPeaks(fd, scan);
    cerr << "done.\n";
    cerr << "Peaks found: " << scan.peakFamilies.size() << endl;

    report.precision(12);
    report << scan << endl;

    return 0;
}
Пример #8
0
/**************************************************************************
Task: Linear equation::Write
Programing:
11/2007 WW/
**************************************************************************/
void Linear_EQS::Write(ostream &os)
{
   long i, size_A;
   A->Write(os);
   size_A = A->Dim();

   //
   os<<" b ( RHS): " <<endl;
   os.width(14);
   os.precision(8);
   //
   for(i=0; i<size_A; i++)
      os<<setw(10)<<i<<" "<<setw(15)<<b[i]<<endl;
}
Пример #9
0
void SparseGenome::print(ostream &sout) {
  static const int cutoff = 10;			// max loci to print
  int i;

  sout.setf(ios::fixed, ios::floatfield);
  sout.precision(4);

  sout << "sparse genome @ " << (void *)this << " w = " << w << endl << endl;
  for (i=0; i<nchromosomes; i++) {
    sout << "sa[" << i << "]: ";
    sa[i].print(sout,cutoff);
    sout << endl;
  }
}
Пример #10
0
void Radiation::write_groups(ostream& os)
{
  os << "# total number of groups = " << nGroups << endl;
  if (nNeutrinoSpecies > 0) {
    os << "# " << nNeutrinoSpecies
       << " neutrino species, numbers of groups are: ";
    for (int n = 0; n < nNeutrinoSpecies; n++) {
      if (n > 0) {
        os << ", ";
      }
      os << nNeutrinoGroups[n];
    }
    os << endl;
  }

  if (nGroups > 1) {
    os << "# group center, group weight" << group_units << endl;
    int oldprec = os.precision(10);
    for (int i = 0; i < nGroups; i++) {
      os.width(3);
      os << i << ": ";
      os.width(15);
      os <<  nugroup[i] * group_print_factor << ", ";
      os.width(15);
      os << dnugroup[i] * group_print_factor << endl;
    }
    os.precision(oldprec);
  }

  if (xnu.size() > 0) {
    os << "# group lower boundaries" << endl;
    for (int i = 0; i < xnu.size(); i++) {
      os << "group(" << i << ") = "
	 << xnu[i] * group_print_factor << endl;
    }
  }
}
Пример #11
0
void file_it(ostream & os, double fo, const double fe[], int n){
    //参数os(其类型为ostream &)可以指向ostream对象(如cout), 也可以指向ofstream对象(如fout)。
    ios_base::fmtflags initial; //setf返回调用它之前有效的所有格式化设置。ios_base::fmtflags 是存储这种信息所需的数据类型名称
                                //因此,将返回值赋给initial将存储调用file_it()之前的格式化设置,然后便可以使用变量initial作为
                                //参数来调用setf,将所有的格式化设置恢复到原来的值。
    
    //方法setf使得能够设置各种格式化状态
    initial = os.setf(ios_base::fixed); //将对象置于使用定点表示法的模式
    os.precision(0);    //方法percision指定显示多少位小数(假定对象处于定点模式下)
    os << "Focal length of objective: " << fo << " mm\n";
    os.setf(ios::showpoint);    //将对象置于显示小数点的模式,即使小数点部分为零
    os.precision(1);
    os.width(12);   //方法width设置下一次输出操作使用的字段宽度,该设置只在显示下一个值时有效,过后恢复默认(0)
    os << "f.l. eyepiece";
    os.width(15);
    os << "magnification" << endl;
    for(int i = 0; i < n; ++i){
        os.width(12);
        os << fe[i];
        os.width(15);
        os << int (fo/fe[i] + 0.5) << endl;
    }
    os.setf(initial);
}
Пример #12
0
void CPicture::DumpTags( ostream& os, bool bRaw /*=false*/ ) {
	CTagMap::const_iterator i;
	int	idx = os.xalloc();
	for( i = TAGMAP.begin(); i != TAGMAP.end(); ++i ) {
		os << (*i).second;
		if( (*i).first > 30000 ) {
			if( PICT_DATA_PSHORT == (*i).second.Type() ) {
				LPWORD	pWord = (LPWORD) (*i).second.pVal();
				if( !bRaw )
					os << endl << szT1;
				for( int ii = 0; ii < (*i).second.Count(); ii++ ) {
					if( !bRaw && ii > 0 && ii % 4 == 0 )
						os << endl;
					if( ii > 0 )
						os << szT1;
					os << pWord[ii];
				}
			} else if( PICT_DATA_PDOUBLE == (*i).second.Type() ) {
				if( !bRaw )
					os << endl << szT1;
				int f = os.flags();
				os.flags( f | ios::fixed );
				os.precision( 5 );
				double	*pDbl = (double*) (*i).second.pVal();
				for( int ii = 0; ii < (*i).second.Count(); ii++ ) {
					if( !bRaw && ii > 0 && ii % 6 == 0 )
						os << endl;
					if( ii > 0 )
						os << szT1;
					os << pDbl[ii];
				}
				os.flags(f);
			} else if( PICT_DATA_PLONG == (*i).second.Type() ) {
				if( !bRaw )
					os << endl << szT1;
				long	*pLng = (long*) (*i).second.pVal();
				for( int ii = 0; ii < (*i).second.Count(); ii++ ) {
					if( !bRaw && ii > 0 && ii % 6 == 0 )
						os << endl;
					if( ii > 0 )
						os << szT1;
					os << pLng[ii];
				}
			}
		}
		os << endl;
	}
}
Пример #13
0
void 
Rule::
print(ostream& os)
{
	stringstream ss;
	ss<<prob;
	string temp;
	ss>>temp;
	//os.setf(
	os.precision(5);
	os.setf(ios::fixed,ios::floatfield);
	os<<prob<<"   ";
	//if(temp.length()<8)
	//	os<<"\t";
	os<<left<<" --> "<<right<<endl;
}
Пример #14
0
void numMatrix::print(ostream &out){
	for(int i=0; i<_n_rows; i++){
		out << "Row " << i << endl;
		for(int j=0; j<_n_cols; j++){
			out.setf(ios::scientific);
			out.precision(4);
			out.width(13);
			out << _coeff[i][j];
			if((j+1)%6 == 0){
				out << endl;
			}
		}
		out << endl;	
		out << endl;	
	}
}
Пример #15
0
void
LinetreePrinter::printInf( ostream& inf,
                                                   const Vector3& _max ,
                                                   const Vector3& _min ) const{

        inf << "File : 1geom" << std::endl;
    inf << "Age : 5   1  pattern(s) number of branches 1"  << std::endl;
    inf << "Random_seed 0 Simplification 0 " << std::endl;

    inf.precision(6);

    inf << _max.x() << " " << _max.y() << " " << _max.z() << std::endl;
    inf << _min.x() << " " << _min.y() << " " << _min.z() << std::endl;
    inf << "entre-noeud 1        nentn105  1" << endl;

}
Пример #16
0
void DataPoint::print(ostream& os) {
  os.setf(ios::fixed, ios::floatfield);
  os.precision(4);
  os.fill('0'); // Pad on left with '0'
  os << setw(2) << getTime().tm_mon << '\\'
     << setw(2) << getTime().tm_mday << '\\'
     << setw(2) << getTime().tm_year << ' '
     << setw(2) << getTime().tm_hour << ':'
     << setw(2) << getTime().tm_min << ':'
     << setw(2) << getTime().tm_sec;
  os.fill(' '); // Pad on left with ' '
  os << " Lat:" << setw(9) << getLatitude()
     << ", Long:" << setw(9) << getLongitude()
     << ", depth:" << setw(9) << getDepth()
     << ", temp:" << setw(9) << getTemperature()
     << endl;
} ///:~
//------------------------------------------------------------------
void 
print_parts( ostream& fout, Part* inventory, int n ){
	Part* p = inventory;
	Part* pend = inventory+n;

	for ( ; p<pend; ++p) {
        fout.setf(ios::left, ios::adjustfield); // Left-adjust the first two outputs.
        fout <<setw(25) <<setfill('.') <<p->part_name;   
        fout <<setw(3)  <<setfill(' ') <<p->store_code;  
        
        fout.setf(ios::fixed, ios::floatfield);   // Use fixed-point for float and double.
        fout.precision(2); 						  // 2 places after the decimal point. 
		fout.setf(ios::right, ios::adjustfield);  // Right-adjust the last two.
        fout <<setw(5) <<p->quantity;
        fout <<setw(8) <<p->price <<endl; 
	}
}
Пример #18
0
  void TriggerEpoch::print_efficiencies ( ostream & os) const {

    if (_events==0) return ;

    os.precision(3) ;
    os << name()  << " ";
    if (_trigVerMin>0) 
      os << " (v" << _trigVerMin << " -- v" << _trigVerMax << ") ";   
    os << _events << " events processed:" << endl ;   

    for(map<string, long>::const_iterator tit = _triggers.begin() ; tit != _triggers.end(); tit++) {
      float eff = ((float) tit->second) / _events ;
      os  << tit->first << " efficiency " << 100.0*eff << " +- " 
	  << 100.0*sqrt(eff*(1.0-eff)/_events) << "%" << endl ;  
    }
    os << endl;
  }
Пример #19
0
  void EstimatorManager::addHeader(ostream& o)
  {
    o.setf(ios::scientific, ios::floatfield);
    o.setf(ios::left,ios::adjustfield);
    o.precision(10);
    for (int i=0; i<BlockAverages.size(); i++)
      FieldWidth = std::max(FieldWidth, BlockAverages.Names[i].size()+2);
    for (int i=0; i<BlockProperties.size(); i++)
      FieldWidth = std::max(FieldWidth, BlockProperties.Names[i].size()+2);

    int maxobjs=std::min(BlockAverages.size(),max4ascii);
    o << "#   index    ";
    for(int i=0; i<maxobjs; i++) o << setw(FieldWidth) << BlockAverages.Names[i];
    for(int i=0; i<BlockProperties.size(); i++) o << setw(FieldWidth) << BlockProperties.Names[i];
    o << endl;
    o.setf(ios::right,ios::adjustfield);
  }
Пример #20
0
void printBulk(ostream& oooo,ThermoPhase* bulkPhaseTP, InterfaceKinetics* iKin_ptr, double* src)
{
    double x[MSSIZE];
    double C[MSSIZE];
    char buf[256];
    oooo.precision(3);
    string bulkParticlePhaseName = bulkPhaseTP->id();
    bulkPhaseTP->getMoleFractions(x);
    bulkPhaseTP->getConcentrations(C);
    size_t kstart = iKin_ptr->kineticsSpeciesIndex(0, 1);
    double dens = bulkPhaseTP->density();
    oooo << "Bulk Phase:  " << bulkParticlePhaseName << "   "
         << "(" << kstart << ")" << endl;
    double Temp = bulkPhaseTP->temperature();
    double p = bulkPhaseTP->pressure();
    oooo << "Bulk Temperature = " << Temp << endl;
    oooo << "Bulk Pressure    = " << p << endl;
    oooo << "                       Name      "
         << "     Conc              MoleF       SrcRate " << endl;
    oooo << "                                 "
         << "   (kmol/m^3)                   (kmol/m^2/s) " << endl;
    double sum = 0.0;
    double Wsum = 0.0;
    const vector_fp& molecW = bulkPhaseTP->molecularWeights();
    size_t nspBulk = bulkPhaseTP->nSpecies();
    for (size_t k = 0; k < nspBulk; k++) {
        kstart = iKin_ptr->kineticsSpeciesIndex(k, 1);
        sprintf(buf, "%4d %24s   %14g %14g  %14e\n",
                (int) k, bulkPhaseTP->speciesName(k).c_str(),
                C[k], x[k], src[kstart]);
        oooo << buf;
        sum += x[k];
        Wsum += src[kstart] * molecW[k];
    }
    oooo << "Bulk Weight Growth Rate = " << Wsum << " kg/m^2/s" << endl;
    double gr = Wsum / dens;
    oooo << "Bulk Growth Rate = " << gr << " m/s" << endl;
    oooo << "Bulk Growth Rate = " << gr * 1.0E6 * 3600.
         << " microns / hour" << endl;
    oooo << "Density of bulk phase = " << dens << " kg / m^3 "<< endl;
    oooo << "                      = " << dens / 1.0E3
         <<" gm / cm^3 " << endl;
    oooo << "Sum of bulk mole fractions= " << sum << endl;
    oooo << endl;
}
Пример #21
0
void Dof::print(ostream &out) const{
	out << " EqnNum = ";
	out.width(6);
	out << _eqn_number;
	if (_active)
	{
		out << " Active, ";
	}
	else 
	{
		out << " Not Active, ";
	}
	out << " Value = ";
	out.setf(ios::scientific);
	out.precision(3);
	out.width(11);
	out << _value;
}
Пример #22
0
  void Save2DMesh (
		   const Mesh & mesh2d,
		   const ARRAY<SplineSegment *> * splines,
		   ostream & outfile)

  {
    int i, j;
    outfile.precision (6);
  
    outfile << "areamesh2" << endl;


    outfile << endl;
    outfile << mesh2d.GetNSeg() << endl;
    for (i = 1; i <= mesh2d.GetNSeg(); i++)
      outfile << mesh2d.LineSegment(i).si << "        "
	      << mesh2d.LineSegment(i).p1 << " "
	      << mesh2d.LineSegment(i).p2 << "  " << endl;
  

    outfile << mesh2d.GetNSE() << endl;
    for (i = 1; i <= mesh2d.GetNSE(); i++)
      {
	outfile << mesh2d.SurfaceElement(i).GetIndex() << "         ";
	outfile << mesh2d.SurfaceElement(i).GetNP() << " ";
	for (j = 1; j <= mesh2d.SurfaceElement(i).GetNP(); j++)
	  outfile << mesh2d.SurfaceElement(i).PNum(j) << " ";
	outfile << endl;
      }

    outfile << mesh2d.GetNP() << endl;
    for (i = 1; i <= mesh2d.GetNP(); i++)
      outfile << mesh2d.Point(i).X() << " "
	      << mesh2d.Point(i).Y() << endl;

    if (splines)
      {
	outfile << splines->Size() << endl;
	for (i = 1; i <= splines->Size(); i++)
	  splines->Get(i) -> PrintCoeff (outfile);
      }
    else
      outfile << "0" << endl;
  }
Пример #23
0
//prints the results into readable form
void simplex::printSimplexTable(ostream& out, Data* data) {
    out.setf(ios::fixed);
    out.precision(3);

    int row = data->system.size();
    int col = data->system[0].size();

    out.width(N);
    out << "Base";
    out.width(N);
    out << "Plan";
    for (int j = 0; j < col; j++) {
        out.width(N - 1);
        out << "x";
        out << j + 1;
    }

    out << endl;
    for (int i = 0; i < row; i++) {
        out.width(N - 1);
        out << "x";
        out << data->base[i];
        out.width(N);
        out << data->freeMembers[i];
        for (int j = 0; j < col; j++) {
            out.width(N);
            out << data->system[i][j];
        }
        out << endl;

    }
    out.width(N);
    out << "F";
    out.width(N);
    out <<data-> max;
    int a = data->coefficients.size();
    for (int i = 0; i < a; i++) {
        out.width(N);
        out << data->coefficients[i];
    }
    out << endl << endl;

}
Пример #24
0
/// Prints the calcpka-style output
void ProtTraj::PrintCalcpka(ostream& fd, const int start) {

   // First calculate the statistics
   vector<long long int> nprot(nres_, 0ll);
   vector<int> transitions(nres_, 0);
   long long int totprot = 0ll;

   // Start with the first point, but skip it in the iteration
   last_point_ = statelist_[start];
   for (int i = start + 1; i < nframes_ + 1; i++) {
      int j = 0;
      for (Cpin::ResIterator rit = cpin_->begin(); rit != cpin_->end(); rit++) {
         transitions[j] += (int) (rit->isProtonated(last_point_[j]) !=
                                  rit->isProtonated(statelist_[i][j]));
         long long int protadd = (long long int) (rit->isProtonated(statelist_[i][j]));
         nprot[j] += protadd;
         totprot += (long long int) rit->numProtons(statelist_[i][j]);
         j++;
      }
      // Reassign the last point to the current one before incrementing
      last_point_ = statelist_[i];
   }

   // Now do the printing
   fd.precision(3);
   fd << fixed;
   fd << "Solvent pH is " << setw(8) << pH_ << endl;
   int i = 0;
   for (Cpin::ResIterator rit = cpin_->begin(); rit != cpin_->end(); rit++) {
      double pKa = pH_ - log10( (double) (nframes_-nprot[i]) / (double) nprot[i] );
      float offset = (float) pKa - pH_;
      fd << setw(3) << rit->getResname() << " " << setw(4) << left << rit->getResnum()
         << ": Offset " << right << setw(6) << offset << "  Pred " << setw(6) << pKa
         << "  Frac Prot " << setw(5) << (double) nprot[i] / (double) nframes_
         << " Transitions " << setw(9) << transitions[i] << endl;
      i++;
   }
   fd << endl << "Average total molecular protonation: " << setw(7)
      << (double)totprot / (double)nframes_ << endl;

   return;
}
Пример #25
0
bool IMM::save(ostream &os)
{
  os.precision(8);
  os << "IMM" << endl;
  os << getContentType() << endl;
  os << N << "\t" << phase << "\t" << endl;
  int numModels=models->size();
  os << numModels << endl;
  for(int i=0 ; i<numModels ; ++i)
    {
      BOOM::StringMap<double> &model=*(*models)[i];
      os << model.size() << endl;
      BOOM::StringMap<double>::iterator cur=model.begin(), end=model.end();
      for(; cur!=end ; ++cur)
	os << (*cur).first << endl << (*cur).second << endl;
    }
  if(getStrand()==FORWARD_STRAND) 
    revComp->save(os);
  return true;
}
Пример #26
0
void printDataOnTreeAsBPValues(ostream &out, Vstring &data, const tree::nodeP &myNode)  {
	if (myNode->isLeaf()) {
		out << myNode->name()<< ":"<<myNode->dis2father();
		return;
	} else {
		out <<"(";
		for (int i=0;i<myNode->getNumberOfSons();++i) {
			if (i>0) out <<",";
			printDataOnTreeAsBPValues(out,data,myNode->getSon(i));
		}
		out <<")";
//		out.precision(3);
//		out<<data[myNode->id()];
//        if (myNode->isRoot()==false) {
			out.precision(3);
			out<<data[myNode->id()];
			out<<":"<<myNode->dis2father();
//		}
	}
}
Пример #27
0
/**
 * Prints the weights of the normalized vector to a stream
 * @param weightStream stream where the weights are written to
 * @param w_ normal vector
 */
void CrossValidation::printSetWeights(ostream & weightStream, unsigned int set, 
                                      Normalizer * pNorm) {
  weightStream << "# first line contains normalized weights, " <<
                  "second line the raw weights" << std::endl;
  weightStream << DataSet::getFeatureNames().getFeatureNames() << 
                  "\tm0" << std::endl;
  weightStream.precision(3);
  weightStream << w_[set][0];
  for (unsigned int ix = 1; ix < FeatureNames::getNumFeatures() + 1; ix++) {
    weightStream << "\t" << fixed << setprecision(4) << w_[set][ix];
  }
  weightStream << endl;
  vector<double> ww(FeatureNames::getNumFeatures() + 1);
  pNorm->unnormalizeweight(w_[set], ww);
  weightStream << ww[0];
  for (unsigned int ix = 1; ix < FeatureNames::getNumFeatures() + 1; ix++) {
    weightStream << "\t" << fixed << setprecision(4) << ww[ix];
  }
  weightStream << endl;
}
Пример #28
0
void add_big(ostream& out)
{
  out.precision(15);

#define T_WL 16
#define T_IWL T_WL
  out << "************* add_big " << T_WL << " ***************\n";
  THE_BIG_ARROW;
#undef T_WL
#undef T_IWL
#define T_WL 67
#define T_IWL T_WL
  out << "************* add_big " << T_WL << " ***************\n";
  THE_BIG_ARROW;
#undef T_WL
#undef T_IWL
#define T_WL 150
#define T_IWL T_WL
  out << "************* add_big " << T_WL << " ***************\n";
  THE_BIG_ARROW;
}
Пример #29
0
void process(istream &input, ostream &output)
{
    int bottles, level, n;
    input >> bottles >> level >> n;

    int row = 0;
    int first = 1;
    while (first + row + 1 <= n)
    {
        ++row;
        first += row;
    }

    cache.clear();

    double value = get_value(level, row, n - first, 750.0 * bottles);

    output.setf(ios_base::fixed, ios_base::floatfield);
    output.precision(7);
    output << ' ' << min(250.0, value) << '\n';
}
Пример #30
0
void bh_constant::pprint(ostream& out, bool opencl) const
{
    if (bh_type_is_integer(type)) {
        if (bh_type_is_signed_integer(type)) {
            out << get_int64();
        } else {
            out << get_uint64() << "u";
        }
    } else {
        out.precision(numeric_limits<double>::max_digits10);
        switch(type) {
            case BH_FLOAT32:
                out << value.float32;
                break;
            case BH_FLOAT64:
                out << value.float64;
                break;
            case BH_R123:
                out << "{.start = " << value.r123.start << ", .key = " << value.r123.key << "}";
                break;
            case BH_COMPLEX64:
                if (opencl) {
                    out << "(float2)(" << value.complex64.real << ", " << value.complex64.imag << ")";
                } else {
                    out << "(" << value.complex64.real << "+" << value.complex64.imag << "*I)";
                }
                break;
            case BH_COMPLEX128:
                if (opencl) {
                    out << "(double2)(" << value.complex128.real << ", " << value.complex128.imag << ")";
                } else {
                    out << "(" << value.complex128.real << "+" << value.complex128.imag << "*I)";
                }
                break;
            case BH_UNKNOWN:
            default:
                out << "?";
        }
    }
}