diff options
author | Gael Guennebaud <g.gael@free.fr> | 2008-07-27 11:39:47 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2008-07-27 11:39:47 +0000 |
commit | 93115619c23bb41fd24b0090cb6adec501edaced (patch) | |
tree | 60ae0887b0705b8a994f8ef9baa5324c87883861 /bench/btl/generic_bench/utils | |
parent | e9e5261664cc77049f8b77a2c36c535fbd44889c (diff) |
* updated benchmark files according to recent renamings
* various improvements in BTL including trisolver and cholesky bench
Diffstat (limited to 'bench/btl/generic_bench/utils')
-rw-r--r-- | bench/btl/generic_bench/utils/xy_file.hh (renamed from bench/btl/generic_bench/utils/dump_file_x_y.hh) | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/bench/btl/generic_bench/utils/dump_file_x_y.hh b/bench/btl/generic_bench/utils/xy_file.hh index 6b99dcb10..4571bed8f 100644 --- a/bench/btl/generic_bench/utils/dump_file_x_y.hh +++ b/bench/btl/generic_bench/utils/xy_file.hh @@ -17,10 +17,41 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // -#ifndef DUMP_FILE_X_Y_HH -#define DUMP_FILE_X_Y_HH +#ifndef XY_FILE_HH +#define XY_FILE_HH #include <fstream> +#include <iostream> #include <string> +#include <vector> +using namespace std; + +bool read_xy_file(const std::string & filename, std::vector<int> & tab_sizes, + std::vector<double> & tab_mflops, bool quiet = false) +{ + + std::ifstream input_file (filename.c_str(),std::ios::in); + + if (!input_file){ + if (!quiet) { + INFOS("!!! Error opening "<<filename); + } + return false; + } + + int nb_point=0; + int size=0; + double mflops=0; + + while (input_file >> size >> mflops ){ + nb_point++; + tab_sizes.push_back(size); + tab_mflops.push_back(mflops); + } + SCRUTE(nb_point); + + input_file.close(); + return true; +} // The Vector class must satisfy the following part of STL vector concept : // resize() method @@ -30,16 +61,13 @@ using namespace std; template<class Vector_A, class Vector_B> -void dump_file_x_y(const Vector_A & X, const Vector_B & Y, const std::string & filename){ +void dump_xy_file(const Vector_A & X, const Vector_B & Y, const std::string & filename){ ofstream outfile (filename.c_str(),ios::out) ; int size=X.size(); - for (int i=0;i<size;i++){ - - outfile << X[i] << " " << Y[i] << endl ; - - } + for (int i=0;i<size;i++) + outfile << X[i] << " " << Y[i] << endl; outfile.close(); } |