queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::StdScalarCdf< T > Class Template Reference

A class for handling standard CDFs. More...

#include <StdScalarCdf.h>

Inheritance diagram for QUESO::StdScalarCdf< T >:
QUESO::BaseScalarCdf< T >

Public Member Functions

Constructor/Destructor methods
 StdScalarCdf (const BaseEnvironment &env, const char *prefix, const std::vector< T > &cdfGrid, const std::vector< double > &cdfValues)
 Default constructor. More...
 
 ~StdScalarCdf ()
 Destructor. More...
 
Mathematical methods
double value (T paramValue) const
 Returns the value of the CDF at paramValue. More...
 
inverse (double cdfValue) const
 Returns the position of a given value of CDF. More...
 
void getSupport (T &minHorizontal, T &maxHorizontal) const
 Returns the support (image) of the CDF between two horizontal values (domain). More...
 
I/O methods
void print (std::ostream &os) const
 Prints the CDF (values of the grid points and of the CDF at such grid points). More...
 
void subWriteContents (const std::string &varNamePrefix, const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds) const
 Writes the CDF of an allowed sub-environment to a file. More...
 
- Public Member Functions inherited from QUESO::BaseScalarCdf< T >
 BaseScalarCdf (const BaseEnvironment &env, const char *prefix)
 Default constructor. More...
 
virtual ~BaseScalarCdf ()
 Virtual destructor. More...
 
const BaseEnvironmentenv () const
 Environment. Access to private attribute m_env. More...
 
const std::string & prefix () const
 Access to private attribute m_prefix. More...
 

Protected Attributes

const StdOneDGrid< T > m_cdfGrid
 
const std::vector< double > m_cdfValues
 
SampledScalarCdf< T > * m_sampledCdfGrid
 
- Protected Attributes inherited from QUESO::BaseScalarCdf< T >
const BaseEnvironmentm_env
 
std::string m_prefix
 
m_minHorizontal
 
m_maxHorizontal
 

Detailed Description

template<class T>
class QUESO::StdScalarCdf< T >

A class for handling standard CDFs.

This class implements a standard cumulative distribution function (CDF). Its protected attribute m_sampledCdfGrid is an object of the class SampledScalarCdf<T>, so all members of this class are implemented using the members of SampledScalarCdf<T>.

Definition at line 48 of file StdScalarCdf.h.

Constructor & Destructor Documentation

template<class T >
QUESO::StdScalarCdf< T >::StdScalarCdf ( const BaseEnvironment env,
const char *  prefix,
const std::vector< T > &  cdfGrid,
const std::vector< double > &  cdfValues 
)

Default constructor.

Instantiates an object of the class given a prefix, the environment, the grid points where it will be evaluated and its resulting values.

Definition at line 31 of file StdScalarCdf.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseScalarCdf< T >::env(), QUESO::StdScalarCdf< T >::m_cdfGrid, QUESO::StdScalarCdf< T >::m_cdfValues, QUESO::BaseScalarCdf< T >::m_env, QUESO::BaseScalarCdf< T >::m_prefix, QUESO::StdScalarCdf< T >::m_sampledCdfGrid, QUESO::BaseScalarCdf< T >::prefix(), and QUESO::BaseEnvironment::subDisplayFile().

36  :
37  BaseScalarCdf<T>(env,((std::string)(prefix)+"").c_str()),
38  m_cdfGrid (env,prefix,cdfGrid),
39  m_cdfValues (cdfValues),
40  m_sampledCdfGrid (NULL)
41 {
42  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
43  *m_env.subDisplayFile() << "Entering StdScalarCdf<T>::constructor()"
44  << ": prefix = " << m_prefix
45  << std::endl;
46  }
47 
48  m_sampledCdfGrid = new SampledScalarCdf<T>(env,prefix,m_cdfGrid,m_cdfValues);
49 
50  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) {
51  *m_env.subDisplayFile() << "Leaving StdScalarCdf<T>::constructor()"
52  << ": prefix = " << m_prefix
53  << std::endl;
54  }
55 }
const BaseEnvironment & env() const
Environment. Access to private attribute m_env.
Definition: ScalarCdf.C:60
const BaseEnvironment & m_env
Definition: ScalarCdf.h:99
SampledScalarCdf< T > * m_sampledCdfGrid
Definition: StdScalarCdf.h:95
const std::vector< double > m_cdfValues
Definition: StdScalarCdf.h:94
std::string m_prefix
Definition: ScalarCdf.h:100
const StdOneDGrid< T > m_cdfGrid
Definition: StdScalarCdf.h:93
const std::string & prefix() const
Access to private attribute m_prefix.
Definition: ScalarCdf.C:67
unsigned int displayVerbosity() const
Definition: Environment.C:450
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
template<class T >
QUESO::StdScalarCdf< T >::~StdScalarCdf ( )

