queso-0.57.1
|
A templated (base) class for handling scalar functions. More...
#include <ScalarFunction.h>
Public Member Functions | |
void | setFiniteDifferenceStepSize (double fdStepSize) |
Sets the step size for finite differencing gradients. More... | |
void | setFiniteDifferenceStepSize (unsigned int i, double fdStepSize) |
Constructor/Destructor methods. | |
BaseScalarFunction (const char *prefix, const VectorSet< V, M > &domainSet) | |
Default constructor. More... | |
virtual | ~BaseScalarFunction () |
Destructor. More... | |
Mathematical methods. | |
const VectorSet< V, M > & | domainSet () const |
Access to the protected attribute m_domainSet: domain set of the scalar function. More... | |
Evaluation methods | |
virtual double | lnValue (const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const |
Logarithm of the value of the scalar function. Deprecated. More... | |
virtual double | lnValue (const V &domainVector) const |
Returns the logarithm of the function at domainVector . More... | |
virtual double | lnValue (const V &domainVector, V &gradVector) const |
Returns the logarithm of the function and its gradient at domainVector . More... | |
virtual double | lnValue (const V &domainVector, V &gradVector, const V &domainDirection, V &hessianEffect) const |
virtual double | actualValue (const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const =0 |
Actual value of the scalar function. More... | |
Protected Attributes | |
const BaseEnvironment & | m_env |
std::string | m_prefix |
const VectorSet< V, M > & | m_domainSet |
Domain set of the scalar function. More... | |
Private Attributes | |
ScopedPtr < BoostInputOptionsParser > ::Type | m_parser |
Input parser. More... | |
std::vector< double > | m_fdStepSize |
Finite different step size. More... | |
A templated (base) class for handling scalar functions.
This class allows the mathematical definition of a scalar function such as: \( f: B \subset R \rightarrow R \). A function of one or more variables has always one-dimensional range. PDFs (marginal, joint) and CDFs are examples of scalar functions.
Definition at line 52 of file ScalarFunction.h.
QUESO::BaseScalarFunction< V, M >::BaseScalarFunction | ( | const char * | prefix, |
const VectorSet< V, M > & | domainSet | ||
) |
Default constructor.
Instantiates an object of the class, i.e. a scalar function, given a prefix and its domain.
Definition at line 46 of file ScalarFunction.C.
References dim, QUESO::BaseEnvironment::input(), QUESO::BaseScalarFunction< V, M >::m_domainSet, QUESO::BaseScalarFunction< V, M >::m_env, QUESO::BaseScalarFunction< V, M >::m_fdStepSize, QUESO::BaseScalarFunction< V, M >::m_parser, QUESO::BaseScalarFunction< V, M >::m_prefix, and QUESO::size.
|
virtual |
|
pure virtual |
Actual value of the scalar function.
Implemented in QUESO::LikelihoodBase< V, M >, QUESO::InvLogitGaussianJointPdf< V, M >, QUESO::GammaJointPdf< V, M >, QUESO::GPMSAEmulator< V, M >, QUESO::ConcatenatedJointPdf< V, M >, QUESO::GaussianJointPdf< V, M >, QUESO::LogNormalJointPdf< V, M >, QUESO::BayesianJointPdf< V, M >, QUESO::BaseJointPdf< V, M >, QUESO::PoweredJointPdf< V, M >, QUESO::InverseGammaJointPdf< V, M >, QUESO::GenericJointPdf< V, M >, QUESO::JeffreysJointPdf< V, M >, QUESO::BetaJointPdf< V, M >, QUESO::WignerJointPdf< V, M >, QUESO::GenericScalarFunction< V, M >, QUESO::UniformJointPdf< V, M >, and QUESO::ConstantScalarFunction< V, M >.
const VectorSet< V, M > & QUESO::BaseScalarFunction< V, M >::domainSet | ( | ) | const |
Access to the protected attribute m_domainSet:
domain set of the scalar function.
Definition at line 122 of file ScalarFunction.C.
Referenced by QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem().
|
virtual |
Logarithm of the value of the scalar function. Deprecated.
Pointers will be NULL if derivative information is not required by QUESO.
Default implementation throws an exception.
Reimplemented in QUESO::InvLogitGaussianJointPdf< V, M >, QUESO::GammaJointPdf< V, M >, QUESO::GaussianJointPdf< V, M >, QUESO::ConcatenatedJointPdf< V, M >, QUESO::LogNormalJointPdf< V, M >, QUESO::PoweredJointPdf< V, M >, QUESO::JeffreysJointPdf< V, M >, QUESO::GPMSAEmulator< V, M >, QUESO::BetaJointPdf< V, M >, QUESO::InverseGammaJointPdf< V, M >, QUESO::WignerJointPdf< V, M >, QUESO::GenericScalarFunction< V, M >, QUESO::GenericJointPdf< V, M >, QUESO::UniformJointPdf< V, M >, and QUESO::ConstantScalarFunction< V, M >.
Definition at line 129 of file ScalarFunction.C.
Referenced by QUESO::LikelihoodBase< V, M >::actualValue().
|
virtual |
Returns the logarithm of the function at domainVector
.
Default implementation calls the deprecated method.
QUESO calls this method when it needs to evaluate the function but doesn't need derivative information about that function.
Reimplemented in QUESO::GaussianLikelihoodBlockDiagonalCovarianceRandomCoefficients< V, M >, QUESO::BayesianJointPdf< V, M >, QUESO::GaussianLikelihoodBlockDiagonalCovariance< V, M >, QUESO::GaussianLikelihoodFullCovarianceRandomCoefficient< V, M >, QUESO::GaussianLikelihoodFullCovariance< V, M >, QUESO::GaussianLikelihoodDiagonalCovariance< V, M >, and QUESO::GaussianLikelihoodScalarCovariance< V, M >.
Definition at line 145 of file ScalarFunction.C.
|
virtual |
Returns the logarithm of the function and its gradient at domainVector
.
Default implementation calls above method successively to fill up gradVector
with a finite difference approximation.
Note, gradVector should be filled with the gradient of the logarithm of the function, not the gradient of the function.
QUESO calls this method when it needs to evaluate the function, needs first order derivative information, but doesn't need second order derivative information.
Reimplemented in QUESO::BayesianJointPdf< V, M >.
Definition at line 152 of file ScalarFunction.C.
|
virtual |
Returns the logarithm of the function domainVector
, the gradient of the logarithm at domainVector
, and the effect of the hessian of the logarithm in the direction at domainDirection
Default implementation throws an exception because we don't expect the user to tolerate a finite difference approximation of the hessian.
Note, gradVector should be filled with the gradient of the logarithm of the function, not the gradient of the function.
The 'hessian' referred to here should be the hessian of the logarithm of the function at domainVector
.
QUESO calls this method when it needs to evaluate the function, needs first order derivative information, and also needs second-order deriative information
Definition at line 176 of file ScalarFunction.C.
void QUESO::BaseScalarFunction< V, M >::setFiniteDifferenceStepSize | ( | double | fdStepSize | ) |
Sets the step size for finite differencing gradients.
If the function is multi-dimensional then the same finite difference step size is used in every direction.
Definition at line 192 of file ScalarFunction.C.
void QUESO::BaseScalarFunction< V, M >::setFiniteDifferenceStepSize | ( | unsigned int | i, |
double | fdStepSize | ||
) |
Sets the step size for the i-th component of the finite differencing vector
i is a zero-based index.
If the function is one-dimensional, the only allowed value for i is 0.
Definition at line 204 of file ScalarFunction.C.
References QUESO::size.
|
protected |
Domain set of the scalar function.
Definition at line 158 of file ScalarFunction.h.
Referenced by QUESO::BaseScalarFunction< V, M >::BaseScalarFunction().
|
protected |
Definition at line 154 of file ScalarFunction.h.
Referenced by QUESO::BaseJointPdf< V, M >::BaseJointPdf(), QUESO::BaseScalarFunction< V, M >::BaseScalarFunction(), QUESO::BetaJointPdf< V, M >::BetaJointPdf(), QUESO::GammaJointPdf< V, M >::GammaJointPdf(), QUESO::GaussianJointPdf< V, M >::GaussianJointPdf(), QUESO::InverseGammaJointPdf< V, M >::InverseGammaJointPdf(), QUESO::JeffreysJointPdf< V, M >::JeffreysJointPdf(), QUESO::LogNormalJointPdf< V, M >::LogNormalJointPdf(), QUESO::PoweredJointPdf< V, M >::PoweredJointPdf(), QUESO::UniformJointPdf< V, M >::UniformJointPdf(), and QUESO::WignerJointPdf< V, M >::WignerJointPdf().
|
private |
Finite different step size.
Definition at line 167 of file ScalarFunction.h.
Referenced by QUESO::BaseScalarFunction< V, M >::BaseScalarFunction().
|
private |
Input parser.
Definition at line 163 of file ScalarFunction.h.
Referenced by QUESO::BaseScalarFunction< V, M >::BaseScalarFunction().
|
protected |
Definition at line 155 of file ScalarFunction.h.
Referenced by QUESO::BaseJointPdf< V, M >::BaseJointPdf(), QUESO::BaseScalarFunction< V, M >::BaseScalarFunction(), QUESO::BetaJointPdf< V, M >::BetaJointPdf(), QUESO::GammaJointPdf< V, M >::GammaJointPdf(), QUESO::GaussianJointPdf< V, M >::GaussianJointPdf(), QUESO::InverseGammaJointPdf< V, M >::InverseGammaJointPdf(), QUESO::JeffreysJointPdf< V, M >::JeffreysJointPdf(), QUESO::LogNormalJointPdf< V, M >::LogNormalJointPdf(), QUESO::PoweredJointPdf< V, M >::PoweredJointPdf(), QUESO::UniformJointPdf< V, M >::UniformJointPdf(), and QUESO::WignerJointPdf< V, M >::WignerJointPdf().