Discrete probability distribution.
More...
#include <mitsuba/core/pmf.h>
Discrete probability distribution.
This data structure can be used to transform uniformly distributed samples to a stored discrete probability distribution.
mitsuba::DiscreteDistribution::DiscreteDistribution |
( |
size_t |
nEntries = 0 | ) |
|
|
inlineexplicit |
Allocate memory for a distribution with the given number of entries.
void mitsuba::DiscreteDistribution::append |
( |
Float |
pdfValue | ) |
|
|
inline |
Append an entry with the specified discrete probability.
void mitsuba::DiscreteDistribution::clear |
( |
| ) |
|
|
inline |
Float mitsuba::DiscreteDistribution::getNormalization |
( |
| ) |
const |
|
inline |
Return the normalization factor (i.e. the inverse of getSum())
This assumes that normalize() has previously been called
Float mitsuba::DiscreteDistribution::getSum |
( |
| ) |
const |
|
inline |
Return the original (unnormalized) sum of all PDF entries.
This assumes that normalize() has previously been called
bool mitsuba::DiscreteDistribution::isNormalized |
( |
| ) |
const |
|
inline |
Have the probability densities been normalized?
Float mitsuba::DiscreteDistribution::normalize |
( |
| ) |
|
|
inline |
Normalize the distribution.
Throws an exception when no entries were previously added to the distribution.
- Returns
- Sum of the (previously unnormalized) entries
Float mitsuba::DiscreteDistribution::operator[] |
( |
size_t |
entry | ) |
const |
|
inline |
Access an entry by its index.
void mitsuba::DiscreteDistribution::reserve |
( |
size_t |
nEntries | ) |
|
|
inline |
Reserve memory for a certain number of entries.
size_t mitsuba::DiscreteDistribution::sample |
( |
Float |
sampleValue | ) |
const |
|
inline |
Transform a uniformly distributed sample to the stored distribution
- Parameters
-
[in] | sampleValue | An uniformly distributed sample on [0,1] |
- Returns
- The discrete index associated with the sample
size_t mitsuba::DiscreteDistribution::sample |
( |
Float |
sampleValue, |
|
|
Float & |
pdf |
|
) |
| const |
|
inline |
Transform a uniformly distributed sample to the stored distribution
- Parameters
-
[in] | sampleValue | An uniformly distributed sample on [0,1] |
[out] | pdf | Probability value of the sample |
- Returns
- The discrete index associated with the sample
size_t mitsuba::DiscreteDistribution::sampleReuse |
( |
Float & |
sampleValue | ) |
const |
|
inline |
Transform a uniformly distributed sample to the stored distribution
The original sample is value adjusted so that it can be "reused".
- Parameters
-
[in,out] | sampleValue | An uniformly distributed sample on [0,1] |
- Returns
- The discrete index associated with the sample
size_t mitsuba::DiscreteDistribution::sampleReuse |
( |
Float & |
sampleValue, |
|
|
Float & |
pdf |
|
) |
| const |
|
inline |
Transform a uniformly distributed sample.
The original sample is value adjusted so that it can be "reused".
- Parameters
-
[in,out] | An | uniformly distributed sample on [0,1] |
[out] | pdf | Probability value of the sample |
- Returns
- The discrete index associated with the sample
size_t mitsuba::DiscreteDistribution::size |
( |
| ) |
const |
|
inline |
Return the number of entries so far.
std::string mitsuba::DiscreteDistribution::toString |
( |
| ) |
const |
|
inline |
Turn the underlying distribution into a human-readable string format.
The documentation for this struct was generated from the following file:
- include/mitsuba/core/pmf.h