Destructor.

Definition at line 58 of file StdScalarCdf.C.

59 {
60  delete m_sampledCdfGrid;
61 }
SampledScalarCdf< T > * m_sampledCdfGrid
Definition: StdScalarCdf.h:95

Member Function Documentation

template<class T >
void QUESO::StdScalarCdf< T >::getSupport ( T &  minHorizontal,
T &  maxHorizontal 
) const
virtual

Returns the support (image) of the CDF between two horizontal values (domain).

Implements QUESO::BaseScalarCdf< T >.

Definition at line 79 of file StdScalarCdf.C.

80 {
81  return m_sampledCdfGrid->getSupport(minHorizontal,maxHorizontal);
82 }
SampledScalarCdf< T > * m_sampledCdfGrid
Definition: StdScalarCdf.h:95
template<class T >
T QUESO::StdScalarCdf< T >::inverse ( double  cdfValue) const
virtual

Returns the position of a given value of CDF.

Implements QUESO::BaseScalarCdf< T >.

Definition at line 72 of file StdScalarCdf.C.

73 {
74  return m_sampledCdfGrid->inverse(cdfValue);
75 }
SampledScalarCdf< T > * m_sampledCdfGrid
Definition: StdScalarCdf.h:95
template<class T >
void QUESO::StdScalarCdf< T >::print ( std::ostream &  os) const
virtual

Prints the CDF (values of the grid points and of the CDF at such grid points).

Implements QUESO::BaseScalarCdf< T >.

Definition at line 86 of file StdScalarCdf.C.

87 {
88  m_sampledCdfGrid->print(os);
89  return;
90 }
SampledScalarCdf< T > * m_sampledCdfGrid
Definition: StdScalarCdf.h:95
template<class T >
void QUESO::StdScalarCdf< T >::subWriteContents ( const std::string &  varNamePrefix,
const std::string &  fileName,
const std::string &  fileType,
const std::set< unsigned int > &  allowedSubEnvIds 
) const
virtual

Writes the CDF of an allowed sub-environment to a file.

It will write the data in Octave/Matlab compatible format.

Reimplemented from QUESO::BaseScalarCdf< T >.

Definition at line 94 of file StdScalarCdf.C.

99 {
100  m_sampledCdfGrid->subWriteContents(varNamePrefix,fileName,fileType,allowedSubEnvIds);
101  return;
102 }
SampledScalarCdf< T > * m_sampledCdfGrid
Definition: StdScalarCdf.h:95
template<class T >
double QUESO::StdScalarCdf< T >::value ( paramValue) const
virtual

Returns the value of the CDF at paramValue.

Implements QUESO::BaseScalarCdf< T >.

Definition at line 65 of file StdScalarCdf.C.

66 {
67  return m_sampledCdfGrid->value(paramValue);
68 }
SampledScalarCdf< T > * m_sampledCdfGrid
Definition: StdScalarCdf.h:95

Member Data Documentation

template<class T >
const StdOneDGrid<T> QUESO::StdScalarCdf< T >::m_cdfGrid
protected

Definition at line 93 of file StdScalarCdf.h.

Referenced by QUESO::StdScalarCdf< T >::StdScalarCdf().

template<class T >
const std::vector<double> QUESO::StdScalarCdf< T >::m_cdfValues
protected

Definition at line 94 of file StdScalarCdf.h.

Referenced by QUESO::StdScalarCdf< T >::StdScalarCdf().

template<class T >
SampledScalarCdf<T>* QUESO::StdScalarCdf< T >::m_sampledCdfGrid
protected

Definition at line 95 of file StdScalarCdf.h.

Referenced by QUESO::StdScalarCdf< T >::StdScalarCdf().


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

Generated on Tue Jun 5 2018 19:49:37 for queso-0.57.1 by  doxygen 1.8.5