optimal_importance_density.cpp
Go to the documentation of this file.
00001 // $Id: optimal_importance_density.cpp 29495 2008-08-13 12:57:49Z tdelaet $
00002 // Copyright (C) 2003 Klaas Gadeyne <first dot last at gmail dot com>
00003 //
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU Lesser General Public License as published by
00006 // the Free Software Foundation; either version 2.1 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 //
00018 
00019 #include "optimal_importance_density.h"
00020 #include "../wrappers/rng/rng.h" // Wrapper around several rng
00021                                  // libraries
00022 
00023 namespace BFL
00024 {
00025 #define OptImpDensity OptimalImportanceDensity
00026 
00027   OptImpDensity::OptImpDensity(AnalyticConditionalGaussian * SystemPdf,
00028                                LinearAnalyticConditionalGaussian * MeasPdf)
00029     : AnalyticConditionalGaussian(SystemPdf->DimensionGet(),
00030                           SystemPdf->NumConditionalArgumentsGet()
00031                           + MeasPdf->NumConditionalArgumentsGet()),
00032       _SystemPdf(SystemPdf),
00033       _MeasPdf(MeasPdf)
00034   {
00035     Matrix tmp((SystemPdf->DimensionGet()),(SystemPdf->DimensionGet()));
00036     tmp = (SystemPdf->AdditiveNoiseSigmaGet().inverse()
00037            + ( MeasPdf->MatrixGet(0).transpose() * (Matrix) (MeasPdf->AdditiveNoiseSigmaGet().inverse()) * MeasPdf->MatrixGet(0) )).inverse();
00038     tmp.convertToSymmetricMatrix(this->_additiveNoise_Sigma);
00039     this->_additiveNoise_Mu = 0.0;
00040   }
00041 
00042   OptImpDensity::~OptImpDensity(){};
00043 
00044   ColumnVector
00045   OptImpDensity::ExpectedValueGet() const
00046   {
00047     ColumnVector mean(DimensionGet()); mean = 0.0;
00048     ColumnVector arg;
00049     for (int i=0; i < NumConditionalArgumentsGet() ; i++)
00050       {
00051         arg = ConditionalArgumentGet(i);
00052         mean += (ColumnVector) (this->MatrixGet(i) * arg);
00053       }
00054     mean += AdditiveNoiseMuGet();
00055     return mean;
00056   }
00057 
00058   SymmetricMatrix
00059   OptImpDensity::CovarianceGet() const
00060   {
00061     return AdditiveNoiseSigmaGet();
00062   }
00063 
00064   Matrix
00065   OptImpDensity::dfGet(int i) const
00066   {
00067     assert(i < NumConditionalArgumentsGet() && i >= 0);
00068     return _ratio[i];
00069   }
00070 
00071   void
00072   OptImpDensity::NumConditionalArgumentsSet(int numconditionalarguments)
00073   {
00074     cerr << "You probably don't want to use this one, do you?" << endl;
00075   }
00076 
00077   void
00078   OptImpDensity::MatrixSet(int i, const Matrix & m)
00079   {
00080     assert(i < NumConditionalArgumentsGet());
00081     _ratio[i] = m;
00082   }
00083 
00084   const Matrix&
00085   OptImpDensity::MatrixGet(int i) const
00086   {
00087     assert(i < NumConditionalArgumentsGet());
00088     return _ratio[i];
00089   }
00090 
00091 } // End namespace BFL


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 Thu Feb 11 2016 22:31:57