Afegeixo el Makefile.am que falta.
#include "Histogram.h"
#include <math.h>
inline double sqr(double x) {return(x*x);}
void Histogram::calc_mean()
{
int total_weight = 0;
int i;
for(i = 0; i < rows; i++)
total_weight = total_weight + weights[i];
mean = (double) total_weight / (double) rows;
}
void Histogram::calc_variance()
{
double sum = 0;
for(int i = 0; i < rows; i++)
sum += sqr(weights[i] - mean);
variance = (double) sum / (double) rows;
}
void Histogram::calc_std_dev()
{
std_dev = sqrt(variance);
}
void Histogram::calcStatistics()
{
calc_mean();
calc_variance();
calc_std_dev();
}
Histogram::Histogram(int numrows)
{
rows = numrows;
weights = new int[numrows];
}
Histogram::~Histogram()
{
delete[] weights;
}