optimal_importance_density.cpp
Go to the documentation of this file.
1 // $Id$
2 // Copyright (C) 2003 Klaas Gadeyne <first dot last at gmail dot com>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation; either version 2.1 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
20 #include "../wrappers/rng/rng.h" // Wrapper around several rng
21  // libraries
22 
23 namespace BFL
24 {
25 #define OptImpDensity OptimalImportanceDensity
26 
27  OptImpDensity::OptImpDensity(AnalyticConditionalGaussian * SystemPdf,
28  LinearAnalyticConditionalGaussian * MeasPdf)
29  : AnalyticConditionalGaussian(SystemPdf->DimensionGet(),
30  SystemPdf->NumConditionalArgumentsGet()
31  + MeasPdf->NumConditionalArgumentsGet()),
32  _SystemPdf(SystemPdf),
33  _MeasPdf(MeasPdf)
34  {
35  Matrix tmp((SystemPdf->DimensionGet()),(SystemPdf->DimensionGet()));
36  tmp = (SystemPdf->AdditiveNoiseSigmaGet().inverse()
37  + ( MeasPdf->MatrixGet(0).transpose() * (Matrix) (MeasPdf->AdditiveNoiseSigmaGet().inverse()) * MeasPdf->MatrixGet(0) )).inverse();
38  tmp.convertToSymmetricMatrix(this->_additiveNoise_Sigma);
39  this->_additiveNoise_Mu = 0.0;
40  }
41 
42  OptImpDensity::~OptImpDensity(){};
43 
44  ColumnVector
45  OptImpDensity::ExpectedValueGet() const
46  {
47  ColumnVector mean(DimensionGet()); mean = 0.0;
48  ColumnVector arg;
49  for (int i=0; i < NumConditionalArgumentsGet() ; i++)
50  {
51  arg = ConditionalArgumentGet(i);
52  mean += (ColumnVector) (this->MatrixGet(i) * arg);
53  }
54  mean += AdditiveNoiseMuGet();
55  return mean;
56  }
57 
58  SymmetricMatrix
59  OptImpDensity::CovarianceGet() const
60  {
61  return AdditiveNoiseSigmaGet();
62  }
63 
64  Matrix
65  OptImpDensity::dfGet(int i) const
66  {
67  assert(i < NumConditionalArgumentsGet() && i >= 0);
68  return _ratio[i];
69  }
70 
71  void
72  OptImpDensity::NumConditionalArgumentsSet(int numconditionalarguments)
73  {
74  cerr << "You probably don't want to use this one, do you?" << endl;
75  }
76 
77  void
78  OptImpDensity::MatrixSet(int i, const Matrix & m)
79  {
80  assert(i < NumConditionalArgumentsGet());
81  _ratio[i] = m;
82  }
83 
84  const Matrix&
85  OptImpDensity::MatrixGet(int i) const
86  {
87  assert(i < NumConditionalArgumentsGet());
88  return _ratio[i];
89  }
90 
91 } // End namespace BFL
#define OptImpDensity


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 Feb 28 2022 21:56:33