/** 
* @file MAPMultinomialGaussianPrior.h
* @brief MAP estimation of multinomial with gaussian prior
* @author Erik Rodner
* @date 05/26/2008

*/
#ifndef MAPMULTINOMIALGAUSSIANPRIORINCLUDE
#define MAPMULTINOMIALGAUSSIANPRIORINCLUDE

#include "core/image/ImageT.h"
#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"
  
#include <set>

#include "vislearning/cbaselib/LabeledSet.h"
#include "core/vector/VVector.h"

#include "MAPEstimation.h"


namespace OBJREC {

/** MAP estimation of multinomial with gaussian prior */
class MAPMultinomialGaussianPrior : public MAPEstimation
{

    protected:
	// refactor-nice.pl: check this substitution
	// old: double estimateLambda ( const Vector & counts, 
	double estimateLambda ( const NICE::Vector & counts, 
				// refactor-nice.pl: check this substitution
				// old: const Vector & mu, 
				const NICE::Vector & mu, 
				double sigmaq );

	double estimateLambdaNonLinear 
			      // refactor-nice.pl: check this substitution
			      // old: ( const Vector & counts, 
			      ( const NICE::Vector & counts, 
				// refactor-nice.pl: check this substitution
				// old: const Vector & mu, 
				const NICE::Vector & mu, 
				double sigmaq );

		// refactor-nice.pl: check this substitution
		// old: double objective ( const Vector & theta,
		double objective ( const NICE::Vector & theta,
		 // refactor-nice.pl: check this substitution
		 // old: const Vector & counts, 
		 const NICE::Vector & counts, 
		 // refactor-nice.pl: check this substitution
		 // old: const Vector & mu, 
		 const NICE::Vector & mu, 
		 double sigmaq );
    
    public:
  
	/** simple constructor */
	MAPMultinomialGaussianPrior();
      
	/** simple destructor */
	virtual ~MAPMultinomialGaussianPrior();
	
	
	// refactor-nice.pl: check this substitution
	// old: static void normalizeProb ( Vector & x );
	static void normalizeProb ( NICE::Vector & x );
 
	// refactor-nice.pl: check this substitution
	// old: void estimate ( Vector & theta, 
	void estimate ( NICE::Vector & theta, 
			// refactor-nice.pl: check this substitution
			// old: const Vector & counts, 
			const NICE::Vector & counts, 
			// refactor-nice.pl: check this substitution
			// old: const Vector & mu, 
			const NICE::Vector & mu, 
			double sigmaq );

	// refactor-nice.pl: check this substitution
	// old: void estimate (	 Vector & mapEstimate,
	void estimate (	 NICE::Vector & mapEstimate,
			 const NICE::VVector & likelihoodDistributionSamples,
			 const NICE::VVector & priorDistributionSamples,
			 double sigmaq );
};


} // namespace

#endif