00001 // $Id: conditionalgaussian.h 29890 2009-02-02 10:22:01Z tdelaet $ 00002 // Copyright (C) 2002 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 #ifndef __CONDITIONAL_GAUSSIAN__ 00021 #define __CONDITIONAL_GAUSSIAN__ 00022 00023 #include "conditionalpdf.h" 00024 00025 namespace BFL 00026 { 00028 00040 class ConditionalGaussian : public ConditionalPdf<MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector> 00041 { 00042 public: 00044 00049 ConditionalGaussian(int dim = 0, int num_conditional_arguments=0); 00050 00051 // Default Copy constructor will do 00052 00054 virtual ~ConditionalGaussian(); 00055 00057 virtual ConditionalGaussian* Clone() const; 00058 00059 // implemented virtuals! 00060 virtual Probability ProbabilityGet(const MatrixWrapper::ColumnVector& input) const; 00061 virtual bool SampleFrom (Sample<MatrixWrapper::ColumnVector>& sample, int method=DEFAULT, void * args=NULL) const; 00062 virtual bool SampleFrom (std::vector<Sample<MatrixWrapper::ColumnVector> >& samples, const int num_samples, 00063 int method=DEFAULT, void * args=NULL) const; 00064 00065 protected: 00066 // variables to avoid allocation on the heap during sampling 00067 mutable ColumnVector _diff; 00068 mutable ColumnVector _Mu; 00069 mutable Matrix _Low_triangle; 00070 mutable ColumnVector _samples; 00071 mutable ColumnVector _SampleValue; 00072 00073 }; 00074 00075 } // End namespace BFL 00076 00077 #endif // __CONDITIONAL_GAUSSIAN__ 00078