67 const T&
getValue (
const Probability_T& iCumulativeProbability)
const {
69 const DictionaryKey_T& lKey =
70 DictionaryManager::valueToKey (iCumulativeProbability);
72 InverseCumulativeDistribution_T::const_iterator itT =
73 _inverseCumulativeDistribution.find (lKey);
75 if (itT == _inverseCumulativeDistribution.end()) {
76 std::ostringstream oStr;
77 oStr <<
"The following cumulative probability is out of range: "
79 throw IndexOutOfRangeException (oStr.str());
112 std::ostringstream oStr;
114 for (
typename InverseCumulativeDistribution_T::const_iterator it =
115 _inverseCumulativeDistribution.begin();
116 it != _inverseCumulativeDistribution.end(); ++it) {
117 oStr <<
"cumulative prob: " << DictionaryManager::keyToValue (it->first)
118 <<
" value: " << it->second << std::endl;
159 Probability_T cumulative_probability_so_far = 0.0;
160 for (
typename ProbabilityMassFunction_T::const_iterator
161 itProbabilityMassFunction = _probabilityMassFunction.begin();
162 itProbabilityMassFunction != _probabilityMassFunction.end();
163 ++itProbabilityMassFunction) {
165 Probability_T attribute_probability_mass =
166 DictionaryManager::keyToValue (itProbabilityMassFunction->second);
168 if (attribute_probability_mass > 0) {
169 T attribute_value = itProbabilityMassFunction->first;
170 cumulative_probability_so_far += attribute_probability_mass;
172 const DictionaryKey_T& lKey =
173 DictionaryManager::valueToKey (cumulative_probability_so_far);
176 _inverseCumulativeDistribution.
178 value_type (lKey, attribute_value));