00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 static doublereal c_b15 = 1.;
00019 static integer c__1 = 1;
00020
00021 int dlavsy_(char *uplo, char *trans, char *diag, integer *n,
00022 integer *nrhs, doublereal *a, integer *lda, integer *ipiv, doublereal
00023 *b, integer *ldb, integer *info)
00024 {
00025
00026 integer a_dim1, a_offset, b_dim1, b_offset, i__1;
00027
00028
00029 integer j, k;
00030 doublereal t1, t2, d11, d12, d21, d22;
00031 integer kp;
00032 extern int dger_(integer *, integer *, doublereal *,
00033 doublereal *, integer *, doublereal *, integer *, doublereal *,
00034 integer *), dscal_(integer *, doublereal *, doublereal *, integer
00035 *);
00036 extern logical lsame_(char *, char *);
00037 extern int dgemv_(char *, integer *, integer *,
00038 doublereal *, doublereal *, integer *, doublereal *, integer *,
00039 doublereal *, doublereal *, integer *), dswap_(integer *,
00040 doublereal *, integer *, doublereal *, integer *), xerbla_(char *,
00041 integer *);
00042 logical nounit;
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133 a_dim1 = *lda;
00134 a_offset = 1 + a_dim1;
00135 a -= a_offset;
00136 --ipiv;
00137 b_dim1 = *ldb;
00138 b_offset = 1 + b_dim1;
00139 b -= b_offset;
00140
00141
00142 *info = 0;
00143 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00144 *info = -1;
00145 } else if (! lsame_(trans, "N") && ! lsame_(trans,
00146 "T") && ! lsame_(trans, "C")) {
00147 *info = -2;
00148 } else if (! lsame_(diag, "U") && ! lsame_(diag,
00149 "N")) {
00150 *info = -3;
00151 } else if (*n < 0) {
00152 *info = -4;
00153 } else if (*lda < max(1,*n)) {
00154 *info = -6;
00155 } else if (*ldb < max(1,*n)) {
00156 *info = -9;
00157 }
00158 if (*info != 0) {
00159 i__1 = -(*info);
00160 xerbla_("DLAVSY ", &i__1);
00161 return 0;
00162 }
00163
00164
00165
00166 if (*n == 0) {
00167 return 0;
00168 }
00169
00170 nounit = lsame_(diag, "N");
00171
00172
00173
00174
00175
00176 if (lsame_(trans, "N")) {
00177
00178
00179
00180
00181 if (lsame_(uplo, "U")) {
00182
00183
00184
00185 k = 1;
00186 L10:
00187 if (k > *n) {
00188 goto L30;
00189 }
00190 if (ipiv[k] > 0) {
00191
00192
00193
00194
00195
00196 if (nounit) {
00197 dscal_(nrhs, &a[k + k * a_dim1], &b[k + b_dim1], ldb);
00198 }
00199
00200
00201
00202 if (k > 1) {
00203
00204
00205
00206 i__1 = k - 1;
00207 dger_(&i__1, nrhs, &c_b15, &a[k * a_dim1 + 1], &c__1, &b[
00208 k + b_dim1], ldb, &b[b_dim1 + 1], ldb);
00209
00210
00211
00212 kp = ipiv[k];
00213 if (kp != k) {
00214 dswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1],
00215 ldb);
00216 }
00217 }
00218 ++k;
00219 } else {
00220
00221
00222
00223
00224
00225 if (nounit) {
00226 d11 = a[k + k * a_dim1];
00227 d22 = a[k + 1 + (k + 1) * a_dim1];
00228 d12 = a[k + (k + 1) * a_dim1];
00229 d21 = d12;
00230 i__1 = *nrhs;
00231 for (j = 1; j <= i__1; ++j) {
00232 t1 = b[k + j * b_dim1];
00233 t2 = b[k + 1 + j * b_dim1];
00234 b[k + j * b_dim1] = d11 * t1 + d12 * t2;
00235 b[k + 1 + j * b_dim1] = d21 * t1 + d22 * t2;
00236
00237 }
00238 }
00239
00240
00241
00242 if (k > 1) {
00243
00244
00245
00246 i__1 = k - 1;
00247 dger_(&i__1, nrhs, &c_b15, &a[k * a_dim1 + 1], &c__1, &b[
00248 k + b_dim1], ldb, &b[b_dim1 + 1], ldb);
00249 i__1 = k - 1;
00250 dger_(&i__1, nrhs, &c_b15, &a[(k + 1) * a_dim1 + 1], &
00251 c__1, &b[k + 1 + b_dim1], ldb, &b[b_dim1 + 1],
00252 ldb);
00253
00254
00255
00256 kp = (i__1 = ipiv[k], abs(i__1));
00257 if (kp != k) {
00258 dswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1],
00259 ldb);
00260 }
00261 }
00262 k += 2;
00263 }
00264 goto L10;
00265 L30:
00266
00267
00268
00269
00270 ;
00271 } else {
00272
00273
00274
00275 k = *n;
00276 L40:
00277 if (k < 1) {
00278 goto L60;
00279 }
00280
00281
00282
00283
00284 if (ipiv[k] > 0) {
00285
00286
00287
00288
00289
00290 if (nounit) {
00291 dscal_(nrhs, &a[k + k * a_dim1], &b[k + b_dim1], ldb);
00292 }
00293
00294
00295
00296 if (k != *n) {
00297 kp = ipiv[k];
00298
00299
00300
00301 i__1 = *n - k;
00302 dger_(&i__1, nrhs, &c_b15, &a[k + 1 + k * a_dim1], &c__1,
00303 &b[k + b_dim1], ldb, &b[k + 1 + b_dim1], ldb);
00304
00305
00306
00307
00308 if (kp != k) {
00309 dswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1],
00310 ldb);
00311 }
00312 }
00313 --k;
00314
00315 } else {
00316
00317
00318
00319
00320
00321 if (nounit) {
00322 d11 = a[k - 1 + (k - 1) * a_dim1];
00323 d22 = a[k + k * a_dim1];
00324 d21 = a[k + (k - 1) * a_dim1];
00325 d12 = d21;
00326 i__1 = *nrhs;
00327 for (j = 1; j <= i__1; ++j) {
00328 t1 = b[k - 1 + j * b_dim1];
00329 t2 = b[k + j * b_dim1];
00330 b[k - 1 + j * b_dim1] = d11 * t1 + d12 * t2;
00331 b[k + j * b_dim1] = d21 * t1 + d22 * t2;
00332
00333 }
00334 }
00335
00336
00337
00338 if (k != *n) {
00339
00340
00341
00342 i__1 = *n - k;
00343 dger_(&i__1, nrhs, &c_b15, &a[k + 1 + k * a_dim1], &c__1,
00344 &b[k + b_dim1], ldb, &b[k + 1 + b_dim1], ldb);
00345 i__1 = *n - k;
00346 dger_(&i__1, nrhs, &c_b15, &a[k + 1 + (k - 1) * a_dim1], &
00347 c__1, &b[k - 1 + b_dim1], ldb, &b[k + 1 + b_dim1],
00348 ldb);
00349
00350
00351
00352
00353 kp = (i__1 = ipiv[k], abs(i__1));
00354 if (kp != k) {
00355 dswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1],
00356 ldb);
00357 }
00358 }
00359 k += -2;
00360 }
00361 goto L40;
00362 L60:
00363 ;
00364 }
00365
00366
00367
00368
00369
00370 } else {
00371
00372
00373
00374
00375
00376 if (lsame_(uplo, "U")) {
00377
00378
00379
00380 k = *n;
00381 L70:
00382 if (k < 1) {
00383 goto L90;
00384 }
00385
00386
00387
00388 if (ipiv[k] > 0) {
00389 if (k > 1) {
00390
00391
00392
00393 kp = ipiv[k];
00394 if (kp != k) {
00395 dswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1],
00396 ldb);
00397 }
00398
00399
00400
00401 i__1 = k - 1;
00402 dgemv_("Transpose", &i__1, nrhs, &c_b15, &b[b_offset],
00403 ldb, &a[k * a_dim1 + 1], &c__1, &c_b15, &b[k +
00404 b_dim1], ldb);
00405 }
00406 if (nounit) {
00407 dscal_(nrhs, &a[k + k * a_dim1], &b[k + b_dim1], ldb);
00408 }
00409 --k;
00410
00411
00412
00413 } else {
00414 if (k > 2) {
00415
00416
00417
00418 kp = (i__1 = ipiv[k], abs(i__1));
00419 if (kp != k - 1) {
00420 dswap_(nrhs, &b[k - 1 + b_dim1], ldb, &b[kp + b_dim1],
00421 ldb);
00422 }
00423
00424
00425
00426 i__1 = k - 2;
00427 dgemv_("Transpose", &i__1, nrhs, &c_b15, &b[b_offset],
00428 ldb, &a[k * a_dim1 + 1], &c__1, &c_b15, &b[k +
00429 b_dim1], ldb);
00430 i__1 = k - 2;
00431 dgemv_("Transpose", &i__1, nrhs, &c_b15, &b[b_offset],
00432 ldb, &a[(k - 1) * a_dim1 + 1], &c__1, &c_b15, &b[
00433 k - 1 + b_dim1], ldb);
00434 }
00435
00436
00437
00438 if (nounit) {
00439 d11 = a[k - 1 + (k - 1) * a_dim1];
00440 d22 = a[k + k * a_dim1];
00441 d12 = a[k - 1 + k * a_dim1];
00442 d21 = d12;
00443 i__1 = *nrhs;
00444 for (j = 1; j <= i__1; ++j) {
00445 t1 = b[k - 1 + j * b_dim1];
00446 t2 = b[k + j * b_dim1];
00447 b[k - 1 + j * b_dim1] = d11 * t1 + d12 * t2;
00448 b[k + j * b_dim1] = d21 * t1 + d22 * t2;
00449
00450 }
00451 }
00452 k += -2;
00453 }
00454 goto L70;
00455 L90:
00456
00457
00458
00459
00460
00461 ;
00462 } else {
00463
00464
00465
00466 k = 1;
00467 L100:
00468 if (k > *n) {
00469 goto L120;
00470 }
00471
00472
00473
00474 if (ipiv[k] > 0) {
00475 if (k < *n) {
00476
00477
00478
00479 kp = ipiv[k];
00480 if (kp != k) {
00481 dswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1],
00482 ldb);
00483 }
00484
00485
00486
00487 i__1 = *n - k;
00488 dgemv_("Transpose", &i__1, nrhs, &c_b15, &b[k + 1 +
00489 b_dim1], ldb, &a[k + 1 + k * a_dim1], &c__1, &
00490 c_b15, &b[k + b_dim1], ldb);
00491 }
00492 if (nounit) {
00493 dscal_(nrhs, &a[k + k * a_dim1], &b[k + b_dim1], ldb);
00494 }
00495 ++k;
00496
00497
00498
00499 } else {
00500 if (k < *n - 1) {
00501
00502
00503
00504 kp = (i__1 = ipiv[k], abs(i__1));
00505 if (kp != k + 1) {
00506 dswap_(nrhs, &b[k + 1 + b_dim1], ldb, &b[kp + b_dim1],
00507 ldb);
00508 }
00509
00510
00511
00512 i__1 = *n - k - 1;
00513 dgemv_("Transpose", &i__1, nrhs, &c_b15, &b[k + 2 +
00514 b_dim1], ldb, &a[k + 2 + (k + 1) * a_dim1], &c__1,
00515 &c_b15, &b[k + 1 + b_dim1], ldb);
00516 i__1 = *n - k - 1;
00517 dgemv_("Transpose", &i__1, nrhs, &c_b15, &b[k + 2 +
00518 b_dim1], ldb, &a[k + 2 + k * a_dim1], &c__1, &
00519 c_b15, &b[k + b_dim1], ldb);
00520 }
00521
00522
00523
00524 if (nounit) {
00525 d11 = a[k + k * a_dim1];
00526 d22 = a[k + 1 + (k + 1) * a_dim1];
00527 d21 = a[k + 1 + k * a_dim1];
00528 d12 = d21;
00529 i__1 = *nrhs;
00530 for (j = 1; j <= i__1; ++j) {
00531 t1 = b[k + j * b_dim1];
00532 t2 = b[k + 1 + j * b_dim1];
00533 b[k + j * b_dim1] = d11 * t1 + d12 * t2;
00534 b[k + 1 + j * b_dim1] = d21 * t1 + d22 * t2;
00535
00536 }
00537 }
00538 k += 2;
00539 }
00540 goto L100;
00541 L120:
00542 ;
00543 }
00544
00545 }
00546 return 0;
00547
00548
00549
00550 }