Added script front-end for primer-design code
[htsworkflow.git] / htswanalysis / MACS / lib / gsl / gsl-1.11 / cblas / source_sbmv.h
1 /* blas/source_sbmv.h
2  * 
3  * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or (at
8  * your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 {
21   INDEX i, j;
22
23   if (N == 0)
24     return;
25
26   if (alpha == 0.0 && beta == 1.0)
27     return;
28
29   /* form  y := beta*y */
30   if (beta == 0.0) {
31     INDEX iy = OFFSET(N, incY);
32     for (i = 0; i < N; i++) {
33       Y[iy] = 0.0;
34       iy += incY;
35     }
36   } else if (beta != 1.0) {
37     INDEX iy = OFFSET(N, incY);
38     for (i = 0; i < N; i++) {
39       Y[iy] *= beta;
40       iy += incY;
41     }
42   }
43
44   if (alpha == 0.0)
45     return;
46
47   /* form  y := alpha*A*x + y */
48
49   if ((order == CblasRowMajor && Uplo == CblasUpper)
50       || (order == CblasColMajor && Uplo == CblasLower)) {
51     INDEX ix = OFFSET(N, incX);
52     INDEX iy = OFFSET(N, incY);
53
54     for (i = 0; i < N; i++) {
55       BASE tmp1 = alpha * X[ix];
56       BASE tmp2 = 0.0;
57       const INDEX j_min = i + 1;
58       const INDEX j_max = GSL_MIN(N, i + K + 1);
59       INDEX jx = OFFSET(N, incX) + j_min * incX;
60       INDEX jy = OFFSET(N, incY) + j_min * incY;
61       Y[iy] += tmp1 * A[0 + i * lda];
62       for (j = j_min; j < j_max; j++) {
63         BASE Aij = A[(j - i) + i * lda];
64         Y[jy] += tmp1 * Aij;
65         tmp2 += Aij * X[jx];
66         jx += incX;
67         jy += incY;
68       }
69       Y[iy] += alpha * tmp2;
70       ix += incX;
71       iy += incY;
72     }
73   } else if ((order == CblasRowMajor && Uplo == CblasLower)
74              || (order == CblasColMajor && Uplo == CblasUpper)) {
75     INDEX ix = OFFSET(N, incX);
76     INDEX iy = OFFSET(N, incY);
77
78     for (i = 0; i < N; i++) {
79       BASE tmp1 = alpha * X[ix];
80       BASE tmp2 = 0.0;
81       const INDEX j_min = (i > K) ? i - K : 0;
82       const INDEX j_max = i;
83       INDEX jx = OFFSET(N, incX) + j_min * incX;
84       INDEX jy = OFFSET(N, incY) + j_min * incY;
85       for (j = j_min; j < j_max; j++) {
86         BASE Aij = A[(K - i + j) + i * lda];
87         Y[jy] += tmp1 * Aij;
88         tmp2 += Aij * X[jx];
89         jx += incX;
90         jy += incY;
91       }
92       Y[iy] += tmp1 * A[K + i * lda] + alpha * tmp2;
93       ix += incX;
94       iy += incY;
95     }
96   } else {
97     BLAS_ERROR("unrecognized operation");
98   }
99
100 }