mixmod  3.2.0
Mixture models for clustering and classification
 All Classes Namespaces Files Functions Variables Enumerations Friends
Data.h
1 /***************************************************************************
2  SRC/mixmod/Kernel/IO/Data.h description
3  copyright : (C) MIXMOD Team - 2001-2016
4  email : contact@mixmod.org
5  ***************************************************************************/
6 
7 /***************************************************************************
8  This file is part of MIXMOD
9 
10  MIXMOD is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MIXMOD is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with MIXMOD. If not, see <http://www.gnu.org/licenses/>.
22 
23  All informations available on : http://www.mixmod.org
24 ***************************************************************************/
25 #ifndef XEMDATA_H
26 #define XEMDATA_H
27 
28 #include "mixmod/Utilities/Util.h"
29 
30 namespace XEM {
31 
32 // pre-declaration
33 class Sample;
34 class DataDescription;
35 class GaussianData;
36 class BinaryData;
37 
43 class Data {
44 
45 public:
46 
48  Data();
49 
51  Data(const Data & iData);
52 
54  Data(int64_t nbSample, int64_t pbDimension);
55 
57  Data(int64_t nbSample, int64_t pbDimension, double weightTotal, double * weight);
58 
60  virtual ~Data();
61 
66  return (GaussianData*)this;
67  }
68 
73  return (BinaryData*)this;
74  }
78  void setWeightTotal(double weightTotal);
79 
81  void setWeight(std::string weightFileName);
83  void setWeight(double* weight);
84 
86  void setWeightDefault();
87 
91  virtual void input(std::ifstream & fi) = 0;
92 
95  virtual void input(const DataDescription & dataDescription) = 0;
96 
100  virtual void output(std::ostream & fo) = 0;
101 
105  virtual Data * clone() const = 0;
106 
107  virtual Sample ** cloneMatrix() = 0;
108 
109  virtual bool verify() const;
110 
111  const std::string & getFileName()const;
112 
114  int64_t _pbDimension;
115 
117  int64_t _nbSample;
118 
120  double _weightTotal;
121 
123  Sample ** _matrix;
124 
126  double * _weight;
127 
129  const Sample** getData() const;
130 
132  const Sample* getDataI(int64_t index) const;
133 
135  const double* getWeight() const;
136 
138  const double & getWeightI(int64_t index) const;
139 
141  const std::string & getFileNameWeight()const;
142 
144  int64_t getPbDimension()const;
145 
147  int64_t getNbSample()const;
148 
150  bool hasDefaultWeight() const;
151 
152 protected:
153 
154  //TODO XEMInput : a enlever
156  std::string _fileNameWeight;
157 
159  bool _defaultWeight;
160 
162  std::string _fileNameData;
163 };
164 
165 inline const Sample ** Data::getData() const {
166  return const_cast<const Sample**> (_matrix);
167 }
168 
169 inline const std::string & Data::getFileNameWeight() const {
170  return _fileNameWeight;
171 }
172 
173 inline const std::string & Data::getFileName() const {
174  return _fileNameData;
175 }
176 
177 inline const Sample * Data::getDataI(int64_t index) const {
178  return _matrix[index];
179 }
180 
181 inline const double * Data::getWeight() const {
182  return _weight;
183 }
184 
185 inline const double & Data::getWeightI(int64_t index) const {
186  return _weight[index];
187 }
188 
190 inline int64_t Data::getPbDimension()const {
191  return _pbDimension;
192 }
193 
195 inline int64_t Data::getNbSample()const {
196  return _nbSample;
197 }
198 
200 inline bool Data::hasDefaultWeight() const {
201  return _defaultWeight;
202 }
203 
204 }
205 
206 #endif
int64_t getNbSample() const
get Number of samples
Definition: Data.h:195
void setWeight(std::string weightFileName)
setWeight
Definition: Data.cpp:98
virtual Data * clone() const =0
Selector.
virtual void output(std::ostream &fo)=0
Write data in output file Output file to write into.
Data()
Default constructor.
Definition: Data.cpp:33
Base class for Binary Data.
Definition: BinaryData.h:41
const double * getWeight() const
getWeight
Definition: Data.h:181
virtual BinaryData * getBinaryData()
Definition: Data.h:72
const Sample * getDataI(int64_t index) const
getMatrix[i]
Definition: Data.h:177
const Sample ** getData() const
getMatrix
Definition: Data.h:165
virtual void input(std::ifstream &fi)=0
Read data from data file Data file to read.
Constants definitions, various utilities to describe models, and others...
void setWeightDefault()
setWeightDefault
Definition: Data.cpp:152
Base class for Sample.
Definition: Sample.h:41
int64_t getPbDimension() const
get dimension
Definition: Data.h:190
Base class for Gaussian Data.
Definition: GaussianData.h:37
Base class for Data.
Definition: Data.h:43
virtual ~Data()
Desctructor.
Definition: Data.cpp:81
const double & getWeightI(int64_t index) const
getWeight[i]
Definition: Data.h:185
bool hasDefaultWeight() const
hasDefaultWeight
Definition: Data.h:200
const std::string & getFileNameWeight() const
get FilenameWeight
Definition: Data.h:169
virtual GaussianData * getGaussianData()
Definition: Data.h:65
void setWeightTotal(double weightTotal)
Selector.
Definition: Data.cpp:91
Definition: DataDescription.h:45