mixmod  3.2.0
Mixture models for clustering and classification
 All Classes Namespaces Files Functions Variables Enumerations Friends
Partition.h
1 /***************************************************************************
2  SRC/mixmod/Kernel/IO/Partition.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 XEMPARTITION_H
26 #define XEMPARTITION_H
27 
28 #include "mixmod/Utilities/Util.h"
29 
30 namespace XEM {
31 
32 // pre-declaration
33 class Label;
34 
39 class Partition {
40 
41 public:
42 
44  Partition();
45 
47  Partition(Partition * iPartition);
48 
50  Partition(int64_t nbSample, int64_t nbCluster, const NumericPartitionFile & partitionFile);
51 
53  Partition(const Label * label, int64_t nbCluster);
54 
56  // used in DCV context
57  Partition(Partition * originalPartition, CVBlock & block);
58 
60  virtual ~Partition();
61 
66  void setDimension(int64_t nbSample, int64_t nbCluster);
67 
68  int64_t getGroupNumber(int64_t idxSample);
69 
74  bool isComplete();
75  int64_t** getTabValue() const;
76  int64_t* getTabValueI(int64_t index) const;
77 
79  const NumericPartitionFile & getPartitionFile() const;
80 
82  int64_t getNbSample()const;
83 
85  int64_t getNbCluster() const;
86 
87  bool operator==(Partition & otherPartition);
88 
92  friend std::ifstream & operator >>(std::ifstream & fi, Partition & partition);
93 
97  friend std::ostream & operator <<(std::ostream & fo, const Partition & partition);
98 
99 //TODO
100 //private:
101 
103  int64_t _nbSample;
104 
106  int64_t _nbCluster;
107 
108  int64_t ** _tabValue; // aggregate
109 
111  NumericPartitionFile _partitionFile;
112 
113  bool _deleteValues;
114 };
115 
116 inline int64_t ** Partition::getTabValue() const {
117  return _tabValue;
118 }
119 
120 inline int64_t * Partition::getTabValueI(int64_t index) const {
121  return _tabValue[index];
122 }
123 
125  return _partitionFile;
126 }
127 
128 inline int64_t Partition::getNbSample()const {
129  return _nbSample;
130 }
131 
132 inline int64_t Partition::getNbCluster() const {
133  return _nbCluster;
134 }
135 
136 }
137 
138 #endif
Partition()
Default constructor.
Definition: Partition.cpp:34
Definition: Label.h:48
void setDimension(int64_t nbSample, int64_t nbCluster)
Set the dimension of the Partition.
Definition: Partition.cpp:160
XEMCVBlock.
Definition: Util.h:393
Base class for Partition(s)
Definition: Partition.h:39
bool isComplete()
Definition: Partition.cpp:190
friend std::ifstream & operator>>(std::ifstream &fi, Partition &partition)
Friend method.
Definition: Partition.cpp:268
int64_t getNbSample() const
get Number of samples
Definition: Partition.h:128
Constants definitions, various utilities to describe models, and others...
virtual ~Partition()
Destructor.
Definition: Partition.cpp:144
const NumericPartitionFile & getPartitionFile() const
get Format
Definition: Partition.h:124
Definition: Util.h:360
int64_t getNbCluster() const
get Number of clusters
Definition: Partition.h:132
friend std::ostream & operator<<(std::ostream &fo, const Partition &partition)
Friend method.
Definition: Partition.cpp:328