linearanalyticconditionalgaussian.cpp
Go to the documentation of this file.
00001 // $Id$
00002 // Copyright (C) 2003 Klaas Gadeyne <first dot last at gmail dot com>
00003 // Copyright (C) 2008 Tinne De Laet <first dot last at mech dot kuleuven dot be>
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU Lesser General Public License as published by
00007 // the Free Software Foundation; either version 2.1 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 //
00019 
00020 #include "linearanalyticconditionalgaussian.h"
00021 #include "../wrappers/rng/rng.h" // Wrapper around several rng
00022                                  // libraries
00023 
00024 namespace BFL
00025 {
00026   using namespace MatrixWrapper;
00027 
00028 
00029   LinearAnalyticConditionalGaussian::LinearAnalyticConditionalGaussian(const vector<Matrix> & ratio,
00030                                                        const Gaussian& additiveNoise)
00031     : AnalyticConditionalGaussianAdditiveNoise(additiveNoise,ratio.size())
00032     , _ratio(ratio)
00033     , _mean_temp(DimensionGet())
00034     , _arg(DimensionGet())
00035   {
00036     // Initialise ConditionalArguments to 0
00037     ColumnVector arg;
00038     for (unsigned int i=0; i < NumConditionalArgumentsGet() ; i++)
00039       {
00040         arg.resize(_ratio[i].columns());
00041         arg = 0.0;
00042         ConditionalArgumentSet(i,arg);
00043       }
00044   }
00045 
00046   // Only one conditional argument
00047   LinearAnalyticConditionalGaussian::LinearAnalyticConditionalGaussian(const Matrix& a,
00048                                                        const Gaussian& additiveNoise)
00049     : AnalyticConditionalGaussianAdditiveNoise(additiveNoise,1)
00050     , _mean_temp(DimensionGet())
00051     , _arg(DimensionGet())
00052   {
00053     _ratio.resize(1);
00054     _ratio[0] = a;
00055     // Initialise ConditionalArguments to 0
00056     ColumnVector x(a.columns()); x = 0.0;
00057     ConditionalArgumentSet(0,x);
00058   }
00059 
00060   LinearAnalyticConditionalGaussian::~LinearAnalyticConditionalGaussian(){}
00061 
00062   //Clone function
00063   LinearAnalyticConditionalGaussian* LinearAnalyticConditionalGaussian::Clone() const
00064   {     
00065       return new LinearAnalyticConditionalGaussian(*this);
00066   }
00067 
00068   ColumnVector
00069   LinearAnalyticConditionalGaussian::ExpectedValueGet() const
00070   {
00071     _mean_temp = 0.0;
00072     for (unsigned int i=0; i < NumConditionalArgumentsGet() ; i++)
00073       {
00074         _arg = ConditionalArgumentGet(i);
00075         _mean_temp += (ColumnVector) (MatrixGet(i) * _arg);
00076       }
00077     _mean_temp += AdditiveNoiseMuGet();
00078     return _mean_temp;
00079   }
00080 
00081   Matrix
00082   LinearAnalyticConditionalGaussian::dfGet(unsigned int i) const
00083   {
00084     assert(i < NumConditionalArgumentsGet());
00085     return _ratio[i];
00086   }
00087 
00088   void
00089   LinearAnalyticConditionalGaussian::NumConditionalArgumentsSet(unsigned int numconditionalarguments)
00090   {
00091     ConditionalPdf<ColumnVector,ColumnVector>::NumConditionalArgumentsSet(numconditionalarguments);
00092     _ratio.resize(numconditionalarguments);
00093   }
00094 
00095   void
00096   LinearAnalyticConditionalGaussian::MatrixSet(unsigned int i, const Matrix & m)
00097   {
00098     assert(i < NumConditionalArgumentsGet());
00099     _ratio[i] = m;
00100   }
00101 
00102   const Matrix&
00103   LinearAnalyticConditionalGaussian::MatrixGet(unsigned int i) const
00104   {
00105     assert(i < NumConditionalArgumentsGet());
00106     return _ratio[i];
00107   }
00108 
00109 } // 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 Mon Feb 11 2019 03:45:12