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