queso-0.56.1
JointPdf.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2015 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_JOINT_PROB_DENSITY_H
26 #define UQ_JOINT_PROB_DENSITY_H
27 
28 #include <cmath>
29 
30 #include <queso/Environment.h>
31 #include <queso/ScalarFunction.h>
32 #include <queso/BoxSubset.h>
33 #include <queso/math_macros.h>
34 
35 namespace QUESO {
36 
37 class GslVector;
38 class GslMatrix;
39 
54 template <class V = GslVector, class M = GslMatrix>
55 class BaseJointPdf : public BaseScalarFunction<V,M> {
56 public:
58 
59 
61  BaseJointPdf(const char* prefix,
62  const VectorSet<V,M>& domainSet);
64  virtual ~BaseJointPdf();
66 
68 
69  virtual double actualValue (const V& domainVector, const V* domainDirection, V* gradVector, M* hessianMatrix, V* hessianEffect) const = 0;
71 
73  virtual double lnValue (const V& domainVector, const V* domainDirection, V* gradVector, M* hessianMatrix, V* hessianEffect) const = 0;
74 
79  virtual void distributionMean (V & meanVector) const;
80 
85  virtual void distributionVariance (M & covMatrix) const;
86 
89 
97  virtual void setNormalizationStyle (unsigned int value) const;
98 
100  void setLogOfNormalizationFactor (double value) const;
101 
103  virtual double computeLogOfNormalizationFactor(unsigned int numSamples, bool m_logOfNormalizationFactor) const = 0;
104 
106  virtual void print(std::ostream & os) const;
107 
108  //const BaseScalarPdf<double>& component(unsigned int componentId) const;
110 protected:
112 
116  double commonComputeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const;
117 
121 
124  mutable unsigned int m_normalizationStyle;
126 
127 //std::vector<BaseScalarPdf<double>*> m_components; // FIXME: will need to be a parallel vector in case of a very large number of components
128 //BaseScalarPdf<double> m_dummyComponent;
129 };
130 
131 template <class V, class M>
132 std::ostream & operator<<(std::ostream & os, const BaseJointPdf<V, M> & obj)
133 {
134  obj.print(os);
135  return os;
136 }
137 
138 } // End namespace QUESO
139 
140 #endif // UQ_JOINT_PROB_DENSITY_H
A templated (base) class for handling scalar functions.
virtual void distributionMean(V &meanVector) const
Definition: JointPdf.C:62
void setLogOfNormalizationFactor(double value) const
Sets a logarithmic value to be used in the normalization factor (stored in the protected attribute m_...
Definition: JointPdf.C:86
virtual void print(std::ostream &os) const
Print method. Non-pure for backwards compatibility.
Definition: JointPdf.C:94
virtual ~BaseJointPdf()
Destructor.
Definition: JointPdf.C:55
A templated (base) class for handling joint PDFs.
Definition: JointPdf.h:55
BaseJointPdf(const char *prefix, const VectorSet< V, M > &domainSet)
Default constructor.
Definition: JointPdf.C:33
virtual void distributionVariance(M &covMatrix) const
Definition: JointPdf.C:70
A templated class for handling sets.
Definition: VectorSet.h:52
unsigned int m_normalizationStyle
Definition: JointPdf.h:124
double commonComputeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const
Common method (to the derived classes) to compute the logarithm of the normalization factor...
Definition: JointPdf.C:115
double m_logOfNormalizationFactor
Definition: JointPdf.h:125
virtual double lnValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const =0
Logarithm of the value of the function.
virtual double actualValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const =0
Actual value of the PDF (scalar function).
const VectorSet< V, M > & domainSet() const
Access to the protected attribute m_domainSet: domain set of the scalar function. ...
virtual void setNormalizationStyle(unsigned int value) const
Definition: JointPdf.C:78
virtual double computeLogOfNormalizationFactor(unsigned int numSamples, bool m_logOfNormalizationFactor) const =0
Computes the logarithm of the normalization factor. See template specialization.

Generated on Thu Dec 15 2016 13:23:11 for queso-0.56.1 by  doxygen 1.8.5