queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::ExponentialScalarCovarianceFunction< V, M > Class Template Reference

A class for exponential covariances. More...

#include <ExponentialScalarCovarianceFunction.h>

Inheritance diagram for QUESO::ExponentialScalarCovarianceFunction< V, M >:
QUESO::BaseScalarCovarianceFunction< V, M >

Public Member Functions

Constructor/Destructor methods
 ExponentialScalarCovarianceFunction (const char *prefix, const VectorSet< V, M > &basicDomainSet, double sigma, double a)
 Default constructor. More...
 
virtual ~ExponentialScalarCovarianceFunction ()
 Virtual destructor. More...
 
Math methods
double value (const V &domainVector1, const V &domainVector2) const
 Calculates the value of the exponential covariance function. More...
 
- Public Member Functions inherited from QUESO::BaseScalarCovarianceFunction< V, M >
 BaseScalarCovarianceFunction (const char *prefix, const VectorSet< V, M > &basicDomainSet)
 Default constructor. More...
 
virtual ~BaseScalarCovarianceFunction ()
 Virtual destructor. More...
 
const VectorSet< V, M > & basicDomainSet () const
 Domain set; access to private attribute m_basicDomainSet. More...
 

Protected Attributes

double m_sigma
 
double m_a
 
- Protected Attributes inherited from QUESO::BaseScalarCovarianceFunction< V, M >
const BaseEnvironmentm_env
 
std::string m_prefix
 
const VectorSet< V, M > & m_basicDomainSet
 

Detailed Description

template<class V = GslVector, class M = GslMatrix>
class QUESO::ExponentialScalarCovarianceFunction< V, M >

A class for exponential covariances.

This class implements squared exponential covariance functions of the form:

\[ cov = a \exp{(-d^2/\sigma^2)}\]

, where \( d=d(x,y) \) is the distance between two points, \( \sigma^2 \) is the variance and \( a \) is the length scale. This is a stationary covariance function with smooth sample paths. Exponential covariance functions are largely employed in Gaussian processes.

Definition at line 52 of file ExponentialScalarCovarianceFunction.h.

Constructor & Destructor Documentation

template<class V , class M >
QUESO::ExponentialScalarCovarianceFunction< V, M >::ExponentialScalarCovarianceFunction ( const char *  prefix,
const VectorSet< V, M > &  basicDomainSet,
double  sigma,
double  a 
)

Default constructor.

Instantiates an object of the class given a prefix, the domain set, the variance and a scale factor.

Definition at line 31 of file ExponentialScalarCovarianceFunction.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseScalarCovarianceFunction< V, M >::m_env, QUESO::BaseScalarCovarianceFunction< V, M >::m_prefix, and QUESO::BaseEnvironment::subDisplayFile().

36  :
37  BaseScalarCovarianceFunction<V,M>(prefix,basicDomainSet),
38  m_sigma(sigma),
39  m_a (a)
40 {
41  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
42  *m_env.subDisplayFile() << "Entering ExponentialScalarCovarianceFunction<V,M>::constructor()"
43  << ": prefix = " << m_prefix
44  << std::endl;
45  }
46 
47  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
48  *m_env.subDisplayFile() << "Leaving ExponentialScalarCovarianceFunction<V,M>::constructor()"
49  << ": prefix = " << m_prefix
50  << std::endl;
51  }
52 }
unsigned int displayVerbosity() const
Definition: Environment.C:450
const VectorSet< V, M > & basicDomainSet() const
Domain set; access to private attribute m_basicDomainSet.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
template<class V , class M >
QUESO::ExponentialScalarCovarianceFunction< V, M >::~ExponentialScalarCovarianceFunction ( )
virtual

Virtual destructor.

Definition at line 55 of file ExponentialScalarCovarianceFunction.C.

56 {
57  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
58  *m_env.subDisplayFile() << "Entering ExponentialScalarCovarianceFunction<V,M>::destructor()"
59  << ": prefix = " << m_prefix
60  << std::endl;
61  }
62 
63  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
64  *m_env.subDisplayFile() << "Leaving ExponentialScalarCovarianceFunction<V,M>::destructor()"
65  << ": prefix = " << m_prefix
66  << std::endl;
67  }
68 }
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

Member Function Documentation

template<class V , class M >
double QUESO::ExponentialScalarCovarianceFunction< V, M >::value ( const V &  domainVector1,
const V &  domainVector2 
) const
virtual

Calculates the value of the exponential covariance function.

The value of the exponential covariance function is: \( cov= a exp (-d^2/sigma)\), with \( d= \sqrt{(domainVector1 - domainVector1)^2} \)

Implements QUESO::BaseScalarCovarianceFunction< V, M >.

Definition at line 72 of file ExponentialScalarCovarianceFunction.C.

73 {
74  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
75  *m_env.subDisplayFile() << "Entering ExponentialScalarCovarianceFunction<V,M>::value()"
76  << std::endl;
77  }
78 
79  double result = 0.;
80 
81  double exponent = -(domainVector1 - domainVector2).norm2Sq()/(m_sigma*m_sigma);
82 
83  result = m_a*std::exp(exponent);
84 
85  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
86  *m_env.subDisplayFile() << "Leaving ExponentialScalarCovarianceFunction<V,M>::value()"
87  << std::endl;
88  }
89 
90  return result;
91 }
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

Member Data Documentation

template<class V = GslVector, class M = GslMatrix>
double QUESO::ExponentialScalarCovarianceFunction< V, M >::m_a
protected

Definition at line 80 of file ExponentialScalarCovarianceFunction.h.

template<class V = GslVector, class M = GslMatrix>
double QUESO::ExponentialScalarCovarianceFunction< V, M >::m_sigma
protected

Definition at line 79 of file ExponentialScalarCovarianceFunction.h.


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

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