queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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-2017 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 
76  virtual void distributionMean (V & meanVector) const;
77 
82  virtual void distributionVariance (M & covMatrix) const;
83 
86 
94  virtual void setNormalizationStyle (unsigned int value) const;
95 
97  void setLogOfNormalizationFactor (double value) const;
98 
100  virtual double computeLogOfNormalizationFactor(unsigned int numSamples, bool m_logOfNormalizationFactor) const = 0;
101 
103  virtual void print(std::ostream & os) const;
104 
105  //const BaseScalarPdf<double>& component(unsigned int componentId) const;
107 protected:
109 
113  double commonComputeLogOfNormalizationFactor(unsigned int numSamples, bool updateFactorInternally) const;
114 
118 
121  mutable unsigned int m_normalizationStyle;
123 
124 //std::vector<BaseScalarPdf<double>*> m_components; // FIXME: will need to be a parallel vector in case of a very large number of components
125 //BaseScalarPdf<double> m_dummyComponent;
126 };
127 
128 template <class V, class M>
129 std::ostream & operator<<(std::ostream & os, const BaseJointPdf<V, M> & obj)
130 {
131  obj.print(os);
132  return os;
133 }
134 
135 } // End namespace QUESO
136 
137 #endif // UQ_JOINT_PROB_DENSITY_H
A templated (base) class for handling scalar functions.
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 setNormalizationStyle(unsigned int value) const
Definition: JointPdf.C:78
virtual ~BaseJointPdf()
Destructor.
Definition: JointPdf.C:55
double m_logOfNormalizationFactor
Definition: JointPdf.h:122
A templated class for handling sets.
Definition: VectorSet.h:52
BaseJointPdf(const char *prefix, const VectorSet< V, M > &domainSet)
Default constructor.
Definition: JointPdf.C:33
const VectorSet< V, M > & domainSet() const
Access to the protected attribute m_domainSet: domain set of the scalar function. ...
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
A templated (base) class for handling joint PDFs.
Definition: JointPdf.h:55
virtual double actualValue(const V &domainVector, const V *domainDirection, V *gradVector, M *hessianMatrix, V *hessianEffect) const =0
Actual value of the PDF (scalar function).
virtual void print(std::ostream &os) const
Print method. Non-pure for backwards compatibility.
Definition: JointPdf.C:94
virtual void distributionVariance(M &covMatrix) const
Definition: JointPdf.C:70
virtual double computeLogOfNormalizationFactor(unsigned int numSamples, bool m_logOfNormalizationFactor) const =0
Computes the logarithm of the normalization factor. See template specialization.
unsigned int m_normalizationStyle
Definition: JointPdf.h:121
virtual void distributionMean(V &meanVector) const
Definition: JointPdf.C:62

Generated on Tue Jun 5 2018 19:48:55 for queso-0.57.1 by  doxygen 1.8.5