Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BFL::DiscreteConditionalPdf Class Reference

Abstract Class representing all FULLY Discrete Conditional PDF's. More...

#include <discreteconditionalpdf.h>

Inheritance diagram for BFL::DiscreteConditionalPdf:
Inheritance graph
[legend]

Public Member Functions

virtual DiscreteConditionalPdfClone () const
 Clone function. More...
 
 DiscreteConditionalPdf (int num_states=1, int num_conditional_arguments=1, int cond_arg_dimensions[]=NULL)
 Constructor. More...
 
 DiscreteConditionalPdf (const DiscreteConditionalPdf &pdf)
 Copy constructor. More...
 
unsigned int NumStatesGet () const
 Get the number of discrete states. More...
 
Probability ProbabilityGet (const int &input) const
 Get the probability of a certain argument. More...
 
void ProbabilitySet (const double &prob, const int &input, const std::vector< int > &condargs) const
 Set the probability (Typical for discrete Pdf's) More...
 
virtual bool SampleFrom (Sample< int > &one_sample, int method, void *args) const
 Draw 1 sample from the Pdf: More...
 
virtual bool SampleFrom (vector< Sample< int > > &list_samples, int num_samples, int method, void *args) const
 
virtual ~DiscreteConditionalPdf ()
 Destructor. More...
 
- Public Member Functions inherited from BFL::ConditionalPdf< int, int >
const int & ConditionalArgumentGet (unsigned int n_argument) const
 Get the n-th argument of the list. More...
 
virtual void ConditionalArgumentSet (unsigned int n_argument, const int &argument)
 Set the n-th argument of the list. More...
 
const std::vector< int > & ConditionalArgumentsGet () const
 Get the whole list of conditional arguments. More...
 
virtual void ConditionalArgumentsSet (std::vector< int > ConditionalArguments)
 Set the whole list of conditional arguments. More...
 
 ConditionalPdf (int dimension=0, unsigned int num_conditional_arguments=0)
 Constructor. More...
 
unsigned int NumConditionalArgumentsGet () const
 Get the Number of conditional arguments. More...
 
virtual void NumConditionalArgumentsSet (unsigned int numconditionalarguments)
 Set the Number of conditional arguments. More...
 
virtual ~ConditionalPdf ()
 Destructor. More...
 
- Public Member Functions inherited from BFL::BFL::Pdf< int >
virtual MatrixWrapper::SymmetricMatrix CovarianceGet () const
 Get the Covariance Matrix E[(x - E[x])^2] of the Analytic pdf. More...
 
unsigned int DimensionGet () const
 Get the dimension of the argument. More...
 
virtual void DimensionSet (unsigned int dim)
 Set the dimension of the argument. More...
 
virtual int ExpectedValueGet () const
 Get the expected value E[x] of the pdf. More...
 
 Pdf (unsigned int dimension=0)
 Constructor. More...
 
virtual bool SampleFrom (vector< Sample< int > > &list_samples, const unsigned int num_samples, int method=DEFAULT, void *args=NULL) const
 Draw multiple samples from the Pdf (overloaded) More...
 
virtual ~Pdf ()
 Destructor. More...
 

Protected Member Functions

int IndexGet (const int &input, const std::vector< int > &condargs) const
 Get the correct index in the row of doubles (double * probability) More...
 

Protected Attributes

int * _cond_arg_dims_p
 "Possible discrete states" of all the conditional arguments More...
 
unsigned int _num_states
 number of discrete states More...
 
double * _probability_p
 Pointer to the probability values. More...
 
std::vector< double > _probs
 
int _total_dimension
 Total dimension of the likelihoodtable. More...
 
std::vector< double > _valuelist
 

Detailed Description

Abstract Class representing all FULLY Discrete Conditional PDF's.

This class inherits only from ConditionalPdf (not from DiscretePdf, avoiding a circular class structure

      ------
      |    |
      ------
     /      \
-----        -----
|   |        |   |
-----        -----
     \      /
      ------
      |    |
      ------
Todo:
Check if this is the best way to implement this.
Note
that the name of this class could be better chosen. Something like Discrete-DiscreteConditionalPdf would maybe be more clear (???), but quite long...
See also
ConditionalPdf

Definition at line 53 of file discreteconditionalpdf.h.

Constructor & Destructor Documentation

◆ DiscreteConditionalPdf() [1/2]

BFL::DiscreteConditionalPdf::DiscreteConditionalPdf ( int  num_states = 1,
int  num_conditional_arguments = 1,
int  cond_arg_dimensions[] = NULL 
)

Constructor.

Precondition
The number of elements of cond_arg_dimensions should be equal to num_conditional_arguments, otherwise -> Segfaults
Parameters
num_statesint representing the number of possible states
num_conditional_argumentsthe number of arguments behind the |
cond_arg_dimensions[]possible number of states of the different conditional arguments
See also
ConditionalPdf
Todo:
Get cleaner api and implementation

Definition at line 28 of file discreteconditionalpdf.cpp.

◆ DiscreteConditionalPdf() [2/2]

BFL::DiscreteConditionalPdf::DiscreteConditionalPdf ( const DiscreteConditionalPdf pdf)

Copy constructor.

Definition at line 61 of file discreteconditionalpdf.cpp.

◆ ~DiscreteConditionalPdf()

BFL::DiscreteConditionalPdf::~DiscreteConditionalPdf ( )
virtual

Destructor.

Definition at line 51 of file discreteconditionalpdf.cpp.

Member Function Documentation

◆ Clone()

DiscreteConditionalPdf * BFL::DiscreteConditionalPdf::Clone ( ) const
virtual

Clone function.

Reimplemented from BFL::ConditionalPdf< int, int >.

Definition at line 84 of file discreteconditionalpdf.cpp.

◆ IndexGet()

int BFL::DiscreteConditionalPdf::IndexGet ( const int &  input,
const std::vector< int > &  condargs 
) const
protected

Get the correct index in the row of doubles (double * probability)

Definition at line 96 of file discreteconditionalpdf.cpp.

◆ NumStatesGet()

unsigned int BFL::DiscreteConditionalPdf::NumStatesGet ( ) const

Get the number of discrete states.

Definition at line 90 of file discreteconditionalpdf.cpp.

◆ ProbabilityGet()

Probability BFL::DiscreteConditionalPdf::ProbabilityGet ( const int &  input) const
virtual

Get the probability of a certain argument.

Parameters
inputT argument of the Pdf
Returns
the probability value of the argument

Reimplemented from BFL::BFL::Pdf< int >.

Definition at line 119 of file discreteconditionalpdf.cpp.

◆ ProbabilitySet()

void BFL::DiscreteConditionalPdf::ProbabilitySet ( const double &  prob,
const int &  input,
const std::vector< int > &  condargs 
) const

Set the probability (Typical for discrete Pdf's)

Definition at line 127 of file discreteconditionalpdf.cpp.

◆ SampleFrom() [1/2]

bool BFL::DiscreteConditionalPdf::SampleFrom ( Sample< int > &  one_sample,
int  method,
void *  args 
) const
virtual

Draw 1 sample from the Pdf:

There's no need to create a list for only 1 sample!

Parameters
one_samplesample that will contain result of sampling
methodSampling method to be used. Each sampling method is currently represented by a #define statement, eg. #define BOXMULLER 1
argsPointer to a struct representing extra sample arguments
See also
SampleFrom()
Bug:
Sometimes the compiler doesn't know which method to choose!

Reimplemented from BFL::BFL::Pdf< int >.

Definition at line 135 of file discreteconditionalpdf.cpp.

◆ SampleFrom() [2/2]

bool BFL::DiscreteConditionalPdf::SampleFrom ( vector< Sample< int > > &  list_samples,
int  num_samples,
int  method,
void *  args 
) const
virtual

Definition at line 179 of file discreteconditionalpdf.cpp.

Member Data Documentation

◆ _cond_arg_dims_p

int* BFL::DiscreteConditionalPdf::_cond_arg_dims_p
protected

"Possible discrete states" of all the conditional arguments

Definition at line 65 of file discreteconditionalpdf.h.

◆ _num_states

unsigned int BFL::DiscreteConditionalPdf::_num_states
protected

number of discrete states

Definition at line 57 of file discreteconditionalpdf.h.

◆ _probability_p

double* BFL::DiscreteConditionalPdf::_probability_p
protected

Pointer to the probability values.

For now we implement this using a simple row of doubles, this should probably become a tensor in the future

Definition at line 63 of file discreteconditionalpdf.h.

◆ _probs

std::vector<double> BFL::DiscreteConditionalPdf::_probs
mutableprotected

Definition at line 75 of file discreteconditionalpdf.h.

◆ _total_dimension

int BFL::DiscreteConditionalPdf::_total_dimension
protected

Total dimension of the likelihoodtable.

Definition at line 68 of file discreteconditionalpdf.h.

◆ _valuelist

std::vector<double> BFL::DiscreteConditionalPdf::_valuelist
mutableprotected

Definition at line 76 of file discreteconditionalpdf.h.


The documentation for this class was generated from the following files:


bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Mon Feb 28 2022 21:56:34