1 /* blas/source_tbmv_r.h
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
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.
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.
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.
22 const int nonunit = (Diag == CblasNonUnit);
23 const int Trans = (TransA != CblasConjTrans) ? TransA : CblasTrans;
28 if ((order == CblasRowMajor && Trans == CblasNoTrans && Uplo == CblasUpper)
29 || (order == CblasColMajor && Trans == CblasTrans && Uplo == CblasLower)) {
32 INDEX ix = OFFSET(N, incX);
33 for (i = 0; i < N; i++) {
34 BASE temp = (nonunit ? A[lda * i + 0] : 1.0) * X[ix];
35 const INDEX j_min = i + 1;
36 const INDEX j_max = GSL_MIN(N, i + K + 1);
37 INDEX jx = OFFSET(N, incX) + j_min * incX;
39 for (j = j_min; j < j_max; j++) {
40 temp += X[jx] * A[lda * i + (j - i)];
47 } else if ((order == CblasRowMajor && Trans == CblasNoTrans && Uplo == CblasLower)
48 || (order == CblasColMajor && Trans == CblasTrans && Uplo == CblasUpper)) {
50 INDEX ix = OFFSET(N, incX) + (N - 1) * incX;
51 for (i = N; i > 0 && i--;) {
52 BASE temp = (nonunit ? A[lda * i + K] : 1.0) * X[ix];
53 const INDEX j_min = (i > K ? i - K : 0);
54 const INDEX j_max = i;
55 INDEX jx = OFFSET(N, incX) + j_min * incX;
56 for (j = j_min; j < j_max; j++) {
57 temp += X[jx] * A[lda * i + (K - i + j)];
64 } else if ((order == CblasRowMajor && Trans == CblasTrans && Uplo == CblasUpper)
65 || (order == CblasColMajor && Trans == CblasNoTrans && Uplo == CblasLower)) {
67 INDEX ix = OFFSET(N, incX) + (N - 1) * incX;
69 for (i = N; i > 0 && i--;) {
71 const INDEX j_min = (K > i ? 0 : i - K);
72 const INDEX j_max = i;
73 INDEX jx = OFFSET(N, incX) + j_min * incX;
74 for (j = j_min; j < j_max; j++) {
75 temp += X[jx] * A[lda * j + (i - j)];
79 X[ix] = temp + X[ix] * A[lda * i + 0];
85 } else if ((order == CblasRowMajor && Trans == CblasTrans && Uplo == CblasLower)
86 || (order == CblasColMajor && Trans == CblasNoTrans && Uplo == CblasUpper)) {
88 INDEX ix = OFFSET(N, incX);
89 for (i = 0; i < N; i++) {
91 const INDEX j_min = i + 1;
92 const INDEX j_max = GSL_MIN(N, i + K + 1);
93 INDEX jx = OFFSET(N, incX) + j_min * incX;
94 for (j = j_min; j < j_max; j++) {
95 temp += X[jx] * A[lda * j + (K - j + i)];
99 X[ix] = temp + X[ix] * A[lda * i + K];