construction d'une fonction de repartition et choix aleatoire d'un element en fonction de la fonction de repartition. More...
#include <Cdf.h>
Public Member Functions | |
Cdf (const int reserve=0) | |
constructeur, indique le nombre d'elements (optionnel). | |
void | insert (const float v) |
insere un element dans la fonction de repartition. | |
float | sampleSlow (int &id) const |
choisit un element, renvoie son indice et la probabilite de l'avoir choisi. | |
float | sample (Sampler &sampler, int &id) const |
choisit un element, renvoie son indice et la probabilite de l'avoir choisi. | |
float | pdf (const int id) const |
renvoie la probabilite d'avoir selectionne un element. | |
float | sampleUniform (Sampler &sampler, int &id) const |
choisit un element uniformement, renvoie son indice et la probabilite de l'avoir choisi. | |
float | pdfUniform (const int id) const |
renvoie la probabilite d'avoir selection un element. |
construction d'une fonction de repartition et choix aleatoire d'un element en fonction de la fonction de repartition.
float gk::Cdf::sampleSlow | ( | int & | id | ) | const [inline] |
choisit un element, renvoie son indice et la probabilite de l'avoir choisi.
utilise une recherche lineaire.
float gk::Cdf::sample | ( | Sampler & | sampler, | |
int & | id | |||
) | const [inline] |
choisit un element, renvoie son indice et la probabilite de l'avoir choisi.
utilise une recherche dichotomique dans l'ensemble de valeurs strictement croissant.
References gk::Sampler::uniformFloat().