| 1 |
/* ./src_f77/cher2k.f -- translated by f2c (version 20030320). |
| 2 |
You must link the resulting object file with the libraries: |
| 3 |
-lf2c -lm (in that order) |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <punc/vf2c.h> |
| 7 |
|
| 8 |
/* Subroutine */ int cher2k_(char *uplo, char *trans, integer *n, integer *k, |
| 9 |
realcomplex *alpha, realcomplex *a, integer *lda, realcomplex *b, integer *ldb, |
| 10 |
real *beta, realcomplex *c__, integer *ldc, ftnlen uplo_len, ftnlen |
| 11 |
trans_len) |
| 12 |
{ |
| 13 |
/* System generated locals */ |
| 14 |
integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2, |
| 15 |
i__3, i__4, i__5, i__6, i__7; |
| 16 |
real r__1; |
| 17 |
realcomplex q__1, q__2, q__3, q__4, q__5, q__6; |
| 18 |
|
| 19 |
/* Builtin functions */ |
| 20 |
void r_cnjg(realcomplex *, realcomplex *); |
| 21 |
|
| 22 |
/* Local variables */ |
| 23 |
static integer i__, j, l, info; |
| 24 |
static realcomplex temp1, temp2; |
| 25 |
extern logical lsame_(char *, char *, ftnlen, ftnlen); |
| 26 |
static integer nrowa; |
| 27 |
static logical upper; |
| 28 |
extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen); |
| 29 |
|
| 30 |
/* .. Scalar Arguments .. */ |
| 31 |
/* .. Array Arguments .. */ |
| 32 |
/* .. */ |
| 33 |
|
| 34 |
/* Purpose */ |
| 35 |
/* ======= */ |
| 36 |
|
| 37 |
/* CHER2K performs one of the hermitian rank 2k operations */ |
| 38 |
|
| 39 |
/* C := alpha*A*conjg( B' ) + conjg( alpha )*B*conjg( A' ) + beta*C, */ |
| 40 |
|
| 41 |
/* or */ |
| 42 |
|
| 43 |
/* C := alpha*conjg( A' )*B + conjg( alpha )*conjg( B' )*A + beta*C, */ |
| 44 |
|
| 45 |
/* where alpha and beta are scalars with beta real, C is an n by n */ |
| 46 |
/* hermitian matrix and A and B are n by k matrices in the first case */ |
| 47 |
/* and k by n matrices in the second case. */ |
| 48 |
|
| 49 |
/* Parameters */ |
| 50 |
/* ========== */ |
| 51 |
|
| 52 |
/* UPLO - CHARACTER*1. */ |
| 53 |
/* On entry, UPLO specifies whether the upper or lower */ |
| 54 |
/* triangular part of the array C is to be referenced as */ |
| 55 |
/* follows: */ |
| 56 |
|
| 57 |
/* UPLO = 'U' or 'u' Only the upper triangular part of C */ |
| 58 |
/* is to be referenced. */ |
| 59 |
|
| 60 |
/* UPLO = 'L' or 'l' Only the lower triangular part of C */ |
| 61 |
/* is to be referenced. */ |
| 62 |
|
| 63 |
/* Unchanged on exit. */ |
| 64 |
|
| 65 |
/* TRANS - CHARACTER*1. */ |
| 66 |
/* On entry, TRANS specifies the operation to be performed as */ |
| 67 |
/* follows: */ |
| 68 |
|
| 69 |
/* TRANS = 'N' or 'n' C := alpha*A*conjg( B' ) + */ |
| 70 |
/* conjg( alpha )*B*conjg( A' ) + */ |
| 71 |
/* beta*C. */ |
| 72 |
|
| 73 |
/* TRANS = 'C' or 'c' C := alpha*conjg( A' )*B + */ |
| 74 |
/* conjg( alpha )*conjg( B' )*A + */ |
| 75 |
/* beta*C. */ |
| 76 |
|
| 77 |
/* Unchanged on exit. */ |
| 78 |
|
| 79 |
/* N - INTEGER. */ |
| 80 |
/* On entry, N specifies the order of the matrix C. N must be */ |
| 81 |
/* at least zero. */ |
| 82 |
/* Unchanged on exit. */ |
| 83 |
|
| 84 |
/* K - INTEGER. */ |
| 85 |
/* On entry with TRANS = 'N' or 'n', K specifies the number */ |
| 86 |
/* of columns of the matrices A and B, and on entry with */ |
| 87 |
/* TRANS = 'C' or 'c', K specifies the number of rows of the */ |
| 88 |
/* matrices A and B. K must be at least zero. */ |
| 89 |
/* Unchanged on exit. */ |
| 90 |
|
| 91 |
/* ALPHA - COMPLEX . */ |
| 92 |
/* On entry, ALPHA specifies the scalar alpha. */ |
| 93 |
/* Unchanged on exit. */ |
| 94 |
|
| 95 |
/* A - COMPLEX array of DIMENSION ( LDA, ka ), where ka is */ |
| 96 |
/* k when TRANS = 'N' or 'n', and is n otherwise. */ |
| 97 |
/* Before entry with TRANS = 'N' or 'n', the leading n by k */ |
| 98 |
/* part of the array A must contain the matrix A, otherwise */ |
| 99 |
/* the leading k by n part of the array A must contain the */ |
| 100 |
/* matrix A. */ |
| 101 |
/* Unchanged on exit. */ |
| 102 |
|
| 103 |
/* LDA - INTEGER. */ |
| 104 |
/* On entry, LDA specifies the first dimension of A as declared */ |
| 105 |
/* in the calling (sub) program. When TRANS = 'N' or 'n' */ |
| 106 |
/* then LDA must be at least max( 1, n ), otherwise LDA must */ |
| 107 |
/* be at least max( 1, k ). */ |
| 108 |
/* Unchanged on exit. */ |
| 109 |
|
| 110 |
/* B - COMPLEX array of DIMENSION ( LDB, kb ), where kb is */ |
| 111 |
/* k when TRANS = 'N' or 'n', and is n otherwise. */ |
| 112 |
/* Before entry with TRANS = 'N' or 'n', the leading n by k */ |
| 113 |
/* part of the array B must contain the matrix B, otherwise */ |
| 114 |
/* the leading k by n part of the array B must contain the */ |
| 115 |
/* matrix B. */ |
| 116 |
/* Unchanged on exit. */ |
| 117 |
|
| 118 |
/* LDB - INTEGER. */ |
| 119 |
/* On entry, LDB specifies the first dimension of B as declared */ |
| 120 |
/* in the calling (sub) program. When TRANS = 'N' or 'n' */ |
| 121 |
/* then LDB must be at least max( 1, n ), otherwise LDB must */ |
| 122 |
/* be at least max( 1, k ). */ |
| 123 |
/* Unchanged on exit. */ |
| 124 |
|
| 125 |
/* BETA - REAL . */ |
| 126 |
/* On entry, BETA specifies the scalar beta. */ |
| 127 |
/* Unchanged on exit. */ |
| 128 |
|
| 129 |
/* C - COMPLEX array of DIMENSION ( LDC, n ). */ |
| 130 |
/* Before entry with UPLO = 'U' or 'u', the leading n by n */ |
| 131 |
/* upper triangular part of the array C must contain the upper */ |
| 132 |
/* triangular part of the hermitian matrix and the strictly */ |
| 133 |
/* lower triangular part of C is not referenced. On exit, the */ |
| 134 |
/* upper triangular part of the array C is overwritten by the */ |
| 135 |
/* upper triangular part of the updated matrix. */ |
| 136 |
/* Before entry with UPLO = 'L' or 'l', the leading n by n */ |
| 137 |
/* lower triangular part of the array C must contain the lower */ |
| 138 |
/* triangular part of the hermitian matrix and the strictly */ |
| 139 |
/* upper triangular part of C is not referenced. On exit, the */ |
| 140 |
/* lower triangular part of the array C is overwritten by the */ |
| 141 |
/* lower triangular part of the updated matrix. */ |
| 142 |
/* Note that the imaginary parts of the diagonal elements need */ |
| 143 |
/* not be set, they are assumed to be zero, and on exit they */ |
| 144 |
/* are set to zero. */ |
| 145 |
|
| 146 |
/* LDC - INTEGER. */ |
| 147 |
/* On entry, LDC specifies the first dimension of C as declared */ |
| 148 |
/* in the calling (sub) program. LDC must be at least */ |
| 149 |
/* max( 1, n ). */ |
| 150 |
/* Unchanged on exit. */ |
| 151 |
|
| 152 |
|
| 153 |
/* Level 3 Blas routine. */ |
| 154 |
|
| 155 |
/* -- Written on 8-February-1989. */ |
| 156 |
/* Jack Dongarra, Argonne National Laboratory. */ |
| 157 |
/* Iain Duff, AERE Harwell. */ |
| 158 |
/* Jeremy Du Croz, Numerical Algorithms Group Ltd. */ |
| 159 |
/* Sven Hammarling, Numerical Algorithms Group Ltd. */ |
| 160 |
|
| 161 |
/* -- Modified 8-Nov-93 to set C(J,J) to REAL( C(J,J) ) when BETA = 1. */ |
| 162 |
/* Ed Anderson, Cray Research Inc. */ |
| 163 |
|
| 164 |
|
| 165 |
/* .. External Functions .. */ |
| 166 |
/* .. External Subroutines .. */ |
| 167 |
/* .. Intrinsic Functions .. */ |
| 168 |
/* .. Local Scalars .. */ |
| 169 |
/* .. Parameters .. */ |
| 170 |
/* .. */ |
| 171 |
/* .. Executable Statements .. */ |
| 172 |
|
| 173 |
/* Test the input parameters. */ |
| 174 |
|
| 175 |
/* Parameter adjustments */ |
| 176 |
a_dim1 = *lda; |
| 177 |
a_offset = 1 + a_dim1; |
| 178 |
a -= a_offset; |
| 179 |
b_dim1 = *ldb; |
| 180 |
b_offset = 1 + b_dim1; |
| 181 |
b -= b_offset; |
| 182 |
c_dim1 = *ldc; |
| 183 |
c_offset = 1 + c_dim1; |
| 184 |
c__ -= c_offset; |
| 185 |
|
| 186 |
/* Function Body */ |
| 187 |
if (lsame_(trans, "N", (ftnlen)1, (ftnlen)1)) { |
| 188 |
nrowa = *n; |
| 189 |
} else { |
| 190 |
nrowa = *k; |
| 191 |
} |
| 192 |
upper = lsame_(uplo, "U", (ftnlen)1, (ftnlen)1); |
| 193 |
|
| 194 |
info = 0; |
| 195 |
if (! upper && ! lsame_(uplo, "L", (ftnlen)1, (ftnlen)1)) { |
| 196 |
info = 1; |
| 197 |
} else if (! lsame_(trans, "N", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, |
| 198 |
"C", (ftnlen)1, (ftnlen)1)) { |
| 199 |
info = 2; |
| 200 |
} else if (*n < 0) { |
| 201 |
info = 3; |
| 202 |
} else if (*k < 0) { |
| 203 |
info = 4; |
| 204 |
} else if (*lda < max(1,nrowa)) { |
| 205 |
info = 7; |
| 206 |
} else if (*ldb < max(1,nrowa)) { |
| 207 |
info = 9; |
| 208 |
} else if (*ldc < max(1,*n)) { |
| 209 |
info = 12; |
| 210 |
} |
| 211 |
if (info != 0) { |
| 212 |
xerbla_("CHER2K", &info, (ftnlen)6); |
| 213 |
return 0; |
| 214 |
} |
| 215 |
|
| 216 |
/* Quick return if possible. */ |
| 217 |
|
| 218 |
if (*n == 0 || (alpha->r == 0.f && alpha->i == 0.f || *k == 0) && *beta == |
| 219 |
1.f) { |
| 220 |
return 0; |
| 221 |
} |
| 222 |
|
| 223 |
/* And when alpha.eq.zero. */ |
| 224 |
|
| 225 |
if (alpha->r == 0.f && alpha->i == 0.f) { |
| 226 |
if (upper) { |
| 227 |
if (*beta == 0.f) { |
| 228 |
i__1 = *n; |
| 229 |
for (j = 1; j <= i__1; ++j) { |
| 230 |
i__2 = j; |
| 231 |
for (i__ = 1; i__ <= i__2; ++i__) { |
| 232 |
i__3 = i__ + j * c_dim1; |
| 233 |
c__[i__3].r = 0.f, c__[i__3].i = 0.f; |
| 234 |
/* L10: */ |
| 235 |
} |
| 236 |
/* L20: */ |
| 237 |
} |
| 238 |
} else { |
| 239 |
i__1 = *n; |
| 240 |
for (j = 1; j <= i__1; ++j) { |
| 241 |
i__2 = j - 1; |
| 242 |
for (i__ = 1; i__ <= i__2; ++i__) { |
| 243 |
i__3 = i__ + j * c_dim1; |
| 244 |
i__4 = i__ + j * c_dim1; |
| 245 |
q__1.r = *beta * c__[i__4].r, q__1.i = *beta * c__[ |
| 246 |
i__4].i; |
| 247 |
c__[i__3].r = q__1.r, c__[i__3].i = q__1.i; |
| 248 |
/* L30: */ |
| 249 |
} |
| 250 |
i__2 = j + j * c_dim1; |
| 251 |
i__3 = j + j * c_dim1; |
| 252 |
r__1 = *beta * c__[i__3].r; |
| 253 |
c__[i__2].r = r__1, c__[i__2].i = 0.f; |
| 254 |
/* L40: */ |
| 255 |
} |
| 256 |
} |
| 257 |
} else { |
| 258 |
if (*beta == 0.f) { |
| 259 |
i__1 = *n; |
| 260 |
for (j = 1; j <= i__1; ++j) { |
| 261 |
i__2 = *n; |
| 262 |
for (i__ = j; i__ <= i__2; ++i__) { |
| 263 |
i__3 = i__ + j * c_dim1; |
| 264 |
c__[i__3].r = 0.f, c__[i__3].i = 0.f; |
| 265 |
/* L50: */ |
| 266 |
} |
| 267 |
/* L60: */ |
| 268 |
} |
| 269 |
} else { |
| 270 |
i__1 = *n; |
| 271 |
for (j = 1; j <= i__1; ++j) { |
| 272 |
i__2 = j + j * c_dim1; |
| 273 |
i__3 = j + j * c_dim1; |
| 274 |
r__1 = *beta * c__[i__3].r; |
| 275 |
c__[i__2].r = r__1, c__[i__2].i = 0.f; |
| 276 |
i__2 = *n; |
| 277 |
for (i__ = j + 1; i__ <= i__2; ++i__) { |
| 278 |
i__3 = i__ + j * c_dim1; |
| 279 |
i__4 = i__ + j * c_dim1; |
| 280 |
q__1.r = *beta * c__[i__4].r, q__1.i = *beta * c__[ |
| 281 |
i__4].i; |
| 282 |
c__[i__3].r = q__1.r, c__[i__3].i = q__1.i; |
| 283 |
/* L70: */ |
| 284 |
} |
| 285 |
/* L80: */ |
| 286 |
} |
| 287 |
} |
| 288 |
} |
| 289 |
return 0; |
| 290 |
} |
| 291 |
|
| 292 |
/* Start the operations. */ |
| 293 |
|
| 294 |
if (lsame_(trans, "N", (ftnlen)1, (ftnlen)1)) { |
| 295 |
|
| 296 |
/* Form C := alpha*A*conjg( B' ) + conjg( alpha )*B*conjg( A' ) + */ |
| 297 |
/* C. */ |
| 298 |
|
| 299 |
if (upper) { |
| 300 |
i__1 = *n; |
| 301 |
for (j = 1; j <= i__1; ++j) { |
| 302 |
if (*beta == 0.f) { |
| 303 |
i__2 = j; |
| 304 |
for (i__ = 1; i__ <= i__2; ++i__) { |
| 305 |
i__3 = i__ + j * c_dim1; |
| 306 |
c__[i__3].r = 0.f, c__[i__3].i = 0.f; |
| 307 |
/* L90: */ |
| 308 |
} |
| 309 |
} else if (*beta != 1.f) { |
| 310 |
i__2 = j - 1; |
| 311 |
for (i__ = 1; i__ <= i__2; ++i__) { |
| 312 |
i__3 = i__ + j * c_dim1; |
| 313 |
i__4 = i__ + j * c_dim1; |
| 314 |
q__1.r = *beta * c__[i__4].r, q__1.i = *beta * c__[ |
| 315 |
i__4].i; |
| 316 |
c__[i__3].r = q__1.r, c__[i__3].i = q__1.i; |
| 317 |
/* L100: */ |
| 318 |
} |
| 319 |
i__2 = j + j * c_dim1; |
| 320 |
i__3 = j + j * c_dim1; |
| 321 |
r__1 = *beta * c__[i__3].r; |
| 322 |
c__[i__2].r = r__1, c__[i__2].i = 0.f; |
| 323 |
} else { |
| 324 |
i__2 = j + j * c_dim1; |
| 325 |
i__3 = j + j * c_dim1; |
| 326 |
r__1 = c__[i__3].r; |
| 327 |
c__[i__2].r = r__1, c__[i__2].i = 0.f; |
| 328 |
} |
| 329 |
i__2 = *k; |
| 330 |
for (l = 1; l <= i__2; ++l) { |
| 331 |
i__3 = j + l * a_dim1; |
| 332 |
i__4 = j + l * b_dim1; |
| 333 |
if (a[i__3].r != 0.f || a[i__3].i != 0.f || (b[i__4].r != |
| 334 |
0.f || b[i__4].i != 0.f)) { |
| 335 |
r_cnjg(&q__2, &b[j + l * b_dim1]); |
| 336 |
q__1.r = alpha->r * q__2.r - alpha->i * q__2.i, |
| 337 |
q__1.i = alpha->r * q__2.i + alpha->i * |
| 338 |
q__2.r; |
| 339 |
temp1.r = q__1.r, temp1.i = q__1.i; |
| 340 |
i__3 = j + l * a_dim1; |
| 341 |
q__2.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i, |
| 342 |
q__2.i = alpha->r * a[i__3].i + alpha->i * a[ |
| 343 |
i__3].r; |
| 344 |
r_cnjg(&q__1, &q__2); |
| 345 |
temp2.r = q__1.r, temp2.i = q__1.i; |
| 346 |
i__3 = j - 1; |
| 347 |
for (i__ = 1; i__ <= i__3; ++i__) { |
| 348 |
i__4 = i__ + j * c_dim1; |
| 349 |
i__5 = i__ + j * c_dim1; |
| 350 |
i__6 = i__ + l * a_dim1; |
| 351 |
q__3.r = a[i__6].r * temp1.r - a[i__6].i * |
| 352 |
temp1.i, q__3.i = a[i__6].r * temp1.i + a[ |
| 353 |
i__6].i * temp1.r; |
| 354 |
q__2.r = c__[i__5].r + q__3.r, q__2.i = c__[i__5] |
| 355 |
.i + q__3.i; |
| 356 |
i__7 = i__ + l * b_dim1; |
| 357 |
q__4.r = b[i__7].r * temp2.r - b[i__7].i * |
| 358 |
temp2.i, q__4.i = b[i__7].r * temp2.i + b[ |
| 359 |
i__7].i * temp2.r; |
| 360 |
q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + |
| 361 |
q__4.i; |
| 362 |
c__[i__4].r = q__1.r, c__[i__4].i = q__1.i; |
| 363 |
/* L110: */ |
| 364 |
} |
| 365 |
i__3 = j + j * c_dim1; |
| 366 |
i__4 = j + j * c_dim1; |
| 367 |
i__5 = j + l * a_dim1; |
| 368 |
q__2.r = a[i__5].r * temp1.r - a[i__5].i * temp1.i, |
| 369 |
q__2.i = a[i__5].r * temp1.i + a[i__5].i * |
| 370 |
temp1.r; |
| 371 |
i__6 = j + l * b_dim1; |
| 372 |
q__3.r = b[i__6].r * temp2.r - b[i__6].i * temp2.i, |
| 373 |
q__3.i = b[i__6].r * temp2.i + b[i__6].i * |
| 374 |
temp2.r; |
| 375 |
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i; |
| 376 |
r__1 = c__[i__4].r + q__1.r; |
| 377 |
c__[i__3].r = r__1, c__[i__3].i = 0.f; |
| 378 |
} |
| 379 |
/* L120: */ |
| 380 |
} |
| 381 |
/* L130: */ |
| 382 |
} |
| 383 |
} else { |
| 384 |
i__1 = *n; |
| 385 |
for (j = 1; j <= i__1; ++j) { |
| 386 |
if (*beta == 0.f) { |
| 387 |
i__2 = *n; |
| 388 |
for (i__ = j; i__ <= i__2; ++i__) { |
| 389 |
i__3 = i__ + j * c_dim1; |
| 390 |
c__[i__3].r = 0.f, c__[i__3].i = 0.f; |
| 391 |
/* L140: */ |
| 392 |
} |
| 393 |
} else if (*beta != 1.f) { |
| 394 |
i__2 = *n; |
| 395 |
for (i__ = j + 1; i__ <= i__2; ++i__) { |
| 396 |
i__3 = i__ + j * c_dim1; |
| 397 |
i__4 = i__ + j * c_dim1; |
| 398 |
q__1.r = *beta * c__[i__4].r, q__1.i = *beta * c__[ |
| 399 |
i__4].i; |
| 400 |
c__[i__3].r = q__1.r, c__[i__3].i = q__1.i; |
| 401 |
/* L150: */ |
| 402 |
} |
| 403 |
i__2 = j + j * c_dim1; |
| 404 |
i__3 = j + j * c_dim1; |
| 405 |
r__1 = *beta * c__[i__3].r; |
| 406 |
c__[i__2].r = r__1, c__[i__2].i = 0.f; |
| 407 |
} else { |
| 408 |
i__2 = j + j * c_dim1; |
| 409 |
i__3 = j + j * c_dim1; |
| 410 |
r__1 = c__[i__3].r; |
| 411 |
c__[i__2].r = r__1, c__[i__2].i = 0.f; |
| 412 |
} |
| 413 |
i__2 = *k; |
| 414 |
for (l = 1; l <= i__2; ++l) { |
| 415 |
i__3 = j + l * a_dim1; |
| 416 |
i__4 = j + l * b_dim1; |
| 417 |
if (a[i__3].r != 0.f || a[i__3].i != 0.f || (b[i__4].r != |
| 418 |
0.f || b[i__4].i != 0.f)) { |
| 419 |
r_cnjg(&q__2, &b[j + l * b_dim1]); |
| 420 |
q__1.r = alpha->r * q__2.r - alpha->i * q__2.i, |
| 421 |
q__1.i = alpha->r * q__2.i + alpha->i * |
| 422 |
q__2.r; |
| 423 |
temp1.r = q__1.r, temp1.i = q__1.i; |
| 424 |
i__3 = j + l * a_dim1; |
| 425 |
q__2.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i, |
| 426 |
q__2.i = alpha->r * a[i__3].i + alpha->i * a[ |
| 427 |
i__3].r; |
| 428 |
r_cnjg(&q__1, &q__2); |
| 429 |
temp2.r = q__1.r, temp2.i = q__1.i; |
| 430 |
i__3 = *n; |
| 431 |
for (i__ = j + 1; i__ <= i__3; ++i__) { |
| 432 |
i__4 = i__ + j * c_dim1; |
| 433 |
i__5 = i__ + j * c_dim1; |
| 434 |
i__6 = i__ + l * a_dim1; |
| 435 |
q__3.r = a[i__6].r * temp1.r - a[i__6].i * |
| 436 |
temp1.i, q__3.i = a[i__6].r * temp1.i + a[ |
| 437 |
i__6].i * temp1.r; |
| 438 |
q__2.r = c__[i__5].r + q__3.r, q__2.i = c__[i__5] |
| 439 |
.i + q__3.i; |
| 440 |
i__7 = i__ + l * b_dim1; |
| 441 |
q__4.r = b[i__7].r * temp2.r - b[i__7].i * |
| 442 |
temp2.i, q__4.i = b[i__7].r * temp2.i + b[ |
| 443 |
i__7].i * temp2.r; |
| 444 |
q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + |
| 445 |
q__4.i; |
| 446 |
c__[i__4].r = q__1.r, c__[i__4].i = q__1.i; |
| 447 |
/* L160: */ |
| 448 |
} |
| 449 |
i__3 = j + j * c_dim1; |
| 450 |
i__4 = j + j * c_dim1; |
| 451 |
i__5 = j + l * a_dim1; |
| 452 |
q__2.r = a[i__5].r * temp1.r - a[i__5].i * temp1.i, |
| 453 |
q__2.i = a[i__5].r * temp1.i + a[i__5].i * |
| 454 |
temp1.r; |
| 455 |
i__6 = j + l * b_dim1; |
| 456 |
q__3.r = b[i__6].r * temp2.r - b[i__6].i * temp2.i, |
| 457 |
q__3.i = b[i__6].r * temp2.i + b[i__6].i * |
| 458 |
temp2.r; |
| 459 |
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i; |
| 460 |
r__1 = c__[i__4].r + q__1.r; |
| 461 |
c__[i__3].r = r__1, c__[i__3].i = 0.f; |
| 462 |
} |
| 463 |
/* L170: */ |
| 464 |
} |
| 465 |
/* L180: */ |
| 466 |
} |
| 467 |
} |
| 468 |
} else { |
| 469 |
|
| 470 |
/* Form C := alpha*conjg( A' )*B + conjg( alpha )*conjg( B' )*A + */ |
| 471 |
/* C. */ |
| 472 |
|
| 473 |
if (upper) { |
| 474 |
i__1 = *n; |
| 475 |
for (j = 1; j <= i__1; ++j) { |
| 476 |
i__2 = j; |
| 477 |
for (i__ = 1; i__ <= i__2; ++i__) { |
| 478 |
temp1.r = 0.f, temp1.i = 0.f; |
| 479 |
temp2.r = 0.f, temp2.i = 0.f; |
| 480 |
i__3 = *k; |
| 481 |
for (l = 1; l <= i__3; ++l) { |
| 482 |
r_cnjg(&q__3, &a[l + i__ * a_dim1]); |
| 483 |
i__4 = l + j * b_dim1; |
| 484 |
q__2.r = q__3.r * b[i__4].r - q__3.i * b[i__4].i, |
| 485 |
q__2.i = q__3.r * b[i__4].i + q__3.i * b[i__4] |
| 486 |
.r; |
| 487 |
q__1.r = temp1.r + q__2.r, q__1.i = temp1.i + q__2.i; |
| 488 |
temp1.r = q__1.r, temp1.i = q__1.i; |
| 489 |
r_cnjg(&q__3, &b[l + i__ * b_dim1]); |
| 490 |
i__4 = l + j * a_dim1; |
| 491 |
q__2.r = q__3.r * a[i__4].r - q__3.i * a[i__4].i, |
| 492 |
q__2.i = q__3.r * a[i__4].i + q__3.i * a[i__4] |
| 493 |
.r; |
| 494 |
q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i; |
| 495 |
temp2.r = q__1.r, temp2.i = q__1.i; |
| 496 |
/* L190: */ |
| 497 |
} |
| 498 |
if (i__ == j) { |
| 499 |
if (*beta == 0.f) { |
| 500 |
i__3 = j + j * c_dim1; |
| 501 |
q__2.r = alpha->r * temp1.r - alpha->i * temp1.i, |
| 502 |
q__2.i = alpha->r * temp1.i + alpha->i * |
| 503 |
temp1.r; |
| 504 |
r_cnjg(&q__4, alpha); |
| 505 |
q__3.r = q__4.r * temp2.r - q__4.i * temp2.i, |
| 506 |
q__3.i = q__4.r * temp2.i + q__4.i * |
| 507 |
temp2.r; |
| 508 |
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + |
| 509 |
q__3.i; |
| 510 |
r__1 = q__1.r; |
| 511 |
c__[i__3].r = r__1, c__[i__3].i = 0.f; |
| 512 |
} else { |
| 513 |
i__3 = j + j * c_dim1; |
| 514 |
i__4 = j + j * c_dim1; |
| 515 |
q__2.r = alpha->r * temp1.r - alpha->i * temp1.i, |
| 516 |
q__2.i = alpha->r * temp1.i + alpha->i * |
| 517 |
temp1.r; |
| 518 |
r_cnjg(&q__4, alpha); |
| 519 |
q__3.r = q__4.r * temp2.r - q__4.i * temp2.i, |
| 520 |
q__3.i = q__4.r * temp2.i + q__4.i * |
| 521 |
temp2.r; |
| 522 |
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + |
| 523 |
q__3.i; |
| 524 |
r__1 = *beta * c__[i__4].r + q__1.r; |
| 525 |
c__[i__3].r = r__1, c__[i__3].i = 0.f; |
| 526 |
} |
| 527 |
} else { |
| 528 |
if (*beta == 0.f) { |
| 529 |
i__3 = i__ + j * c_dim1; |
| 530 |
q__2.r = alpha->r * temp1.r - alpha->i * temp1.i, |
| 531 |
q__2.i = alpha->r * temp1.i + alpha->i * |
| 532 |
temp1.r; |
| 533 |
r_cnjg(&q__4, alpha); |
| 534 |
q__3.r = q__4.r * temp2.r - q__4.i * temp2.i, |
| 535 |
q__3.i = q__4.r * temp2.i + q__4.i * |
| 536 |
temp2.r; |
| 537 |
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + |
| 538 |
q__3.i; |
| 539 |
c__[i__3].r = q__1.r, c__[i__3].i = q__1.i; |
| 540 |
} else { |
| 541 |
i__3 = i__ + j * c_dim1; |
| 542 |
i__4 = i__ + j * c_dim1; |
| 543 |
q__3.r = *beta * c__[i__4].r, q__3.i = *beta * |
| 544 |
c__[i__4].i; |
| 545 |
q__4.r = alpha->r * temp1.r - alpha->i * temp1.i, |
| 546 |
q__4.i = alpha->r * temp1.i + alpha->i * |
| 547 |
temp1.r; |
| 548 |
q__2.r = q__3.r + q__4.r, q__2.i = q__3.i + |
| 549 |
q__4.i; |
| 550 |
r_cnjg(&q__6, alpha); |
| 551 |
q__5.r = q__6.r * temp2.r - q__6.i * temp2.i, |
| 552 |
q__5.i = q__6.r * temp2.i + q__6.i * |
| 553 |
temp2.r; |
| 554 |
q__1.r = q__2.r + q__5.r, q__1.i = q__2.i + |
| 555 |
q__5.i; |
| 556 |
c__[i__3].r = q__1.r, c__[i__3].i = q__1.i; |
| 557 |
} |
| 558 |
} |
| 559 |
/* L200: */ |
| 560 |
} |
| 561 |
/* L210: */ |
| 562 |
} |
| 563 |
} else { |
| 564 |
i__1 = *n; |
| 565 |
for (j = 1; j <= i__1; ++j) { |
| 566 |
i__2 = *n; |
| 567 |
for (i__ = j; i__ <= i__2; ++i__) { |
| 568 |
temp1.r = 0.f, temp1.i = 0.f; |
| 569 |
temp2.r = 0.f, temp2.i = 0.f; |
| 570 |
i__3 = *k; |
| 571 |
for (l = 1; l <= i__3; ++l) { |
| 572 |
r_cnjg(&q__3, &a[l + i__ * a_dim1]); |
| 573 |
i__4 = l + j * b_dim1; |
| 574 |
q__2.r = q__3.r * b[i__4].r - q__3.i * b[i__4].i, |
| 575 |
q__2.i = q__3.r * b[i__4].i + q__3.i * b[i__4] |
| 576 |
.r; |
| 577 |
q__1.r = temp1.r + q__2.r, q__1.i = temp1.i + q__2.i; |
| 578 |
temp1.r = q__1.r, temp1.i = q__1.i; |
| 579 |
r_cnjg(&q__3, &b[l + i__ * b_dim1]); |
| 580 |
i__4 = l + j * a_dim1; |
| 581 |
q__2.r = q__3.r * a[i__4].r - q__3.i * a[i__4].i, |
| 582 |
q__2.i = q__3.r * a[i__4].i + q__3.i * a[i__4] |
| 583 |
.r; |
| 584 |
q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i; |
| 585 |
temp2.r = q__1.r, temp2.i = q__1.i; |
| 586 |
/* L220: */ |
| 587 |
} |
| 588 |
if (i__ == j) { |
| 589 |
if (*beta == 0.f) { |
| 590 |
i__3 = j + j * c_dim1; |
| 591 |
q__2.r = alpha->r * temp1.r - alpha->i * temp1.i, |
| 592 |
q__2.i = alpha->r * temp1.i + alpha->i * |
| 593 |
temp1.r; |
| 594 |
r_cnjg(&q__4, alpha); |
| 595 |
q__3.r = q__4.r * temp2.r - q__4.i * temp2.i, |
| 596 |
q__3.i = q__4.r * temp2.i + q__4.i * |
| 597 |
temp2.r; |
| 598 |
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + |
| 599 |
q__3.i; |
| 600 |
r__1 = q__1.r; |
| 601 |
c__[i__3].r = r__1, c__[i__3].i = 0.f; |
| 602 |
} else { |
| 603 |
i__3 = j + j * c_dim1; |
| 604 |
i__4 = j + j * c_dim1; |
| 605 |
q__2.r = alpha->r * temp1.r - alpha->i * temp1.i, |
| 606 |
q__2.i = alpha->r * temp1.i + alpha->i * |
| 607 |
temp1.r; |
| 608 |
r_cnjg(&q__4, alpha); |
| 609 |
q__3.r = q__4.r * temp2.r - q__4.i * temp2.i, |
| 610 |
q__3.i = q__4.r * temp2.i + q__4.i * |
| 611 |
temp2.r; |
| 612 |
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + |
| 613 |
q__3.i; |
| 614 |
r__1 = *beta * c__[i__4].r + q__1.r; |
| 615 |
c__[i__3].r = r__1, c__[i__3].i = 0.f; |
| 616 |
} |
| 617 |
} else { |
| 618 |
if (*beta == 0.f) { |
| 619 |
i__3 = i__ + j * c_dim1; |
| 620 |
q__2.r = alpha->r * temp1.r - alpha->i * temp1.i, |
| 621 |
q__2.i = alpha->r * temp1.i + alpha->i * |
| 622 |
temp1.r; |
| 623 |
r_cnjg(&q__4, alpha); |
| 624 |
q__3.r = q__4.r * temp2.r - q__4.i * temp2.i, |
| 625 |
q__3.i = q__4.r * temp2.i + q__4.i * |
| 626 |
temp2.r; |
| 627 |
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + |
| 628 |
q__3.i; |
| 629 |
c__[i__3].r = q__1.r, c__[i__3].i = q__1.i; |
| 630 |
} else { |
| 631 |
i__3 = i__ + j * c_dim1; |
| 632 |
i__4 = i__ + j * c_dim1; |
| 633 |
q__3.r = *beta * c__[i__4].r, q__3.i = *beta * |
| 634 |
c__[i__4].i; |
| 635 |
q__4.r = alpha->r * temp1.r - alpha->i * temp1.i, |
| 636 |
q__4.i = alpha->r * temp1.i + alpha->i * |
| 637 |
temp1.r; |
| 638 |
q__2.r = q__3.r + q__4.r, q__2.i = q__3.i + |
| 639 |
q__4.i; |
| 640 |
r_cnjg(&q__6, alpha); |
| 641 |
q__5.r = q__6.r * temp2.r - q__6.i * temp2.i, |
| 642 |
q__5.i = q__6.r * temp2.i + q__6.i * |
| 643 |
temp2.r; |
| 644 |
q__1.r = q__2.r + q__5.r, q__1.i = q__2.i + |
| 645 |
q__5.i; |
| 646 |
c__[i__3].r = q__1.r, c__[i__3].i = q__1.i; |
| 647 |
} |
| 648 |
} |
| 649 |
/* L230: */ |
| 650 |
} |
| 651 |
/* L240: */ |
| 652 |
} |
| 653 |
} |
| 654 |
} |
| 655 |
|
| 656 |
return 0; |
| 657 |
|
| 658 |
/* End of CHER2K. */ |
| 659 |
|
| 660 |
} /* cher2k_ */ |
| 661 |
|