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_INVGAMMA_REALIZER_H 26 #define UQ_INVGAMMA_REALIZER_H 27 28 #include <queso/VectorRealizer.h> 29 #include <queso/VectorSequence.h> 30 #include <queso/Environment.h> 31 #include <math.h> 32 33 namespace QUESO { 34 35 class GslVector; 36 class GslMatrix; 37 38 //***************************************************** 39 // InverseGamma class [R-07] 40 //***************************************************** 41 /*! 42 * \class InverseGammaVectorRealizer 43 * \brief A class for handling sampling from an Inverse Gamma probability density distribution. 44 * 45 * This class handles sampling from an Inverse Gamma probability density distribution, of 46 * parameters \c alpha and \c beta.*/ 47 48 template <class V = GslVector, class M = GslMatrix> 49 class InverseGammaVectorRealizer : public BaseVectorRealizer<V,M> { 50 public: 51 //! @name Constructor/Destructor methods 52 //@{ 53 //! Constructor 54 /*! Constructs a new object, given a prefix, the image set of the vector realizer, and the 55 * Beta distribution parameters \c a and \c b, which are assigned to private attributes 56 * m_alpha and m_beta. */ 57 InverseGammaVectorRealizer(const char* prefix, 58 const VectorSet<V,M>& unifiedImageSet, 59 const V& alpha, 60 const V& beta); 61 //! Destructor 62 ~InverseGammaVectorRealizer(); 63 //@} 64 65 //! @name Realization-related methods 66 //@{ 67 //! Draws a realization. 68 /*! This function draws a realization of an Inverse Gamma distribution and saves it in \c nextValues. 69 * It internally checks whether the image set, where the realization should be drawn, belongs 70 * to the interval (0, infinity) - which is the range where Gamma distribution is defined over. */ 71 void realization(V& nextValues) const; 72 //@} 73 74 private: 75 using BaseVectorRealizer<V,M>::m_env; 76 using BaseVectorRealizer<V,M>::m_prefix; 77 using BaseVectorRealizer<V,M>::m_unifiedImageSet; 78 using BaseVectorRealizer<V,M>::m_subPeriod; 79 80 V m_alpha; 81 V m_beta; 82 }; 83 84 } // End namespace QUESO 85 86 #endif // UQ_INVGAMMA_REALIZER_H 87