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 integer c__1 = 1;
00019
00020 doublereal slantr_(char *norm, char *uplo, char *diag, integer *m, integer *n,
00021 real *a, integer *lda, real *work)
00022 {
00023
00024 integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
00025 real ret_val, r__1, r__2, r__3;
00026
00027
00028 double sqrt(doublereal);
00029
00030
00031 integer i__, j;
00032 real sum, scale;
00033 logical udiag;
00034 extern logical lsame_(char *, char *);
00035 real value;
00036 extern int slassq_(integer *, real *, integer *, real *,
00037 real *);
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
00126
00127
00128
00129
00130
00131
00132
00133 a_dim1 = *lda;
00134 a_offset = 1 + a_dim1;
00135 a -= a_offset;
00136 --work;
00137
00138
00139 if (min(*m,*n) == 0) {
00140 value = 0.f;
00141 } else if (lsame_(norm, "M")) {
00142
00143
00144
00145 if (lsame_(diag, "U")) {
00146 value = 1.f;
00147 if (lsame_(uplo, "U")) {
00148 i__1 = *n;
00149 for (j = 1; j <= i__1; ++j) {
00150
00151 i__3 = *m, i__4 = j - 1;
00152 i__2 = min(i__3,i__4);
00153 for (i__ = 1; i__ <= i__2; ++i__) {
00154
00155 r__2 = value, r__3 = (r__1 = a[i__ + j * a_dim1],
00156 dabs(r__1));
00157 value = dmax(r__2,r__3);
00158
00159 }
00160
00161 }
00162 } else {
00163 i__1 = *n;
00164 for (j = 1; j <= i__1; ++j) {
00165 i__2 = *m;
00166 for (i__ = j + 1; i__ <= i__2; ++i__) {
00167
00168 r__2 = value, r__3 = (r__1 = a[i__ + j * a_dim1],
00169 dabs(r__1));
00170 value = dmax(r__2,r__3);
00171
00172 }
00173
00174 }
00175 }
00176 } else {
00177 value = 0.f;
00178 if (lsame_(uplo, "U")) {
00179 i__1 = *n;
00180 for (j = 1; j <= i__1; ++j) {
00181 i__2 = min(*m,j);
00182 for (i__ = 1; i__ <= i__2; ++i__) {
00183
00184 r__2 = value, r__3 = (r__1 = a[i__ + j * a_dim1],
00185 dabs(r__1));
00186 value = dmax(r__2,r__3);
00187
00188 }
00189
00190 }
00191 } else {
00192 i__1 = *n;
00193 for (j = 1; j <= i__1; ++j) {
00194 i__2 = *m;
00195 for (i__ = j; i__ <= i__2; ++i__) {
00196
00197 r__2 = value, r__3 = (r__1 = a[i__ + j * a_dim1],
00198 dabs(r__1));
00199 value = dmax(r__2,r__3);
00200
00201 }
00202
00203 }
00204 }
00205 }
00206 } else if (lsame_(norm, "O") || *(unsigned char *)
00207 norm == '1') {
00208
00209
00210
00211 value = 0.f;
00212 udiag = lsame_(diag, "U");
00213 if (lsame_(uplo, "U")) {
00214 i__1 = *n;
00215 for (j = 1; j <= i__1; ++j) {
00216 if (udiag && j <= *m) {
00217 sum = 1.f;
00218 i__2 = j - 1;
00219 for (i__ = 1; i__ <= i__2; ++i__) {
00220 sum += (r__1 = a[i__ + j * a_dim1], dabs(r__1));
00221
00222 }
00223 } else {
00224 sum = 0.f;
00225 i__2 = min(*m,j);
00226 for (i__ = 1; i__ <= i__2; ++i__) {
00227 sum += (r__1 = a[i__ + j * a_dim1], dabs(r__1));
00228
00229 }
00230 }
00231 value = dmax(value,sum);
00232
00233 }
00234 } else {
00235 i__1 = *n;
00236 for (j = 1; j <= i__1; ++j) {
00237 if (udiag) {
00238 sum = 1.f;
00239 i__2 = *m;
00240 for (i__ = j + 1; i__ <= i__2; ++i__) {
00241 sum += (r__1 = a[i__ + j * a_dim1], dabs(r__1));
00242
00243 }
00244 } else {
00245 sum = 0.f;
00246 i__2 = *m;
00247 for (i__ = j; i__ <= i__2; ++i__) {
00248 sum += (r__1 = a[i__ + j * a_dim1], dabs(r__1));
00249
00250 }
00251 }
00252 value = dmax(value,sum);
00253
00254 }
00255 }
00256 } else if (lsame_(norm, "I")) {
00257
00258
00259
00260 if (lsame_(uplo, "U")) {
00261 if (lsame_(diag, "U")) {
00262 i__1 = *m;
00263 for (i__ = 1; i__ <= i__1; ++i__) {
00264 work[i__] = 1.f;
00265
00266 }
00267 i__1 = *n;
00268 for (j = 1; j <= i__1; ++j) {
00269
00270 i__3 = *m, i__4 = j - 1;
00271 i__2 = min(i__3,i__4);
00272 for (i__ = 1; i__ <= i__2; ++i__) {
00273 work[i__] += (r__1 = a[i__ + j * a_dim1], dabs(r__1));
00274
00275 }
00276
00277 }
00278 } else {
00279 i__1 = *m;
00280 for (i__ = 1; i__ <= i__1; ++i__) {
00281 work[i__] = 0.f;
00282
00283 }
00284 i__1 = *n;
00285 for (j = 1; j <= i__1; ++j) {
00286 i__2 = min(*m,j);
00287 for (i__ = 1; i__ <= i__2; ++i__) {
00288 work[i__] += (r__1 = a[i__ + j * a_dim1], dabs(r__1));
00289
00290 }
00291
00292 }
00293 }
00294 } else {
00295 if (lsame_(diag, "U")) {
00296 i__1 = *n;
00297 for (i__ = 1; i__ <= i__1; ++i__) {
00298 work[i__] = 1.f;
00299
00300 }
00301 i__1 = *m;
00302 for (i__ = *n + 1; i__ <= i__1; ++i__) {
00303 work[i__] = 0.f;
00304
00305 }
00306 i__1 = *n;
00307 for (j = 1; j <= i__1; ++j) {
00308 i__2 = *m;
00309 for (i__ = j + 1; i__ <= i__2; ++i__) {
00310 work[i__] += (r__1 = a[i__ + j * a_dim1], dabs(r__1));
00311
00312 }
00313
00314 }
00315 } else {
00316 i__1 = *m;
00317 for (i__ = 1; i__ <= i__1; ++i__) {
00318 work[i__] = 0.f;
00319
00320 }
00321 i__1 = *n;
00322 for (j = 1; j <= i__1; ++j) {
00323 i__2 = *m;
00324 for (i__ = j; i__ <= i__2; ++i__) {
00325 work[i__] += (r__1 = a[i__ + j * a_dim1], dabs(r__1));
00326
00327 }
00328
00329 }
00330 }
00331 }
00332 value = 0.f;
00333 i__1 = *m;
00334 for (i__ = 1; i__ <= i__1; ++i__) {
00335
00336 r__1 = value, r__2 = work[i__];
00337 value = dmax(r__1,r__2);
00338
00339 }
00340 } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
00341
00342
00343
00344 if (lsame_(uplo, "U")) {
00345 if (lsame_(diag, "U")) {
00346 scale = 1.f;
00347 sum = (real) min(*m,*n);
00348 i__1 = *n;
00349 for (j = 2; j <= i__1; ++j) {
00350
00351 i__3 = *m, i__4 = j - 1;
00352 i__2 = min(i__3,i__4);
00353 slassq_(&i__2, &a[j * a_dim1 + 1], &c__1, &scale, &sum);
00354
00355 }
00356 } else {
00357 scale = 0.f;
00358 sum = 1.f;
00359 i__1 = *n;
00360 for (j = 1; j <= i__1; ++j) {
00361 i__2 = min(*m,j);
00362 slassq_(&i__2, &a[j * a_dim1 + 1], &c__1, &scale, &sum);
00363
00364 }
00365 }
00366 } else {
00367 if (lsame_(diag, "U")) {
00368 scale = 1.f;
00369 sum = (real) min(*m,*n);
00370 i__1 = *n;
00371 for (j = 1; j <= i__1; ++j) {
00372 i__2 = *m - j;
00373
00374 i__3 = *m, i__4 = j + 1;
00375 slassq_(&i__2, &a[min(i__3, i__4)+ j * a_dim1], &c__1, &
00376 scale, &sum);
00377
00378 }
00379 } else {
00380 scale = 0.f;
00381 sum = 1.f;
00382 i__1 = *n;
00383 for (j = 1; j <= i__1; ++j) {
00384 i__2 = *m - j + 1;
00385 slassq_(&i__2, &a[j + j * a_dim1], &c__1, &scale, &sum);
00386
00387 }
00388 }
00389 }
00390 value = scale * sqrt(sum);
00391 }
00392
00393 ret_val = value;
00394 return ret_val;
00395
00396
00397
00398 }