/** 
 * @file VectorStatistics.h
 * @brief B. P. Welford Computation of Mean and Variance download at: http://www.johndcook.com/standard_deviation.html
 * @author Michael Koch
 * @date 18/02/2009
 */
#ifndef VectorStatisticsINCLUDE
#define VectorStatisticsINCLUDE

#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"
namespace OBJREC
{

/** @brief online statistics */
class VectorStatistics
{
public:

	VectorStatistics(const NICE::Vector &data,bool compute=true);

	~VectorStatistics();

	void calculateStatistics();
	void initVariables();
	void setData(const NICE::Vector &data);

	void setMean();
	void setMedian();
	void setVariance();
	void setSkewness();
	void setKurtosis();
	void setEntropy();
	void setNormalizedEntropy();
	

	double getMean();
	double getMedian();
	double getVariance();
	double getStandardDeviation();
	double getSkewness();
	double getKurtosis();
	double getEntropy();
	double getNormalizedEntropy();
	


	static double computeEntropy(const NICE::Vector &data);
	static double computeNormalizedEntropy(const NICE::Vector &data);
	static double computeMean(const NICE::Vector &data);
	static double computeMedian(const NICE::Vector &data);
	static double computeVariance(const NICE::Vector &data);
	static double computeStandardDeviation(const NICE::Vector &data);
	static double computeSkew(const NICE::Vector &data);
	static double computeKurtosis(const NICE::Vector &data);
private:

	NICE::Vector datavector;
	double mean, med;
	double var, skew, kurt;
	double entropy,normalizedentropy;
	bool meancalculated, mediancalculated, varcalculated, stdcalculated,
			skewcalculated, kurtcalculated,entropycalculated,normalizedentropycalculated;

private:

};

}
#endif

