00001 00002 /* Copyright(C) (2002) (ID - IMAG) <Florent.Morata@imag.fr> */ 00003 00004 /* 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 00029 #ifndef _HBF_H_ 00030 #define _HBF_H_ 00031 00032 00033 #include <vector> 00034 #include <string> 00035 #include <fstream> 00036 #include <cmath> 00037 00039 using namespace std; 00040 00042 typedef vector<int>::iterator iteri; 00044 typedef vector<double>::iterator iterd; 00046 typedef string psi_name; 00047 00051 enum psi_type{continuous,discrete}; 00052 00053 00064 class HBF{ 00065 private: 00066 00068 psi_name model_name; 00070 psi_type model_type; 00072 int dimension; 00074 int nz_number; 00076 vector<double> Val; 00078 vector<int> Col; 00080 vector<int> Row; 00082 vector<int> ValbyRow; 00084 double biggest; 00085 00086 public: 00087 00088 static HBF hbf; 00089 HBF(); 00090 void create(const int d,const int n); 00091 ~HBF(); 00092 int size() const; 00093 int order() const; 00094 psi_type type() const; 00095 double maxi() const; 00096 bool is_empty() const; 00097 double val(const int i) const; 00098 int col(const int i) const; 00099 int row(const int i) const; 00100 int valbyrow(const int i) const; 00101 int zero_or_one(); 00102 void update(); 00103 void read_hbf_r(const psi_name path); 00104 void read_marca(const psi_name path); 00105 void read_hbf_c(const psi_name path); 00106 void uniformization(); 00107 void write_unif(const psi_name file); 00108 void col2row(); 00109 void convert(); 00110 void scale(const double d); 00111 void give_a_name(const psi_name file); 00112 psi_name name() const; 00113 int out_degree() const; 00114 void transform(const int d); 00115 }; 00116 00117 00118 #include "hbf.inl" 00119 00120 00121 #endif 00122