20 #include <unordered_map> 24 #include "allocator.h" 25 #include "operators.h" 35 void printMarginal(
const std::tuple<double*,double*,int*,int>& results,
int dim);
72 const double* _masses,
136 inline double logProb(Conf conf)
const {
return loggamma_nominator + unnormalized_logProb(conf, atom_lProbs, isotopeNo); };
148 std::unordered_map<Conf,int,KeyHasher,ConfEqual> visited;
153 std::vector<double> _conf_lprobs;
154 std::vector<double> _conf_masses;
155 std::vector<int*> _confs;
158 bool add_next_conf();
181 while(current_count <= idx)
193 int processUntilCutoff(
double cutoff);
195 inline const std::vector<double>& conf_lprobs()
const {
return _conf_lprobs; };
196 inline const std::vector<double>& conf_masses()
const {
return _conf_masses; };
197 inline const std::vector<int*>& confs()
const {
return _confs; };
216 std::vector<Conf> configurations;
218 unsigned int no_confs;
247 inline bool inRange(
unsigned int idx)
const {
return idx < no_confs; };
254 inline const double&
get_lProb(
int idx)
const {
return lProbs[idx]; };
261 inline const double&
get_prob(
int idx)
const {
return probs[idx]; };
268 inline const double&
get_mass(
int idx)
const {
return masses[idx]; };
288 inline const Conf&
get_conf(
int idx)
const {
return confs[idx]; };
double getLightestConfMass() const
Get the mass of the lightest subisotopologue.
double getModeProb() const
The the probability of the mode subisotopologue.
bool inRange(unsigned int idx) const
Is there a subisotopologue with a given number?
The marginal distribution class (a subisotopologue).
const unsigned int isotopeNo
const unsigned int atomCnt
const double & get_prob(int idx) const
Get the probability of the idx-th subisotopologue.
int get_isotopeNo() const
Get the number of isotopes of the investigated element.
virtual ~Marginal()
Destructor.
const double & get_lProb(int idx) const
Get the log-probability of the idx-th subisotopologue.
const double *const atom_lProbs
double getHeaviestConfMass() const
Get the mass of the heaviest subisotopologue.
const double loggamma_nominator
const double * get_lProbs_ptr() const
Get the table of the log-probabilities of subisotopologues.
unsigned int get_no_confs() const
Get the number of precomputed subisotopologues.
double getModeLProb() const
Get the log-probability of the mode subisotopologue.
Conf initialConfigure(const int atomCnt, const int isotopeNo, const double *probs, const double *lprobs)
Find one of the most probable subisotopologues.
const double smallest_lprob
Marginal(const double *_masses, const double *_probs, int _isotopeNo, int _atomCnt)
Class constructor.
const double & get_mass(int idx) const
Get the mass of the idx-th subisotopologue.
bool probeConfigurationIdx(int idx)
Check if the table of computed subisotopologues does not have to be extended.
const double *const atom_masses
const Conf & get_conf(int idx) const
Get the counts of isotopes that define the subisotopologue.
double getModeMass() const
The the mass of the mode subisotopologue.
The marginal distribution class (a subisotopologue).
Precalculated Marginal class.
double getSmallestLProb() const
The the log-probability of the lightest subisotopologue.
double logProb(Conf conf) const
Calculate the log-probability of a given subisotopologue.
const double * get_masses_ptr() const
Get the table of the masses of subisotopologues.