root / src / blas / zherk.f @ 2
Historique | Voir | Annoter | Télécharger (10,52 ko)
| 1 | 1 | pfleura2 | SUBROUTINE ZHERK(UPLO,TRANS,N,K,ALPHA,A,LDA,BETA,C,LDC) |
|---|---|---|---|
| 2 | 1 | pfleura2 | * .. Scalar Arguments .. |
| 3 | 1 | pfleura2 | DOUBLE PRECISION ALPHA,BETA |
| 4 | 1 | pfleura2 | INTEGER K,LDA,LDC,N |
| 5 | 1 | pfleura2 | CHARACTER TRANS,UPLO |
| 6 | 1 | pfleura2 | * .. |
| 7 | 1 | pfleura2 | * .. Array Arguments .. |
| 8 | 1 | pfleura2 | DOUBLE COMPLEX A(LDA,*),C(LDC,*) |
| 9 | 1 | pfleura2 | * .. |
| 10 | 1 | pfleura2 | * |
| 11 | 1 | pfleura2 | * Purpose |
| 12 | 1 | pfleura2 | * ======= |
| 13 | 1 | pfleura2 | * |
| 14 | 1 | pfleura2 | * ZHERK performs one of the hermitian rank k operations |
| 15 | 1 | pfleura2 | * |
| 16 | 1 | pfleura2 | * C := alpha*A*conjg( A' ) + beta*C, |
| 17 | 1 | pfleura2 | * |
| 18 | 1 | pfleura2 | * or |
| 19 | 1 | pfleura2 | * |
| 20 | 1 | pfleura2 | * C := alpha*conjg( A' )*A + beta*C, |
| 21 | 1 | pfleura2 | * |
| 22 | 1 | pfleura2 | * where alpha and beta are real scalars, C is an n by n hermitian |
| 23 | 1 | pfleura2 | * matrix and A is an n by k matrix in the first case and a k by n |
| 24 | 1 | pfleura2 | * matrix in the second case. |
| 25 | 1 | pfleura2 | * |
| 26 | 1 | pfleura2 | * Arguments |
| 27 | 1 | pfleura2 | * ========== |
| 28 | 1 | pfleura2 | * |
| 29 | 1 | pfleura2 | * UPLO - CHARACTER*1. |
| 30 | 1 | pfleura2 | * On entry, UPLO specifies whether the upper or lower |
| 31 | 1 | pfleura2 | * triangular part of the array C is to be referenced as |
| 32 | 1 | pfleura2 | * follows: |
| 33 | 1 | pfleura2 | * |
| 34 | 1 | pfleura2 | * UPLO = 'U' or 'u' Only the upper triangular part of C |
| 35 | 1 | pfleura2 | * is to be referenced. |
| 36 | 1 | pfleura2 | * |
| 37 | 1 | pfleura2 | * UPLO = 'L' or 'l' Only the lower triangular part of C |
| 38 | 1 | pfleura2 | * is to be referenced. |
| 39 | 1 | pfleura2 | * |
| 40 | 1 | pfleura2 | * Unchanged on exit. |
| 41 | 1 | pfleura2 | * |
| 42 | 1 | pfleura2 | * TRANS - CHARACTER*1. |
| 43 | 1 | pfleura2 | * On entry, TRANS specifies the operation to be performed as |
| 44 | 1 | pfleura2 | * follows: |
| 45 | 1 | pfleura2 | * |
| 46 | 1 | pfleura2 | * TRANS = 'N' or 'n' C := alpha*A*conjg( A' ) + beta*C. |
| 47 | 1 | pfleura2 | * |
| 48 | 1 | pfleura2 | * TRANS = 'C' or 'c' C := alpha*conjg( A' )*A + beta*C. |
| 49 | 1 | pfleura2 | * |
| 50 | 1 | pfleura2 | * Unchanged on exit. |
| 51 | 1 | pfleura2 | * |
| 52 | 1 | pfleura2 | * N - INTEGER. |
| 53 | 1 | pfleura2 | * On entry, N specifies the order of the matrix C. N must be |
| 54 | 1 | pfleura2 | * at least zero. |
| 55 | 1 | pfleura2 | * Unchanged on exit. |
| 56 | 1 | pfleura2 | * |
| 57 | 1 | pfleura2 | * K - INTEGER. |
| 58 | 1 | pfleura2 | * On entry with TRANS = 'N' or 'n', K specifies the number |
| 59 | 1 | pfleura2 | * of columns of the matrix A, and on entry with |
| 60 | 1 | pfleura2 | * TRANS = 'C' or 'c', K specifies the number of rows of the |
| 61 | 1 | pfleura2 | * matrix A. K must be at least zero. |
| 62 | 1 | pfleura2 | * Unchanged on exit. |
| 63 | 1 | pfleura2 | * |
| 64 | 1 | pfleura2 | * ALPHA - DOUBLE PRECISION . |
| 65 | 1 | pfleura2 | * On entry, ALPHA specifies the scalar alpha. |
| 66 | 1 | pfleura2 | * Unchanged on exit. |
| 67 | 1 | pfleura2 | * |
| 68 | 1 | pfleura2 | * A - COMPLEX*16 array of DIMENSION ( LDA, ka ), where ka is |
| 69 | 1 | pfleura2 | * k when TRANS = 'N' or 'n', and is n otherwise. |
| 70 | 1 | pfleura2 | * Before entry with TRANS = 'N' or 'n', the leading n by k |
| 71 | 1 | pfleura2 | * part of the array A must contain the matrix A, otherwise |
| 72 | 1 | pfleura2 | * the leading k by n part of the array A must contain the |
| 73 | 1 | pfleura2 | * matrix A. |
| 74 | 1 | pfleura2 | * Unchanged on exit. |
| 75 | 1 | pfleura2 | * |
| 76 | 1 | pfleura2 | * LDA - INTEGER. |
| 77 | 1 | pfleura2 | * On entry, LDA specifies the first dimension of A as declared |
| 78 | 1 | pfleura2 | * in the calling (sub) program. When TRANS = 'N' or 'n' |
| 79 | 1 | pfleura2 | * then LDA must be at least max( 1, n ), otherwise LDA must |
| 80 | 1 | pfleura2 | * be at least max( 1, k ). |
| 81 | 1 | pfleura2 | * Unchanged on exit. |
| 82 | 1 | pfleura2 | * |
| 83 | 1 | pfleura2 | * BETA - DOUBLE PRECISION. |
| 84 | 1 | pfleura2 | * On entry, BETA specifies the scalar beta. |
| 85 | 1 | pfleura2 | * Unchanged on exit. |
| 86 | 1 | pfleura2 | * |
| 87 | 1 | pfleura2 | * C - COMPLEX*16 array of DIMENSION ( LDC, n ). |
| 88 | 1 | pfleura2 | * Before entry with UPLO = 'U' or 'u', the leading n by n |
| 89 | 1 | pfleura2 | * upper triangular part of the array C must contain the upper |
| 90 | 1 | pfleura2 | * triangular part of the hermitian matrix and the strictly |
| 91 | 1 | pfleura2 | * lower triangular part of C is not referenced. On exit, the |
| 92 | 1 | pfleura2 | * upper triangular part of the array C is overwritten by the |
| 93 | 1 | pfleura2 | * upper triangular part of the updated matrix. |
| 94 | 1 | pfleura2 | * Before entry with UPLO = 'L' or 'l', the leading n by n |
| 95 | 1 | pfleura2 | * lower triangular part of the array C must contain the lower |
| 96 | 1 | pfleura2 | * triangular part of the hermitian matrix and the strictly |
| 97 | 1 | pfleura2 | * upper triangular part of C is not referenced. On exit, the |
| 98 | 1 | pfleura2 | * lower triangular part of the array C is overwritten by the |
| 99 | 1 | pfleura2 | * lower triangular part of the updated matrix. |
| 100 | 1 | pfleura2 | * Note that the imaginary parts of the diagonal elements need |
| 101 | 1 | pfleura2 | * not be set, they are assumed to be zero, and on exit they |
| 102 | 1 | pfleura2 | * are set to zero. |
| 103 | 1 | pfleura2 | * |
| 104 | 1 | pfleura2 | * LDC - INTEGER. |
| 105 | 1 | pfleura2 | * On entry, LDC specifies the first dimension of C as declared |
| 106 | 1 | pfleura2 | * in the calling (sub) program. LDC must be at least |
| 107 | 1 | pfleura2 | * max( 1, n ). |
| 108 | 1 | pfleura2 | * Unchanged on exit. |
| 109 | 1 | pfleura2 | * |
| 110 | 1 | pfleura2 | * |
| 111 | 1 | pfleura2 | * Level 3 Blas routine. |
| 112 | 1 | pfleura2 | * |
| 113 | 1 | pfleura2 | * -- Written on 8-February-1989. |
| 114 | 1 | pfleura2 | * Jack Dongarra, Argonne National Laboratory. |
| 115 | 1 | pfleura2 | * Iain Duff, AERE Harwell. |
| 116 | 1 | pfleura2 | * Jeremy Du Croz, Numerical Algorithms Group Ltd. |
| 117 | 1 | pfleura2 | * Sven Hammarling, Numerical Algorithms Group Ltd. |
| 118 | 1 | pfleura2 | * |
| 119 | 1 | pfleura2 | * -- Modified 8-Nov-93 to set C(J,J) to DBLE( C(J,J) ) when BETA = 1. |
| 120 | 1 | pfleura2 | * Ed Anderson, Cray Research Inc. |
| 121 | 1 | pfleura2 | * |
| 122 | 1 | pfleura2 | * |
| 123 | 1 | pfleura2 | * .. External Functions .. |
| 124 | 1 | pfleura2 | LOGICAL LSAME |
| 125 | 1 | pfleura2 | EXTERNAL LSAME |
| 126 | 1 | pfleura2 | * .. |
| 127 | 1 | pfleura2 | * .. External Subroutines .. |
| 128 | 1 | pfleura2 | EXTERNAL XERBLA |
| 129 | 1 | pfleura2 | * .. |
| 130 | 1 | pfleura2 | * .. Intrinsic Functions .. |
| 131 | 1 | pfleura2 | INTRINSIC DBLE,DCMPLX,DCONJG,MAX |
| 132 | 1 | pfleura2 | * .. |
| 133 | 1 | pfleura2 | * .. Local Scalars .. |
| 134 | 1 | pfleura2 | DOUBLE COMPLEX TEMP |
| 135 | 1 | pfleura2 | DOUBLE PRECISION RTEMP |
| 136 | 1 | pfleura2 | INTEGER I,INFO,J,L,NROWA |
| 137 | 1 | pfleura2 | LOGICAL UPPER |
| 138 | 1 | pfleura2 | * .. |
| 139 | 1 | pfleura2 | * .. Parameters .. |
| 140 | 1 | pfleura2 | DOUBLE PRECISION ONE,ZERO |
| 141 | 1 | pfleura2 | PARAMETER (ONE=1.0D+0,ZERO=0.0D+0) |
| 142 | 1 | pfleura2 | * .. |
| 143 | 1 | pfleura2 | * |
| 144 | 1 | pfleura2 | * Test the input parameters. |
| 145 | 1 | pfleura2 | * |
| 146 | 1 | pfleura2 | IF (LSAME(TRANS,'N')) THEN |
| 147 | 1 | pfleura2 | NROWA = N |
| 148 | 1 | pfleura2 | ELSE |
| 149 | 1 | pfleura2 | NROWA = K |
| 150 | 1 | pfleura2 | END IF |
| 151 | 1 | pfleura2 | UPPER = LSAME(UPLO,'U') |
| 152 | 1 | pfleura2 | * |
| 153 | 1 | pfleura2 | INFO = 0 |
| 154 | 1 | pfleura2 | IF ((.NOT.UPPER) .AND. (.NOT.LSAME(UPLO,'L'))) THEN |
| 155 | 1 | pfleura2 | INFO = 1 |
| 156 | 1 | pfleura2 | ELSE IF ((.NOT.LSAME(TRANS,'N')) .AND. |
| 157 | 1 | pfleura2 | + (.NOT.LSAME(TRANS,'C'))) THEN |
| 158 | 1 | pfleura2 | INFO = 2 |
| 159 | 1 | pfleura2 | ELSE IF (N.LT.0) THEN |
| 160 | 1 | pfleura2 | INFO = 3 |
| 161 | 1 | pfleura2 | ELSE IF (K.LT.0) THEN |
| 162 | 1 | pfleura2 | INFO = 4 |
| 163 | 1 | pfleura2 | ELSE IF (LDA.LT.MAX(1,NROWA)) THEN |
| 164 | 1 | pfleura2 | INFO = 7 |
| 165 | 1 | pfleura2 | ELSE IF (LDC.LT.MAX(1,N)) THEN |
| 166 | 1 | pfleura2 | INFO = 10 |
| 167 | 1 | pfleura2 | END IF |
| 168 | 1 | pfleura2 | IF (INFO.NE.0) THEN |
| 169 | 1 | pfleura2 | CALL XERBLA('ZHERK ',INFO)
|
| 170 | 1 | pfleura2 | RETURN |
| 171 | 1 | pfleura2 | END IF |
| 172 | 1 | pfleura2 | * |
| 173 | 1 | pfleura2 | * Quick return if possible. |
| 174 | 1 | pfleura2 | * |
| 175 | 1 | pfleura2 | IF ((N.EQ.0) .OR. (((ALPHA.EQ.ZERO).OR. |
| 176 | 1 | pfleura2 | + (K.EQ.0)).AND. (BETA.EQ.ONE))) RETURN |
| 177 | 1 | pfleura2 | * |
| 178 | 1 | pfleura2 | * And when alpha.eq.zero. |
| 179 | 1 | pfleura2 | * |
| 180 | 1 | pfleura2 | IF (ALPHA.EQ.ZERO) THEN |
| 181 | 1 | pfleura2 | IF (UPPER) THEN |
| 182 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
| 183 | 1 | pfleura2 | DO 20 J = 1,N |
| 184 | 1 | pfleura2 | DO 10 I = 1,J |
| 185 | 1 | pfleura2 | C(I,J) = ZERO |
| 186 | 1 | pfleura2 | 10 CONTINUE |
| 187 | 1 | pfleura2 | 20 CONTINUE |
| 188 | 1 | pfleura2 | ELSE |
| 189 | 1 | pfleura2 | DO 40 J = 1,N |
| 190 | 1 | pfleura2 | DO 30 I = 1,J - 1 |
| 191 | 1 | pfleura2 | C(I,J) = BETA*C(I,J) |
| 192 | 1 | pfleura2 | 30 CONTINUE |
| 193 | 1 | pfleura2 | C(J,J) = BETA*DBLE(C(J,J)) |
| 194 | 1 | pfleura2 | 40 CONTINUE |
| 195 | 1 | pfleura2 | END IF |
| 196 | 1 | pfleura2 | ELSE |
| 197 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
| 198 | 1 | pfleura2 | DO 60 J = 1,N |
| 199 | 1 | pfleura2 | DO 50 I = J,N |
| 200 | 1 | pfleura2 | C(I,J) = ZERO |
| 201 | 1 | pfleura2 | 50 CONTINUE |
| 202 | 1 | pfleura2 | 60 CONTINUE |
| 203 | 1 | pfleura2 | ELSE |
| 204 | 1 | pfleura2 | DO 80 J = 1,N |
| 205 | 1 | pfleura2 | C(J,J) = BETA*DBLE(C(J,J)) |
| 206 | 1 | pfleura2 | DO 70 I = J + 1,N |
| 207 | 1 | pfleura2 | C(I,J) = BETA*C(I,J) |
| 208 | 1 | pfleura2 | 70 CONTINUE |
| 209 | 1 | pfleura2 | 80 CONTINUE |
| 210 | 1 | pfleura2 | END IF |
| 211 | 1 | pfleura2 | END IF |
| 212 | 1 | pfleura2 | RETURN |
| 213 | 1 | pfleura2 | END IF |
| 214 | 1 | pfleura2 | * |
| 215 | 1 | pfleura2 | * Start the operations. |
| 216 | 1 | pfleura2 | * |
| 217 | 1 | pfleura2 | IF (LSAME(TRANS,'N')) THEN |
| 218 | 1 | pfleura2 | * |
| 219 | 1 | pfleura2 | * Form C := alpha*A*conjg( A' ) + beta*C. |
| 220 | 1 | pfleura2 | * |
| 221 | 1 | pfleura2 | IF (UPPER) THEN |
| 222 | 1 | pfleura2 | DO 130 J = 1,N |
| 223 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
| 224 | 1 | pfleura2 | DO 90 I = 1,J |
| 225 | 1 | pfleura2 | C(I,J) = ZERO |
| 226 | 1 | pfleura2 | 90 CONTINUE |
| 227 | 1 | pfleura2 | ELSE IF (BETA.NE.ONE) THEN |
| 228 | 1 | pfleura2 | DO 100 I = 1,J - 1 |
| 229 | 1 | pfleura2 | C(I,J) = BETA*C(I,J) |
| 230 | 1 | pfleura2 | 100 CONTINUE |
| 231 | 1 | pfleura2 | C(J,J) = BETA*DBLE(C(J,J)) |
| 232 | 1 | pfleura2 | ELSE |
| 233 | 1 | pfleura2 | C(J,J) = DBLE(C(J,J)) |
| 234 | 1 | pfleura2 | END IF |
| 235 | 1 | pfleura2 | DO 120 L = 1,K |
| 236 | 1 | pfleura2 | IF (A(J,L).NE.DCMPLX(ZERO)) THEN |
| 237 | 1 | pfleura2 | TEMP = ALPHA*DCONJG(A(J,L)) |
| 238 | 1 | pfleura2 | DO 110 I = 1,J - 1 |
| 239 | 1 | pfleura2 | C(I,J) = C(I,J) + TEMP*A(I,L) |
| 240 | 1 | pfleura2 | 110 CONTINUE |
| 241 | 1 | pfleura2 | C(J,J) = DBLE(C(J,J)) + DBLE(TEMP*A(I,L)) |
| 242 | 1 | pfleura2 | END IF |
| 243 | 1 | pfleura2 | 120 CONTINUE |
| 244 | 1 | pfleura2 | 130 CONTINUE |
| 245 | 1 | pfleura2 | ELSE |
| 246 | 1 | pfleura2 | DO 180 J = 1,N |
| 247 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
| 248 | 1 | pfleura2 | DO 140 I = J,N |
| 249 | 1 | pfleura2 | C(I,J) = ZERO |
| 250 | 1 | pfleura2 | 140 CONTINUE |
| 251 | 1 | pfleura2 | ELSE IF (BETA.NE.ONE) THEN |
| 252 | 1 | pfleura2 | C(J,J) = BETA*DBLE(C(J,J)) |
| 253 | 1 | pfleura2 | DO 150 I = J + 1,N |
| 254 | 1 | pfleura2 | C(I,J) = BETA*C(I,J) |
| 255 | 1 | pfleura2 | 150 CONTINUE |
| 256 | 1 | pfleura2 | ELSE |
| 257 | 1 | pfleura2 | C(J,J) = DBLE(C(J,J)) |
| 258 | 1 | pfleura2 | END IF |
| 259 | 1 | pfleura2 | DO 170 L = 1,K |
| 260 | 1 | pfleura2 | IF (A(J,L).NE.DCMPLX(ZERO)) THEN |
| 261 | 1 | pfleura2 | TEMP = ALPHA*DCONJG(A(J,L)) |
| 262 | 1 | pfleura2 | C(J,J) = DBLE(C(J,J)) + DBLE(TEMP*A(J,L)) |
| 263 | 1 | pfleura2 | DO 160 I = J + 1,N |
| 264 | 1 | pfleura2 | C(I,J) = C(I,J) + TEMP*A(I,L) |
| 265 | 1 | pfleura2 | 160 CONTINUE |
| 266 | 1 | pfleura2 | END IF |
| 267 | 1 | pfleura2 | 170 CONTINUE |
| 268 | 1 | pfleura2 | 180 CONTINUE |
| 269 | 1 | pfleura2 | END IF |
| 270 | 1 | pfleura2 | ELSE |
| 271 | 1 | pfleura2 | * |
| 272 | 1 | pfleura2 | * Form C := alpha*conjg( A' )*A + beta*C. |
| 273 | 1 | pfleura2 | * |
| 274 | 1 | pfleura2 | IF (UPPER) THEN |
| 275 | 1 | pfleura2 | DO 220 J = 1,N |
| 276 | 1 | pfleura2 | DO 200 I = 1,J - 1 |
| 277 | 1 | pfleura2 | TEMP = ZERO |
| 278 | 1 | pfleura2 | DO 190 L = 1,K |
| 279 | 1 | pfleura2 | TEMP = TEMP + DCONJG(A(L,I))*A(L,J) |
| 280 | 1 | pfleura2 | 190 CONTINUE |
| 281 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
| 282 | 1 | pfleura2 | C(I,J) = ALPHA*TEMP |
| 283 | 1 | pfleura2 | ELSE |
| 284 | 1 | pfleura2 | C(I,J) = ALPHA*TEMP + BETA*C(I,J) |
| 285 | 1 | pfleura2 | END IF |
| 286 | 1 | pfleura2 | 200 CONTINUE |
| 287 | 1 | pfleura2 | RTEMP = ZERO |
| 288 | 1 | pfleura2 | DO 210 L = 1,K |
| 289 | 1 | pfleura2 | RTEMP = RTEMP + DCONJG(A(L,J))*A(L,J) |
| 290 | 1 | pfleura2 | 210 CONTINUE |
| 291 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
| 292 | 1 | pfleura2 | C(J,J) = ALPHA*RTEMP |
| 293 | 1 | pfleura2 | ELSE |
| 294 | 1 | pfleura2 | C(J,J) = ALPHA*RTEMP + BETA*DBLE(C(J,J)) |
| 295 | 1 | pfleura2 | END IF |
| 296 | 1 | pfleura2 | 220 CONTINUE |
| 297 | 1 | pfleura2 | ELSE |
| 298 | 1 | pfleura2 | DO 260 J = 1,N |
| 299 | 1 | pfleura2 | RTEMP = ZERO |
| 300 | 1 | pfleura2 | DO 230 L = 1,K |
| 301 | 1 | pfleura2 | RTEMP = RTEMP + DCONJG(A(L,J))*A(L,J) |
| 302 | 1 | pfleura2 | 230 CONTINUE |
| 303 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
| 304 | 1 | pfleura2 | C(J,J) = ALPHA*RTEMP |
| 305 | 1 | pfleura2 | ELSE |
| 306 | 1 | pfleura2 | C(J,J) = ALPHA*RTEMP + BETA*DBLE(C(J,J)) |
| 307 | 1 | pfleura2 | END IF |
| 308 | 1 | pfleura2 | DO 250 I = J + 1,N |
| 309 | 1 | pfleura2 | TEMP = ZERO |
| 310 | 1 | pfleura2 | DO 240 L = 1,K |
| 311 | 1 | pfleura2 | TEMP = TEMP + DCONJG(A(L,I))*A(L,J) |
| 312 | 1 | pfleura2 | 240 CONTINUE |
| 313 | 1 | pfleura2 | IF (BETA.EQ.ZERO) THEN |
| 314 | 1 | pfleura2 | C(I,J) = ALPHA*TEMP |
| 315 | 1 | pfleura2 | ELSE |
| 316 | 1 | pfleura2 | C(I,J) = ALPHA*TEMP + BETA*C(I,J) |
| 317 | 1 | pfleura2 | END IF |
| 318 | 1 | pfleura2 | 250 CONTINUE |
| 319 | 1 | pfleura2 | 260 CONTINUE |
| 320 | 1 | pfleura2 | END IF |
| 321 | 1 | pfleura2 | END IF |
| 322 | 1 | pfleura2 | * |
| 323 | 1 | pfleura2 | RETURN |
| 324 | 1 | pfleura2 | * |
| 325 | 1 | pfleura2 | * End of ZHERK . |
| 326 | 1 | pfleura2 | * |
| 327 | 1 | pfleura2 | END |