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.
23 if (alpha == 0.0 && beta == 1.0)
26 /* form y := beta*y */
28 INDEX iy = OFFSET(N, incY);
29 for (i = 0; i < N; i++) {
33 } else if (beta != 1.0) {
34 INDEX iy = OFFSET(N, incY);
35 for (i = 0; i < N; i++) {
44 /* form y := alpha*A*x + y */
46 if ((order == CblasRowMajor && Uplo == CblasUpper)
47 || (order == CblasColMajor && Uplo == CblasLower)) {
48 INDEX ix = OFFSET(N, incX);
49 INDEX iy = OFFSET(N, incY);
50 for (i = 0; i < N; i++) {
51 BASE temp1 = alpha * X[ix];
53 const INDEX j_min = i + 1;
54 const INDEX j_max = N;
55 INDEX jx = OFFSET(N, incX) + j_min * incX;
56 INDEX jy = OFFSET(N, incY) + j_min * incY;
57 Y[iy] += temp1 * A[lda * i + i];
58 for (j = j_min; j < j_max; j++) {
59 Y[jy] += temp1 * A[lda * i + j];
60 temp2 += X[jx] * A[lda * i + j];
64 Y[iy] += alpha * temp2;
68 } else if ((order == CblasRowMajor && Uplo == CblasLower)
69 || (order == CblasColMajor && Uplo == CblasUpper)) {
70 INDEX ix = OFFSET(N, incX) + (N - 1) * incX;
71 INDEX iy = OFFSET(N, incY) + (N - 1) * incY;
72 for (i = N; i > 0 && i--;) {
73 BASE temp1 = alpha * X[ix];
75 const INDEX j_min = 0;
76 const INDEX j_max = i;
77 INDEX jx = OFFSET(N, incX) + j_min * incX;
78 INDEX jy = OFFSET(N, incY) + j_min * incY;
79 Y[iy] += temp1 * A[lda * i + i];
80 for (j = j_min; j < j_max; j++) {
81 Y[jy] += temp1 * A[lda * i + j];
82 temp2 += X[jx] * A[lda * i + j];
86 Y[iy] += alpha * temp2;
91 BLAS_ERROR("unrecognized operation");