1 /*********************************************************************/
2 /* Copyright 2009, 2010 The University of Texas at Austin. */
3 /* All rights reserved. */
5 /* Redistribution and use in source and binary forms, with or */
6 /* without modification, are permitted provided that the following */
7 /* conditions are met: */
9 /* 1. Redistributions of source code must retain the above */
10 /* copyright notice, this list of conditions and the following */
13 /* 2. Redistributions in binary form must reproduce the above */
14 /* copyright notice, this list of conditions and the following */
15 /* disclaimer in the documentation and/or other materials */
16 /* provided with the distribution. */
18 /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
19 /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
20 /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
21 /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
23 /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
24 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
25 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
26 /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
27 /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
28 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
30 /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
31 /* POSSIBILITY OF SUCH DAMAGE. */
33 /* The views and conclusions contained in the software and */
34 /* documentation are those of the authors and should not be */
35 /* interpreted as representing official policies, either expressed */
36 /* or implied, of The University of Texas at Austin. */
37 /*********************************************************************/
41 #ifdef FUNCTION_PROFILE
42 #include "functable.h"
46 #define ERROR_NAME "QGBMV "
48 #define ERROR_NAME "DGBMV "
50 #define ERROR_NAME "SGBMV "
53 static void (*gbmv[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT,
54 FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
65 static int (*gbmv_thread[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT,
66 FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
68 qgbmv_thread_n, qgbmv_thread_t,
70 dgbmv_thread_n, dgbmv_thread_t,
72 sgbmv_thread_n, sgbmv_thread_t,
79 void NAME(char *TRANS, blasint *M, blasint *N,
80 blasint *KU, blasint *KL,
81 FLOAT *ALPHA, FLOAT *a, blasint *LDA,
82 FLOAT *x, blasint *INCX,
83 FLOAT *BETA, FLOAT *y, blasint *INCY){
113 if (trans == 'N') i = 0;
114 if (trans == 'T') i = 1;
115 if (trans == 'R') i = 0;
116 if (trans == 'C') i = 1;
118 if (incy == 0) info = 13;
119 if (incx == 0) info = 10;
120 if (lda < kl + ku + 1) info = 8;
121 if (kl < 0) info = 5;
122 if (ku < 0) info = 4;
130 BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
136 void CNAME(enum CBLAS_ORDER order,
137 enum CBLAS_TRANSPOSE TransA,
138 blasint m, blasint n,
139 blasint ku, blasint kl,
141 FLOAT *a, blasint lda,
142 FLOAT *x, blasint incx,
144 FLOAT *y, blasint incy){
147 blasint lenx, leny, info, t;
158 if (order == CblasColMajor) {
159 if (TransA == CblasNoTrans) trans = 0;
160 if (TransA == CblasTrans) trans = 1;
161 if (TransA == CblasConjNoTrans) trans = 0;
162 if (TransA == CblasConjTrans) trans = 1;
166 if (incy == 0) info = 13;
167 if (incx == 0) info = 10;
168 if (lda < kl + ku + 1) info = 8;
169 if (kl < 0) info = 5;
170 if (ku < 0) info = 4;
173 if (trans < 0) info = 1;
176 if (order == CblasRowMajor) {
177 if (TransA == CblasNoTrans) trans = 1;
178 if (TransA == CblasTrans) trans = 0;
179 if (TransA == CblasConjNoTrans) trans = 1;
180 if (TransA == CblasConjTrans) trans = 0;
192 if (incy == 0) info = 13;
193 if (incx == 0) info = 10;
194 if (lda < kl + ku + 1) info = 8;
195 if (kl < 0) info = 5;
196 if (ku < 0) info = 4;
199 if (trans < 0) info = 1;
203 BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
209 if ((m==0) || (n==0)) return;
216 if (beta != ONE) SCAL_K(leny, 0, 0, beta, y, blasabs(incy), NULL, 0, NULL, 0);
218 if (alpha == ZERO) return;
222 FUNCTION_PROFILE_START();
224 if (incx < 0) x -= (lenx-1)*incx;
225 if (incy < 0) y -= (leny-1)*incy;
227 buffer = (FLOAT *)blas_memory_alloc(1);
230 nthreads = num_cpu_avail(2);
235 (gbmv[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer);
240 (gbmv_thread[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer, nthreads);
245 blas_memory_free(buffer);
247 FUNCTION_PROFILE_END(1, m * n / 2 + n, m * n);