Added MACS source
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / cblas / test_nrm2.c
1 #include <gsl/gsl_test.h>
2 #include <gsl/gsl_ieee_utils.h>
3 #include <gsl/gsl_math.h>
4 #include <gsl/gsl_cblas.h>
5
6 #include "tests.h"
7
8 void
9 test_nrm2 (void) {
10 const double flteps = 1e-4, dbleps = 1e-6;
11   {
12    int N = 1;
13    float X[] = { 0.317f };
14    int incX = -1;
15    float expected = 0.0f;
16    float f;
17    f = cblas_snrm2(N, X, incX);
18    gsl_test_rel(f, expected, flteps, "snrm2(case 28)");
19   };
20
21
22   {
23    int N = 1;
24    double X[] = { 0.071 };
25    int incX = -1;
26    double expected = 0;
27    double f;
28    f = cblas_dnrm2(N, X, incX);
29    gsl_test_rel(f, expected, dbleps, "dnrm2(case 29)");
30   };
31
32
33   {
34    int N = 1;
35    float X[] = { 0.776f, 0.983f };
36    int incX = -1;
37    float expected = 0.0f;
38    float f;
39    f = cblas_scnrm2(N, X, incX);
40    gsl_test_rel(f, expected, flteps, "scnrm2(case 30)");
41   };
42
43
44   {
45    int N = 1;
46    double X[] = { 0.549, -0.354 };
47    int incX = -1;
48    double expected = 0;
49    double f;
50    f = cblas_dznrm2(N, X, incX);
51    gsl_test_rel(f, expected, dbleps, "dznrm2(case 31)");
52   };
53
54
55   {
56    int N = 2;
57    float X[] = { 0.14f, -0.632f };
58    int incX = 1;
59    float expected = 0.647320631527f;
60    float f;
61    f = cblas_snrm2(N, X, incX);
62    gsl_test_rel(f, expected, flteps, "snrm2(case 32)");
63   };
64
65
66   {
67    int N = 2;
68    double X[] = { 0.696, -0.804 };
69    int incX = 1;
70    double expected = 1.06340584915;
71    double f;
72    f = cblas_dnrm2(N, X, incX);
73    gsl_test_rel(f, expected, dbleps, "dnrm2(case 33)");
74   };
75
76
77   {
78    int N = 2;
79    float X[] = { 0.281f, -0.063f, 0.367f, 0.232f };
80    int incX = 1;
81    float expected = 0.521001919382f;
82    float f;
83    f = cblas_scnrm2(N, X, incX);
84    gsl_test_rel(f, expected, flteps, "scnrm2(case 34)");
85   };
86
87
88   {
89    int N = 2;
90    double X[] = { -0.359, -0.76, -0.906, -0.108 };
91    int incX = 1;
92    double expected = 1.24055672986;
93    double f;
94    f = cblas_dznrm2(N, X, incX);
95    gsl_test_rel(f, expected, dbleps, "dznrm2(case 35)");
96   };
97
98
99   {
100    int N = 2;
101    float X[] = { 0.918f, -0.126f };
102    int incX = -1;
103    float expected = 0.0f;
104    float f;
105    f = cblas_snrm2(N, X, incX);
106    gsl_test_rel(f, expected, flteps, "snrm2(case 36)");
107   };
108
109
110   {
111    int N = 2;
112    double X[] = { 0.217, -0.588 };
113    int incX = -1;
114    double expected = 0;
115    double f;
116    f = cblas_dnrm2(N, X, incX);
117    gsl_test_rel(f, expected, dbleps, "dnrm2(case 37)");
118   };
119
120
121   {
122    int N = 2;
123    float X[] = { 0.31f, 0.059f, -0.442f, 0.987f };
124    int incX = -1;
125    float expected = 0.0f;
126    float f;
127    f = cblas_scnrm2(N, X, incX);
128    gsl_test_rel(f, expected, flteps, "scnrm2(case 38)");
129   };
130
131
132   {
133    int N = 2;
134    double X[] = { 0.609, 0.615, -0.143, -0.957 };
135    int incX = -1;
136    double expected = 0;
137    double f;
138    f = cblas_dznrm2(N, X, incX);
139    gsl_test_rel(f, expected, dbleps, "dznrm2(case 39)");
140   };
141
142
143 }