Added script front-end for primer-design code
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / multifit / test_estimator.c
1 void
2 test_estimator ()
3 {
4   gsl_vector_view c;
5   gsl_matrix_view cov;
6   gsl_vector_view x;
7   double y, y_err;
8   
9   double cov_ij[25] = {    
10     4.271520, -0.526675,  0.957930,  0.267750, -0.103610,
11     -0.526675,  5.701680, -0.098080,  0.641845,  0.429780,
12     0.957930, -0.098080,  4.584790,  0.375865,  1.510810,
13     0.267750,  0.641845,  0.375865,  4.422720,  0.392210,
14   -0.103610,  0.429780,  1.510810,  0.392210,  5.782750
15
16  };
17     
18   double c_i[5] = {  
19     -0.627020,   0.848674,   0.216877,  -0.057883,   0.596668
20   };
21
22   double x_i[5] = {
23     0.99932,   0.23858,   0.19797,   1.44008,  -0.15335
24   };
25
26   double y_expected = -5.56037032230000e-01;
27   double yerr_expected = 3.91891123349318e+00;
28
29   cov = gsl_matrix_view_array(cov_ij, 5, 5);
30   c = gsl_vector_view_array(c_i, 5);
31   x = gsl_vector_view_array(x_i, 5);
32
33   gsl_multifit_linear_est(&x.vector , &c.vector, &cov.matrix, &y, &y_err);
34
35   gsl_test_rel (y, y_expected, 256*GSL_DBL_EPSILON, "gsl_multifit_linear_est y");
36   gsl_test_rel (y_err, yerr_expected, 256*GSL_DBL_EPSILON, "gsl_multifit_linear_est yerr");
37 }