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 integer c__1 = 1;
00019 static integer c_n1 = -1;
00020 static doublereal c_b14 = 1.;
00021 static doublereal c_b16 = -.5;
00022 static doublereal c_b19 = -1.;
00023 static doublereal c_b52 = .5;
00024
00025 int dsygst_(integer *itype, char *uplo, integer *n,
00026 doublereal *a, integer *lda, doublereal *b, integer *ldb, integer *
00027 info)
00028 {
00029
00030 integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3;
00031
00032
00033 integer k, kb, nb;
00034 extern logical lsame_(char *, char *);
00035 extern int dtrmm_(char *, char *, char *, char *,
00036 integer *, integer *, doublereal *, doublereal *, integer *,
00037 doublereal *, integer *), dsymm_(
00038 char *, char *, integer *, integer *, doublereal *, doublereal *,
00039 integer *, doublereal *, integer *, doublereal *, doublereal *,
00040 integer *);
00041 logical upper;
00042 extern int dtrsm_(char *, char *, char *, char *,
00043 integer *, integer *, doublereal *, doublereal *, integer *,
00044 doublereal *, integer *), dsygs2_(
00045 integer *, char *, integer *, doublereal *, integer *, doublereal
00046 *, integer *, integer *), dsyr2k_(char *, char *, integer
00047 *, integer *, doublereal *, doublereal *, integer *, doublereal *,
00048 integer *, doublereal *, doublereal *, integer *)
00049 , xerbla_(char *, integer *);
00050 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00051 integer *, integer *);
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
00134
00135
00136 a_dim1 = *lda;
00137 a_offset = 1 + a_dim1;
00138 a -= a_offset;
00139 b_dim1 = *ldb;
00140 b_offset = 1 + b_dim1;
00141 b -= b_offset;
00142
00143
00144 *info = 0;
00145 upper = lsame_(uplo, "U");
00146 if (*itype < 1 || *itype > 3) {
00147 *info = -1;
00148 } else if (! upper && ! lsame_(uplo, "L")) {
00149 *info = -2;
00150 } else if (*n < 0) {
00151 *info = -3;
00152 } else if (*lda < max(1,*n)) {
00153 *info = -5;
00154 } else if (*ldb < max(1,*n)) {
00155 *info = -7;
00156 }
00157 if (*info != 0) {
00158 i__1 = -(*info);
00159 xerbla_("DSYGST", &i__1);
00160 return 0;
00161 }
00162
00163
00164
00165 if (*n == 0) {
00166 return 0;
00167 }
00168
00169
00170
00171 nb = ilaenv_(&c__1, "DSYGST", uplo, n, &c_n1, &c_n1, &c_n1);
00172
00173 if (nb <= 1 || nb >= *n) {
00174
00175
00176
00177 dsygs2_(itype, uplo, n, &a[a_offset], lda, &b[b_offset], ldb, info);
00178 } else {
00179
00180
00181
00182 if (*itype == 1) {
00183 if (upper) {
00184
00185
00186
00187 i__1 = *n;
00188 i__2 = nb;
00189 for (k = 1; i__2 < 0 ? k >= i__1 : k <= i__1; k += i__2) {
00190
00191 i__3 = *n - k + 1;
00192 kb = min(i__3,nb);
00193
00194
00195
00196 dsygs2_(itype, uplo, &kb, &a[k + k * a_dim1], lda, &b[k +
00197 k * b_dim1], ldb, info);
00198 if (k + kb <= *n) {
00199 i__3 = *n - k - kb + 1;
00200 dtrsm_("Left", uplo, "Transpose", "Non-unit", &kb, &
00201 i__3, &c_b14, &b[k + k * b_dim1], ldb, &a[k +
00202 (k + kb) * a_dim1], lda);
00203 i__3 = *n - k - kb + 1;
00204 dsymm_("Left", uplo, &kb, &i__3, &c_b16, &a[k + k *
00205 a_dim1], lda, &b[k + (k + kb) * b_dim1], ldb,
00206 &c_b14, &a[k + (k + kb) * a_dim1], lda);
00207 i__3 = *n - k - kb + 1;
00208 dsyr2k_(uplo, "Transpose", &i__3, &kb, &c_b19, &a[k +
00209 (k + kb) * a_dim1], lda, &b[k + (k + kb) *
00210 b_dim1], ldb, &c_b14, &a[k + kb + (k + kb) *
00211 a_dim1], lda);
00212 i__3 = *n - k - kb + 1;
00213 dsymm_("Left", uplo, &kb, &i__3, &c_b16, &a[k + k *
00214 a_dim1], lda, &b[k + (k + kb) * b_dim1], ldb,
00215 &c_b14, &a[k + (k + kb) * a_dim1], lda);
00216 i__3 = *n - k - kb + 1;
00217 dtrsm_("Right", uplo, "No transpose", "Non-unit", &kb,
00218 &i__3, &c_b14, &b[k + kb + (k + kb) * b_dim1]
00219 , ldb, &a[k + (k + kb) * a_dim1], lda);
00220 }
00221
00222 }
00223 } else {
00224
00225
00226
00227 i__2 = *n;
00228 i__1 = nb;
00229 for (k = 1; i__1 < 0 ? k >= i__2 : k <= i__2; k += i__1) {
00230
00231 i__3 = *n - k + 1;
00232 kb = min(i__3,nb);
00233
00234
00235
00236 dsygs2_(itype, uplo, &kb, &a[k + k * a_dim1], lda, &b[k +
00237 k * b_dim1], ldb, info);
00238 if (k + kb <= *n) {
00239 i__3 = *n - k - kb + 1;
00240 dtrsm_("Right", uplo, "Transpose", "Non-unit", &i__3,
00241 &kb, &c_b14, &b[k + k * b_dim1], ldb, &a[k +
00242 kb + k * a_dim1], lda);
00243 i__3 = *n - k - kb + 1;
00244 dsymm_("Right", uplo, &i__3, &kb, &c_b16, &a[k + k *
00245 a_dim1], lda, &b[k + kb + k * b_dim1], ldb, &
00246 c_b14, &a[k + kb + k * a_dim1], lda);
00247 i__3 = *n - k - kb + 1;
00248 dsyr2k_(uplo, "No transpose", &i__3, &kb, &c_b19, &a[
00249 k + kb + k * a_dim1], lda, &b[k + kb + k *
00250 b_dim1], ldb, &c_b14, &a[k + kb + (k + kb) *
00251 a_dim1], lda);
00252 i__3 = *n - k - kb + 1;
00253 dsymm_("Right", uplo, &i__3, &kb, &c_b16, &a[k + k *
00254 a_dim1], lda, &b[k + kb + k * b_dim1], ldb, &
00255 c_b14, &a[k + kb + k * a_dim1], lda);
00256 i__3 = *n - k - kb + 1;
00257 dtrsm_("Left", uplo, "No transpose", "Non-unit", &
00258 i__3, &kb, &c_b14, &b[k + kb + (k + kb) *
00259 b_dim1], ldb, &a[k + kb + k * a_dim1], lda);
00260 }
00261
00262 }
00263 }
00264 } else {
00265 if (upper) {
00266
00267
00268
00269 i__1 = *n;
00270 i__2 = nb;
00271 for (k = 1; i__2 < 0 ? k >= i__1 : k <= i__1; k += i__2) {
00272
00273 i__3 = *n - k + 1;
00274 kb = min(i__3,nb);
00275
00276
00277
00278 i__3 = k - 1;
00279 dtrmm_("Left", uplo, "No transpose", "Non-unit", &i__3, &
00280 kb, &c_b14, &b[b_offset], ldb, &a[k * a_dim1 + 1],
00281 lda)
00282 ;
00283 i__3 = k - 1;
00284 dsymm_("Right", uplo, &i__3, &kb, &c_b52, &a[k + k *
00285 a_dim1], lda, &b[k * b_dim1 + 1], ldb, &c_b14, &a[
00286 k * a_dim1 + 1], lda);
00287 i__3 = k - 1;
00288 dsyr2k_(uplo, "No transpose", &i__3, &kb, &c_b14, &a[k *
00289 a_dim1 + 1], lda, &b[k * b_dim1 + 1], ldb, &c_b14,
00290 &a[a_offset], lda);
00291 i__3 = k - 1;
00292 dsymm_("Right", uplo, &i__3, &kb, &c_b52, &a[k + k *
00293 a_dim1], lda, &b[k * b_dim1 + 1], ldb, &c_b14, &a[
00294 k * a_dim1 + 1], lda);
00295 i__3 = k - 1;
00296 dtrmm_("Right", uplo, "Transpose", "Non-unit", &i__3, &kb,
00297 &c_b14, &b[k + k * b_dim1], ldb, &a[k * a_dim1 +
00298 1], lda);
00299 dsygs2_(itype, uplo, &kb, &a[k + k * a_dim1], lda, &b[k +
00300 k * b_dim1], ldb, info);
00301
00302 }
00303 } else {
00304
00305
00306
00307 i__2 = *n;
00308 i__1 = nb;
00309 for (k = 1; i__1 < 0 ? k >= i__2 : k <= i__2; k += i__1) {
00310
00311 i__3 = *n - k + 1;
00312 kb = min(i__3,nb);
00313
00314
00315
00316 i__3 = k - 1;
00317 dtrmm_("Right", uplo, "No transpose", "Non-unit", &kb, &
00318 i__3, &c_b14, &b[b_offset], ldb, &a[k + a_dim1],
00319 lda);
00320 i__3 = k - 1;
00321 dsymm_("Left", uplo, &kb, &i__3, &c_b52, &a[k + k *
00322 a_dim1], lda, &b[k + b_dim1], ldb, &c_b14, &a[k +
00323 a_dim1], lda);
00324 i__3 = k - 1;
00325 dsyr2k_(uplo, "Transpose", &i__3, &kb, &c_b14, &a[k +
00326 a_dim1], lda, &b[k + b_dim1], ldb, &c_b14, &a[
00327 a_offset], lda);
00328 i__3 = k - 1;
00329 dsymm_("Left", uplo, &kb, &i__3, &c_b52, &a[k + k *
00330 a_dim1], lda, &b[k + b_dim1], ldb, &c_b14, &a[k +
00331 a_dim1], lda);
00332 i__3 = k - 1;
00333 dtrmm_("Left", uplo, "Transpose", "Non-unit", &kb, &i__3,
00334 &c_b14, &b[k + k * b_dim1], ldb, &a[k + a_dim1],
00335 lda);
00336 dsygs2_(itype, uplo, &kb, &a[k + k * a_dim1], lda, &b[k +
00337 k * b_dim1], ldb, info);
00338
00339 }
00340 }
00341 }
00342 }
00343 return 0;
00344
00345
00346
00347 }