| 1 | /* blas/source_geru.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 | const BASE alpha_real = CONST_REAL0(alpha); |
| 23 | const BASE alpha_imag = CONST_IMAG0(alpha); |
| 24 | |
| 25 | if (order == CblasRowMajor) { |
| 26 | INDEX ix = OFFSET(M, incX); |
| 27 | for (i = 0; i < M; i++) { |
| 28 | const BASE X_real = CONST_REAL(X, ix); |
| 29 | const BASE X_imag = CONST_IMAG(X, ix); |
| 30 | const BASE tmp_real = alpha_real * X_real - alpha_imag * X_imag; |
| 31 | const BASE tmp_imag = alpha_imag * X_real + alpha_real * X_imag; |
| 32 | INDEX jy = OFFSET(N, incY); |
| 33 | for (j = 0; j < N; j++) { |
| 34 | const BASE Y_real = CONST_REAL(Y, jy); |
| 35 | const BASE Y_imag = CONST_IMAG(Y, jy); |
| 36 | REAL(A, lda * i + j) += Y_real * tmp_real - Y_imag * tmp_imag; |
| 37 | IMAG(A, lda * i + j) += Y_imag * tmp_real + Y_real * tmp_imag; |
| 38 | jy += incY; |
| 39 | } |
| 40 | ix += incX; |
| 41 | } |
| 42 | } else if (order == CblasColMajor) { |
| 43 | INDEX jy = OFFSET(N, incY); |
| 44 | for (j = 0; j < N; j++) { |
| 45 | const BASE Y_real = CONST_REAL(Y, jy); |
| 46 | const BASE Y_imag = CONST_IMAG(Y, jy); |
| 47 | const BASE tmp_real = alpha_real * Y_real - alpha_imag * Y_imag; |
| 48 | const BASE tmp_imag = alpha_imag * Y_real + alpha_real * Y_imag; |
| 49 | INDEX ix = OFFSET(M, incX); |
| 50 | for (i = 0; i < M; i++) { |
| 51 | const BASE X_real = CONST_REAL(X, ix); |
| 52 | const BASE X_imag = CONST_IMAG(X, ix); |
| 53 | REAL(A, i + lda * j) += X_real * tmp_real - X_imag * tmp_imag; |
| 54 | IMAG(A, i + lda * j) += X_imag * tmp_real + X_real * tmp_imag; |
| 55 | ix += incX; |
| 56 | } |
| 57 | jy += incY; |
| 58 | } |
| 59 | } else { |
| 60 | BLAS_ERROR("unrecognized operation"); |
| 61 | } |
| 62 | } |