8 #ifndef LAR_DISCRETE_PROBABILITY_VECTOR_H 9 #define LAR_DISCRETE_PROBABILITY_VECTOR_H 1 11 #include "Pandora/PandoraInternal.h" 12 #include "Pandora/StatusCodes.h" 28 template <
typename TX,
typename TY>
31 template <
typename TX,
typename TY>
45 template <
typename TX,
typename TY>
87 float GetX(
const unsigned int index)
const;
134 void GetAllAtIndex(
const unsigned int index,
float &
x,
float &probabilityDensity,
float &cumulativeProbability,
float &width)
const;
197 template <
typename TX,
typename TY>
231 template <
typename TX,
typename TY>
241 template <
typename TX,
typename TY>
316 const unsigned int index,
float &
x,
float &probabilityDensity,
float &cumulativeProbability,
float &width)
const 322 probabilityDensity = theDatum.GetDensityDatum();
323 cumulativeProbability = theDatum.GetCumulativeDatum();
324 width = theDatum.GetWidth();
330 const float x,
const float densityDatum,
const float cumulativeDatum,
const float width) :
371 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_INITIALIZED);
374 throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
384 throw pandora::StatusCodeException(pandora::STATUS_CODE_OUT_OF_RANGE);
391 #endif // #ifndef LAR_DISCRETE_PROBABILITY_VECTOR_H std::vector< InputDatum< TX, TY >> InputData
float GetProbabilityDensity(const unsigned int index) const
Get the probability density value of the element in the vector.
void VerifyCompleteData() const
Verify the integrity of the complete probability vector.
float GetX(const unsigned int index) const
Get the x value of the element in the vector.
float EvaluateCumulativeProbability(const float x) const
Evaluate the cumulative probability at arbitrary x.
DiscreteProbabilityVector class.
float m_densityDatum
The probability density value.
float m_cumulativeDatum
The cumulative probability value.
DiscreteProbabilityData ResampleDiscreteProbabilityData(const DiscreteProbabilityVector &discreteProbabilityVector, const ResamplingPoints &resamplingPoints) const
Get a resampled probability data vector by resampling another probability data vector.
std::vector< DiscreteProbabilityDatum > DiscreteProbabilityData
float CalculateNormalisation(const InputData< TX, TY > &inputData) const
Calculate the probability normalisation.
DiscreteProbabilityDatum(const float x, const float densityDatum, const float cumulativeDatum, const float width)
Constructor.
DiscreteProbabilityData InitialiseDiscreteProbabilityData(InputData< TX, TY > inputData) const
Get a initialised probability data vector from the input data.
float GetWidth(const unsigned int index) const
Get the width of the element in the vectorr.
float GetWidth() const
Get the width of the datum.
void VerifyElementRequest(const unsigned int index) const
Verify the integrity of the element request.
float GetDensityDatum() const
Get the probability density for the datum.
void GetAllAtIndex(const unsigned int index, float &x, float &probabilityDensity, float &cumulativeProbability, float &width) const
Get all information stored at a particular index.
float m_width
The width of the probability bin.
DiscreteProbabilityData RandomiseDiscreteProbabilityData(const DiscreteProbabilityVector &discreteProbabilityVector, std::mt19937 &randomNumberGenerator) const
Get a randomised probability data vector in which the x values are unchanged, the probability density...
static bool SortInputDataByX(const InputDatum< TX, TY > &lhs, const InputDatum< TX, TY > &rhs)
Sort the input data according to their x value.
InputData< float, float > AllFloatInputData
float GetCumulativeProbability(const unsigned int index) const
Get the cumulative probability value of the element in the vector.
float GetProbability(const unsigned int index) const
Get the probability value of the element in the vector.
DiscreteProbabilityVector(const InputData< TX, TY > &inputData, const TX xUpperBound, const bool useWidths)
Constructor.
DiscreteProbabilityData m_discreteProbabilityData
the probability data
float m_xUpperBound
the upper bound of the probability vector
float GetX() const
Get the x value for the datum.
bool m_useWidths
controls whether bin widths are used in calculations
DiscreteProbabilityData class.
float m_x
The x coordinate.
unsigned int GetSize() const
Get the size of the probability vector.
float GetCumulativeDatum() const
Get the cumulative probability for the datum.
Dft::FloatVector FloatVector
std::pair< TX, TY > InputDatum
pandora::FloatVector ResamplingPoints