---
name: "IsoSpec_Marginal"
section: "3"
platform: "linux"
package: "libisospec++-dev"
version: "2.2.1-4.1+b3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/IsoSpec_Marginal"
---

# IsoSpec\_Marginal(3)

The marginal distribution class (a subisotopologue).

## NAME

IsoSpec::Marginal - The marginal distribution class (a subisotopologue).

## SYNOPSIS

`#include <marginalTrek++.h>`

Inherited by **IsoSpec::LayeredMarginal**, **IsoSpec::MarginalTrek**, and **IsoSpec::PrecalculatedMarginal**.

### Public Member Functions

**Marginal** (const double \*\_masses, const double \*\_probs, int \_isotopeNo, int \_atomCnt)\
 Class constructor.  **Marginal** & **operator=** (const **Marginal** &other)=delete\
 **Marginal** (const **Marginal** &other)\
 Copy constructor.  **Marginal** (**Marginal** &&other)\
 Move constructor.  virtual **~Marginal** ()\
 Destructor.  int **get\_isotopeNo** () const\
 Get the number of isotopes of the investigated element.  const double \* **get\_lProbs** () const\
 double **getLightestConfMass** () const\
 Get the mass of the lightest subisotopologue.  double **getHeaviestConfMass** () const\
 Get the mass of the heaviest subisotopologue.  double **getMonoisotopicConfMass** () const\
 Get the mass of the monoisotopic subisotopologue.  double **getModeMass** ()\
 The the mass of the mode subisotopologue.  double **getModeLProb** ()\
 Get the log-probability of the mode subisotopologue.  double **fastGetModeLProb** ()\
 Get the log-probability of the mode subisotopologue. Results undefined if ensureModeConf() wasn't called before.  Conf **computeModeConf** () const\
 The the probability of the mode subisotopologue.  double **getSmallestLProb** () const\
 The the log-probability of the lightest subisotopologue.  double **getAtomAverageMass** () const\
 The average mass of a single atom.  double **getTheoreticalAverageMass** () const\
 The theoretical average mass of the molecule.  double **variance** () const\
 Calculate the variance of the theoretical distribution describing the subisotopologue.  double **getLogSizeEstimate** (double logEllipsoidRadius) const\
 Return estimated logarithm of size of the marginal at a given ellipsoid radius.  void **ensureModeConf** ()\

### Protected Member Functions

ISOSPEC\_FORCE\_INLINE double **unnormalized\_logProb** (Conf conf) const\
 Calculate the log-probability of a given subisotopologue.  ISOSPEC\_FORCE\_INLINE double **logProb** (Conf conf) const\

### Protected Attributes

const unsigned int **isotopeNo**\
 const unsigned int **atomCnt**\
 const double \*const **atom\_lProbs**\
 const double \*const **atom\_masses**\
 const double **loggamma\_nominator**\
 Conf **mode\_conf**\
 double **mode\_lprob**\

## Detailed Description

The marginal distribution class (a subisotopologue).

This class mostly provides some basic common API for subclasses, but itself is not abstract. This class represents the probability distribution generated by one element only -- a subisotopologue. For instance, it might be the distribution of C200, that might be part of, say, C200H402. It corresponds to the multinomial distribution, where each configuration can also be attributed a precise mass. The constructor method perform initial hill-climbing to find the most probable sub-isotopologue (the mode).

Definition at line **42** of file **marginalTrek++.h**.

## Constructor & Destructor Documentation

### IsoSpec::Marginal::Marginal (const double \* \_masses, const double \* \_probs, int \_isotopeNo, int \_atomCnt)

Class constructor.

**Parameters**

*\_masses* A table of masses of the stable isotopes of the investigated element, e.g. for C10 it is 2: C12 and C13. \
 *\_probs* A table of natural frequencies of the stable isotopes of the investigated element, see IUPAC at https://iupac.org/isotopesmatter/ \
 *\_isotopeNo* Number of isotopes of a given element. \
 *\_atomCnt* The number of atoms of the given element, e.g. 10 for C10.

**Returns**

An instance of the **Marginal** class.

Definition at line **165** of file **marginalTrek++.cpp**.

### IsoSpec::Marginal::Marginal (const Marginal & other)

Copy constructor.

Definition at line **181** of file **marginalTrek++.cpp**.

### IsoSpec::Marginal::Marginal (Marginal && other)

Move constructor.

Definition at line **203** of file **marginalTrek++.cpp**.

### IsoSpec::Marginal::~Marginal ()` [virtual]`

Destructor.

Definition at line **224** of file **marginalTrek++.cpp**.

## Member Function Documentation

### Conf IsoSpec::Marginal::computeModeConf () const

The the probability of the mode subisotopologue.

**Returns**

The probability of a/the most probable subisotopologue. Computes and returns the mode configuration, a isotopeNo-large array that the caller is responsible for delete\[\]-ing.

Definition at line **235** of file **marginalTrek++.cpp**.

### void IsoSpec::Marginal::ensureModeConf ()` [inline]`

Definition at line **168** of file **marginalTrek++.h**.

### double IsoSpec::Marginal::fastGetModeLProb ()` [inline]`

