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