![]() |
OpenMS
|
Decomposes a real-valued mass over a real-valued alphabet of Weights, within a configurable absolute mass error. More...
#include <OpenMS/CHEMISTRY/MASSDECOMPOSITION/IMS/RealMassDecomposer.h>
Public Types | |
| typedef IntegerMassDecomposer | integer_decomposer_type |
| Underlying integer decomposer. | |
| typedef integer_decomposer_type::value_type | integer_value_type |
| Integer mass values consumed by the integer decomposer. | |
| typedef integer_decomposer_type::decompositions_type | decompositions_type |
| Result type of the integer decomposer (collection of decompositions). | |
| typedef unsigned long long | number_of_decompositions_type |
| Counter type returned by getNumberOfDecompositions. | |
| typedef std::map< unsigned int, std::pair< unsigned int, unsigned int > > | constraints_type |
| Per-alphabet-entry count constraint: alphabet index -> (min count, max count); both bounds inclusive. | |
Public Member Functions | |
| RealMassDecomposer (const Weights &weights) | |
| Construct from an alphabet of Weights. | |
| decompositions_type | getDecompositions (double mass, double error) |
All decompositions of mass within absolute tolerance error. | |
| decompositions_type | getDecompositions (double mass, double error, const constraints_type &constraints) |
| Same as getDecompositions(double,double), additionally filtered by per-alphabet count bounds. | |
| number_of_decompositions_type | getNumberOfDecompositions (double mass, double error) |
Count of decompositions of mass within absolute tolerance error. | |
Private Attributes | |
| Weights | weights_ |
| Alphabet captured at construction time. | |
| std::pair< double, double > | rounding_errors_ |
| Minimum and maximum relative rounding errors of weights_, captured at construction time. | |
| double | precision_ |
| Precision of weights_, captured at construction time. | |
| std::shared_ptr< integer_decomposer_type > | decomposer_ |
| Lazy integer decomposer reused across calls; captured at construction time. | |
Decomposes a real-valued mass over a real-valued alphabet of Weights, within a configurable absolute mass error.
Translates the real-valued problem into integer mass decomposition against the Weights' scaled integer alphabet: it computes the integer-mass window that brackets the user-supplied [mass - error, mass + error] range (accounting for the precision-induced rounding errors stored on Weights), runs an IntegerMassDecomposer over each integer mass in the window, then drops every integer decomposition whose reconstructed real parent mass still differs from mass by more than error.
| typedef std::map<unsigned int, std::pair<unsigned int, unsigned int> > constraints_type |
Per-alphabet-entry count constraint: alphabet index -> (min count, max count); both bounds inclusive.
Result type of the integer decomposer (collection of decompositions).
Underlying integer decomposer.
Integer mass values consumed by the integer decomposer.
| typedef unsigned long long number_of_decompositions_type |
Counter type returned by getNumberOfDecompositions.
|
explicit |
Construct from an alphabet of Weights.
The alphabet's precision and rounding-error bounds are captured at construction time and reused on every subsequent getDecompositions / getNumberOfDecompositions call.
| [in] | weights | Real-valued alphabet to decompose against. |
| decompositions_type getDecompositions | ( | double | mass, |
| double | error | ||
| ) |
All decompositions of mass within absolute tolerance error.
Returns every alphabet-multiplicity vector whose reconstructed parent mass lies in [mass - error, mass + error].
| [in] | mass | Target real-valued mass. |
| [in] | error | Absolute mass tolerance. |
error of mass. | decompositions_type getDecompositions | ( | double | mass, |
| double | error, | ||
| const constraints_type & | constraints | ||
| ) |
Same as getDecompositions(double,double), additionally filtered by per-alphabet count bounds.
For each entry (idx, (lo, hi)) in constraints, only decompositions d with lo <= d[idx] <= hi are kept. Constraints whose alphabet index does not appear in decompositions are simply skipped.
| [in] | mass | Target real-valued mass. |
| [in] | error | Absolute mass tolerance. |
| [in] | constraints | Per-alphabet-entry count bounds. |
| number_of_decompositions_type getNumberOfDecompositions | ( | double | mass, |
| double | error | ||
| ) |
Count of decompositions of mass within absolute tolerance error.
Equivalent in result to getDecompositions(mass, error).size() but does not materialise the individual decompositions.
When mass - error is non-positive, the integer-mass window starts at 1 rather than at a non-positive value.
| [in] | mass | Target real-valued mass. |
| [in] | error | Absolute mass tolerance. |
error of mass.
|
private |
Lazy integer decomposer reused across calls; captured at construction time.
|
private |
Precision of weights_, captured at construction time.
|
private |
Minimum and maximum relative rounding errors of weights_, captured at construction time.
|
private |
Alphabet captured at construction time.