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_b9 = 0.;
00019 static doublereal c_b10 = 1.;
00020 static integer c__3 = 3;
00021 static integer c__1 = 1;
00022
00023 int dlaror_(char *side, char *init, integer *m, integer *n,
00024 doublereal *a, integer *lda, integer *iseed, doublereal *x, integer *
00025 info)
00026 {
00027
00028 integer a_dim1, a_offset, i__1, i__2;
00029 doublereal d__1;
00030
00031
00032 double d_sign(doublereal *, doublereal *);
00033
00034
00035 integer j, kbeg;
00036 extern int dger_(integer *, integer *, doublereal *,
00037 doublereal *, integer *, doublereal *, integer *, doublereal *,
00038 integer *);
00039 integer jcol, irow;
00040 extern doublereal dnrm2_(integer *, doublereal *, integer *);
00041 extern int dscal_(integer *, doublereal *, doublereal *,
00042 integer *);
00043 extern logical lsame_(char *, char *);
00044 extern int dgemv_(char *, integer *, integer *,
00045 doublereal *, doublereal *, integer *, doublereal *, integer *,
00046 doublereal *, doublereal *, integer *);
00047 integer ixfrm, itype, nxfrm;
00048 doublereal xnorm;
00049 extern doublereal dlarnd_(integer *, integer *);
00050 extern int dlaset_(char *, integer *, integer *,
00051 doublereal *, doublereal *, doublereal *, integer *),
00052 xerbla_(char *, integer *);
00053 doublereal factor, xnorms;
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 a_dim1 = *lda;
00162 a_offset = 1 + a_dim1;
00163 a -= a_offset;
00164 --iseed;
00165 --x;
00166
00167
00168 if (*n == 0 || *m == 0) {
00169 return 0;
00170 }
00171
00172 itype = 0;
00173 if (lsame_(side, "L")) {
00174 itype = 1;
00175 } else if (lsame_(side, "R")) {
00176 itype = 2;
00177 } else if (lsame_(side, "C") || lsame_(side, "T")) {
00178 itype = 3;
00179 }
00180
00181
00182
00183 *info = 0;
00184 if (itype == 0) {
00185 *info = -1;
00186 } else if (*m < 0) {
00187 *info = -3;
00188 } else if (*n < 0 || itype == 3 && *n != *m) {
00189 *info = -4;
00190 } else if (*lda < *m) {
00191 *info = -6;
00192 }
00193 if (*info != 0) {
00194 i__1 = -(*info);
00195 xerbla_("DLAROR", &i__1);
00196 return 0;
00197 }
00198
00199 if (itype == 1) {
00200 nxfrm = *m;
00201 } else {
00202 nxfrm = *n;
00203 }
00204
00205
00206
00207 if (lsame_(init, "I")) {
00208 dlaset_("Full", m, n, &c_b9, &c_b10, &a[a_offset], lda);
00209 }
00210
00211
00212
00213
00214
00215
00216 i__1 = nxfrm;
00217 for (j = 1; j <= i__1; ++j) {
00218 x[j] = 0.;
00219
00220 }
00221
00222 i__1 = nxfrm;
00223 for (ixfrm = 2; ixfrm <= i__1; ++ixfrm) {
00224 kbeg = nxfrm - ixfrm + 1;
00225
00226
00227
00228 i__2 = nxfrm;
00229 for (j = kbeg; j <= i__2; ++j) {
00230 x[j] = dlarnd_(&c__3, &iseed[1]);
00231
00232 }
00233
00234
00235
00236 xnorm = dnrm2_(&ixfrm, &x[kbeg], &c__1);
00237 xnorms = d_sign(&xnorm, &x[kbeg]);
00238 d__1 = -x[kbeg];
00239 x[kbeg + nxfrm] = d_sign(&c_b10, &d__1);
00240 factor = xnorms * (xnorms + x[kbeg]);
00241 if (abs(factor) < 1e-20) {
00242 *info = 1;
00243 xerbla_("DLAROR", info);
00244 return 0;
00245 } else {
00246 factor = 1. / factor;
00247 }
00248 x[kbeg] += xnorms;
00249
00250
00251
00252 if (itype == 1 || itype == 3) {
00253
00254
00255
00256 dgemv_("T", &ixfrm, n, &c_b10, &a[kbeg + a_dim1], lda, &x[kbeg], &
00257 c__1, &c_b9, &x[(nxfrm << 1) + 1], &c__1);
00258 d__1 = -factor;
00259 dger_(&ixfrm, n, &d__1, &x[kbeg], &c__1, &x[(nxfrm << 1) + 1], &
00260 c__1, &a[kbeg + a_dim1], lda);
00261
00262 }
00263
00264 if (itype == 2 || itype == 3) {
00265
00266
00267
00268 dgemv_("N", m, &ixfrm, &c_b10, &a[kbeg * a_dim1 + 1], lda, &x[
00269 kbeg], &c__1, &c_b9, &x[(nxfrm << 1) + 1], &c__1);
00270 d__1 = -factor;
00271 dger_(m, &ixfrm, &d__1, &x[(nxfrm << 1) + 1], &c__1, &x[kbeg], &
00272 c__1, &a[kbeg * a_dim1 + 1], lda);
00273
00274 }
00275
00276 }
00277
00278 d__1 = dlarnd_(&c__3, &iseed[1]);
00279 x[nxfrm * 2] = d_sign(&c_b10, &d__1);
00280
00281
00282
00283 if (itype == 1 || itype == 3) {
00284 i__1 = *m;
00285 for (irow = 1; irow <= i__1; ++irow) {
00286 dscal_(n, &x[nxfrm + irow], &a[irow + a_dim1], lda);
00287
00288 }
00289 }
00290
00291 if (itype == 2 || itype == 3) {
00292 i__1 = *n;
00293 for (jcol = 1; jcol <= i__1; ++jcol) {
00294 dscal_(m, &x[nxfrm + jcol], &a[jcol * a_dim1 + 1], &c__1);
00295
00296 }
00297 }
00298 return 0;
00299
00300
00301
00302 }