 |
IsoSpec
1.95
|
20 #include <unordered_map>
23 #include "allocator.h"
24 #include "operators.h"
34 void printMarginal(
const std::tuple<double*,double*,int*,int>& results,
int dim);
71 const double* _masses,
93 inline const double* get_lProbs()
const {
return atom_lProbs; };
161 std::unordered_map<Conf,int,KeyHasher,ConfEqual> visited;
166 std::vector<double> _conf_lprobs;
167 std::vector<double> _conf_masses;
168 std::vector<int*> _confs;
171 bool add_next_conf();
194 while(current_count <= idx)
208 inline const std::vector<double>& conf_lprobs()
const {
return _conf_lprobs; };
209 inline const std::vector<double>& conf_masses()
const {
return _conf_masses; };
210 inline const std::vector<int*>& confs()
const {
return _confs; };
229 std::vector<Conf> configurations;
231 unsigned int no_confs;
260 inline bool inRange(
unsigned int idx)
const {
return idx < no_confs; };
267 inline const double&
get_lProb(
int idx)
const {
return lProbs[idx]; };
274 inline const double&
get_prob(
int idx)
const {
return probs[idx]; };
281 inline const double&
get_mass(
int idx)
const {
return masses[idx]; };
301 inline const Conf&
get_conf(
int idx)
const {
return confs[idx]; };
318 double current_threshold;
319 std::vector<Conf> configurations;
320 std::vector<Conf> fringe;
322 unsigned int sorted_up_to_idx;
326 std::vector<double> lProbs;
327 std::vector<double> probs;
328 std::vector<double> masses;
329 double* guarded_lProbs;
345 bool extend(
double new_threshold);
348 inline double get_lProb(
int idx)
const {
return guarded_lProbs[idx]; };
351 inline double get_prob(
int idx)
const {
return probs[idx]; };
354 inline double get_mass(
int idx)
const {
return masses[idx]; };
360 inline const Conf&
get_conf(
int idx)
const {
return configurations[idx]; };
363 inline unsigned int get_no_confs()
const {
return configurations.size(); };
double getMonoisotopicConfMass() const
Get the mass of the monoisotopic subisotopologue.
PrecalculatedMarginal(Marginal &&m, double lCutOff, bool sort=true, int tabSize=1000, int hashSize=1000)
The move constructor (disowns the Marginal).
Marginal(const double *_masses, const double *_probs, int _isotopeNo, int _atomCnt)
Class constructor.
const double * get_masses_ptr() const
Get the table of the masses of subisotopologues.
Precalculated Marginal class.
The marginal distribution class (a subisotopologue).
unsigned int get_no_confs() const
Get the number of precomputed subisotopologues, see details in PrecalculatedMarginal::get_no_confs.
bool extend(double new_threshold)
Extend the set of computed subisotopologues to those above the new threshold.
const double * get_lProbs_ptr() const
Get the table of the log-probabilities of subisotopologues.
const double & get_mass(int idx) const
Get the mass of the idx-th subisotopologue.
double logProb(Conf conf) const
Calculate the log-probability of a given subisotopologue.
LayeredMarginal(Marginal &&m, int tabSize=1000, int hashSize=1000)
Move constructor: specializes the Marginal class.
int processUntilCutoff(double cutoff)
Calculate subisotopologues with probability above or equal to the cut-off.
double getHeaviestConfMass() const
Get the mass of the heaviest subisotopologue.
const double smallest_lprob
double getSmallestLProb() const
The the log-probability of the lightest subisotopologue.
Conf initialConfigure(const int atomCnt, const int isotopeNo, const double *probs, const double *lprobs)
Find one of the most probable subisotopologues.
double getModeLProb() const
Get the log-probability of the mode subisotopologue.
const Conf & get_conf(int idx) const
Get the counts of isotopes that define the subisotopologue.
const double & get_lProb(int idx) const
Get the log-probability of the idx-th subisotopologue.
virtual ~PrecalculatedMarginal()
Destructor.
double get_mass(int idx) const
get the mass of the idx-th subisotopologue, see details in PrecalculatedMarginal::get_mass.
double getLightestConfMass() const
Get the mass of the lightest subisotopologue.
const double *const atom_masses
const unsigned int atomCnt
const Conf & get_conf(int idx) const
get the counts of isotopes that define the subisotopologue, see details in PrecalculatedMarginal::get...
unsigned int get_no_confs() const
Get the number of precomputed subisotopologues.
double getModeMass() const
The the mass of the mode subisotopologue.
double getTheoreticalAverageMass() const
The theoretical average mass of the molecule.
const double * get_lProbs_ptr() const
get the pointer to lProbs array. Accessing index -1 is legal and returns a guardian of -inf....
bool probeConfigurationIdx(int idx)
Check if the table of computed subisotopologues does not have to be extended.
int get_isotopeNo() const
Get the number of isotopes of the investigated element.
const double *const atom_lProbs
virtual ~Marginal()
Destructor.
double get_prob(int idx) const
get the probability of the idx-th subisotopologue, see details in PrecalculatedMarginal::get_eProb.
double getModeProb() const
The the probability of the mode subisotopologue.
MarginalTrek(Marginal &&m, int tabSize=1000, int hashSize=1000)
Move constructor: specializes the Marginal class.
bool inRange(unsigned int idx) const
Is there a subisotopologue with a given number?
The marginal distribution class (a subisotopologue).
double get_lProb(int idx) const
get the log-probability of the idx-th subisotopologue, see details in PrecalculatedMarginal::get_lPro...
const double & get_prob(int idx) const
Get the probability of the idx-th subisotopologue.
const unsigned int isotopeNo
const double loggamma_nominator