linearanalyticconditionalgaussian.cpp
Go to the documentation of this file.
1 // $Id$
2 // Copyright (C) 2003 Klaas Gadeyne <first dot last at gmail dot com>
3 // Copyright (C) 2008 Tinne De Laet <first dot last at mech dot kuleuven dot be>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 2.1 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 
21 #include "../wrappers/rng/rng.h" // Wrapper around several rng
22  // libraries
23 
24 namespace BFL
25 {
26  using namespace MatrixWrapper;
27 
28 
30  const Gaussian& additiveNoise)
31  : AnalyticConditionalGaussianAdditiveNoise(additiveNoise,ratio.size())
32  , _ratio(ratio)
33  , _mean_temp(DimensionGet())
34  , _arg(DimensionGet())
35  {
36  // Initialise ConditionalArguments to 0
37  ColumnVector arg;
38  for (unsigned int i=0; i < NumConditionalArgumentsGet() ; i++)
39  {
40  arg.resize(_ratio[i].columns());
41  arg = 0.0;
42  ConditionalArgumentSet(i,arg);
43  }
44  }
45 
46  // Only one conditional argument
48  const Gaussian& additiveNoise)
49  : AnalyticConditionalGaussianAdditiveNoise(additiveNoise,1)
50  , _mean_temp(DimensionGet())
51  , _arg(DimensionGet())
52  {
53  _ratio.resize(1);
54  _ratio[0] = a;
55  // Initialise ConditionalArguments to 0
56  ColumnVector x(a.columns()); x = 0.0;
57  ConditionalArgumentSet(0,x);
58  }
59 
61 
62  //Clone function
64  {
65  return new LinearAnalyticConditionalGaussian(*this);
66  }
67 
68  ColumnVector
70  {
71  _mean_temp = 0.0;
72  for (unsigned int i=0; i < NumConditionalArgumentsGet() ; i++)
73  {
74  _arg = ConditionalArgumentGet(i);
75  _mean_temp += (ColumnVector) (MatrixGet(i) * _arg);
76  }
77  _mean_temp += AdditiveNoiseMuGet();
78  return _mean_temp;
79  }
80 
81  Matrix
83  {
84  assert(i < NumConditionalArgumentsGet());
85  return _ratio[i];
86  }
87 
88  void
90  {
92  _ratio.resize(numconditionalarguments);
93  }
94 
95  void
96  LinearAnalyticConditionalGaussian::MatrixSet(unsigned int i, const Matrix & m)
97  {
98  assert(i < NumConditionalArgumentsGet());
99  _ratio[i] = m;
100  }
101 
102  const Matrix&
104  {
105  assert(i < NumConditionalArgumentsGet());
106  return _ratio[i];
107  }
108 
109 } // End namespace BFL
virtual MatrixWrapper::Matrix dfGet(unsigned int i) const
returns derivative from function to n-th conditional variable
virtual void NumConditionalArgumentsSet(unsigned int numconditionalarguments)
Set the Number of conditional arguments.
LinearAnalyticConditionalGaussian(const vector< MatrixWrapper::Matrix > &ratio, const Gaussian &additiveNoise)
Constructor.
void MatrixSet(unsigned int i, const MatrixWrapper::Matrix &m)
Set the i-th Matrix for calculation of .
const MatrixWrapper::Matrix & MatrixGet(unsigned int i) const
Get the i-th matrix of the system.
virtual void NumConditionalArgumentsSet(unsigned int numconditionalarguments)
Be careful: you don&#39;t want to use this one: Redefined.
virtual MatrixWrapper::ColumnVector ExpectedValueGet() const
Get the expected value E[x] of the pdf.
virtual LinearAnalyticConditionalGaussian * Clone() const
Clone function.


bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Mon Jun 10 2019 12:47:59