1dnl **********************************************************************
2dnl * Generates alpha, A, x, beta, and y, where A is a symmetric matrix  *
3dnl * and computes r_true.                                               *
4dnl **********************************************************************
5dnl
6dnl
7include(cblas.m4)dnl
8include(test-common.m4)dnl
9dnl
10dnl
11define(`GEMV_TESTGEN_COMMENT', `
12/*
13 * Purpose
14 * =======
15 *
16 * Generates alpha, A, x, beta, and y, where A is a general
17 * matrix; and computes r_true.
18 *
19 * Arguments
20 * =========
21 *
22 * norm         (input) blas_norm_type
23 *
24 * order        (input) blas_order_type
25 *              Order of A; row or column major
26 *
27 * trans         (input) blas_trans_type
28 *              Whether A is no trans, trans, or conj trans
29 *
30 * m            (input) int
31 *              The number of rows
32 *
33 * n            (input) int
34 *              The number of columns
35 *
36 * alpha        (input/output) $1_array
37 *              If alpha_flag = 1, alpha is input.
38 *              If alpha_flag = 0, alpha is output.
39 *
40 * alpha_flag   (input) int
41 *              = 0 : alpha is free, and is output.
42 *              = 1 : alpha is fixed on input.
43 *
44 * A           (output) $2_array
45 *              Matrix A
46 *
47 * lda          (input) int
48 *              The first dimension of A
49 *
50 * x            (input/output) $3_array
51 *
52 * beta         (input/output) $1_array
53 *              If beta_flag = 1, beta is input.
54 *              If beta_flag = 0, beta is output.
55 *
56 * beta_flag    (input) int
57 *              = 0 : beta is free, and is output.
58 *              = 1 : beta is fixed on input.
59 *
60 * y            (input/output) $1_array
61 *
62 * seed         (input/output) int
63 *
64 * r_true_l     (output) double*
65 *              The leading part of the truth in double-double.
66 *
67 * r_true_t     (output) double*
68 *              The trailing part of the truth in double-double.
69 *
70 */')
71dnl
72dnl
73dnl ---------------------------------------------------------------------
74dnl Usage: GEMV_TESTGEN(aby_typeltr, A_typeltr, x_typeltr)
75dnl        produce gemv_prepare signature
76dnl ---------------------------------------------------------------------
77define(`GEMV_TESTGEN_NAME',
78  `BLAS_$1gemv`'ifelse(`$2&&$3', `$1&&$1', `', `_$2_$3')_testgen')dnl
79dnl
80dnl
81define(`GEMV_TESTGEN_HEAD',
82  `void GEMV_TESTGEN_NAME($1, $2, $3)(int norm, enum blas_order_type order, dnl
83      enum blas_trans_type trans, int m, int n, $1_array alpha, dnl
84      int alpha_flag, $2_array A, int lda, $3_array x, $1_array beta, dnl
85      int beta_flag, $1_array y, int *seed, double *r_true_l, dnl
86      double *r_true_t)')dnl
87dnl
88dnl
89define(`GEMV_TESTGEN',
90  `GEMV_TESTGEN_HEAD($1, $2, $3)
91   GEMV_TESTGEN_COMMENT($1, $2, $3)
92   GEMV_TESTGEN_BODY($1, $2, $3)')dnl
93dnl
94dnl
95dnl ---------------------------------------------------------------------
96dnl Usage: GEMV_TESTGEN_BODY(aby_typeltr, A_typeltr, x_typeltr)
97dnl        produce gemv_prepare signature
98dnl ---------------------------------------------------------------------
99define(`GEMV_TESTGEN_BODY',
100`{
101  PTR_CAST(y, $1_type)
102  int n_fix2;
103  int n_mix;
104  int i;
105  DECLARE_VECTOR(temp, $2_type)
106  int m_i, n_i;
107  int max_mn;
108  int incy, incA;
109  DECLARE(y_elem, $1_type)
110
111  incy = incA = 1;
112  INC_ADJUST(incy, $1_type)
113  INC_ADJUST(incA, $2_type)
114
115  max_mn = MAX(m, n);
116
117  if (trans==blas_no_trans) {
118    m_i=m; n_i=n;
119  } else {
120    m_i=n; n_i=m;
121  }
122
123  MALLOC_VECTOR(temp, $2_type, max_mn)
124
125  /* calling dot_testgen n time. in each iteration, one row of A, and one
126     element of y are produced. the vector x is produced at the first
127     iteration only */
128  n_fix2 = n_mix = 0;
129  for(i=0; i<m_i; i++) {
130
131    if (i == 0) {
132      n_fix2 = 0;
133      n_mix  = 0;
134    } else if (i == 1) {
135      /* from now on, x is fixed */
136      n_mix  = n_i;
137
138      /* from now on, fix alpha and beta */
139      alpha_flag = 1; beta_flag = 1;
140    }
141
142    DOT_TESTGEN_NAME($1, $3, $2)(n_i, n_fix2, n_mix, norm, blas_no_conj, dnl
143        alpha, alpha_flag, beta, beta_flag, x, temp, seed, dnl
144        PASS_BY_REF(y_elem, $1_type), &r_true_l[i*incy], &r_true_t[i*incy]);
145    SET_VECTOR_ELEMENT(y_i, i*incy, y_elem, $1_type)
146
147    /* copy temp to A */
148    $2ge_commit_row(order, trans, m_i, n_i, A, lda, temp, i);
149  }
150
151  FREE_VECTOR(temp, $2_type)
152}')dnl
153dnl
154dnl
155define(`PROTOTYPES', `FOREACH(`PREC_ARGS', `
156GEMV_TESTGEN_HEAD(arg);')')dnl
157dnl
158dnl
159define(`SOURCE', `dnl
160#include "blas_extended.h"
161#include "blas_extended_private.h"
162#include "blas_extended_test.h"
163
164FOREACH(`PREC_ARGS', `
165GEMV_TESTGEN(arg)')
166')dnl
167dnl
168dnl
169ifdef(`prototypes_only', `PROTOTYPES()', `SOURCE()')dnl
170dnl
171dnl
172