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