queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
TransitionKernelFactory.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 QUESO_TK_FACTORY_H
26 #define QUESO_TK_FACTORY_H
27 
28 #include <queso/Factory.h>
29 #include <queso/GslVector.h>
30 #include <queso/GslMatrix.h>
31 #include <queso/VectorSpace.h>
32 #include <queso/TKGroup.h>
33 #include <queso/MetropolisHastingsSGOptions.h>
34 
35 namespace QUESO
36 {
37 
41 class TransitionKernelFactory : public Factory<BaseTKGroup<GslVector, GslMatrix> >
42 {
43 public:
47  TransitionKernelFactory(const std::string & name)
49  {}
50 
55 
60  {
61  m_vectorSpace = &v;
62  }
63 
68  static void set_dr_scales(const std::vector<double> & scales)
69  {
70  m_dr_scales = &scales;
71  }
72 
77  {
78  m_pdf_synchronizer = &synchronizer;
79  }
80 
84  static void set_initial_cov_matrix(GslMatrix & cov_matrix)
85  {
86  m_initial_cov_matrix = &cov_matrix;
87  }
88 
93  static void set_options(const MhOptionsValues & options)
94  {
95  m_options = &options;
96  }
97 
101  static void set_target_pdf(const BaseJointPdf<GslVector, GslMatrix> & target_pdf)
102  {
103  m_target_pdf = &target_pdf;
104  }
105 
106 protected:
108 
110  static const std::vector<double> * m_dr_scales;
113  static const MhOptionsValues * m_options;
115 
116 private:
122 };
123 
124 inline
126 {
127  queso_require_msg(m_vectorSpace, "ERROR: must call set_vectorspace() before building tk!");
128  queso_require_msg(m_dr_scales, "ERROR: must call set_dr_scales() before building tk!");
129  queso_require_msg(m_pdf_synchronizer, "ERROR: must call set_pdf_synchronizer() before building tk!");
130  queso_require_msg(m_initial_cov_matrix, "ERROR: must call set_initial_cov_matrix() before building tk!");
131  queso_require_msg(m_options, "ERROR: must call set_options() before building tk!");
132  queso_require_msg(m_target_pdf, "ERROR: must call set_target_pdf() before building tk!");
133 
134  SharedPtr<BaseTKGroup<GslVector, GslMatrix> >::Type new_tk = this->build_tk();
135 
136  queso_assert(new_tk);
137 
138  return new_tk;
139 }
140 
141 } // namespace QUESO
142 
143 #endif // QUESO_TK_FACTORY_H
A templated class for synchronizing the calls of scalar functions (BaseScalarFunction and derived cla...
A class representing a vector space.
Definition: VectorSet.h:49
virtual SharedPtr< BaseTKGroup< GslVector, GslMatrix > >::Type build_tk()=0
TransitionKernelFactory(const std::string &name)
static const BaseJointPdf< GslVector, GslMatrix > * m_target_pdf
static void set_pdf_synchronizer(const ScalarFunctionSynchronizer< GslVector, GslMatrix > &synchronizer)
static void set_vectorspace(const VectorSpace< GslVector, GslMatrix > &v)
Class for matrix operations using GSL library.
Definition: GslMatrix.h:49
static void set_target_pdf(const BaseJointPdf< GslVector, GslMatrix > &target_pdf)
static void set_options(const MhOptionsValues &options)
static const MhOptionsValues * m_options
This class provides options for the Metropolis-Hastings generator of samples if no input file is avai...
A templated (base) class for handling joint PDFs.
Definition: JointPdf.h:55
Class for vector operations using GSL library.
Definition: GslVector.h:49
static const ScalarFunctionSynchronizer< GslVector, GslMatrix > * m_pdf_synchronizer
This base class allows the representation of a transition kernel.
Definition: Algorithm.h:32
static const VectorSpace< GslVector, GslMatrix > * m_vectorSpace
static void set_dr_scales(const std::vector< double > &scales)
static const std::vector< double > * m_dr_scales
static void set_initial_cov_matrix(GslMatrix &cov_matrix)
virtual SharedPtr< BaseTKGroup< GslVector, GslMatrix > >::Type create()

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