queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
InverseGammaVectorRV.C
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 #include <queso/InverseGammaVectorRV.h>
26 #include <queso/InverseGammaVectorRealizer.h>
27 #include <queso/InverseGammaJointPdf.h>
28 #include <queso/GslVector.h>
29 #include <queso/GslMatrix.h>
30 
31 namespace QUESO {
32 
33 // Constructor---------------------------------------
34 template<class V, class M>
36  const char* prefix,
37  const VectorSet<V,M>& imageSet,
38  const V& alpha,
39  const V& beta)
40  :
41  BaseVectorRV<V,M>(((std::string)(prefix)+"uni").c_str(),imageSet)
42 {
43  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
44  *m_env.subDisplayFile() << "Entering InverseGammaVectorRV<V,M>::constructor()"
45  << ": prefix = " << m_prefix
46  << std::endl;
47  }
48 
49 // begin kemelli 2013-April-22 --------------------------
50 // InverseGamma dist is defined only in (0,inf)
51  const BoxSubset<V,M>* imageBox = dynamic_cast<const BoxSubset<V,M>* >(&imageSet);
52  double smallerOfMaxValues = imageBox->maxValues().getMinValue();
53  double smallerOfMinValues = imageBox->minValues().getMinValue();
54 
55  if( smallerOfMinValues < 0 )
56  {
57  std::cerr << "In InverseGammaVectorRV<V,M>::constructor()\n"
58  << "Inverse Gamma distribution is only defined in (0, infinity).\n"
59  << "The data provided is: \n"
60  << *imageBox
61  << "Sampling will not cover all interval.\n"
62  << std::endl;
63 
64  queso_require_greater_equal_msg(smallerOfMaxValues, 0, "invalid input: Inverse Gamma distribution is only defined in (0, infinity), and min(m_maxValues)<0");
65  }
66 // end kemelli 2013-April-22 --------------------------
67 
69  m_imageSet,
70  alpha,
71  beta);
73  m_imageSet,
74  alpha,
75  beta);
76  m_subCdf = NULL; // FIX ME: complete code
77  m_unifiedCdf = NULL; // FIX ME: complete code
78  m_mdf = NULL; // FIX ME: complete code
79 
80  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
81  *m_env.subDisplayFile() << "Leaving InverseGammaVectorRV<V,M>::constructor()"
82  << ": prefix = " << m_prefix
83  << std::endl;
84  }
85 }
86 // Destructor ---------------------------------------
87 template<class V, class M>
89 {
90  delete m_mdf;
91  delete m_unifiedCdf;
92  delete m_subCdf;
93  delete m_realizer;
94  delete m_pdf;
95 }
96 // I/O methods---------------------------------------
97 template <class V, class M>
98 void
99 InverseGammaVectorRV<V,M>::print(std::ostream& os) const
100 {
101  os << "InverseGammaVectorRV<V,M>::print() says, 'Please implement me.'" << std::endl;
102  return;
103 }
104 
105 } // End namespace QUESO
106 
std::string m_prefix
Definition: VectorRV.h:118
const BaseVectorCdf< V, M > * m_unifiedCdf
Definition: VectorRV.h:123
A class for handling sampling from an Inverse Gamma probability density distribution.
virtual ~InverseGammaVectorRV()
Virtual destructor.
const BaseEnvironment & m_env
Definition: VectorRV.h:117
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
Definition: VectorRV.C:83
A templated class for handling sets.
Definition: VectorSet.h:52
BaseVectorRealizer< V, M > * m_realizer
Definition: VectorRV.h:121
const V & minValues() const
Vector of the minimum values of the box subset.
Definition: BoxSubset.C:95
Class representing a subset of a vector space shaped like a hypercube.
Definition: BoxSubset.h:44
A class for handling Inverse Gamma joint PDFs.
void print(std::ostream &os) const
TODO: Prints the vector RV.
BaseJointPdf< V, M > * m_pdf
Definition: VectorRV.h:120
A templated base class for handling vector RV.
Definition: VectorRV.h:53
const BaseVectorCdf< V, M > * m_subCdf
Definition: VectorRV.h:122
unsigned int displayVerbosity() const
Definition: Environment.C:450
const V & maxValues() const
Vector of the maximum values of the box subset.
Definition: BoxSubset.C:101
const VectorSet< V, M > & m_imageSet
Definition: VectorRV.h:119
const BaseVectorMdf< V, M > * m_mdf
Definition: VectorRV.h:124
InverseGammaVectorRV(const char *prefix, const VectorSet< V, M > &imageSet, const V &alpha, const V &beta)
Default Constructor.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
A class representing a vector RV constructed via Inverse Gamma distribution.

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