Added script front-end for primer-design code
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / cblas / test_hpr.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_hpr (void) {
10 const double flteps = 1e-4, dbleps = 1e-6;
11   {
12    int order = 101;
13    int uplo = 121;
14    int N = 2;
15    float alpha = 0.1f;
16    float Ap[] = { -0.273f, -0.499f, -0.305f, -0.277f, 0.238f, -0.369f };
17    float X[] = { 0.638f, -0.905f, 0.224f, 0.182f };
18    int incX = -1;
19    float Ap_expected[] = { -0.26467f, 0.0f, -0.30718f, -0.245116f, 0.360607f, 0.0f };
20    cblas_chpr(order, uplo, N, alpha, X, incX, Ap);
21    {
22      int i;
23      for (i = 0; i < 3; i++) {
24        gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr(case 1418) real");
25        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr(case 1418) imag");
26      };
27    };
28   };
29
30
31   {
32    int order = 101;
33    int uplo = 122;
34    int N = 2;
35    float alpha = 0.1f;
36    float Ap[] = { -0.273f, -0.499f, -0.305f, -0.277f, 0.238f, -0.369f };
37    float X[] = { 0.638f, -0.905f, 0.224f, 0.182f };
38    int incX = -1;
39    float Ap_expected[] = { -0.26467f, 0.0f, -0.30718f, -0.308884f, 0.360607f, 0.0f };
40    cblas_chpr(order, uplo, N, alpha, X, incX, Ap);
41    {
42      int i;
43      for (i = 0; i < 3; i++) {
44        gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr(case 1419) real");
45        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr(case 1419) imag");
46      };
47    };
48   };
49
50
51   {
52    int order = 102;
53    int uplo = 121;
54    int N = 2;
55    float alpha = 0.1f;
56    float Ap[] = { -0.273f, -0.499f, -0.305f, -0.277f, 0.238f, -0.369f };
57    float X[] = { 0.638f, -0.905f, 0.224f, 0.182f };
58    int incX = -1;
59    float Ap_expected[] = { -0.26467f, 0.0f, -0.30718f, -0.245116f, 0.360607f, 0.0f };
60    cblas_chpr(order, uplo, N, alpha, X, incX, Ap);
61    {
62      int i;
63      for (i = 0; i < 3; i++) {
64        gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr(case 1420) real");
65        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr(case 1420) imag");
66      };
67    };
68   };
69
70
71   {
72    int order = 102;
73    int uplo = 122;
74    int N = 2;
75    float alpha = 0.1f;
76    float Ap[] = { -0.273f, -0.499f, -0.305f, -0.277f, 0.238f, -0.369f };
77    float X[] = { 0.638f, -0.905f, 0.224f, 0.182f };
78    int incX = -1;
79    float Ap_expected[] = { -0.26467f, 0.0f, -0.30718f, -0.308884f, 0.360607f, 0.0f };
80    cblas_chpr(order, uplo, N, alpha, X, incX, Ap);
81    {
82      int i;
83      for (i = 0; i < 3; i++) {
84        gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr(case 1421) real");
85        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr(case 1421) imag");
86      };
87    };
88   };
89
90
91   {
92    int order = 101;
93    int uplo = 121;
94    int N = 2;
95    double alpha = 1;
96    double Ap[] = { 0.265, 0.362, -0.855, 0.035, 0.136, 0.133 };
97    double X[] = { -0.278, -0.686, -0.736, -0.918 };
98    int incX = -1;
99    double Ap_expected[] = { 1.64942, 0.0, -0.020644, -0.214692, 0.68388, 0.0 };
100    cblas_zhpr(order, uplo, N, alpha, X, incX, Ap);
101    {
102      int i;
103      for (i = 0; i < 3; i++) {
104        gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr(case 1422) real");
105        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr(case 1422) imag");
106      };
107    };
108   };
109
110
111   {
112    int order = 101;
113    int uplo = 122;
114    int N = 2;
115    double alpha = 1;
116    double Ap[] = { 0.265, 0.362, -0.855, 0.035, 0.136, 0.133 };
117    double X[] = { -0.278, -0.686, -0.736, -0.918 };
118    int incX = -1;
119    double Ap_expected[] = { 1.64942, 0.0, -0.020644, 0.284692, 0.68388, 0.0 };
120    cblas_zhpr(order, uplo, N, alpha, X, incX, Ap);
121    {
122      int i;
123      for (i = 0; i < 3; i++) {
124        gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr(case 1423) real");
125        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr(case 1423) imag");
126      };
127    };
128   };
129
130
131   {
132    int order = 102;
133    int uplo = 121;
134    int N = 2;
135    double alpha = 1;
136    double Ap[] = { 0.265, 0.362, -0.855, 0.035, 0.136, 0.133 };
137    double X[] = { -0.278, -0.686, -0.736, -0.918 };
138    int incX = -1;
139    double Ap_expected[] = { 1.64942, 0.0, -0.020644, -0.214692, 0.68388, 0.0 };
140    cblas_zhpr(order, uplo, N, alpha, X, incX, Ap);
141    {
142      int i;
143      for (i = 0; i < 3; i++) {
144        gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr(case 1424) real");
145        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr(case 1424) imag");
146      };
147    };
148   };
149
150
151   {
152    int order = 102;
153    int uplo = 122;
154    int N = 2;
155    double alpha = 1;
156    double Ap[] = { 0.265, 0.362, -0.855, 0.035, 0.136, 0.133 };
157    double X[] = { -0.278, -0.686, -0.736, -0.918 };
158    int incX = -1;
159    double Ap_expected[] = { 1.64942, 0.0, -0.020644, 0.284692, 0.68388, 0.0 };
160    cblas_zhpr(order, uplo, N, alpha, X, incX, Ap);
161    {
162      int i;
163      for (i = 0; i < 3; i++) {
164        gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr(case 1425) real");
165        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr(case 1425) imag");
166      };
167    };
168   };
169
170
171 }