aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2012-09-28 07:24:21 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2012-09-28 07:24:21 +0000
commit3e12a1047ff1e9cfeab0b2b659563fa5042c0dfb (patch)
treee09bfbec2473632f9e6d8fcc3d433769b72819b3
parenta820e3bd3c87127755b92a34cc234777502fc282 (diff)
downloadopt-utilities-3e12a1047ff1e9cfeab0b2b659563fa5042c0dfb.tar.bz2
i/o for types
git-svn-id: file:///home/svn/opt_utilities@246 ed2142bd-67ad-457f-ba7c-d818d4011675
-rw-r--r--interface/opt_io.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/interface/opt_io.hpp b/interface/opt_io.hpp
new file mode 100644
index 0000000..f7b68d8
--- /dev/null
+++ b/interface/opt_io.hpp
@@ -0,0 +1,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