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

Generated on Thu Apr 23 2015 19:18:34 for queso-0.50.1 by  doxygen 1.8.5