1 
2 #include "blas_extended.h"
3 #include "blas_extended_private.h"
4 #include "blas_extended_test.h"
5 
BLAS_ssymv2_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,float * alpha,int alpha_flag,float * A,int lda,float * head_x,float * tail_x,float * beta,int beta_flag,float * y,int * seed,double * r_true_l,double * r_true_t)6 void BLAS_ssymv2_testgen(int norm, enum blas_order_type order,
7 			 enum blas_uplo_type uplo, int n, float *alpha,
8 			 int alpha_flag, float *A, int lda, float *head_x,
9 			 float *tail_x, float *beta, int beta_flag, float *y,
10 			 int *seed, double *r_true_l, double *r_true_t)
11 
12 /*
13  * Purpose
14  * =======
15  *
16  * Generates alpha, A, x, beta, and y, where A is a general
17  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
18  *
19  * Arguments
20  * =========
21  *
22  * norm         (input) blas_norm_type
23  *
24  * order        (input) blas_order_type
25  *              Order of A; row or column major
26  *
27  * uplo         (input) enum blas_uplo_type
28  *              Which half of the symmetric matrix A is to be stored.
29  *
30  * n            (input) int
31  *              Size of matrix A, length of vectors x and y.
32  *
33  * alpha        (input/output) float*
34  *              If alpha_flag = 1, alpha is input.
35  *              If alpha_flag = 0, alpha is output.
36  *
37  * alpha_flag   (input) int
38  *              = 0 : alpha is free, and is output.
39  *              = 1 : alpha is fixed on input.
40  *
41  * A            (output) float*
42  *              Matrix A
43  *
44  * lda          (input) int
45  *              The first dimension of A
46  *
47  * head_x
48  * tail_x       (input/output) float*
49  *
50  * beta         (input/output) float*
51  *              If beta_flag = 1, beta is input.
52  *              If beta_flag = 0, beta is output.
53  *
54  * beta_flag    (input) int
55  *              = 0 : beta is free, and is output.
56  *              = 1 : beta is fixed on input.
57  *
58  * y            (input/output) float*
59  *
60  * seed         (input/output) int
61  *
62  * r_true_l     (output) double*
63  *              The leading part of the truth in double-double.
64  *
65  * r_true_t     (output) double*
66  *              The trailing part of the truth in double-double.
67  *
68  */
69 {
70   float *y_i = y;
71   int n_fix2;
72   int n_mix;
73   int i;
74   float *temp;
75   int incy, incA;
76   float y_elem;
77 
78   incy = incA = 1;
79 
80 
81   temp = (float *) blas_malloc(n * incA * sizeof(float));
82   if (n * incA > 0 && temp == NULL) {
83     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
84   }
85 
86   /* calling dot2_testgen n times. in each iteration, one row of A, and one
87      element of y are produced. the vector x is produced at the first
88      iteration only */
89   n_mix = 0;
90   for (i = 0; i < n; i++) {
91     n_fix2 = i;
92     if (i >= 1) {
93       n_mix = n - n_fix2;
94       alpha_flag = 1;
95       beta_flag = 1;
96     }
97 
98     ssy_copy_row(order, uplo, n, A, lda, temp, i);
99     BLAS_sdot2_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
100 		       alpha_flag, beta, beta_flag, head_x, tail_x, temp,
101 		       seed, &y_elem, &r_true_l[i * incy],
102 		       &r_true_t[i * incy]);
103     y_i[i * incy] = y_elem;
104 
105     /* copy temp to A */
106     ssy_commit_row(order, uplo, n, A, lda, temp, i);
107   }
108   blas_free(temp);
109 }
BLAS_dsymv2_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,double * alpha,int alpha_flag,double * A,int lda,double * head_x,double * tail_x,double * beta,int beta_flag,double * y,int * seed,double * r_true_l,double * r_true_t)110 void BLAS_dsymv2_testgen(int norm, enum blas_order_type order,
111 			 enum blas_uplo_type uplo, int n, double *alpha,
112 			 int alpha_flag, double *A, int lda, double *head_x,
113 			 double *tail_x, double *beta, int beta_flag,
114 			 double *y, int *seed, double *r_true_l,
115 			 double *r_true_t)
116 
117 /*
118  * Purpose
119  * =======
120  *
121  * Generates alpha, A, x, beta, and y, where A is a general
122  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
123  *
124  * Arguments
125  * =========
126  *
127  * norm         (input) blas_norm_type
128  *
129  * order        (input) blas_order_type
130  *              Order of A; row or column major
131  *
132  * uplo         (input) enum blas_uplo_type
133  *              Which half of the symmetric matrix A is to be stored.
134  *
135  * n            (input) int
136  *              Size of matrix A, length of vectors x and y.
137  *
138  * alpha        (input/output) double*
139  *              If alpha_flag = 1, alpha is input.
140  *              If alpha_flag = 0, alpha is output.
141  *
142  * alpha_flag   (input) int
143  *              = 0 : alpha is free, and is output.
144  *              = 1 : alpha is fixed on input.
145  *
146  * A            (output) double*
147  *              Matrix A
148  *
149  * lda          (input) int
150  *              The first dimension of A
151  *
152  * head_x
153  * tail_x       (input/output) double*
154  *
155  * beta         (input/output) double*
156  *              If beta_flag = 1, beta is input.
157  *              If beta_flag = 0, beta is output.
158  *
159  * beta_flag    (input) int
160  *              = 0 : beta is free, and is output.
161  *              = 1 : beta is fixed on input.
162  *
163  * y            (input/output) double*
164  *
165  * seed         (input/output) int
166  *
167  * r_true_l     (output) double*
168  *              The leading part of the truth in double-double.
169  *
170  * r_true_t     (output) double*
171  *              The trailing part of the truth in double-double.
172  *
173  */
174 {
175   double *y_i = y;
176   int n_fix2;
177   int n_mix;
178   int i;
179   double *temp;
180   int incy, incA;
181   double y_elem;
182 
183   incy = incA = 1;
184 
185 
186   temp = (double *) blas_malloc(n * incA * sizeof(double));
187   if (n * incA > 0 && temp == NULL) {
188     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
189   }
190 
191   /* calling dot2_testgen n times. in each iteration, one row of A, and one
192      element of y are produced. the vector x is produced at the first
193      iteration only */
194   n_mix = 0;
195   for (i = 0; i < n; i++) {
196     n_fix2 = i;
197     if (i >= 1) {
198       n_mix = n - n_fix2;
199       alpha_flag = 1;
200       beta_flag = 1;
201     }
202 
203     dsy_copy_row(order, uplo, n, A, lda, temp, i);
204     BLAS_ddot2_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
205 		       alpha_flag, beta, beta_flag, head_x, tail_x, temp,
206 		       seed, &y_elem, &r_true_l[i * incy],
207 		       &r_true_t[i * incy]);
208     y_i[i * incy] = y_elem;
209 
210     /* copy temp to A */
211     dsy_commit_row(order, uplo, n, A, lda, temp, i);
212   }
213   blas_free(temp);
214 }
BLAS_csymv2_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,void * A,int lda,void * head_x,void * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)215 void BLAS_csymv2_testgen(int norm, enum blas_order_type order,
216 			 enum blas_uplo_type uplo, int n, void *alpha,
217 			 int alpha_flag, void *A, int lda, void *head_x,
218 			 void *tail_x, void *beta, int beta_flag, void *y,
219 			 int *seed, double *r_true_l, double *r_true_t)
220 
221 /*
222  * Purpose
223  * =======
224  *
225  * Generates alpha, A, x, beta, and y, where A is a general
226  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
227  *
228  * Arguments
229  * =========
230  *
231  * norm         (input) blas_norm_type
232  *
233  * order        (input) blas_order_type
234  *              Order of A; row or column major
235  *
236  * uplo         (input) enum blas_uplo_type
237  *              Which half of the symmetric matrix A is to be stored.
238  *
239  * n            (input) int
240  *              Size of matrix A, length of vectors x and y.
241  *
242  * alpha        (input/output) void*
243  *              If alpha_flag = 1, alpha is input.
244  *              If alpha_flag = 0, alpha is output.
245  *
246  * alpha_flag   (input) int
247  *              = 0 : alpha is free, and is output.
248  *              = 1 : alpha is fixed on input.
249  *
250  * A            (output) void*
251  *              Matrix A
252  *
253  * lda          (input) int
254  *              The first dimension of A
255  *
256  * head_x
257  * tail_x       (input/output) void*
258  *
259  * beta         (input/output) void*
260  *              If beta_flag = 1, beta is input.
261  *              If beta_flag = 0, beta is output.
262  *
263  * beta_flag    (input) int
264  *              = 0 : beta is free, and is output.
265  *              = 1 : beta is fixed on input.
266  *
267  * y            (input/output) void*
268  *
269  * seed         (input/output) int
270  *
271  * r_true_l     (output) double*
272  *              The leading part of the truth in double-double.
273  *
274  * r_true_t     (output) double*
275  *              The trailing part of the truth in double-double.
276  *
277  */
278 {
279   float *y_i = (float *) y;
280   int n_fix2;
281   int n_mix;
282   int i;
283   float *temp;
284   int incy, incA;
285   float y_elem[2];
286 
287   incy = incA = 1;
288   incy *= 2;
289   incA *= 2;
290   temp = (float *) blas_malloc(n * incA * sizeof(float) * 2);
291   if (n * incA > 0 && temp == NULL) {
292     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
293   }
294 
295   /* calling dot2_testgen n times. in each iteration, one row of A, and one
296      element of y are produced. the vector x is produced at the first
297      iteration only */
298   n_mix = 0;
299   for (i = 0; i < n; i++) {
300     n_fix2 = i;
301     if (i >= 1) {
302       n_mix = n - n_fix2;
303       alpha_flag = 1;
304       beta_flag = 1;
305     }
306 
307     csy_copy_row(order, uplo, n, A, lda, temp, i);
308     BLAS_cdot2_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
309 		       alpha_flag, beta, beta_flag, head_x, tail_x, temp,
310 		       seed, y_elem, &r_true_l[i * incy],
311 		       &r_true_t[i * incy]);
312     y_i[i * incy] = y_elem[0];
313     y_i[i * incy + 1] = y_elem[1];
314 
315     /* copy temp to A */
316     csy_commit_row(order, uplo, n, A, lda, temp, i);
317   }
318   blas_free(temp);
319 }
BLAS_zsymv2_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,void * A,int lda,void * head_x,void * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)320 void BLAS_zsymv2_testgen(int norm, enum blas_order_type order,
321 			 enum blas_uplo_type uplo, int n, void *alpha,
322 			 int alpha_flag, void *A, int lda, void *head_x,
323 			 void *tail_x, void *beta, int beta_flag, void *y,
324 			 int *seed, double *r_true_l, double *r_true_t)
325 
326 /*
327  * Purpose
328  * =======
329  *
330  * Generates alpha, A, x, beta, and y, where A is a general
331  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
332  *
333  * Arguments
334  * =========
335  *
336  * norm         (input) blas_norm_type
337  *
338  * order        (input) blas_order_type
339  *              Order of A; row or column major
340  *
341  * uplo         (input) enum blas_uplo_type
342  *              Which half of the symmetric matrix A is to be stored.
343  *
344  * n            (input) int
345  *              Size of matrix A, length of vectors x and y.
346  *
347  * alpha        (input/output) void*
348  *              If alpha_flag = 1, alpha is input.
349  *              If alpha_flag = 0, alpha is output.
350  *
351  * alpha_flag   (input) int
352  *              = 0 : alpha is free, and is output.
353  *              = 1 : alpha is fixed on input.
354  *
355  * A            (output) void*
356  *              Matrix A
357  *
358  * lda          (input) int
359  *              The first dimension of A
360  *
361  * head_x
362  * tail_x       (input/output) void*
363  *
364  * beta         (input/output) void*
365  *              If beta_flag = 1, beta is input.
366  *              If beta_flag = 0, beta is output.
367  *
368  * beta_flag    (input) int
369  *              = 0 : beta is free, and is output.
370  *              = 1 : beta is fixed on input.
371  *
372  * y            (input/output) void*
373  *
374  * seed         (input/output) int
375  *
376  * r_true_l     (output) double*
377  *              The leading part of the truth in double-double.
378  *
379  * r_true_t     (output) double*
380  *              The trailing part of the truth in double-double.
381  *
382  */
383 {
384   double *y_i = (double *) y;
385   int n_fix2;
386   int n_mix;
387   int i;
388   double *temp;
389   int incy, incA;
390   double y_elem[2];
391 
392   incy = incA = 1;
393   incy *= 2;
394   incA *= 2;
395   temp = (double *) blas_malloc(n * incA * sizeof(double) * 2);
396   if (n * incA > 0 && temp == NULL) {
397     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
398   }
399 
400   /* calling dot2_testgen n times. in each iteration, one row of A, and one
401      element of y are produced. the vector x is produced at the first
402      iteration only */
403   n_mix = 0;
404   for (i = 0; i < n; i++) {
405     n_fix2 = i;
406     if (i >= 1) {
407       n_mix = n - n_fix2;
408       alpha_flag = 1;
409       beta_flag = 1;
410     }
411 
412     zsy_copy_row(order, uplo, n, A, lda, temp, i);
413     BLAS_zdot2_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
414 		       alpha_flag, beta, beta_flag, head_x, tail_x, temp,
415 		       seed, y_elem, &r_true_l[i * incy],
416 		       &r_true_t[i * incy]);
417     y_i[i * incy] = y_elem[0];
418     y_i[i * incy + 1] = y_elem[1];
419 
420     /* copy temp to A */
421     zsy_commit_row(order, uplo, n, A, lda, temp, i);
422   }
423   blas_free(temp);
424 }
BLAS_csymv2_s_s_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,float * A,int lda,float * head_x,float * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)425 void BLAS_csymv2_s_s_testgen(int norm, enum blas_order_type order,
426 			     enum blas_uplo_type uplo, int n, void *alpha,
427 			     int alpha_flag, float *A, int lda, float *head_x,
428 			     float *tail_x, void *beta, int beta_flag,
429 			     void *y, int *seed, double *r_true_l,
430 			     double *r_true_t)
431 
432 /*
433  * Purpose
434  * =======
435  *
436  * Generates alpha, A, x, beta, and y, where A is a general
437  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
438  *
439  * Arguments
440  * =========
441  *
442  * norm         (input) blas_norm_type
443  *
444  * order        (input) blas_order_type
445  *              Order of A; row or column major
446  *
447  * uplo         (input) enum blas_uplo_type
448  *              Which half of the symmetric matrix A is to be stored.
449  *
450  * n            (input) int
451  *              Size of matrix A, length of vectors x and y.
452  *
453  * alpha        (input/output) void*
454  *              If alpha_flag = 1, alpha is input.
455  *              If alpha_flag = 0, alpha is output.
456  *
457  * alpha_flag   (input) int
458  *              = 0 : alpha is free, and is output.
459  *              = 1 : alpha is fixed on input.
460  *
461  * A            (output) float*
462  *              Matrix A
463  *
464  * lda          (input) int
465  *              The first dimension of A
466  *
467  * head_x
468  * tail_x       (input/output) float*
469  *
470  * beta         (input/output) void*
471  *              If beta_flag = 1, beta is input.
472  *              If beta_flag = 0, beta is output.
473  *
474  * beta_flag    (input) int
475  *              = 0 : beta is free, and is output.
476  *              = 1 : beta is fixed on input.
477  *
478  * y            (input/output) void*
479  *
480  * seed         (input/output) int
481  *
482  * r_true_l     (output) double*
483  *              The leading part of the truth in double-double.
484  *
485  * r_true_t     (output) double*
486  *              The trailing part of the truth in double-double.
487  *
488  */
489 {
490   float *y_i = (float *) y;
491   int n_fix2;
492   int n_mix;
493   int i;
494   float *temp;
495   int incy, incA;
496   float y_elem[2];
497 
498   incy = incA = 1;
499   incy *= 2;
500 
501   temp = (float *) blas_malloc(n * incA * sizeof(float));
502   if (n * incA > 0 && temp == NULL) {
503     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
504   }
505 
506   /* calling dot2_testgen n times. in each iteration, one row of A, and one
507      element of y are produced. the vector x is produced at the first
508      iteration only */
509   n_mix = 0;
510   for (i = 0; i < n; i++) {
511     n_fix2 = i;
512     if (i >= 1) {
513       n_mix = n - n_fix2;
514       alpha_flag = 1;
515       beta_flag = 1;
516     }
517 
518     ssy_copy_row(order, uplo, n, A, lda, temp, i);
519     BLAS_cdot2_s_s_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
520 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
521 			   seed, y_elem, &r_true_l[i * incy],
522 			   &r_true_t[i * incy]);
523     y_i[i * incy] = y_elem[0];
524     y_i[i * incy + 1] = y_elem[1];
525 
526     /* copy temp to A */
527     ssy_commit_row(order, uplo, n, A, lda, temp, i);
528   }
529   blas_free(temp);
530 }
BLAS_csymv2_s_c_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,float * A,int lda,void * head_x,void * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)531 void BLAS_csymv2_s_c_testgen(int norm, enum blas_order_type order,
532 			     enum blas_uplo_type uplo, int n, void *alpha,
533 			     int alpha_flag, float *A, int lda, void *head_x,
534 			     void *tail_x, void *beta, int beta_flag, void *y,
535 			     int *seed, double *r_true_l, double *r_true_t)
536 
537 /*
538  * Purpose
539  * =======
540  *
541  * Generates alpha, A, x, beta, and y, where A is a general
542  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
543  *
544  * Arguments
545  * =========
546  *
547  * norm         (input) blas_norm_type
548  *
549  * order        (input) blas_order_type
550  *              Order of A; row or column major
551  *
552  * uplo         (input) enum blas_uplo_type
553  *              Which half of the symmetric matrix A is to be stored.
554  *
555  * n            (input) int
556  *              Size of matrix A, length of vectors x and y.
557  *
558  * alpha        (input/output) void*
559  *              If alpha_flag = 1, alpha is input.
560  *              If alpha_flag = 0, alpha is output.
561  *
562  * alpha_flag   (input) int
563  *              = 0 : alpha is free, and is output.
564  *              = 1 : alpha is fixed on input.
565  *
566  * A            (output) float*
567  *              Matrix A
568  *
569  * lda          (input) int
570  *              The first dimension of A
571  *
572  * head_x
573  * tail_x       (input/output) void*
574  *
575  * beta         (input/output) void*
576  *              If beta_flag = 1, beta is input.
577  *              If beta_flag = 0, beta is output.
578  *
579  * beta_flag    (input) int
580  *              = 0 : beta is free, and is output.
581  *              = 1 : beta is fixed on input.
582  *
583  * y            (input/output) void*
584  *
585  * seed         (input/output) int
586  *
587  * r_true_l     (output) double*
588  *              The leading part of the truth in double-double.
589  *
590  * r_true_t     (output) double*
591  *              The trailing part of the truth in double-double.
592  *
593  */
594 {
595   float *y_i = (float *) y;
596   int n_fix2;
597   int n_mix;
598   int i;
599   float *temp;
600   int incy, incA;
601   float y_elem[2];
602 
603   incy = incA = 1;
604   incy *= 2;
605 
606   temp = (float *) blas_malloc(n * incA * sizeof(float));
607   if (n * incA > 0 && temp == NULL) {
608     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
609   }
610 
611   /* calling dot2_testgen n times. in each iteration, one row of A, and one
612      element of y are produced. the vector x is produced at the first
613      iteration only */
614   n_mix = 0;
615   for (i = 0; i < n; i++) {
616     n_fix2 = i;
617     if (i >= 1) {
618       n_mix = n - n_fix2;
619       alpha_flag = 1;
620       beta_flag = 1;
621     }
622 
623     ssy_copy_row(order, uplo, n, A, lda, temp, i);
624     BLAS_cdot2_c_s_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
625 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
626 			   seed, y_elem, &r_true_l[i * incy],
627 			   &r_true_t[i * incy]);
628     y_i[i * incy] = y_elem[0];
629     y_i[i * incy + 1] = y_elem[1];
630 
631     /* copy temp to A */
632     ssy_commit_row(order, uplo, n, A, lda, temp, i);
633   }
634   blas_free(temp);
635 }
BLAS_csymv2_c_s_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,void * A,int lda,float * head_x,float * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)636 void BLAS_csymv2_c_s_testgen(int norm, enum blas_order_type order,
637 			     enum blas_uplo_type uplo, int n, void *alpha,
638 			     int alpha_flag, void *A, int lda, float *head_x,
639 			     float *tail_x, void *beta, int beta_flag,
640 			     void *y, int *seed, double *r_true_l,
641 			     double *r_true_t)
642 
643 /*
644  * Purpose
645  * =======
646  *
647  * Generates alpha, A, x, beta, and y, where A is a general
648  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
649  *
650  * Arguments
651  * =========
652  *
653  * norm         (input) blas_norm_type
654  *
655  * order        (input) blas_order_type
656  *              Order of A; row or column major
657  *
658  * uplo         (input) enum blas_uplo_type
659  *              Which half of the symmetric matrix A is to be stored.
660  *
661  * n            (input) int
662  *              Size of matrix A, length of vectors x and y.
663  *
664  * alpha        (input/output) void*
665  *              If alpha_flag = 1, alpha is input.
666  *              If alpha_flag = 0, alpha is output.
667  *
668  * alpha_flag   (input) int
669  *              = 0 : alpha is free, and is output.
670  *              = 1 : alpha is fixed on input.
671  *
672  * A            (output) void*
673  *              Matrix A
674  *
675  * lda          (input) int
676  *              The first dimension of A
677  *
678  * head_x
679  * tail_x       (input/output) float*
680  *
681  * beta         (input/output) void*
682  *              If beta_flag = 1, beta is input.
683  *              If beta_flag = 0, beta is output.
684  *
685  * beta_flag    (input) int
686  *              = 0 : beta is free, and is output.
687  *              = 1 : beta is fixed on input.
688  *
689  * y            (input/output) void*
690  *
691  * seed         (input/output) int
692  *
693  * r_true_l     (output) double*
694  *              The leading part of the truth in double-double.
695  *
696  * r_true_t     (output) double*
697  *              The trailing part of the truth in double-double.
698  *
699  */
700 {
701   float *y_i = (float *) y;
702   int n_fix2;
703   int n_mix;
704   int i;
705   float *temp;
706   int incy, incA;
707   float y_elem[2];
708 
709   incy = incA = 1;
710   incy *= 2;
711   incA *= 2;
712   temp = (float *) blas_malloc(n * incA * sizeof(float) * 2);
713   if (n * incA > 0 && temp == NULL) {
714     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
715   }
716 
717   /* calling dot2_testgen n times. in each iteration, one row of A, and one
718      element of y are produced. the vector x is produced at the first
719      iteration only */
720   n_mix = 0;
721   for (i = 0; i < n; i++) {
722     n_fix2 = i;
723     if (i >= 1) {
724       n_mix = n - n_fix2;
725       alpha_flag = 1;
726       beta_flag = 1;
727     }
728 
729     csy_copy_row(order, uplo, n, A, lda, temp, i);
730     BLAS_cdot2_s_c_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
731 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
732 			   seed, y_elem, &r_true_l[i * incy],
733 			   &r_true_t[i * incy]);
734     y_i[i * incy] = y_elem[0];
735     y_i[i * incy + 1] = y_elem[1];
736 
737     /* copy temp to A */
738     csy_commit_row(order, uplo, n, A, lda, temp, i);
739   }
740   blas_free(temp);
741 }
BLAS_zsymv2_d_d_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,double * A,int lda,double * head_x,double * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)742 void BLAS_zsymv2_d_d_testgen(int norm, enum blas_order_type order,
743 			     enum blas_uplo_type uplo, int n, void *alpha,
744 			     int alpha_flag, double *A, int lda,
745 			     double *head_x, double *tail_x, void *beta,
746 			     int beta_flag, void *y, int *seed,
747 			     double *r_true_l, double *r_true_t)
748 
749 /*
750  * Purpose
751  * =======
752  *
753  * Generates alpha, A, x, beta, and y, where A is a general
754  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
755  *
756  * Arguments
757  * =========
758  *
759  * norm         (input) blas_norm_type
760  *
761  * order        (input) blas_order_type
762  *              Order of A; row or column major
763  *
764  * uplo         (input) enum blas_uplo_type
765  *              Which half of the symmetric matrix A is to be stored.
766  *
767  * n            (input) int
768  *              Size of matrix A, length of vectors x and y.
769  *
770  * alpha        (input/output) void*
771  *              If alpha_flag = 1, alpha is input.
772  *              If alpha_flag = 0, alpha is output.
773  *
774  * alpha_flag   (input) int
775  *              = 0 : alpha is free, and is output.
776  *              = 1 : alpha is fixed on input.
777  *
778  * A            (output) double*
779  *              Matrix A
780  *
781  * lda          (input) int
782  *              The first dimension of A
783  *
784  * head_x
785  * tail_x       (input/output) double*
786  *
787  * beta         (input/output) void*
788  *              If beta_flag = 1, beta is input.
789  *              If beta_flag = 0, beta is output.
790  *
791  * beta_flag    (input) int
792  *              = 0 : beta is free, and is output.
793  *              = 1 : beta is fixed on input.
794  *
795  * y            (input/output) void*
796  *
797  * seed         (input/output) int
798  *
799  * r_true_l     (output) double*
800  *              The leading part of the truth in double-double.
801  *
802  * r_true_t     (output) double*
803  *              The trailing part of the truth in double-double.
804  *
805  */
806 {
807   double *y_i = (double *) y;
808   int n_fix2;
809   int n_mix;
810   int i;
811   double *temp;
812   int incy, incA;
813   double y_elem[2];
814 
815   incy = incA = 1;
816   incy *= 2;
817 
818   temp = (double *) blas_malloc(n * incA * sizeof(double));
819   if (n * incA > 0 && temp == NULL) {
820     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
821   }
822 
823   /* calling dot2_testgen n times. in each iteration, one row of A, and one
824      element of y are produced. the vector x is produced at the first
825      iteration only */
826   n_mix = 0;
827   for (i = 0; i < n; i++) {
828     n_fix2 = i;
829     if (i >= 1) {
830       n_mix = n - n_fix2;
831       alpha_flag = 1;
832       beta_flag = 1;
833     }
834 
835     dsy_copy_row(order, uplo, n, A, lda, temp, i);
836     BLAS_zdot2_d_d_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
837 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
838 			   seed, y_elem, &r_true_l[i * incy],
839 			   &r_true_t[i * incy]);
840     y_i[i * incy] = y_elem[0];
841     y_i[i * incy + 1] = y_elem[1];
842 
843     /* copy temp to A */
844     dsy_commit_row(order, uplo, n, A, lda, temp, i);
845   }
846   blas_free(temp);
847 }
BLAS_zsymv2_d_z_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,double * A,int lda,void * head_x,void * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)848 void BLAS_zsymv2_d_z_testgen(int norm, enum blas_order_type order,
849 			     enum blas_uplo_type uplo, int n, void *alpha,
850 			     int alpha_flag, double *A, int lda, void *head_x,
851 			     void *tail_x, void *beta, int beta_flag, void *y,
852 			     int *seed, double *r_true_l, double *r_true_t)
853 
854 /*
855  * Purpose
856  * =======
857  *
858  * Generates alpha, A, x, beta, and y, where A is a general
859  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
860  *
861  * Arguments
862  * =========
863  *
864  * norm         (input) blas_norm_type
865  *
866  * order        (input) blas_order_type
867  *              Order of A; row or column major
868  *
869  * uplo         (input) enum blas_uplo_type
870  *              Which half of the symmetric matrix A is to be stored.
871  *
872  * n            (input) int
873  *              Size of matrix A, length of vectors x and y.
874  *
875  * alpha        (input/output) void*
876  *              If alpha_flag = 1, alpha is input.
877  *              If alpha_flag = 0, alpha is output.
878  *
879  * alpha_flag   (input) int
880  *              = 0 : alpha is free, and is output.
881  *              = 1 : alpha is fixed on input.
882  *
883  * A            (output) double*
884  *              Matrix A
885  *
886  * lda          (input) int
887  *              The first dimension of A
888  *
889  * head_x
890  * tail_x       (input/output) void*
891  *
892  * beta         (input/output) void*
893  *              If beta_flag = 1, beta is input.
894  *              If beta_flag = 0, beta is output.
895  *
896  * beta_flag    (input) int
897  *              = 0 : beta is free, and is output.
898  *              = 1 : beta is fixed on input.
899  *
900  * y            (input/output) void*
901  *
902  * seed         (input/output) int
903  *
904  * r_true_l     (output) double*
905  *              The leading part of the truth in double-double.
906  *
907  * r_true_t     (output) double*
908  *              The trailing part of the truth in double-double.
909  *
910  */
911 {
912   double *y_i = (double *) y;
913   int n_fix2;
914   int n_mix;
915   int i;
916   double *temp;
917   int incy, incA;
918   double y_elem[2];
919 
920   incy = incA = 1;
921   incy *= 2;
922 
923   temp = (double *) blas_malloc(n * incA * sizeof(double));
924   if (n * incA > 0 && temp == NULL) {
925     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
926   }
927 
928   /* calling dot2_testgen n times. in each iteration, one row of A, and one
929      element of y are produced. the vector x is produced at the first
930      iteration only */
931   n_mix = 0;
932   for (i = 0; i < n; i++) {
933     n_fix2 = i;
934     if (i >= 1) {
935       n_mix = n - n_fix2;
936       alpha_flag = 1;
937       beta_flag = 1;
938     }
939 
940     dsy_copy_row(order, uplo, n, A, lda, temp, i);
941     BLAS_zdot2_z_d_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
942 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
943 			   seed, y_elem, &r_true_l[i * incy],
944 			   &r_true_t[i * incy]);
945     y_i[i * incy] = y_elem[0];
946     y_i[i * incy + 1] = y_elem[1];
947 
948     /* copy temp to A */
949     dsy_commit_row(order, uplo, n, A, lda, temp, i);
950   }
951   blas_free(temp);
952 }
BLAS_zsymv2_z_d_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,void * A,int lda,double * head_x,double * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)953 void BLAS_zsymv2_z_d_testgen(int norm, enum blas_order_type order,
954 			     enum blas_uplo_type uplo, int n, void *alpha,
955 			     int alpha_flag, void *A, int lda, double *head_x,
956 			     double *tail_x, void *beta, int beta_flag,
957 			     void *y, int *seed, double *r_true_l,
958 			     double *r_true_t)
959 
960 /*
961  * Purpose
962  * =======
963  *
964  * Generates alpha, A, x, beta, and y, where A is a general
965  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
966  *
967  * Arguments
968  * =========
969  *
970  * norm         (input) blas_norm_type
971  *
972  * order        (input) blas_order_type
973  *              Order of A; row or column major
974  *
975  * uplo         (input) enum blas_uplo_type
976  *              Which half of the symmetric matrix A is to be stored.
977  *
978  * n            (input) int
979  *              Size of matrix A, length of vectors x and y.
980  *
981  * alpha        (input/output) void*
982  *              If alpha_flag = 1, alpha is input.
983  *              If alpha_flag = 0, alpha is output.
984  *
985  * alpha_flag   (input) int
986  *              = 0 : alpha is free, and is output.
987  *              = 1 : alpha is fixed on input.
988  *
989  * A            (output) void*
990  *              Matrix A
991  *
992  * lda          (input) int
993  *              The first dimension of A
994  *
995  * head_x
996  * tail_x       (input/output) double*
997  *
998  * beta         (input/output) void*
999  *              If beta_flag = 1, beta is input.
1000  *              If beta_flag = 0, beta is output.
1001  *
1002  * beta_flag    (input) int
1003  *              = 0 : beta is free, and is output.
1004  *              = 1 : beta is fixed on input.
1005  *
1006  * y            (input/output) void*
1007  *
1008  * seed         (input/output) int
1009  *
1010  * r_true_l     (output) double*
1011  *              The leading part of the truth in double-double.
1012  *
1013  * r_true_t     (output) double*
1014  *              The trailing part of the truth in double-double.
1015  *
1016  */
1017 {
1018   double *y_i = (double *) y;
1019   int n_fix2;
1020   int n_mix;
1021   int i;
1022   double *temp;
1023   int incy, incA;
1024   double y_elem[2];
1025 
1026   incy = incA = 1;
1027   incy *= 2;
1028   incA *= 2;
1029   temp = (double *) blas_malloc(n * incA * sizeof(double) * 2);
1030   if (n * incA > 0 && temp == NULL) {
1031     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
1032   }
1033 
1034   /* calling dot2_testgen n times. in each iteration, one row of A, and one
1035      element of y are produced. the vector x is produced at the first
1036      iteration only */
1037   n_mix = 0;
1038   for (i = 0; i < n; i++) {
1039     n_fix2 = i;
1040     if (i >= 1) {
1041       n_mix = n - n_fix2;
1042       alpha_flag = 1;
1043       beta_flag = 1;
1044     }
1045 
1046     zsy_copy_row(order, uplo, n, A, lda, temp, i);
1047     BLAS_zdot2_d_z_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
1048 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
1049 			   seed, y_elem, &r_true_l[i * incy],
1050 			   &r_true_t[i * incy]);
1051     y_i[i * incy] = y_elem[0];
1052     y_i[i * incy + 1] = y_elem[1];
1053 
1054     /* copy temp to A */
1055     zsy_commit_row(order, uplo, n, A, lda, temp, i);
1056   }
1057   blas_free(temp);
1058 }
BLAS_dsymv2_s_s_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,double * alpha,int alpha_flag,float * A,int lda,float * head_x,float * tail_x,double * beta,int beta_flag,double * y,int * seed,double * r_true_l,double * r_true_t)1059 void BLAS_dsymv2_s_s_testgen(int norm, enum blas_order_type order,
1060 			     enum blas_uplo_type uplo, int n, double *alpha,
1061 			     int alpha_flag, float *A, int lda, float *head_x,
1062 			     float *tail_x, double *beta, int beta_flag,
1063 			     double *y, int *seed, double *r_true_l,
1064 			     double *r_true_t)
1065 
1066 /*
1067  * Purpose
1068  * =======
1069  *
1070  * Generates alpha, A, x, beta, and y, where A is a general
1071  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
1072  *
1073  * Arguments
1074  * =========
1075  *
1076  * norm         (input) blas_norm_type
1077  *
1078  * order        (input) blas_order_type
1079  *              Order of A; row or column major
1080  *
1081  * uplo         (input) enum blas_uplo_type
1082  *              Which half of the symmetric matrix A is to be stored.
1083  *
1084  * n            (input) int
1085  *              Size of matrix A, length of vectors x and y.
1086  *
1087  * alpha        (input/output) double*
1088  *              If alpha_flag = 1, alpha is input.
1089  *              If alpha_flag = 0, alpha is output.
1090  *
1091  * alpha_flag   (input) int
1092  *              = 0 : alpha is free, and is output.
1093  *              = 1 : alpha is fixed on input.
1094  *
1095  * A            (output) float*
1096  *              Matrix A
1097  *
1098  * lda          (input) int
1099  *              The first dimension of A
1100  *
1101  * head_x
1102  * tail_x       (input/output) float*
1103  *
1104  * beta         (input/output) double*
1105  *              If beta_flag = 1, beta is input.
1106  *              If beta_flag = 0, beta is output.
1107  *
1108  * beta_flag    (input) int
1109  *              = 0 : beta is free, and is output.
1110  *              = 1 : beta is fixed on input.
1111  *
1112  * y            (input/output) double*
1113  *
1114  * seed         (input/output) int
1115  *
1116  * r_true_l     (output) double*
1117  *              The leading part of the truth in double-double.
1118  *
1119  * r_true_t     (output) double*
1120  *              The trailing part of the truth in double-double.
1121  *
1122  */
1123 {
1124   double *y_i = y;
1125   int n_fix2;
1126   int n_mix;
1127   int i;
1128   float *temp;
1129   int incy, incA;
1130   double y_elem;
1131 
1132   incy = incA = 1;
1133 
1134 
1135   temp = (float *) blas_malloc(n * incA * sizeof(float));
1136   if (n * incA > 0 && temp == NULL) {
1137     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
1138   }
1139 
1140   /* calling dot2_testgen n times. in each iteration, one row of A, and one
1141      element of y are produced. the vector x is produced at the first
1142      iteration only */
1143   n_mix = 0;
1144   for (i = 0; i < n; i++) {
1145     n_fix2 = i;
1146     if (i >= 1) {
1147       n_mix = n - n_fix2;
1148       alpha_flag = 1;
1149       beta_flag = 1;
1150     }
1151 
1152     ssy_copy_row(order, uplo, n, A, lda, temp, i);
1153     BLAS_ddot2_s_s_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
1154 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
1155 			   seed, &y_elem, &r_true_l[i * incy],
1156 			   &r_true_t[i * incy]);
1157     y_i[i * incy] = y_elem;
1158 
1159     /* copy temp to A */
1160     ssy_commit_row(order, uplo, n, A, lda, temp, i);
1161   }
1162   blas_free(temp);
1163 }
BLAS_dsymv2_s_d_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,double * alpha,int alpha_flag,float * A,int lda,double * head_x,double * tail_x,double * beta,int beta_flag,double * y,int * seed,double * r_true_l,double * r_true_t)1164 void BLAS_dsymv2_s_d_testgen(int norm, enum blas_order_type order,
1165 			     enum blas_uplo_type uplo, int n, double *alpha,
1166 			     int alpha_flag, float *A, int lda,
1167 			     double *head_x, double *tail_x, double *beta,
1168 			     int beta_flag, double *y, int *seed,
1169 			     double *r_true_l, double *r_true_t)
1170 
1171 /*
1172  * Purpose
1173  * =======
1174  *
1175  * Generates alpha, A, x, beta, and y, where A is a general
1176  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
1177  *
1178  * Arguments
1179  * =========
1180  *
1181  * norm         (input) blas_norm_type
1182  *
1183  * order        (input) blas_order_type
1184  *              Order of A; row or column major
1185  *
1186  * uplo         (input) enum blas_uplo_type
1187  *              Which half of the symmetric matrix A is to be stored.
1188  *
1189  * n            (input) int
1190  *              Size of matrix A, length of vectors x and y.
1191  *
1192  * alpha        (input/output) double*
1193  *              If alpha_flag = 1, alpha is input.
1194  *              If alpha_flag = 0, alpha is output.
1195  *
1196  * alpha_flag   (input) int
1197  *              = 0 : alpha is free, and is output.
1198  *              = 1 : alpha is fixed on input.
1199  *
1200  * A            (output) float*
1201  *              Matrix A
1202  *
1203  * lda          (input) int
1204  *              The first dimension of A
1205  *
1206  * head_x
1207  * tail_x       (input/output) double*
1208  *
1209  * beta         (input/output) double*
1210  *              If beta_flag = 1, beta is input.
1211  *              If beta_flag = 0, beta is output.
1212  *
1213  * beta_flag    (input) int
1214  *              = 0 : beta is free, and is output.
1215  *              = 1 : beta is fixed on input.
1216  *
1217  * y            (input/output) double*
1218  *
1219  * seed         (input/output) int
1220  *
1221  * r_true_l     (output) double*
1222  *              The leading part of the truth in double-double.
1223  *
1224  * r_true_t     (output) double*
1225  *              The trailing part of the truth in double-double.
1226  *
1227  */
1228 {
1229   double *y_i = y;
1230   int n_fix2;
1231   int n_mix;
1232   int i;
1233   float *temp;
1234   int incy, incA;
1235   double y_elem;
1236 
1237   incy = incA = 1;
1238 
1239 
1240   temp = (float *) blas_malloc(n * incA * sizeof(float));
1241   if (n * incA > 0 && temp == NULL) {
1242     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
1243   }
1244 
1245   /* calling dot2_testgen n times. in each iteration, one row of A, and one
1246      element of y are produced. the vector x is produced at the first
1247      iteration only */
1248   n_mix = 0;
1249   for (i = 0; i < n; i++) {
1250     n_fix2 = i;
1251     if (i >= 1) {
1252       n_mix = n - n_fix2;
1253       alpha_flag = 1;
1254       beta_flag = 1;
1255     }
1256 
1257     ssy_copy_row(order, uplo, n, A, lda, temp, i);
1258     BLAS_ddot2_d_s_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
1259 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
1260 			   seed, &y_elem, &r_true_l[i * incy],
1261 			   &r_true_t[i * incy]);
1262     y_i[i * incy] = y_elem;
1263 
1264     /* copy temp to A */
1265     ssy_commit_row(order, uplo, n, A, lda, temp, i);
1266   }
1267   blas_free(temp);
1268 }
BLAS_dsymv2_d_s_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,double * alpha,int alpha_flag,double * A,int lda,float * head_x,float * tail_x,double * beta,int beta_flag,double * y,int * seed,double * r_true_l,double * r_true_t)1269 void BLAS_dsymv2_d_s_testgen(int norm, enum blas_order_type order,
1270 			     enum blas_uplo_type uplo, int n, double *alpha,
1271 			     int alpha_flag, double *A, int lda,
1272 			     float *head_x, float *tail_x, double *beta,
1273 			     int beta_flag, double *y, int *seed,
1274 			     double *r_true_l, double *r_true_t)
1275 
1276 /*
1277  * Purpose
1278  * =======
1279  *
1280  * Generates alpha, A, x, beta, and y, where A is a general
1281  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
1282  *
1283  * Arguments
1284  * =========
1285  *
1286  * norm         (input) blas_norm_type
1287  *
1288  * order        (input) blas_order_type
1289  *              Order of A; row or column major
1290  *
1291  * uplo         (input) enum blas_uplo_type
1292  *              Which half of the symmetric matrix A is to be stored.
1293  *
1294  * n            (input) int
1295  *              Size of matrix A, length of vectors x and y.
1296  *
1297  * alpha        (input/output) double*
1298  *              If alpha_flag = 1, alpha is input.
1299  *              If alpha_flag = 0, alpha is output.
1300  *
1301  * alpha_flag   (input) int
1302  *              = 0 : alpha is free, and is output.
1303  *              = 1 : alpha is fixed on input.
1304  *
1305  * A            (output) double*
1306  *              Matrix A
1307  *
1308  * lda          (input) int
1309  *              The first dimension of A
1310  *
1311  * head_x
1312  * tail_x       (input/output) float*
1313  *
1314  * beta         (input/output) double*
1315  *              If beta_flag = 1, beta is input.
1316  *              If beta_flag = 0, beta is output.
1317  *
1318  * beta_flag    (input) int
1319  *              = 0 : beta is free, and is output.
1320  *              = 1 : beta is fixed on input.
1321  *
1322  * y            (input/output) double*
1323  *
1324  * seed         (input/output) int
1325  *
1326  * r_true_l     (output) double*
1327  *              The leading part of the truth in double-double.
1328  *
1329  * r_true_t     (output) double*
1330  *              The trailing part of the truth in double-double.
1331  *
1332  */
1333 {
1334   double *y_i = y;
1335   int n_fix2;
1336   int n_mix;
1337   int i;
1338   double *temp;
1339   int incy, incA;
1340   double y_elem;
1341 
1342   incy = incA = 1;
1343 
1344 
1345   temp = (double *) blas_malloc(n * incA * sizeof(double));
1346   if (n * incA > 0 && temp == NULL) {
1347     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
1348   }
1349 
1350   /* calling dot2_testgen n times. in each iteration, one row of A, and one
1351      element of y are produced. the vector x is produced at the first
1352      iteration only */
1353   n_mix = 0;
1354   for (i = 0; i < n; i++) {
1355     n_fix2 = i;
1356     if (i >= 1) {
1357       n_mix = n - n_fix2;
1358       alpha_flag = 1;
1359       beta_flag = 1;
1360     }
1361 
1362     dsy_copy_row(order, uplo, n, A, lda, temp, i);
1363     BLAS_ddot2_s_d_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
1364 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
1365 			   seed, &y_elem, &r_true_l[i * incy],
1366 			   &r_true_t[i * incy]);
1367     y_i[i * incy] = y_elem;
1368 
1369     /* copy temp to A */
1370     dsy_commit_row(order, uplo, n, A, lda, temp, i);
1371   }
1372   blas_free(temp);
1373 }
BLAS_zsymv2_c_c_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,void * A,int lda,void * head_x,void * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)1374 void BLAS_zsymv2_c_c_testgen(int norm, enum blas_order_type order,
1375 			     enum blas_uplo_type uplo, int n, void *alpha,
1376 			     int alpha_flag, void *A, int lda, void *head_x,
1377 			     void *tail_x, void *beta, int beta_flag, void *y,
1378 			     int *seed, double *r_true_l, double *r_true_t)
1379 
1380 /*
1381  * Purpose
1382  * =======
1383  *
1384  * Generates alpha, A, x, beta, and y, where A is a general
1385  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
1386  *
1387  * Arguments
1388  * =========
1389  *
1390  * norm         (input) blas_norm_type
1391  *
1392  * order        (input) blas_order_type
1393  *              Order of A; row or column major
1394  *
1395  * uplo         (input) enum blas_uplo_type
1396  *              Which half of the symmetric matrix A is to be stored.
1397  *
1398  * n            (input) int
1399  *              Size of matrix A, length of vectors x and y.
1400  *
1401  * alpha        (input/output) void*
1402  *              If alpha_flag = 1, alpha is input.
1403  *              If alpha_flag = 0, alpha is output.
1404  *
1405  * alpha_flag   (input) int
1406  *              = 0 : alpha is free, and is output.
1407  *              = 1 : alpha is fixed on input.
1408  *
1409  * A            (output) void*
1410  *              Matrix A
1411  *
1412  * lda          (input) int
1413  *              The first dimension of A
1414  *
1415  * head_x
1416  * tail_x       (input/output) void*
1417  *
1418  * beta         (input/output) void*
1419  *              If beta_flag = 1, beta is input.
1420  *              If beta_flag = 0, beta is output.
1421  *
1422  * beta_flag    (input) int
1423  *              = 0 : beta is free, and is output.
1424  *              = 1 : beta is fixed on input.
1425  *
1426  * y            (input/output) void*
1427  *
1428  * seed         (input/output) int
1429  *
1430  * r_true_l     (output) double*
1431  *              The leading part of the truth in double-double.
1432  *
1433  * r_true_t     (output) double*
1434  *              The trailing part of the truth in double-double.
1435  *
1436  */
1437 {
1438   double *y_i = (double *) y;
1439   int n_fix2;
1440   int n_mix;
1441   int i;
1442   float *temp;
1443   int incy, incA;
1444   double y_elem[2];
1445 
1446   incy = incA = 1;
1447   incy *= 2;
1448   incA *= 2;
1449   temp = (float *) blas_malloc(n * incA * sizeof(float) * 2);
1450   if (n * incA > 0 && temp == NULL) {
1451     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
1452   }
1453 
1454   /* calling dot2_testgen n times. in each iteration, one row of A, and one
1455      element of y are produced. the vector x is produced at the first
1456      iteration only */
1457   n_mix = 0;
1458   for (i = 0; i < n; i++) {
1459     n_fix2 = i;
1460     if (i >= 1) {
1461       n_mix = n - n_fix2;
1462       alpha_flag = 1;
1463       beta_flag = 1;
1464     }
1465 
1466     csy_copy_row(order, uplo, n, A, lda, temp, i);
1467     BLAS_zdot2_c_c_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
1468 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
1469 			   seed, y_elem, &r_true_l[i * incy],
1470 			   &r_true_t[i * incy]);
1471     y_i[i * incy] = y_elem[0];
1472     y_i[i * incy + 1] = y_elem[1];
1473 
1474     /* copy temp to A */
1475     csy_commit_row(order, uplo, n, A, lda, temp, i);
1476   }
1477   blas_free(temp);
1478 }
BLAS_zsymv2_c_z_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,void * A,int lda,void * head_x,void * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)1479 void BLAS_zsymv2_c_z_testgen(int norm, enum blas_order_type order,
1480 			     enum blas_uplo_type uplo, int n, void *alpha,
1481 			     int alpha_flag, void *A, int lda, void *head_x,
1482 			     void *tail_x, void *beta, int beta_flag, void *y,
1483 			     int *seed, double *r_true_l, double *r_true_t)
1484 
1485 /*
1486  * Purpose
1487  * =======
1488  *
1489  * Generates alpha, A, x, beta, and y, where A is a general
1490  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
1491  *
1492  * Arguments
1493  * =========
1494  *
1495  * norm         (input) blas_norm_type
1496  *
1497  * order        (input) blas_order_type
1498  *              Order of A; row or column major
1499  *
1500  * uplo         (input) enum blas_uplo_type
1501  *              Which half of the symmetric matrix A is to be stored.
1502  *
1503  * n            (input) int
1504  *              Size of matrix A, length of vectors x and y.
1505  *
1506  * alpha        (input/output) void*
1507  *              If alpha_flag = 1, alpha is input.
1508  *              If alpha_flag = 0, alpha is output.
1509  *
1510  * alpha_flag   (input) int
1511  *              = 0 : alpha is free, and is output.
1512  *              = 1 : alpha is fixed on input.
1513  *
1514  * A            (output) void*
1515  *              Matrix A
1516  *
1517  * lda          (input) int
1518  *              The first dimension of A
1519  *
1520  * head_x
1521  * tail_x       (input/output) void*
1522  *
1523  * beta         (input/output) void*
1524  *              If beta_flag = 1, beta is input.
1525  *              If beta_flag = 0, beta is output.
1526  *
1527  * beta_flag    (input) int
1528  *              = 0 : beta is free, and is output.
1529  *              = 1 : beta is fixed on input.
1530  *
1531  * y            (input/output) void*
1532  *
1533  * seed         (input/output) int
1534  *
1535  * r_true_l     (output) double*
1536  *              The leading part of the truth in double-double.
1537  *
1538  * r_true_t     (output) double*
1539  *              The trailing part of the truth in double-double.
1540  *
1541  */
1542 {
1543   double *y_i = (double *) y;
1544   int n_fix2;
1545   int n_mix;
1546   int i;
1547   float *temp;
1548   int incy, incA;
1549   double y_elem[2];
1550 
1551   incy = incA = 1;
1552   incy *= 2;
1553   incA *= 2;
1554   temp = (float *) blas_malloc(n * incA * sizeof(float) * 2);
1555   if (n * incA > 0 && temp == NULL) {
1556     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
1557   }
1558 
1559   /* calling dot2_testgen n times. in each iteration, one row of A, and one
1560      element of y are produced. the vector x is produced at the first
1561      iteration only */
1562   n_mix = 0;
1563   for (i = 0; i < n; i++) {
1564     n_fix2 = i;
1565     if (i >= 1) {
1566       n_mix = n - n_fix2;
1567       alpha_flag = 1;
1568       beta_flag = 1;
1569     }
1570 
1571     csy_copy_row(order, uplo, n, A, lda, temp, i);
1572     BLAS_zdot2_z_c_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
1573 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
1574 			   seed, y_elem, &r_true_l[i * incy],
1575 			   &r_true_t[i * incy]);
1576     y_i[i * incy] = y_elem[0];
1577     y_i[i * incy + 1] = y_elem[1];
1578 
1579     /* copy temp to A */
1580     csy_commit_row(order, uplo, n, A, lda, temp, i);
1581   }
1582   blas_free(temp);
1583 }
BLAS_zsymv2_z_c_testgen(int norm,enum blas_order_type order,enum blas_uplo_type uplo,int n,void * alpha,int alpha_flag,void * A,int lda,void * head_x,void * tail_x,void * beta,int beta_flag,void * y,int * seed,double * r_true_l,double * r_true_t)1584 void BLAS_zsymv2_z_c_testgen(int norm, enum blas_order_type order,
1585 			     enum blas_uplo_type uplo, int n, void *alpha,
1586 			     int alpha_flag, void *A, int lda, void *head_x,
1587 			     void *tail_x, void *beta, int beta_flag, void *y,
1588 			     int *seed, double *r_true_l, double *r_true_t)
1589 
1590 /*
1591  * Purpose
1592  * =======
1593  *
1594  * Generates alpha, A, x, beta, and y, where A is a general
1595  * matrix, and x has two parts: (head_x, tail_x); Computes r_true.
1596  *
1597  * Arguments
1598  * =========
1599  *
1600  * norm         (input) blas_norm_type
1601  *
1602  * order        (input) blas_order_type
1603  *              Order of A; row or column major
1604  *
1605  * uplo         (input) enum blas_uplo_type
1606  *              Which half of the symmetric matrix A is to be stored.
1607  *
1608  * n            (input) int
1609  *              Size of matrix A, length of vectors x and y.
1610  *
1611  * alpha        (input/output) void*
1612  *              If alpha_flag = 1, alpha is input.
1613  *              If alpha_flag = 0, alpha is output.
1614  *
1615  * alpha_flag   (input) int
1616  *              = 0 : alpha is free, and is output.
1617  *              = 1 : alpha is fixed on input.
1618  *
1619  * A            (output) void*
1620  *              Matrix A
1621  *
1622  * lda          (input) int
1623  *              The first dimension of A
1624  *
1625  * head_x
1626  * tail_x       (input/output) void*
1627  *
1628  * beta         (input/output) void*
1629  *              If beta_flag = 1, beta is input.
1630  *              If beta_flag = 0, beta is output.
1631  *
1632  * beta_flag    (input) int
1633  *              = 0 : beta is free, and is output.
1634  *              = 1 : beta is fixed on input.
1635  *
1636  * y            (input/output) void*
1637  *
1638  * seed         (input/output) int
1639  *
1640  * r_true_l     (output) double*
1641  *              The leading part of the truth in double-double.
1642  *
1643  * r_true_t     (output) double*
1644  *              The trailing part of the truth in double-double.
1645  *
1646  */
1647 {
1648   double *y_i = (double *) y;
1649   int n_fix2;
1650   int n_mix;
1651   int i;
1652   double *temp;
1653   int incy, incA;
1654   double y_elem[2];
1655 
1656   incy = incA = 1;
1657   incy *= 2;
1658   incA *= 2;
1659   temp = (double *) blas_malloc(n * incA * sizeof(double) * 2);
1660   if (n * incA > 0 && temp == NULL) {
1661     BLAS_error("blas_malloc", 0, 0, "malloc failed.\n");
1662   }
1663 
1664   /* calling dot2_testgen n times. in each iteration, one row of A, and one
1665      element of y are produced. the vector x is produced at the first
1666      iteration only */
1667   n_mix = 0;
1668   for (i = 0; i < n; i++) {
1669     n_fix2 = i;
1670     if (i >= 1) {
1671       n_mix = n - n_fix2;
1672       alpha_flag = 1;
1673       beta_flag = 1;
1674     }
1675 
1676     zsy_copy_row(order, uplo, n, A, lda, temp, i);
1677     BLAS_zdot2_c_z_testgen(n, n_fix2, n_mix, norm, blas_no_conj, alpha,
1678 			   alpha_flag, beta, beta_flag, head_x, tail_x, temp,
1679 			   seed, y_elem, &r_true_l[i * incy],
1680 			   &r_true_t[i * incy]);
1681     y_i[i * incy] = y_elem[0];
1682     y_i[i * incy + 1] = y_elem[1];
1683 
1684     /* copy temp to A */
1685     zsy_commit_row(order, uplo, n, A, lda, temp, i);
1686   }
1687   blas_free(temp);
1688 }
1689