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>
10 const double flteps = 1e-4, dbleps = 1e-6;
14 float alpha[2] = {0.0f, 1.0f};
15 float beta[2] = {-0.3f, 0.1f};
19 float A[] = { 0.937f, -0.035f, 0.339f, 0.847f, 0.022f, 0.153f, -0.785f, 0.193f, -0.731f, -0.166f, -0.243f, -0.319f, 0.173f, -0.24f, 0.079f, -0.058f, 0.124f, 0.445f };
20 float X[] = { -0.093f, -0.103f, -0.537f, -0.151f, 0.094f, 0.954f };
22 float Y[] = { 0.029f, -0.391f, -0.256f, 0.031f, -0.478f, 0.098f };
24 float y_expected[] = { 0.02698f, 0.521724f, -0.379354f, 1.27743f, -0.25427f, -0.043268f };
25 cblas_chbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
28 for (i = 0; i < 3; i++) {
29 gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chbmv(case 1086) real");
30 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chbmv(case 1086) imag");
39 float alpha[2] = {0.0f, 1.0f};
40 float beta[2] = {-0.3f, 0.1f};
44 float A[] = { 0.937f, -0.035f, 0.339f, 0.847f, 0.022f, 0.153f, -0.785f, 0.193f, -0.731f, -0.166f, -0.243f, -0.319f, 0.173f, -0.24f, 0.079f, -0.058f, 0.124f, 0.445f };
45 float X[] = { -0.093f, -0.103f, -0.537f, -0.151f, 0.094f, 0.954f };
47 float Y[] = { 0.029f, -0.391f, -0.256f, 0.031f, -0.478f, 0.098f };
49 float y_expected[] = { 0.02698f, 0.521724f, -0.379354f, 1.27743f, -0.25427f, -0.043268f };
50 cblas_chbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
53 for (i = 0; i < 3; i++) {
54 gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chbmv(case 1087) real");
55 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chbmv(case 1087) imag");
64 float alpha[2] = {0.0f, 1.0f};
65 float beta[2] = {-0.3f, 0.1f};
69 float A[] = { 0.937f, -0.035f, 0.339f, 0.847f, 0.022f, 0.153f, -0.785f, 0.193f, -0.731f, -0.166f, -0.243f, -0.319f, 0.173f, -0.24f, 0.079f, -0.058f, 0.124f, 0.445f };
70 float X[] = { -0.093f, -0.103f, -0.537f, -0.151f, 0.094f, 0.954f };
72 float Y[] = { 0.029f, -0.391f, -0.256f, 0.031f, -0.478f, 0.098f };
74 float y_expected[] = { -0.06422f, -0.016288f, 0.734206f, 0.108366f, -0.411982f, 0.347068f };
75 cblas_chbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
78 for (i = 0; i < 3; i++) {
79 gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chbmv(case 1088) real");
80 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chbmv(case 1088) imag");
89 float alpha[2] = {0.0f, 1.0f};
90 float beta[2] = {-0.3f, 0.1f};
94 float A[] = { 0.937f, -0.035f, 0.339f, 0.847f, 0.022f, 0.153f, -0.785f, 0.193f, -0.731f, -0.166f, -0.243f, -0.319f, 0.173f, -0.24f, 0.079f, -0.058f, 0.124f, 0.445f };
95 float X[] = { -0.093f, -0.103f, -0.537f, -0.151f, 0.094f, 0.954f };
97 float Y[] = { 0.029f, -0.391f, -0.256f, 0.031f, -0.478f, 0.098f };
99 float y_expected[] = { -0.06422f, -0.016288f, 0.734206f, 0.108366f, -0.411982f, 0.347068f };
100 cblas_chbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
103 for (i = 0; i < 3; i++) {
104 gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chbmv(case 1089) real");
105 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chbmv(case 1089) imag");
114 float alpha[2] = {0.0f, 1.0f};
115 float beta[2] = {-0.3f, 0.1f};
119 float A[] = { 0.937f, -0.035f, 0.339f, 0.847f, 0.022f, 0.153f, -0.785f, 0.193f, -0.731f, -0.166f, -0.243f, -0.319f, 0.173f, -0.24f, 0.079f, -0.058f, 0.124f, 0.445f };
120 float X[] = { -0.093f, -0.103f, -0.537f, -0.151f, 0.094f, 0.954f };
122 float Y[] = { 0.029f, -0.391f, -0.256f, 0.031f, -0.478f, 0.098f };
124 float y_expected[] = { 0.19354f, 0.056192f, 0.72585f, 0.42717f, -0.2047f, 0.405354f };
125 cblas_chbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
128 for (i = 0; i < 3; i++) {
129 gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chbmv(case 1090) real");
130 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chbmv(case 1090) imag");
139 float alpha[2] = {0.0f, 1.0f};
140 float beta[2] = {-0.3f, 0.1f};
144 float A[] = { 0.937f, -0.035f, 0.339f, 0.847f, 0.022f, 0.153f, -0.785f, 0.193f, -0.731f, -0.166f, -0.243f, -0.319f, 0.173f, -0.24f, 0.079f, -0.058f, 0.124f, 0.445f };
145 float X[] = { -0.093f, -0.103f, -0.537f, -0.151f, 0.094f, 0.954f };
147 float Y[] = { 0.029f, -0.391f, -0.256f, 0.031f, -0.478f, 0.098f };
149 float y_expected[] = { 0.19354f, 0.056192f, 0.72585f, 0.42717f, -0.2047f, 0.405354f };
150 cblas_chbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
153 for (i = 0; i < 3; i++) {
154 gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chbmv(case 1091) real");
155 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chbmv(case 1091) imag");
164 float alpha[2] = {0.0f, 1.0f};
165 float beta[2] = {-0.3f, 0.1f};
169 float A[] = { 0.937f, -0.035f, 0.339f, 0.847f, 0.022f, 0.153f, -0.785f, 0.193f, -0.731f, -0.166f, -0.243f, -0.319f, 0.173f, -0.24f, 0.079f, -0.058f, 0.124f, 0.445f };
170 float X[] = { -0.093f, -0.103f, -0.537f, -0.151f, 0.094f, 0.954f };
172 float Y[] = { 0.029f, -0.391f, -0.256f, 0.031f, -0.478f, 0.098f };
174 float y_expected[] = { -0.151304f, 0.471592f, -0.507714f, -0.304446f, -1.16395f, -0.299062f };
175 cblas_chbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
178 for (i = 0; i < 3; i++) {
179 gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chbmv(case 1092) real");
180 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chbmv(case 1092) imag");
189 float alpha[2] = {0.0f, 1.0f};
190 float beta[2] = {-0.3f, 0.1f};
194 float A[] = { 0.937f, -0.035f, 0.339f, 0.847f, 0.022f, 0.153f, -0.785f, 0.193f, -0.731f, -0.166f, -0.243f, -0.319f, 0.173f, -0.24f, 0.079f, -0.058f, 0.124f, 0.445f };
195 float X[] = { -0.093f, -0.103f, -0.537f, -0.151f, 0.094f, 0.954f };
197 float Y[] = { 0.029f, -0.391f, -0.256f, 0.031f, -0.478f, 0.098f };
199 float y_expected[] = { -0.151304f, 0.471592f, -0.507714f, -0.304446f, -1.16395f, -0.299062f };
200 cblas_chbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
203 for (i = 0; i < 3; i++) {
204 gsl_test_rel(Y[2*i], y_expected[2*i], flteps, "chbmv(case 1093) real");
205 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], flteps, "chbmv(case 1093) imag");
214 double alpha[2] = {1, 0};
215 double beta[2] = {1, 0};
219 double A[] = { 0.662, 0.24, -0.311, -0.345, -0.782, 0.904, -0.842, 0.065, -0.168, -0.855, -0.692, 0.113, 0.009, -0.707, -0.981, 0.019, -0.687, 0.861 };
220 double X[] = { 0.873, -0.509, 0.398, 0.471, 0.214, 0.878 };
222 double Y[] = { -0.441, -0.781, 0.979, -0.911, 0.879, 0.807 };
224 double y_expected[] = { -0.902712, -0.524419, -0.307439, -2.167713, 1.059385, 1.104445 };
225 cblas_zhbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
228 for (i = 0; i < 3; i++) {
229 gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhbmv(case 1094) real");
230 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhbmv(case 1094) imag");
239 double alpha[2] = {1, 0};
240 double beta[2] = {1, 0};
244 double A[] = { 0.662, 0.24, -0.311, -0.345, -0.782, 0.904, -0.842, 0.065, -0.168, -0.855, -0.692, 0.113, 0.009, -0.707, -0.981, 0.019, -0.687, 0.861 };
245 double X[] = { 0.873, -0.509, 0.398, 0.471, 0.214, 0.878 };
247 double Y[] = { -0.441, -0.781, 0.979, -0.911, 0.879, 0.807 };
249 double y_expected[] = { -0.902712, -0.524419, -0.307439, -2.167713, 1.059385, 1.104445 };
250 cblas_zhbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
253 for (i = 0; i < 3; i++) {
254 gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhbmv(case 1095) real");
255 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhbmv(case 1095) imag");
264 double alpha[2] = {1, 0};
265 double beta[2] = {1, 0};
269 double A[] = { 0.662, 0.24, -0.311, -0.345, -0.782, 0.904, -0.842, 0.065, -0.168, -0.855, -0.692, 0.113, 0.009, -0.707, -0.981, 0.019, -0.687, 0.861 };
270 double X[] = { 0.873, -0.509, 0.398, 0.471, 0.214, 0.878 };
272 double Y[] = { -0.441, -0.781, 0.979, -0.911, 0.879, 0.807 };
274 double y_expected[] = { -0.960834, -0.558818, 1.042598, -1.102864, 0.507945, 0.11149 };
275 cblas_zhbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
278 for (i = 0; i < 3; i++) {
279 gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhbmv(case 1096) real");
280 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhbmv(case 1096) imag");
289 double alpha[2] = {1, 0};
290 double beta[2] = {1, 0};
294 double A[] = { 0.662, 0.24, -0.311, -0.345, -0.782, 0.904, -0.842, 0.065, -0.168, -0.855, -0.692, 0.113, 0.009, -0.707, -0.981, 0.019, -0.687, 0.861 };
295 double X[] = { 0.873, -0.509, 0.398, 0.471, 0.214, 0.878 };
297 double Y[] = { -0.441, -0.781, 0.979, -0.911, 0.879, 0.807 };
299 double y_expected[] = { -0.960834, -0.558818, 1.042598, -1.102864, 0.507945, 0.11149 };
300 cblas_zhbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
303 for (i = 0; i < 3; i++) {
304 gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhbmv(case 1097) real");
305 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhbmv(case 1097) imag");
314 double alpha[2] = {1, 0};
315 double beta[2] = {1, 0};
319 double A[] = { 0.662, 0.24, -0.311, -0.345, -0.782, 0.904, -0.842, 0.065, -0.168, -0.855, -0.692, 0.113, 0.009, -0.707, -0.981, 0.019, -0.687, 0.861 };
320 double X[] = { 0.873, -0.509, 0.398, 0.471, 0.214, 0.878 };
322 double Y[] = { -0.441, -0.781, 0.979, -0.911, 0.879, 0.807 };
324 double y_expected[] = { -1.626828, 0.003954, 0.437012, -2.365106, 0.446715, 0.16323 };
325 cblas_zhbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
328 for (i = 0; i < 3; i++) {
329 gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhbmv(case 1098) real");
330 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhbmv(case 1098) imag");
339 double alpha[2] = {1, 0};
340 double beta[2] = {1, 0};
344 double A[] = { 0.662, 0.24, -0.311, -0.345, -0.782, 0.904, -0.842, 0.065, -0.168, -0.855, -0.692, 0.113, 0.009, -0.707, -0.981, 0.019, -0.687, 0.861 };
345 double X[] = { 0.873, -0.509, 0.398, 0.471, 0.214, 0.878 };
347 double Y[] = { -0.441, -0.781, 0.979, -0.911, 0.879, 0.807 };
349 double y_expected[] = { -1.626828, 0.003954, 0.437012, -2.365106, 0.446715, 0.16323 };
350 cblas_zhbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
353 for (i = 0; i < 3; i++) {
354 gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhbmv(case 1099) real");
355 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhbmv(case 1099) imag");
364 double alpha[2] = {1, 0};
365 double beta[2] = {1, 0};
369 double A[] = { 0.662, 0.24, -0.311, -0.345, -0.782, 0.904, -0.842, 0.065, -0.168, -0.855, -0.692, 0.113, 0.009, -0.707, -0.981, 0.019, -0.687, 0.861 };
370 double X[] = { 0.873, -0.509, 0.398, 0.471, 0.214, 0.878 };
372 double Y[] = { -0.441, -0.781, 0.979, -0.911, 0.879, 0.807 };
374 double y_expected[] = { -0.097302, -1.204999, 1.168771, -0.822543, 0.734395, 1.379065 };
375 cblas_zhbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
378 for (i = 0; i < 3; i++) {
379 gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhbmv(case 1100) real");
380 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhbmv(case 1100) imag");
389 double alpha[2] = {1, 0};
390 double beta[2] = {1, 0};
394 double A[] = { 0.662, 0.24, -0.311, -0.345, -0.782, 0.904, -0.842, 0.065, -0.168, -0.855, -0.692, 0.113, 0.009, -0.707, -0.981, 0.019, -0.687, 0.861 };
395 double X[] = { 0.873, -0.509, 0.398, 0.471, 0.214, 0.878 };
397 double Y[] = { -0.441, -0.781, 0.979, -0.911, 0.879, 0.807 };
399 double y_expected[] = { -0.097302, -1.204999, 1.168771, -0.822543, 0.734395, 1.379065 };
400 cblas_zhbmv(order, uplo, N, k, alpha, A, lda, X, incX, beta, Y, incY);
403 for (i = 0; i < 3; i++) {
404 gsl_test_rel(Y[2*i], y_expected[2*i], dbleps, "zhbmv(case 1101) real");
405 gsl_test_rel(Y[2*i+1], y_expected[2*i+1], dbleps, "zhbmv(case 1101) imag");