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 doublecomplex c_b1 = {0.,0.};
00019 static doublecomplex c_b2 = {1.,0.};
00020 static integer c__3 = 3;
00021 static integer c__1 = 1;
00022
00023 int zlaror_(char *side, char *init, integer *m, integer *n,
00024 doublecomplex *a, integer *lda, integer *iseed, doublecomplex *x,
00025 integer *info)
00026 {
00027
00028 integer a_dim1, a_offset, i__1, i__2, i__3;
00029 doublecomplex z__1, z__2;
00030
00031
00032 double z_abs(doublecomplex *);
00033 void d_cnjg(doublecomplex *, doublecomplex *);
00034
00035
00036 integer j, kbeg, jcol;
00037 doublereal xabs;
00038 integer irow;
00039 extern logical lsame_(char *, char *);
00040 doublecomplex csign;
00041 extern int zgerc_(integer *, integer *, doublecomplex *,
00042 doublecomplex *, integer *, doublecomplex *, integer *,
00043 doublecomplex *, integer *), zscal_(integer *, doublecomplex *,
00044 doublecomplex *, integer *);
00045 integer ixfrm;
00046 extern int zgemv_(char *, integer *, integer *,
00047 doublecomplex *, doublecomplex *, integer *, doublecomplex *,
00048 integer *, doublecomplex *, doublecomplex *, integer *);
00049 integer itype, nxfrm;
00050 doublereal xnorm;
00051 extern doublereal dznrm2_(integer *, doublecomplex *, integer *);
00052 extern int xerbla_(char *, integer *);
00053 doublereal factor;
00054 extern int zlacgv_(integer *, doublecomplex *, integer *)
00055 ;
00056 extern VOID zlarnd_(doublecomplex *, integer *,
00057 integer *);
00058 extern int zlaset_(char *, integer *, integer *,
00059 doublecomplex *, doublecomplex *, doublecomplex *, integer *);
00060 doublecomplex xnorms;
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
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 a_dim1 = *lda;
00183 a_offset = 1 + a_dim1;
00184 a -= a_offset;
00185 --iseed;
00186 --x;
00187
00188
00189 if (*n == 0 || *m == 0) {
00190 return 0;
00191 }
00192
00193 itype = 0;
00194 if (lsame_(side, "L")) {
00195 itype = 1;
00196 } else if (lsame_(side, "R")) {
00197 itype = 2;
00198 } else if (lsame_(side, "C")) {
00199 itype = 3;
00200 } else if (lsame_(side, "T")) {
00201 itype = 4;
00202 }
00203
00204
00205
00206 *info = 0;
00207 if (itype == 0) {
00208 *info = -1;
00209 } else if (*m < 0) {
00210 *info = -3;
00211 } else if (*n < 0 || itype == 3 && *n != *m) {
00212 *info = -4;
00213 } else if (*lda < *m) {
00214 *info = -6;
00215 }
00216 if (*info != 0) {
00217 i__1 = -(*info);
00218 xerbla_("ZLAROR", &i__1);
00219 return 0;
00220 }
00221
00222 if (itype == 1) {
00223 nxfrm = *m;
00224 } else {
00225 nxfrm = *n;
00226 }
00227
00228
00229
00230 if (lsame_(init, "I")) {
00231 zlaset_("Full", m, n, &c_b1, &c_b2, &a[a_offset], lda);
00232 }
00233
00234
00235
00236
00237
00238
00239
00240
00241 i__1 = nxfrm;
00242 for (j = 1; j <= i__1; ++j) {
00243 i__2 = j;
00244 x[i__2].r = 0., x[i__2].i = 0.;
00245
00246 }
00247
00248 i__1 = nxfrm;
00249 for (ixfrm = 2; ixfrm <= i__1; ++ixfrm) {
00250 kbeg = nxfrm - ixfrm + 1;
00251
00252
00253
00254 i__2 = nxfrm;
00255 for (j = kbeg; j <= i__2; ++j) {
00256 i__3 = j;
00257 zlarnd_(&z__1, &c__3, &iseed[1]);
00258 x[i__3].r = z__1.r, x[i__3].i = z__1.i;
00259
00260 }
00261
00262
00263
00264 xnorm = dznrm2_(&ixfrm, &x[kbeg], &c__1);
00265 xabs = z_abs(&x[kbeg]);
00266 if (xabs != 0.) {
00267 i__2 = kbeg;
00268 z__1.r = x[i__2].r / xabs, z__1.i = x[i__2].i / xabs;
00269 csign.r = z__1.r, csign.i = z__1.i;
00270 } else {
00271 csign.r = 1., csign.i = 0.;
00272 }
00273 z__1.r = xnorm * csign.r, z__1.i = xnorm * csign.i;
00274 xnorms.r = z__1.r, xnorms.i = z__1.i;
00275 i__2 = nxfrm + kbeg;
00276 z__1.r = -csign.r, z__1.i = -csign.i;
00277 x[i__2].r = z__1.r, x[i__2].i = z__1.i;
00278 factor = xnorm * (xnorm + xabs);
00279 if (abs(factor) < 1e-20) {
00280 *info = 1;
00281 i__2 = -(*info);
00282 xerbla_("ZLAROR", &i__2);
00283 return 0;
00284 } else {
00285 factor = 1. / factor;
00286 }
00287 i__2 = kbeg;
00288 i__3 = kbeg;
00289 z__1.r = x[i__3].r + xnorms.r, z__1.i = x[i__3].i + xnorms.i;
00290 x[i__2].r = z__1.r, x[i__2].i = z__1.i;
00291
00292
00293
00294 if (itype == 1 || itype == 3 || itype == 4) {
00295
00296
00297
00298 zgemv_("C", &ixfrm, n, &c_b2, &a[kbeg + a_dim1], lda, &x[kbeg], &
00299 c__1, &c_b1, &x[(nxfrm << 1) + 1], &c__1);
00300 z__2.r = factor, z__2.i = 0.;
00301 z__1.r = -z__2.r, z__1.i = -z__2.i;
00302 zgerc_(&ixfrm, n, &z__1, &x[kbeg], &c__1, &x[(nxfrm << 1) + 1], &
00303 c__1, &a[kbeg + a_dim1], lda);
00304
00305 }
00306
00307 if (itype >= 2 && itype <= 4) {
00308
00309
00310
00311 if (itype == 4) {
00312 zlacgv_(&ixfrm, &x[kbeg], &c__1);
00313 }
00314
00315 zgemv_("N", m, &ixfrm, &c_b2, &a[kbeg * a_dim1 + 1], lda, &x[kbeg]
00316 , &c__1, &c_b1, &x[(nxfrm << 1) + 1], &c__1);
00317 z__2.r = factor, z__2.i = 0.;
00318 z__1.r = -z__2.r, z__1.i = -z__2.i;
00319 zgerc_(m, &ixfrm, &z__1, &x[(nxfrm << 1) + 1], &c__1, &x[kbeg], &
00320 c__1, &a[kbeg * a_dim1 + 1], lda);
00321
00322 }
00323
00324 }
00325
00326 zlarnd_(&z__1, &c__3, &iseed[1]);
00327 x[1].r = z__1.r, x[1].i = z__1.i;
00328 xabs = z_abs(&x[1]);
00329 if (xabs != 0.) {
00330 z__1.r = x[1].r / xabs, z__1.i = x[1].i / xabs;
00331 csign.r = z__1.r, csign.i = z__1.i;
00332 } else {
00333 csign.r = 1., csign.i = 0.;
00334 }
00335 i__1 = nxfrm << 1;
00336 x[i__1].r = csign.r, x[i__1].i = csign.i;
00337
00338
00339
00340 if (itype == 1 || itype == 3 || itype == 4) {
00341 i__1 = *m;
00342 for (irow = 1; irow <= i__1; ++irow) {
00343 d_cnjg(&z__1, &x[nxfrm + irow]);
00344 zscal_(n, &z__1, &a[irow + a_dim1], lda);
00345
00346 }
00347 }
00348
00349 if (itype == 2 || itype == 3) {
00350 i__1 = *n;
00351 for (jcol = 1; jcol <= i__1; ++jcol) {
00352 zscal_(m, &x[nxfrm + jcol], &a[jcol * a_dim1 + 1], &c__1);
00353
00354 }
00355 }
00356
00357 if (itype == 4) {
00358 i__1 = *n;
00359 for (jcol = 1; jcol <= i__1; ++jcol) {
00360 d_cnjg(&z__1, &x[nxfrm + jcol]);
00361 zscal_(m, &z__1, &a[jcol * a_dim1 + 1], &c__1);
00362
00363 }
00364 }
00365 return 0;
00366
00367
00368
00369 }