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

#include <UT_Cdf.h>

Public Types

enum  { DIM = N }
 

Public Member Functions

 UT_Cdf ()
 
 UT_Cdf (T *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 (T *data, const bool &copydata)
 
template<class F >
void setRawArray (const F &ftor)
 
TgetRawArray ()
 
void build ()
 
void sample (const T *u, T *dval) const
 
void sample (const T *u, T *dval, T &pdf) const
 
void sample (const T *u, int *didx) const
 Same as above but produces an exact index. More...
 
void sample (const T *u, int *didx, T *doff, T &pdf) const
 
void evaluatePdf (const T *u, T &pdf) const
 Evaluate the pdf at the given index. More...
 
const TgetSum () const
 Get the sum over all image values. More...
 
const TgetISum () const
 
const TgetScaling () const
 Get the average image value. More...
 
const TgetIScaling () const
 
int getDim () const
 
const intgetRes () const
 
const intgetRes (int dim) const
 
void dump () const
 

Detailed Description

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

Definition at line 338 of file UT_Cdf.h.

Member Enumeration Documentation

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

Definition at line 343 of file UT_Cdf.h.

Constructor & Destructor Documentation

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

Definition at line 447 of file UT_Cdf.h.

template<int N, typename T , class S >
UT_Cdf< N, T, S >::UT_Cdf ( T 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 454 of file UT_Cdf.h.

template<int N, typename T , class S >
template<class F >
UT_Cdf< N, T, 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 469 of file UT_Cdf.h.

template<int N, typename T , class S >
UT_Cdf< N, T, 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 480 of file UT_Cdf.h.

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

Definition at line 488 of file UT_Cdf.h.

Member Function Documentation

template<int N, typename T , class S >
void UT_Cdf< N, T, 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 590 of file UT_Cdf.h.

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

Clear associated storage.

Definition at line 513 of file UT_Cdf.h.

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

Definition at line 717 of file UT_Cdf.h.

template<int N, typename T , class S >
void UT_Cdf< N, T, S >::evaluatePdf ( const T u,
T pdf 
) const
inline

Evaluate the pdf at the given index.

Definition at line 692 of file UT_Cdf.h.

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

Definition at line 424 of file UT_Cdf.h.

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

Definition at line 422 of file UT_Cdf.h.

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

Definition at line 418 of file UT_Cdf.h.

template<int N = 1, typename T = float, class S = UT_Cdf_default_search_t>
T* UT_Cdf< N, T, 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 392 of file UT_Cdf.h.

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

Definition at line 425 of file UT_Cdf.h.

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

Definition at line 426 of file UT_Cdf.h.

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

Get the average image value.

Definition at line 421 of file UT_Cdf.h.

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

Get the sum over all image values.

Definition at line 417 of file UT_Cdf.h.

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

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

Definition at line 543 of file UT_Cdf.h.

template<int N, typename T , class S >
void UT_Cdf< N, T, S >::sample ( const T u,
T 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 632 of file UT_Cdf.h.

template<int N, typename T , class S >
void UT_Cdf< N, T, S >::sample ( const T u,
T dval,
T pdf 
) const
inline

Definition at line 641 of file UT_Cdf.h.

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

Same as above but produces an exact index.

Definition at line 655 of file UT_Cdf.h.

template<int N, typename T , class S >
void UT_Cdf< N, T, S >::sample ( const T u,
int didx,
T doff,
T 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 672 of file UT_Cdf.h.

template<int N, typename T , class S >
void UT_Cdf< N, T, S >::setRawArray ( T 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 557 of file UT_Cdf.h.

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

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

Definition at line 579 of file UT_Cdf.h.


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