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