Egglib 2.1.11
C++ library reference manual
ParamSet.hpp
1 /*
2  Copyright 2009-2010 Stéphane De Mita, Mathieu Siol
3 
4  This file is part of the EggLib library.
5 
6  EggLib is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  EggLib is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with EggLib. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef EGGLIB_PARAMSET_HPP
21 #define EGGLIB_PARAMSET_HPP
22 
23 
24 #include "DataMatrix.hpp"
25 
26 
27 namespace egglib {
28 
29  class Change;
30  class Controller;
31 
32 
38  class ParamSet {
39 
40  public:
41 
50  ParamSet();
51 
55  ~ParamSet();
56 
60  ParamSet(const ParamSet&);
61 
65  ParamSet& operator=(const ParamSet&);
66 
70  void reset();
71 
75  unsigned int numberOfPopulations() const;
76 
84  double pairwiseMigrationRate(unsigned int source, unsigned int dest) const;
85 
94  void pairwiseMigrationRate(unsigned int source, unsigned int dest, double value);
95 
99  void migrationRate(double value);
100 
104  double populationSize(unsigned int populationIndex) const;
105 
111  void populationSize(unsigned int populationIndex, double value);
112 
116  double growthRate(unsigned int populationIndex) const;
117 
121  void growthRate(unsigned int populationIndex, double value);
122 
126  double recombinationRate() const;
127 
131  void recombinationRate(double value);
132 
136  unsigned int numberOfSegments() const;
137 
141  void numberOfSegments(unsigned int value);
142 
146  double selfingRate() const;
147 
151  void selfingRate(double value);
152 
162  void addPopulation(double migr);
163 
172  void addChange(const Change* change);
173 
179  double nextChangeDate() const;
180 
188  void nextChangeDo(Controller* controller);
189 
193  unsigned int singles(unsigned int populationIndex) const;
194 
198  void singles(unsigned int populationIndex, unsigned int value);
199 
203  unsigned int doubles(unsigned int populationIndex) const;
204 
208  void doubles(unsigned int populationIndex, unsigned int value);
209 
213  unsigned int numberOfSamples() const;
214 
222  double dateOfLastChange(unsigned int populationIndex) const;
223 
224 
232  void dateOfLastChange(unsigned int populationIndex, double date) const;
233 
234 
254  void setGroups(DataMatrix& dataMatrix, bool labelIndividuals=false);
255 
256  private:
257 
258  void clear();
259  void init();
260  void copy(const ParamSet&);
261 
262  double _selfingRate;
263  double _recombinationRate;
264  unsigned int _numberOfSegments;
265  unsigned int _numberOfPopulations;
266  unsigned int* _singles;
267  unsigned int* _doubles;
268  double* _growthRates;
269  double* _populationSize;
270  double* _dateOfLastChange;
271  double** migrationMatrix;
272  unsigned int _numberOfChanges;
273  unsigned int nextChangeIndex;
274  Change const** changes;
275  };
276 
277 }
278 
279 #endif
unsigned int numberOfPopulations() const
Gets the number of populations.
Definition: ParamSet.cpp:199
Data table.
Definition: DataMatrix.hpp:41
unsigned int numberOfSamples() const
Computes the total number of samples.
Definition: ParamSet.cpp:364
unsigned int singles(unsigned int populationIndex) const
Gets the number of single sample from a population.
Definition: ParamSet.cpp:341
ParamSet()
Default constructor.
Definition: ParamSet.cpp:31
void addPopulation(double migr)
Adds a population to the model.
Definition: ParamSet.cpp:154
double populationSize(unsigned int populationIndex) const
Gets a population size.
Definition: ParamSet.cpp:229
double nextChangeDate() const
Gets the date of the next change.
Definition: ParamSet.cpp:303
double dateOfLastChange(unsigned int populationIndex) const
Gives the date of the last size change.
Definition: ParamSet.cpp:372
unsigned int numberOfSegments() const
Gets the number of recombining segments.
Definition: ParamSet.cpp:266
void nextChangeDo(Controller *controller)
Applies the next change event.
Definition: ParamSet.cpp:309
void setGroups(DataMatrix &dataMatrix, bool labelIndividuals=false)
Set groups labels.
Definition: ParamSet.cpp:384
Controls a coalescent simulation.
Definition: Controller.hpp:39
void reset()
Restores default value of all parameters.
Definition: ParamSet.cpp:92
Pure virtual base class for parameter changes.
Definition: ChangeTypes.hpp:35
double recombinationRate() const
Gets the recombination rate.
Definition: ParamSet.cpp:254
double growthRate(unsigned int populationIndex) const
Gets a growth rate.
Definition: ParamSet.cpp:242
void migrationRate(double value)
Sets the migration rate for all matrix.
Definition: ParamSet.cpp:219
Definition: ABC.cpp:37
Set of parameters.
Definition: ParamSet.hpp:38
~ParamSet()
Destructor.
Definition: ParamSet.cpp:37
ParamSet & operator=(const ParamSet &)
Assignment operator.
Definition: ParamSet.cpp:84
double selfingRate() const
Gets the selfing rate.
Definition: ParamSet.cpp:278
unsigned int doubles(unsigned int populationIndex) const
Gets the number of double sample from a population.
Definition: ParamSet.cpp:353
double pairwiseMigrationRate(unsigned int source, unsigned int dest) const
Gets a pairwise migration rate.
Definition: ParamSet.cpp:204
void addChange(const Change *change)
Adds a change.
Definition: ParamSet.cpp:289

Hosted by 
Get EggLib at SourceForge.net. Fast, secure and Free Open Source software downloads