[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] inconsistent output with gsl_stat function
From: |
Philip Ogunbona |
Subject: |
[Help-gsl] inconsistent output with gsl_stat function |
Date: |
Thu, 22 May 2008 00:42:00 +1000 |
User-agent: |
Thunderbird 2.0.0.14 (X11/20080501) |
I noticed an unusual behaviour while using some statistical functions in
gsl. The code below gave different output on each execution.
compilation :
g++ my_code.cpp -Wall -o my_code.cpp -lgsl -lcblas -lm
=======the code=======
#include <iostream>
#include <cstdlib>
#include <ctime> // used for other parts of code
#include <cmath> // used fr other part of code
#include <gsl/gsl_statistics_double.h>
using namespace std;
int main()
{
double data_set[] = {-0.39, 0.12, 0.94, 1.67,
1.76, 2.44, 3.72, 4.28,
4.92, 5.53, 0.06, 0.48,
1.01, 1.68, 1.80, 3.25,
4.12, 4.60, 5.28, 6.22};
size_t data_size = sizeof(data_set)/sizeof(data_set[0]);
double sigma1 = gsl_stats_variance(data_set,
(size_t)sizeof(data_set[0]), data_size);
double sigma2 = sigma1;
cout << "sigma1 = " << sigma1 << endl;
cout << "sigma2 = " << sigma2 << endl;
cout << "mu = " << gsl_stats_mean(data_set, (size_t)sizeof(data_set[0]),
data_size) << endl;
return EXIT_SUCCESS;
}
- [Help-gsl] inconsistent output with gsl_stat function,
Philip Ogunbona <=