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 }
 
using value_type = T
 

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
 
size_t getMemoryUsage () 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 Typedef Documentation

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

Definition at line 344 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 463 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 470 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 485 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 496 of file UT_Cdf.h.

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

Definition at line 504 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 606 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 529 of file UT_Cdf.h.

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

Definition at line 735 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 708 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 425 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 423 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 419 of file UT_Cdf.h.

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

Definition at line 431 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 393 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 426 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 427 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 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 >::getSum ( ) const
inline

Get the sum over all image values.

Definition at line 418 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 559 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 648 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 657 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 671 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 688 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 573 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 595 of file UT_Cdf.h.


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