00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int clascl_(char *type__, integer *kl, integer *ku, real *
00017 cfrom, real *cto, integer *m, integer *n, complex *a, integer *lda,
00018 integer *info)
00019 {
00020
00021 integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
00022 complex q__1;
00023
00024
00025 integer i__, j, k1, k2, k3, k4;
00026 real mul, cto1;
00027 logical done;
00028 real ctoc;
00029 extern logical lsame_(char *, char *);
00030 integer itype;
00031 real cfrom1;
00032 extern doublereal slamch_(char *);
00033 real cfromc;
00034 extern int xerbla_(char *, integer *);
00035 real bignum;
00036 extern logical sisnan_(real *);
00037 real smlnum;
00038
00039
00040
00041
00042
00043
00044
00045
00046
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 a_dim1 = *lda;
00126 a_offset = 1 + a_dim1;
00127 a -= a_offset;
00128
00129
00130 *info = 0;
00131
00132 if (lsame_(type__, "G")) {
00133 itype = 0;
00134 } else if (lsame_(type__, "L")) {
00135 itype = 1;
00136 } else if (lsame_(type__, "U")) {
00137 itype = 2;
00138 } else if (lsame_(type__, "H")) {
00139 itype = 3;
00140 } else if (lsame_(type__, "B")) {
00141 itype = 4;
00142 } else if (lsame_(type__, "Q")) {
00143 itype = 5;
00144 } else if (lsame_(type__, "Z")) {
00145 itype = 6;
00146 } else {
00147 itype = -1;
00148 }
00149
00150 if (itype == -1) {
00151 *info = -1;
00152 } else if (*cfrom == 0.f || sisnan_(cfrom)) {
00153 *info = -4;
00154 } else if (sisnan_(cto)) {
00155 *info = -5;
00156 } else if (*m < 0) {
00157 *info = -6;
00158 } else if (*n < 0 || itype == 4 && *n != *m || itype == 5 && *n != *m) {
00159 *info = -7;
00160 } else if (itype <= 3 && *lda < max(1,*m)) {
00161 *info = -9;
00162 } else if (itype >= 4) {
00163
00164 i__1 = *m - 1;
00165 if (*kl < 0 || *kl > max(i__1,0)) {
00166 *info = -2;
00167 } else {
00168
00169 i__1 = *n - 1;
00170 if (*ku < 0 || *ku > max(i__1,0) || (itype == 4 || itype == 5) &&
00171 *kl != *ku) {
00172 *info = -3;
00173 } else if (itype == 4 && *lda < *kl + 1 || itype == 5 && *lda < *
00174 ku + 1 || itype == 6 && *lda < (*kl << 1) + *ku + 1) {
00175 *info = -9;
00176 }
00177 }
00178 }
00179
00180 if (*info != 0) {
00181 i__1 = -(*info);
00182 xerbla_("CLASCL", &i__1);
00183 return 0;
00184 }
00185
00186
00187
00188 if (*n == 0 || *m == 0) {
00189 return 0;
00190 }
00191
00192
00193
00194 smlnum = slamch_("S");
00195 bignum = 1.f / smlnum;
00196
00197 cfromc = *cfrom;
00198 ctoc = *cto;
00199
00200 L10:
00201 cfrom1 = cfromc * smlnum;
00202 if (cfrom1 == cfromc) {
00203
00204
00205 mul = ctoc / cfromc;
00206 done = TRUE_;
00207 cto1 = ctoc;
00208 } else {
00209 cto1 = ctoc / bignum;
00210 if (cto1 == ctoc) {
00211
00212
00213 mul = ctoc;
00214 done = TRUE_;
00215 cfromc = 1.f;
00216 } else if (dabs(cfrom1) > dabs(ctoc) && ctoc != 0.f) {
00217 mul = smlnum;
00218 done = FALSE_;
00219 cfromc = cfrom1;
00220 } else if (dabs(cto1) > dabs(cfromc)) {
00221 mul = bignum;
00222 done = FALSE_;
00223 ctoc = cto1;
00224 } else {
00225 mul = ctoc / cfromc;
00226 done = TRUE_;
00227 }
00228 }
00229
00230 if (itype == 0) {
00231
00232
00233
00234 i__1 = *n;
00235 for (j = 1; j <= i__1; ++j) {
00236 i__2 = *m;
00237 for (i__ = 1; i__ <= i__2; ++i__) {
00238 i__3 = i__ + j * a_dim1;
00239 i__4 = i__ + j * a_dim1;
00240 q__1.r = mul * a[i__4].r, q__1.i = mul * a[i__4].i;
00241 a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00242
00243 }
00244
00245 }
00246
00247 } else if (itype == 1) {
00248
00249
00250
00251 i__1 = *n;
00252 for (j = 1; j <= i__1; ++j) {
00253 i__2 = *m;
00254 for (i__ = j; i__ <= i__2; ++i__) {
00255 i__3 = i__ + j * a_dim1;
00256 i__4 = i__ + j * a_dim1;
00257 q__1.r = mul * a[i__4].r, q__1.i = mul * a[i__4].i;
00258 a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00259
00260 }
00261
00262 }
00263
00264 } else if (itype == 2) {
00265
00266
00267
00268 i__1 = *n;
00269 for (j = 1; j <= i__1; ++j) {
00270 i__2 = min(j,*m);
00271 for (i__ = 1; i__ <= i__2; ++i__) {
00272 i__3 = i__ + j * a_dim1;
00273 i__4 = i__ + j * a_dim1;
00274 q__1.r = mul * a[i__4].r, q__1.i = mul * a[i__4].i;
00275 a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00276
00277 }
00278
00279 }
00280
00281 } else if (itype == 3) {
00282
00283
00284
00285 i__1 = *n;
00286 for (j = 1; j <= i__1; ++j) {
00287
00288 i__3 = j + 1;
00289 i__2 = min(i__3,*m);
00290 for (i__ = 1; i__ <= i__2; ++i__) {
00291 i__3 = i__ + j * a_dim1;
00292 i__4 = i__ + j * a_dim1;
00293 q__1.r = mul * a[i__4].r, q__1.i = mul * a[i__4].i;
00294 a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00295
00296 }
00297
00298 }
00299
00300 } else if (itype == 4) {
00301
00302
00303
00304 k3 = *kl + 1;
00305 k4 = *n + 1;
00306 i__1 = *n;
00307 for (j = 1; j <= i__1; ++j) {
00308
00309 i__3 = k3, i__4 = k4 - j;
00310 i__2 = min(i__3,i__4);
00311 for (i__ = 1; i__ <= i__2; ++i__) {
00312 i__3 = i__ + j * a_dim1;
00313 i__4 = i__ + j * a_dim1;
00314 q__1.r = mul * a[i__4].r, q__1.i = mul * a[i__4].i;
00315 a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00316
00317 }
00318
00319 }
00320
00321 } else if (itype == 5) {
00322
00323
00324
00325 k1 = *ku + 2;
00326 k3 = *ku + 1;
00327 i__1 = *n;
00328 for (j = 1; j <= i__1; ++j) {
00329
00330 i__2 = k1 - j;
00331 i__3 = k3;
00332 for (i__ = max(i__2,1); i__ <= i__3; ++i__) {
00333 i__2 = i__ + j * a_dim1;
00334 i__4 = i__ + j * a_dim1;
00335 q__1.r = mul * a[i__4].r, q__1.i = mul * a[i__4].i;
00336 a[i__2].r = q__1.r, a[i__2].i = q__1.i;
00337
00338 }
00339
00340 }
00341
00342 } else if (itype == 6) {
00343
00344
00345
00346 k1 = *kl + *ku + 2;
00347 k2 = *kl + 1;
00348 k3 = (*kl << 1) + *ku + 1;
00349 k4 = *kl + *ku + 1 + *m;
00350 i__1 = *n;
00351 for (j = 1; j <= i__1; ++j) {
00352
00353 i__3 = k1 - j;
00354
00355 i__4 = k3, i__5 = k4 - j;
00356 i__2 = min(i__4,i__5);
00357 for (i__ = max(i__3,k2); i__ <= i__2; ++i__) {
00358 i__3 = i__ + j * a_dim1;
00359 i__4 = i__ + j * a_dim1;
00360 q__1.r = mul * a[i__4].r, q__1.i = mul * a[i__4].i;
00361 a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00362
00363 }
00364
00365 }
00366
00367 }
00368
00369 if (! done) {
00370 goto L10;
00371 }
00372
00373 return 0;
00374
00375
00376
00377 }