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__4 = 4;
00020 static integer c__8 = 8;
00021 static integer c__24 = 24;
00022
00023 int clatm6_(integer *type__, integer *n, complex *a, integer
00024 *lda, complex *b, complex *x, integer *ldx, complex *y, integer *ldy,
00025 complex *alpha, complex *beta, complex *wx, complex *wy, real *s,
00026 real *dif)
00027 {
00028
00029 integer a_dim1, a_offset, b_dim1, b_offset, x_dim1, x_offset, y_dim1,
00030 y_offset, i__1, i__2, i__3;
00031 real r__1, r__2;
00032 complex q__1, q__2, q__3, q__4;
00033
00034
00035 void r_cnjg(complex *, complex *);
00036 double c_abs(complex *), sqrt(doublereal);
00037
00038
00039 integer i__, j;
00040 complex z__[64] ;
00041 integer info;
00042 complex work[26];
00043 extern int clakf2_(integer *, integer *, complex *,
00044 integer *, complex *, complex *, complex *, complex *, integer *);
00045 real rwork[50];
00046 extern int cgesvd_(char *, char *, integer *, integer *,
00047 complex *, integer *, real *, complex *, integer *, complex *,
00048 integer *, complex *, integer *, real *, integer *), clacpy_(char *, integer *, integer *, complex *, integer
00049 *, complex *, integer *);
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
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 b_dim1 = *lda;
00166 b_offset = 1 + b_dim1;
00167 b -= b_offset;
00168 a_dim1 = *lda;
00169 a_offset = 1 + a_dim1;
00170 a -= a_offset;
00171 x_dim1 = *ldx;
00172 x_offset = 1 + x_dim1;
00173 x -= x_offset;
00174 y_dim1 = *ldy;
00175 y_offset = 1 + y_dim1;
00176 y -= y_offset;
00177 --s;
00178 --dif;
00179
00180
00181 i__1 = *n;
00182 for (i__ = 1; i__ <= i__1; ++i__) {
00183 i__2 = *n;
00184 for (j = 1; j <= i__2; ++j) {
00185
00186 if (i__ == j) {
00187 i__3 = i__ + i__ * a_dim1;
00188 q__2.r = (real) i__, q__2.i = 0.f;
00189 q__1.r = q__2.r + alpha->r, q__1.i = q__2.i + alpha->i;
00190 a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00191 i__3 = i__ + i__ * b_dim1;
00192 b[i__3].r = 1.f, b[i__3].i = 0.f;
00193 } else {
00194 i__3 = i__ + j * a_dim1;
00195 a[i__3].r = 0.f, a[i__3].i = 0.f;
00196 i__3 = i__ + j * b_dim1;
00197 b[i__3].r = 0.f, b[i__3].i = 0.f;
00198 }
00199
00200
00201 }
00202
00203 }
00204 if (*type__ == 2) {
00205 i__1 = a_dim1 + 1;
00206 a[i__1].r = 1.f, a[i__1].i = 1.f;
00207 i__1 = (a_dim1 << 1) + 2;
00208 r_cnjg(&q__1, &a[a_dim1 + 1]);
00209 a[i__1].r = q__1.r, a[i__1].i = q__1.i;
00210 i__1 = a_dim1 * 3 + 3;
00211 a[i__1].r = 1.f, a[i__1].i = 0.f;
00212 i__1 = (a_dim1 << 2) + 4;
00213 q__2.r = alpha->r + 1.f, q__2.i = alpha->i + 0.f;
00214 r__1 = q__2.r;
00215 q__3.r = beta->r + 1.f, q__3.i = beta->i + 0.f;
00216 r__2 = q__3.r;
00217 q__1.r = r__1, q__1.i = r__2;
00218 a[i__1].r = q__1.r, a[i__1].i = q__1.i;
00219 i__1 = a_dim1 * 5 + 5;
00220 r_cnjg(&q__1, &a[(a_dim1 << 2) + 4]);
00221 a[i__1].r = q__1.r, a[i__1].i = q__1.i;
00222 }
00223
00224
00225
00226 clacpy_("F", n, n, &b[b_offset], lda, &y[y_offset], ldy);
00227 i__1 = y_dim1 + 3;
00228 r_cnjg(&q__2, wy);
00229 q__1.r = -q__2.r, q__1.i = -q__2.i;
00230 y[i__1].r = q__1.r, y[i__1].i = q__1.i;
00231 i__1 = y_dim1 + 4;
00232 r_cnjg(&q__1, wy);
00233 y[i__1].r = q__1.r, y[i__1].i = q__1.i;
00234 i__1 = y_dim1 + 5;
00235 r_cnjg(&q__2, wy);
00236 q__1.r = -q__2.r, q__1.i = -q__2.i;
00237 y[i__1].r = q__1.r, y[i__1].i = q__1.i;
00238 i__1 = (y_dim1 << 1) + 3;
00239 r_cnjg(&q__2, wy);
00240 q__1.r = -q__2.r, q__1.i = -q__2.i;
00241 y[i__1].r = q__1.r, y[i__1].i = q__1.i;
00242 i__1 = (y_dim1 << 1) + 4;
00243 r_cnjg(&q__1, wy);
00244 y[i__1].r = q__1.r, y[i__1].i = q__1.i;
00245 i__1 = (y_dim1 << 1) + 5;
00246 r_cnjg(&q__2, wy);
00247 q__1.r = -q__2.r, q__1.i = -q__2.i;
00248 y[i__1].r = q__1.r, y[i__1].i = q__1.i;
00249
00250 clacpy_("F", n, n, &b[b_offset], lda, &x[x_offset], ldx);
00251 i__1 = x_dim1 * 3 + 1;
00252 q__1.r = -wx->r, q__1.i = -wx->i;
00253 x[i__1].r = q__1.r, x[i__1].i = q__1.i;
00254 i__1 = (x_dim1 << 2) + 1;
00255 q__1.r = -wx->r, q__1.i = -wx->i;
00256 x[i__1].r = q__1.r, x[i__1].i = q__1.i;
00257 i__1 = x_dim1 * 5 + 1;
00258 x[i__1].r = wx->r, x[i__1].i = wx->i;
00259 i__1 = x_dim1 * 3 + 2;
00260 x[i__1].r = wx->r, x[i__1].i = wx->i;
00261 i__1 = (x_dim1 << 2) + 2;
00262 q__1.r = -wx->r, q__1.i = -wx->i;
00263 x[i__1].r = q__1.r, x[i__1].i = q__1.i;
00264 i__1 = x_dim1 * 5 + 2;
00265 q__1.r = -wx->r, q__1.i = -wx->i;
00266 x[i__1].r = q__1.r, x[i__1].i = q__1.i;
00267
00268
00269
00270 i__1 = b_dim1 * 3 + 1;
00271 q__1.r = wx->r + wy->r, q__1.i = wx->i + wy->i;
00272 b[i__1].r = q__1.r, b[i__1].i = q__1.i;
00273 i__1 = b_dim1 * 3 + 2;
00274 q__2.r = -wx->r, q__2.i = -wx->i;
00275 q__1.r = q__2.r + wy->r, q__1.i = q__2.i + wy->i;
00276 b[i__1].r = q__1.r, b[i__1].i = q__1.i;
00277 i__1 = (b_dim1 << 2) + 1;
00278 q__1.r = wx->r - wy->r, q__1.i = wx->i - wy->i;
00279 b[i__1].r = q__1.r, b[i__1].i = q__1.i;
00280 i__1 = (b_dim1 << 2) + 2;
00281 q__1.r = wx->r - wy->r, q__1.i = wx->i - wy->i;
00282 b[i__1].r = q__1.r, b[i__1].i = q__1.i;
00283 i__1 = b_dim1 * 5 + 1;
00284 q__2.r = -wx->r, q__2.i = -wx->i;
00285 q__1.r = q__2.r + wy->r, q__1.i = q__2.i + wy->i;
00286 b[i__1].r = q__1.r, b[i__1].i = q__1.i;
00287 i__1 = b_dim1 * 5 + 2;
00288 q__1.r = wx->r + wy->r, q__1.i = wx->i + wy->i;
00289 b[i__1].r = q__1.r, b[i__1].i = q__1.i;
00290 i__1 = a_dim1 * 3 + 1;
00291 i__2 = a_dim1 + 1;
00292 q__2.r = wx->r * a[i__2].r - wx->i * a[i__2].i, q__2.i = wx->r * a[i__2]
00293 .i + wx->i * a[i__2].r;
00294 i__3 = a_dim1 * 3 + 3;
00295 q__3.r = wy->r * a[i__3].r - wy->i * a[i__3].i, q__3.i = wy->r * a[i__3]
00296 .i + wy->i * a[i__3].r;
00297 q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
00298 a[i__1].r = q__1.r, a[i__1].i = q__1.i;
00299 i__1 = a_dim1 * 3 + 2;
00300 q__3.r = -wx->r, q__3.i = -wx->i;
00301 i__2 = (a_dim1 << 1) + 2;
00302 q__2.r = q__3.r * a[i__2].r - q__3.i * a[i__2].i, q__2.i = q__3.r * a[
00303 i__2].i + q__3.i * a[i__2].r;
00304 i__3 = a_dim1 * 3 + 3;
00305 q__4.r = wy->r * a[i__3].r - wy->i * a[i__3].i, q__4.i = wy->r * a[i__3]
00306 .i + wy->i * a[i__3].r;
00307 q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;
00308 a[i__1].r = q__1.r, a[i__1].i = q__1.i;
00309 i__1 = (a_dim1 << 2) + 1;
00310 i__2 = a_dim1 + 1;
00311 q__2.r = wx->r * a[i__2].r - wx->i * a[i__2].i, q__2.i = wx->r * a[i__2]
00312 .i + wx->i * a[i__2].r;
00313 i__3 = (a_dim1 << 2) + 4;
00314 q__3.r = wy->r * a[i__3].r - wy->i * a[i__3].i, q__3.i = wy->r * a[i__3]
00315 .i + wy->i * a[i__3].r;
00316 q__1.r = q__2.r - q__3.r, q__1.i = q__2.i - q__3.i;
00317 a[i__1].r = q__1.r, a[i__1].i = q__1.i;
00318 i__1 = (a_dim1 << 2) + 2;
00319 i__2 = (a_dim1 << 1) + 2;
00320 q__2.r = wx->r * a[i__2].r - wx->i * a[i__2].i, q__2.i = wx->r * a[i__2]
00321 .i + wx->i * a[i__2].r;
00322 i__3 = (a_dim1 << 2) + 4;
00323 q__3.r = wy->r * a[i__3].r - wy->i * a[i__3].i, q__3.i = wy->r * a[i__3]
00324 .i + wy->i * a[i__3].r;
00325 q__1.r = q__2.r - q__3.r, q__1.i = q__2.i - q__3.i;
00326 a[i__1].r = q__1.r, a[i__1].i = q__1.i;
00327 i__1 = a_dim1 * 5 + 1;
00328 q__3.r = -wx->r, q__3.i = -wx->i;
00329 i__2 = a_dim1 + 1;
00330 q__2.r = q__3.r * a[i__2].r - q__3.i * a[i__2].i, q__2.i = q__3.r * a[
00331 i__2].i + q__3.i * a[i__2].r;
00332 i__3 = a_dim1 * 5 + 5;
00333 q__4.r = wy->r * a[i__3].r - wy->i * a[i__3].i, q__4.i = wy->r * a[i__3]
00334 .i + wy->i * a[i__3].r;
00335 q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;
00336 a[i__1].r = q__1.r, a[i__1].i = q__1.i;
00337 i__1 = a_dim1 * 5 + 2;
00338 i__2 = (a_dim1 << 1) + 2;
00339 q__2.r = wx->r * a[i__2].r - wx->i * a[i__2].i, q__2.i = wx->r * a[i__2]
00340 .i + wx->i * a[i__2].r;
00341 i__3 = a_dim1 * 5 + 5;
00342 q__3.r = wy->r * a[i__3].r - wy->i * a[i__3].i, q__3.i = wy->r * a[i__3]
00343 .i + wy->i * a[i__3].r;
00344 q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
00345 a[i__1].r = q__1.r, a[i__1].i = q__1.i;
00346
00347
00348
00349 s[1] = 1.f / sqrt((c_abs(wy) * 3.f * c_abs(wy) + 1.f) / (c_abs(&a[a_dim1
00350 + 1]) * c_abs(&a[a_dim1 + 1]) + 1.f));
00351 s[2] = 1.f / sqrt((c_abs(wy) * 3.f * c_abs(wy) + 1.f) / (c_abs(&a[(a_dim1
00352 << 1) + 2]) * c_abs(&a[(a_dim1 << 1) + 2]) + 1.f));
00353 s[3] = 1.f / sqrt((c_abs(wx) * 2.f * c_abs(wx) + 1.f) / (c_abs(&a[a_dim1 *
00354 3 + 3]) * c_abs(&a[a_dim1 * 3 + 3]) + 1.f));
00355 s[4] = 1.f / sqrt((c_abs(wx) * 2.f * c_abs(wx) + 1.f) / (c_abs(&a[(a_dim1
00356 << 2) + 4]) * c_abs(&a[(a_dim1 << 2) + 4]) + 1.f));
00357 s[5] = 1.f / sqrt((c_abs(wx) * 2.f * c_abs(wx) + 1.f) / (c_abs(&a[a_dim1 *
00358 5 + 5]) * c_abs(&a[a_dim1 * 5 + 5]) + 1.f));
00359
00360 clakf2_(&c__1, &c__4, &a[a_offset], lda, &a[(a_dim1 << 1) + 2], &b[
00361 b_offset], &b[(b_dim1 << 1) + 2], z__, &c__8);
00362 cgesvd_("N", "N", &c__8, &c__8, z__, &c__8, rwork, work, &c__1, &work[1],
00363 &c__1, &work[2], &c__24, &rwork[8], &info);
00364 dif[1] = rwork[7];
00365
00366 clakf2_(&c__4, &c__1, &a[a_offset], lda, &a[a_dim1 * 5 + 5], &b[b_offset],
00367 &b[b_dim1 * 5 + 5], z__, &c__8);
00368 cgesvd_("N", "N", &c__8, &c__8, z__, &c__8, rwork, work, &c__1, &work[1],
00369 &c__1, &work[2], &c__24, &rwork[8], &info);
00370 dif[5] = rwork[7];
00371
00372 return 0;
00373
00374
00375
00376 }