queso-0.53.0
MarkovChainPositionData.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-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 #include <queso/MarkovChainPositionData.h>
26 #include <queso/GslVector.h>
27 
28 namespace QUESO {
29 
30 // Constructor 1 -----------------------------------
31 template <class V>
33  :
34  m_env (env),
35  m_vecValues (NULL),
36  m_outOfTargetSupport(false),
37  m_logLikelihood (0.),
38  m_logTarget (0.)
39 {
40 }
41 // Constructor 2 -----------------------------------
42 template <class V>
44  const BaseEnvironment& env,
45  const V& vecValues,
46  bool outOfTargetSupport,
47  double logLikelihood,
48  double logTarget)
49  :
50  m_env (env),
51  m_vecValues (new V(vecValues)),
52  m_outOfTargetSupport(outOfTargetSupport),
53  m_logLikelihood (logLikelihood),
54  m_logTarget (logTarget)
55 {
56 }
57 // Copy constructor---------------------------------
58 template <class V>
60  :
61  m_env (rhs.m_env ),
62  m_vecValues (new V(*rhs.m_vecValues )),
63  m_outOfTargetSupport(rhs.m_outOfTargetSupport),
64  m_logLikelihood (rhs.m_logLikelihood ),
65  m_logTarget (rhs.m_logTarget )
66 {
67 }
68 // Destructor---------------------------------------
69 template <class V>
71 {
72  if (m_vecValues) delete m_vecValues;
73 }
74 // Set methods--------------------------------------
75 template <class V>
78 {
79  if (m_vecValues == NULL) m_vecValues = new V(*rhs.m_vecValues);
80  else *m_vecValues = *rhs.m_vecValues;
81  m_outOfTargetSupport = rhs.m_outOfTargetSupport;
82  m_logLikelihood = rhs.m_logLikelihood;
83  m_logTarget = rhs.m_logTarget;
84 
85  return *this;
86 }
87 
88 // Statistical methods-------------------------------
89 template <class V>
90 const V&
92 {
93  queso_require_msg(m_vecValues, "m_vecValues is NULL");
94  return *m_vecValues;
95 }
96 
97 //--------------------------------------------------
98 template <class V>
99 bool
101 {
102  return m_outOfTargetSupport;
103 }
104 
105 //--------------------------------------------------
106 template <class V>
107 double
109 {
110  return m_logLikelihood;
111 }
112 
113 //--------------------------------------------------
114 template <class V>
115 double
117 {
118  return m_logTarget;
119 }
120 //--------------------------------------------------
121 template <class V>
122 void
124  const V& vecValues,
125  bool outOfTargetSupport,
126  double logLikelihood,
127  double logTarget)
128 {
129  if (m_vecValues == NULL) m_vecValues = new V(vecValues);
130  else *m_vecValues = vecValues;
131  m_outOfTargetSupport = outOfTargetSupport;
132  m_logLikelihood = logLikelihood;
133  m_logTarget = logTarget;
134 
135  return;
136 }
137 
138 } // End namespace QUESO
139 
double logTarget() const
Logarithm of the value of the target; access to private attribute m_logTarget.
const V & vecValues() const
Values of the chain (vector); access to private attribute m_vecValues.
A templated class that represents a Markov Chain.
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:193
void set(const V &vecValues, bool outOfTargetSupport, double logLikelihood, double logTarget)
Sets the values of the chain.
MarkovChainPositionData< V > & operator=(const MarkovChainPositionData< V > &rhs)
Assignment operator.
bool outOfTargetSupport() const
Whether or not a position is out of target support; access to private attribute m_outOfTargetSupport...
double logLikelihood() const
Logarithm of the value of the likelihood; access to private attribute m_logLikelihood.
MarkovChainPositionData(const BaseEnvironment &env)
Constructor 1.

Generated on Thu Jun 11 2015 13:52:32 for queso-0.53.0 by  doxygen 1.8.5