00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 doublereal sla_syrpvgrw__(char *uplo, integer *n, integer *info, real *a,
00017 integer *lda, real *af, integer *ldaf, integer *ipiv, real *work,
00018 ftnlen uplo_len)
00019 {
00020
00021 integer a_dim1, a_offset, af_dim1, af_offset, i__1, i__2;
00022 real ret_val, r__1, r__2, r__3;
00023
00024
00025 integer i__, j, k, kp;
00026 real tmp, amax, umax;
00027 extern logical lsame_(char *, char *);
00028 integer ncols;
00029 logical upper;
00030 real rpvgrw;
00031
00032
00033
00034
00035
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 a_dim1 = *lda;
00106 a_offset = 1 + a_dim1;
00107 a -= a_offset;
00108 af_dim1 = *ldaf;
00109 af_offset = 1 + af_dim1;
00110 af -= af_offset;
00111 --ipiv;
00112 --work;
00113
00114
00115 upper = lsame_("Upper", uplo);
00116 if (*info == 0) {
00117 if (upper) {
00118 ncols = 1;
00119 } else {
00120 ncols = *n;
00121 }
00122 } else {
00123 ncols = *info;
00124 }
00125 rpvgrw = 1.f;
00126 i__1 = *n << 1;
00127 for (i__ = 1; i__ <= i__1; ++i__) {
00128 work[i__] = 0.f;
00129 }
00130
00131
00132
00133
00134
00135 if (upper) {
00136 i__1 = *n;
00137 for (j = 1; j <= i__1; ++j) {
00138 i__2 = j;
00139 for (i__ = 1; i__ <= i__2; ++i__) {
00140
00141 r__2 = (r__1 = a[i__ + j * a_dim1], dabs(r__1)), r__3 = work[*
00142 n + i__];
00143 work[*n + i__] = dmax(r__2,r__3);
00144
00145 r__2 = (r__1 = a[i__ + j * a_dim1], dabs(r__1)), r__3 = work[*
00146 n + j];
00147 work[*n + j] = dmax(r__2,r__3);
00148 }
00149 }
00150 } else {
00151 i__1 = *n;
00152 for (j = 1; j <= i__1; ++j) {
00153 i__2 = *n;
00154 for (i__ = j; i__ <= i__2; ++i__) {
00155
00156 r__2 = (r__1 = a[i__ + j * a_dim1], dabs(r__1)), r__3 = work[*
00157 n + i__];
00158 work[*n + i__] = dmax(r__2,r__3);
00159
00160 r__2 = (r__1 = a[i__ + j * a_dim1], dabs(r__1)), r__3 = work[*
00161 n + j];
00162 work[*n + j] = dmax(r__2,r__3);
00163 }
00164 }
00165 }
00166
00167
00168
00169
00170
00171
00172
00173
00174 if (upper) {
00175 k = *n;
00176 while(k < ncols && k > 0) {
00177 if (ipiv[k] > 0) {
00178
00179 kp = ipiv[k];
00180 if (kp != k) {
00181 tmp = work[*n + k];
00182 work[*n + k] = work[*n + kp];
00183 work[*n + kp] = tmp;
00184 }
00185 i__1 = k;
00186 for (i__ = 1; i__ <= i__1; ++i__) {
00187
00188 r__2 = (r__1 = af[i__ + k * af_dim1], dabs(r__1)), r__3 =
00189 work[k];
00190 work[k] = dmax(r__2,r__3);
00191 }
00192 --k;
00193 } else {
00194
00195 kp = -ipiv[k];
00196 tmp = work[*n + k - 1];
00197 work[*n + k - 1] = work[*n + kp];
00198 work[*n + kp] = tmp;
00199 i__1 = k - 1;
00200 for (i__ = 1; i__ <= i__1; ++i__) {
00201
00202 r__2 = (r__1 = af[i__ + k * af_dim1], dabs(r__1)), r__3 =
00203 work[k];
00204 work[k] = dmax(r__2,r__3);
00205
00206 r__2 = (r__1 = af[i__ + (k - 1) * af_dim1], dabs(r__1)),
00207 r__3 = work[k - 1];
00208 work[k - 1] = dmax(r__2,r__3);
00209 }
00210
00211 r__2 = (r__1 = af[k + k * af_dim1], dabs(r__1)), r__3 = work[
00212 k];
00213 work[k] = dmax(r__2,r__3);
00214 k += -2;
00215 }
00216 }
00217 k = ncols;
00218 while(k <= *n) {
00219 if (ipiv[k] > 0) {
00220 kp = ipiv[k];
00221 if (kp != k) {
00222 tmp = work[*n + k];
00223 work[*n + k] = work[*n + kp];
00224 work[*n + kp] = tmp;
00225 }
00226 ++k;
00227 } else {
00228 kp = -ipiv[k];
00229 tmp = work[*n + k];
00230 work[*n + k] = work[*n + kp];
00231 work[*n + kp] = tmp;
00232 k += 2;
00233 }
00234 }
00235 } else {
00236 k = 1;
00237 while(k <= ncols) {
00238 if (ipiv[k] > 0) {
00239
00240 kp = ipiv[k];
00241 if (kp != k) {
00242 tmp = work[*n + k];
00243 work[*n + k] = work[*n + kp];
00244 work[*n + kp] = tmp;
00245 }
00246 i__1 = *n;
00247 for (i__ = k; i__ <= i__1; ++i__) {
00248
00249 r__2 = (r__1 = af[i__ + k * af_dim1], dabs(r__1)), r__3 =
00250 work[k];
00251 work[k] = dmax(r__2,r__3);
00252 }
00253 ++k;
00254 } else {
00255
00256 kp = -ipiv[k];
00257 tmp = work[*n + k + 1];
00258 work[*n + k + 1] = work[*n + kp];
00259 work[*n + kp] = tmp;
00260 i__1 = *n;
00261 for (i__ = k + 1; i__ <= i__1; ++i__) {
00262
00263 r__2 = (r__1 = af[i__ + k * af_dim1], dabs(r__1)), r__3 =
00264 work[k];
00265 work[k] = dmax(r__2,r__3);
00266
00267 r__2 = (r__1 = af[i__ + (k + 1) * af_dim1], dabs(r__1)),
00268 r__3 = work[k + 1];
00269 work[k + 1] = dmax(r__2,r__3);
00270 }
00271
00272 r__2 = (r__1 = af[k + k * af_dim1], dabs(r__1)), r__3 = work[
00273 k];
00274 work[k] = dmax(r__2,r__3);
00275 k += 2;
00276 }
00277 }
00278 k = ncols;
00279 while(k >= 1) {
00280 if (ipiv[k] > 0) {
00281 kp = ipiv[k];
00282 if (kp != k) {
00283 tmp = work[*n + k];
00284 work[*n + k] = work[*n + kp];
00285 work[*n + kp] = tmp;
00286 }
00287 --k;
00288 } else {
00289 kp = -ipiv[k];
00290 tmp = work[*n + k];
00291 work[*n + k] = work[*n + kp];
00292 work[*n + kp] = tmp;
00293 k += -2;
00294 }
00295 }
00296 }
00297
00298
00299
00300
00301
00302
00303
00304
00305 if (upper) {
00306 i__1 = *n;
00307 for (i__ = ncols; i__ <= i__1; ++i__) {
00308 umax = work[i__];
00309 amax = work[*n + i__];
00310 if (umax != 0.f) {
00311
00312 r__1 = amax / umax;
00313 rpvgrw = dmin(r__1,rpvgrw);
00314 }
00315 }
00316 } else {
00317 i__1 = ncols;
00318 for (i__ = 1; i__ <= i__1; ++i__) {
00319 umax = work[i__];
00320 amax = work[*n + i__];
00321 if (umax != 0.f) {
00322
00323 r__1 = amax / umax;
00324 rpvgrw = dmin(r__1,rpvgrw);
00325 }
00326 }
00327 }
00328 ret_val = rpvgrw;
00329 return ret_val;
00330 }