aboutsummaryrefslogtreecommitdiffstats
path: root/interface/opt_io.hpp
blob: f7b68d84102a4327e478a8d167580d1ca81e898e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef OPT_IO
#define OPT_IO
#include <iostream>
#include <cmath>
#include "core/fitter.hpp"


namespace std
{
  template <typename Ty,typename Tx>
  std::ostream& operator<<(std::ostream& os,const opt_utilities::data<Ty,Tx>& d)
  {
    os<<d.get_x()<<"("<<-std::abs(d.get_x_lower_err())<<",+"<<std::abs(d.get_x_upper_err())<<") "<<d.get_y()<<"("<<-std::abs(d.get_y_lower_err())<<",+"<<std::abs(d.get_y_upper_err())<<") ";
    return os;
  }
  
  template <typename Ty,typename Tx>
  std::ostream& operator<<(std::ostream& os,const opt_utilities::data_set<Ty,Tx>& ds)
  {
    os<<"data set with size of "<<ds.size()<<"\n"
      <<"[\n";
    int s=5>ds.size()?ds.size():5;
    for(int i=0;i<s;++i)
      {
	os<<ds.get_data(i)<<"\n";
      }
    os<<"]";
    return os;
  }
}
#endif