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