HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_Cdf< N, S > Class Template Reference

#include <UT_Cdf.h>

Public Types

enum  { DIM = N }
 

Public Member Functions

 UT_Cdf ()
 
 UT_Cdf (float *data, const int *res, const bool &copydata)
 
template<class F >
 UT_Cdf (const F &ftor, const int *res)
 
 UT_Cdf (const int *res)
 
 ~UT_Cdf ()
 
void clear ()
 Clear associated storage. More...
 
void resize (const int *res)
 
void setRawArray (float *data, const bool &copydata)
 
template<class F >
void setRawArray (const F &ftor)
 
float * getRawArray ()
 
void build ()
 
void sample (const float *u, float *dval) const
 
void sample (const float *u, float *dval, float &pdf) const
 
void sample (const float *u, int *didx) const
 Same as above but produces an exact index. More...
 
void sample (const float *u, int *didx, float *doff, float &pdf) const
 
void evaluatePdf (const float *u, float &pdf) const
 Evaluate the pdf at the given index. More...
 
const float & getSum () const
 Get the sum over all image values. More...
 
const float & getISum () const
 
const float & getScaling () const
 Get the average image value. More...
 
const float & getIScaling () const
 
int getDim () const
 
const intgetRes () const
 
const intgetRes (int dim) const
 
void dump () const
 

Detailed Description

template<int N = 1, class S = UT_Cdf_default_search_t>
class UT_Cdf< N, S >

Definition at line 335 of file UT_Cdf.h.

Member Enumeration Documentation

template<int N = 1, class S = UT_Cdf_default_search_t>
anonymous enum
Enumerator
DIM 

Definition at line 340 of file UT_Cdf.h.

Constructor & Destructor Documentation

template<int N, class S >
UT_Cdf< N, S >::UT_Cdf ( )
inline

Definition at line 444 of file UT_Cdf.h.

template<int N, class S >
UT_Cdf< N, S >::UT_Cdf ( float *  data,
const int res,
const bool &  copydata 
)
inline

Construct from an array data = row-major pdf/cdf data res = resolution for each dimension data values less than zero will be treated as zero.

Definition at line 451 of file UT_Cdf.h.

template<int N, class S >
template<class F >
UT_Cdf< N, S >::UT_Cdf ( const F &  ftor,
const int res 
)
inline

Construct from a value functor ftor = value functor res = resolution for each dimension data values less than zero will be treated as zero.

Definition at line 465 of file UT_Cdf.h.

template<int N, class S >
UT_Cdf< N, S >::UT_Cdf ( const int res)
inline

Create a cdf without data. You should then use getRawArray() or setRawArray() functions and build() to construct the cdf. This method avoids duplication of memory for the pdf and cdf when only the cdf is needed. res = resolution for each dimension

Definition at line 476 of file UT_Cdf.h.

template<int N, class S >
UT_Cdf< N, S >::~UT_Cdf ( )
inline

Definition at line 484 of file UT_Cdf.h.

Member Function Documentation

template<int N, class S >
void UT_Cdf< N, S >::build ( )
inline

Build the cdf from the row-major data array. If you provided data to the constructor, you don't need to call this method unless you've modified the data through getRawArray().

Definition at line 585 of file UT_Cdf.h.

template<int N, class S >
void UT_Cdf< N, S >::clear ( void  )
inline

Clear associated storage.

Definition at line 509 of file UT_Cdf.h.

template<int N, class S >
void UT_Cdf< N, S >::dump ( ) const
inline

Definition at line 709 of file UT_Cdf.h.

template<int N, class S >
void UT_Cdf< N, S >::evaluatePdf ( const float *  u,
float &  pdf 
) const
inline

Evaluate the pdf at the given index.

Definition at line 684 of file UT_Cdf.h.

template<int N = 1, class S = UT_Cdf_default_search_t>
int UT_Cdf< N, S >::getDim ( ) const
inline

Definition at line 421 of file UT_Cdf.h.

template<int N = 1, class S = UT_Cdf_default_search_t>
const float& UT_Cdf< N, S >::getIScaling ( ) const
inline

Definition at line 419 of file UT_Cdf.h.

template<int N = 1, class S = UT_Cdf_default_search_t>
const float& UT_Cdf< N, S >::getISum ( ) const
inline

Definition at line 415 of file UT_Cdf.h.

template<int N = 1, class S = UT_Cdf_default_search_t>
float* UT_Cdf< N, S >::getRawArray ( )
inline

Retrieve the raw data array in row-major order. There will be product(res) entries in the array to fill out.

Definition at line 389 of file UT_Cdf.h.

template<int N = 1, class S = UT_Cdf_default_search_t>
const int* UT_Cdf< N, S >::getRes ( ) const
inline

Definition at line 422 of file UT_Cdf.h.

template<int N = 1, class S = UT_Cdf_default_search_t>
const int& UT_Cdf< N, S >::getRes ( int  dim) const
inline

Definition at line 423 of file UT_Cdf.h.

template<int N = 1, class S = UT_Cdf_default_search_t>
const float& UT_Cdf< N, S >::getScaling ( ) const
inline

Get the average image value.

Definition at line 418 of file UT_Cdf.h.

template<int N = 1, class S = UT_Cdf_default_search_t>
const float& UT_Cdf< N, S >::getSum ( ) const
inline

Get the sum over all image values.

Definition at line 414 of file UT_Cdf.h.

template<int N, class S >
void UT_Cdf< N, S >::resize ( const int res)
inline

Resize storage according to resolution. res = resolution for each dimension

Definition at line 539 of file UT_Cdf.h.

template<int N, class S >
void UT_Cdf< N, S >::sample ( const float *  u,
float *  dval 
) const
inline

Draw an importance sample from the cdf. u and dval must have 'N' entries. In this version, dval is the resulting sample value for each dimension in the range [0, 1).

Definition at line 622 of file UT_Cdf.h.

template<int N, class S >
void UT_Cdf< N, S >::sample ( const float *  u,
float *  dval,
float &  pdf 
) const
inline

Definition at line 631 of file UT_Cdf.h.

template<int N, class S >
void UT_Cdf< N, S >::sample ( const float *  u,
int didx 
) const
inline

Same as above but produces an exact index.

Definition at line 645 of file UT_Cdf.h.

template<int N, class S >
void UT_Cdf< N, S >::sample ( const float *  u,
int didx,
float *  doff,
float &  pdf 
) const
inline

Same as above but produces an exact index. (dval) above relates to (didx, doff) using the following identity: dval[dim] = (didx[dim] + doff[dim]) / res[dim]

Definition at line 663 of file UT_Cdf.h.

template<int N, class S >
void UT_Cdf< N, S >::setRawArray ( float *  data,
const bool &  copydata 
)
inline

Set the data array from an array. data = row-major pdf/cdf data copydata = should the data be copied?

Definition at line 553 of file UT_Cdf.h.

template<int N, class S >
template<class F >
void UT_Cdf< N, S >::setRawArray ( const F &  ftor)
inline

Set the data array from a value functor. ftor = value functor

Definition at line 574 of file UT_Cdf.h.


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