queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::InfiniteDimensionalGaussian Class Reference

Class defining infinite dimensional Gaussian measures. More...

#include <InfiniteDimensionalGaussian.h>

Inheritance diagram for QUESO::InfiniteDimensionalGaussian:
QUESO::InfiniteDimensionalMeasureBase

Public Member Functions

virtual SharedPtr
< FunctionBase >::Type 
draw ()
 Draw from the measure, and then return a shared pointer to the draw. More...
 
virtual double get_kl_coefficient (unsigned int i) const
 Return coefficient i of the KL expansion of the current draw. Must be called after draw() More...
 
Constructor/Destructor methods
 InfiniteDimensionalGaussian (const FullEnvironment &env, const FunctionBase &mean, const OperatorBase &precision, double alpha, double beta)
 Construct a Gaussian with mean mean, precision operator precision. alpha controls regularity of draws and beta^2 is a multiplicative coefficient of precision. More...
 
 ~InfiniteDimensionalGaussian ()
 Destructor. More...
 
- Public Member Functions inherited from QUESO::InfiniteDimensionalMeasureBase
 InfiniteDimensionalMeasureBase ()
 Default constructor. More...
 
virtual ~InfiniteDimensionalMeasureBase ()
 Destructor. More...
 

Private Attributes

const FunctionBasemean
 
const OperatorBaseprecision
 
const FullEnvironmentenv
 
double alpha
 
double beta
 
std::vector< double > coeffs
 

Detailed Description

Class defining infinite dimensional Gaussian measures.

Definition at line 45 of file InfiniteDimensionalGaussian.h.

Constructor & Destructor Documentation

QUESO::InfiniteDimensionalGaussian::InfiniteDimensionalGaussian ( const FullEnvironment env,
const FunctionBase mean,
const OperatorBase precision,
double  alpha,
double  beta 
)

Construct a Gaussian with mean mean, precision operator precision. alpha controls regularity of draws and beta^2 is a multiplicative coefficient of precision.

The argument alpha refers to the power to which the precision will be taken. And beta is the multiplicative coefficient of preicision. The complete measure is therefore:

N(mean, beta^2 * pow(precision, alpha))

It is expected that mean and precision will live longer than this

Definition at line 38 of file InfiniteDimensionalGaussian.C.

References coeffs, and QUESO::OperatorBase::get_num_converged().

45  mean(mean),
47  env(env),
48  alpha(alpha),
49  beta(beta)
50 {
51  this->coeffs.resize(this->precision.get_num_converged(), 0.0);
52 }
virtual unsigned int get_num_converged() const =0
Return the number of converged eigenpairs.
QUESO::InfiniteDimensionalGaussian::~InfiniteDimensionalGaussian ( )

Destructor.

Definition at line 54 of file InfiniteDimensionalGaussian.C.

55 {
56 }

Member Function Documentation

SharedPtr< FunctionBase >::Type QUESO::InfiniteDimensionalGaussian::draw ( )
virtual

Draw from the measure, and then return a shared pointer to the draw.

Implements QUESO::InfiniteDimensionalMeasureBase.

Definition at line 58 of file InfiniteDimensionalGaussian.C.

References beta, coeffs, env, QUESO::RngBase::gaussianSample(), QUESO::OperatorBase::get_num_converged(), QUESO::OperatorBase::inverse_kl_transform(), mean, precision, and QUESO::BaseEnvironment::rngObject().

59 {
60  unsigned int i;
61 
62  for (i = 0; i < this->precision.get_num_converged(); i++) {
63  (this->coeffs)[i] = env.rngObject()->gaussianSample(this->beta);
64  }
65 
66  SharedPtr<FunctionBase>::Type f(this->precision.inverse_kl_transform(this->coeffs, this->alpha));
67 
68  // Add on the mean
69  f->add(1.0, mean);
70 
71  return f;
72 }
virtual double gaussianSample(double stdDev) const =0
Samples a value from a Gaussian distribution with standard deviation given by stdDev.
virtual unsigned int get_num_converged() const =0
Return the number of converged eigenpairs.
const RngBase * rngObject() const
Access to the RNG object.
Definition: Environment.C:471
Definition of a shared pointer.
virtual SharedPtr< FunctionBase >::Type inverse_kl_transform(std::vector< double > &xi, double alpha) const =0
Given coefficients xi, computes the Karhunen-Loeve transform.
double QUESO::InfiniteDimensionalGaussian::get_kl_coefficient ( unsigned int  i) const
virtual

Return coefficient i of the KL expansion of the current draw. Must be called after draw()

Implements QUESO::InfiniteDimensionalMeasureBase.

Definition at line 74 of file InfiniteDimensionalGaussian.C.

References alpha, coeffs, QUESO::OperatorBase::get_eigenvalue(), and precision.

75 {
76  // This is code repetition, but I'm not quite sure this belongs
77  // in the operator class, because it's useful in the measure
78  return (this->coeffs)[i] / std::pow(this->precision.get_eigenvalue(i), this->alpha / 2.0);
79 }
virtual double get_eigenvalue(unsigned int i) const =0
Return eigenvalue i.

Member Data Documentation

double QUESO::InfiniteDimensionalGaussian::alpha
private

Definition at line 84 of file InfiniteDimensionalGaussian.h.

Referenced by get_kl_coefficient().

double QUESO::InfiniteDimensionalGaussian::beta
private

Definition at line 87 of file InfiniteDimensionalGaussian.h.

Referenced by draw().

std::vector<double> QUESO::InfiniteDimensionalGaussian::coeffs
private
const FullEnvironment& QUESO::InfiniteDimensionalGaussian::env
private

Definition at line 81 of file InfiniteDimensionalGaussian.h.

Referenced by draw().

const FunctionBase& QUESO::InfiniteDimensionalGaussian::mean
private

Definition at line 75 of file InfiniteDimensionalGaussian.h.

Referenced by draw().

const OperatorBase& QUESO::InfiniteDimensionalGaussian::precision
private

Definition at line 78 of file InfiniteDimensionalGaussian.h.

Referenced by draw(), and get_kl_coefficient().


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

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