contrib/brl/bbas/bsta/bsta_gaussian.h
Go to the documentation of this file.
00001 // This is brl/bbas/bsta/bsta_gaussian.h
00002 #ifndef bsta_gaussian_h_
00003 #define bsta_gaussian_h_
00004 //:
00005 // \file
00006 // \brief A Gaussian distribution for use in a mixture model
00007 // \author Matt Leotta (mleotta@lems.brown.edu)
00008 // \date January 25, 2006
00009 //
00010 // \verbatim
00011 //  Modifications
00012 //   (none yet)
00013 // \endverbatim
00014 
00015 #include "bsta_distribution.h"
00016 #include <vnl/vnl_math.h>
00017 
00018 //: forward declare vnl_vector_fixed
00019 template<class T, unsigned n> class vnl_vector_fixed;
00020 
00021 
00022 template<unsigned n>
00023 struct two_pi_power
00024 {
00025   static inline double value()
00026   { return 2.0*vnl_math::pi*two_pi_power<n-1>::value(); }
00027 };
00028 
00029 VCL_DEFINE_SPECIALIZATION
00030 struct two_pi_power<0>
00031 {
00032   static inline double value() { return 1.0; }
00033 };
00034 
00035 
00036 //: A Gaussian distribution
00037 // used as a component of the mixture
00038 template <class T, unsigned n>
00039 class bsta_gaussian : public bsta_distribution<T,n>
00040 {
00041   typedef typename bsta_distribution<T,n>::vector_type vector_;
00042 
00043  public:
00044 
00045   //: The mean of the distribution
00046   const vector_& mean() const { return mean_; }
00047 
00048   //: Set the mean of the distribution
00049   void set_mean(const vector_& mean) { mean_ = mean; }
00050 
00051  protected:
00052   bsta_gaussian() : mean_(T(0)) {}
00053   bsta_gaussian(const vector_& mean) : mean_(mean) {}
00054 
00055   //: The mean
00056   vector_ mean_;
00057 };
00058 
00059 #endif // bsta_gaussian_h_