Get the log-probability of the mode subisotopologue. Results undefined if ensureModeConf() wasn't called before.

Definition at line **124** of file **marginalTrek++.h**.

### int IsoSpec::Marginal::get\_isotopeNo () const` [inline]`

Get the number of isotopes of the investigated element.

**Returns**

The integer number of isotopes of the investigated element.

Definition at line **88** of file **marginalTrek++.h**.

### const double \* IsoSpec::Marginal::get\_lProbs () const` [inline]`

Definition at line **90** of file **marginalTrek++.h**.

### double IsoSpec::Marginal::getAtomAverageMass () const

The average mass of a single atom.

**Returns**

The average mass of a single atom.

Definition at line **281** of file **marginalTrek++.cpp**.

### double IsoSpec::Marginal::getHeaviestConfMass () const

Get the mass of the heaviest subisotopologue. This is trivially obtained by considering all atomNo atoms to be the heaviest isotope possible.

**Returns**

The mass of the heaviest subisotopologue.

Definition at line **259** of file **marginalTrek++.cpp**.

### double IsoSpec::Marginal::getLightestConfMass () const

Get the mass of the lightest subisotopologue. This is trivially obtained by considering all atomNo atoms to be the lightest isotope possible.

**Returns**

The mass of the lightiest subisotopologue.

Definition at line **250** of file **marginalTrek++.cpp**.

### double IsoSpec::Marginal::getLogSizeEstimate (double logEllipsoidRadius) const

Return estimated logarithm of size of the marginal at a given ellipsoid radius.

Definition at line **301** of file **marginalTrek++.cpp**.

### double IsoSpec::Marginal::getModeLProb ()` [inline]`

Get the log-probability of the mode subisotopologue.

**Returns**

The log-probability of a/the most probable subisotopologue.

Definition at line **121** of file **marginalTrek++.h**.

### double IsoSpec::Marginal::getModeMass ()` [inline]`

The the mass of the mode subisotopologue.

**Returns**

The mass of one of the most probable subisotopologues.

Definition at line **115** of file **marginalTrek++.h**.

### double IsoSpec::Marginal::getMonoisotopicConfMass () const

Get the mass of the monoisotopic subisotopologue. The monoisotopic subisotopologue is defined as the molecule consiting only of the most likely isotope. This is frequently the lightest subisotopologue, making this frequently (but not always) equal to **getLightestConfMass()**

Definition at line **268** of file **marginalTrek++.cpp**.

### double IsoSpec::Marginal::getSmallestLProb () const` [inline]`

The the log-probability of the lightest subisotopologue.

**Returns**

The logarithm of the smallest non-zero probability of a subisotopologue.

Definition at line **139** of file **marginalTrek++.h**.

### double IsoSpec::Marginal::getTheoreticalAverageMass () const` [inline]`

The theoretical average mass of the molecule.

**Returns**

The theoretical average mass of the molecule.

Definition at line **151** of file **marginalTrek++.h**.

### ISOSPEC\_FORCE\_INLINE double IsoSpec::Marginal::logProb (Conf conf) const` [inline]`, ` [protected]`

Definition at line **160** of file **marginalTrek++.h**.

### ISOSPEC\_FORCE\_INLINE double IsoSpec::Marginal::unnormalized\_logProb (Conf conf) const` [inline]`, ` [protected]`

Calculate the log-probability of a given subisotopologue.

**Parameters**

*conf* A subisotopologue (a table of integers describing subsequent isotope-counts).

**Returns**

The log-probability of the input subisotopologue.

Definition at line **159** of file **marginalTrek++.h**.

### double IsoSpec::Marginal::variance () const

Calculate the variance of the theoretical distribution describing the subisotopologue.

Definition at line **289** of file **marginalTrek++.cpp**.

## Member Data Documentation

### const double\* const IsoSpec::Marginal::atom\_lProbs` [protected]`

Table of log-probabilities of all the isotopeNo isotopes.

Definition at line **49** of file **marginalTrek++.h**.

### const double\* const IsoSpec::Marginal::atom\_masses` [protected]`

Table of atomic masses of all the isotopeNo isotopes.

Definition at line **50** of file **marginalTrek++.h**.

### const unsigned int IsoSpec::Marginal::atomCnt` [protected]`

The number of atoms of the given element.

Definition at line **48** of file **marginalTrek++.h**.

### const unsigned int IsoSpec::Marginal::isotopeNo` [protected]`

The number of isotopes of the given element.

Definition at line **47** of file **marginalTrek++.h**.

### const double IsoSpec::Marginal::loggamma\_nominator` [protected]`

The constant nominator that appears in the expressions for the multinomial probabilities.

Definition at line **51** of file **marginalTrek++.h**.

### Conf IsoSpec::Marginal::mode\_conf` [protected]`

A subisotopologue with most probability. If not unique, one of the representatives of that class of subisotopologues.

Definition at line **52** of file **marginalTrek++.h**.

### double IsoSpec::Marginal::mode\_lprob` [protected]`

The log-probability of the mode subisotopologue.

Definition at line **53** of file **marginalTrek++.h**.

## Author

Generated automatically by Doxygen for IsoSpec from the source code.
