dlansf.c
Go to the documentation of this file.
00001 /* dlansf.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Table of constant values */
00017 
00018 static integer c__1 = 1;
00019 
00020 doublereal dlansf_(char *norm, char *transr, char *uplo, integer *n, 
00021         doublereal *a, doublereal *work)
00022 {
00023     /* System generated locals */
00024     integer i__1, i__2;
00025     doublereal ret_val, d__1, d__2, d__3;
00026 
00027     /* Builtin functions */
00028     double sqrt(doublereal);
00029 
00030     /* Local variables */
00031     integer i__, j, k, l;
00032     doublereal s;
00033     integer n1;
00034     doublereal aa;
00035     integer lda, ifm, noe, ilu;
00036     doublereal scale;
00037     extern logical lsame_(char *, char *);
00038     doublereal value;
00039     extern integer idamax_(integer *, doublereal *, integer *);
00040     extern /* Subroutine */ int dlassq_(integer *, doublereal *, integer *, 
00041             doublereal *, doublereal *);
00042 
00043 
00044 /*  -- LAPACK routine (version 3.2)                                    -- */
00045 
00046 /*  -- Contributed by Fred Gustavson of the IBM Watson Research Center -- */
00047 /*  -- November 2008                                                   -- */
00048 
00049 /*  -- LAPACK is a software package provided by Univ. of Tennessee,    -- */
00050 /*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
00051 
00052 /*     .. Scalar Arguments .. */
00053 /*     .. */
00054 /*     .. Array Arguments .. */
00055 /*     .. */
00056 
00057 /*  Purpose */
00058 /*  ======= */
00059 
00060 /*  DLANSF returns the value of the one norm, or the Frobenius norm, or */
00061 /*  the infinity norm, or the element of largest absolute value of a */
00062 /*  real symmetric matrix A in RFP format. */
00063 
00064 /*  Description */
00065 /*  =========== */
00066 
00067 /*  DLANSF returns the value */
00068 
00069 /*     DLANSF = ( max(abs(A(i,j))), NORM = 'M' or 'm' */
00070 /*              ( */
00071 /*              ( norm1(A),         NORM = '1', 'O' or 'o' */
00072 /*              ( */
00073 /*              ( normI(A),         NORM = 'I' or 'i' */
00074 /*              ( */
00075 /*              ( normF(A),         NORM = 'F', 'f', 'E' or 'e' */
00076 
00077 /*  where  norm1  denotes the  one norm of a matrix (maximum column sum), */
00078 /*  normI  denotes the  infinity norm  of a matrix  (maximum row sum) and */
00079 /*  normF  denotes the  Frobenius norm of a matrix (square root of sum of */
00080 /*  squares).  Note that  max(abs(A(i,j)))  is not a  matrix norm. */
00081 
00082 /*  Arguments */
00083 /*  ========= */
00084 
00085 /*  NORM    (input) CHARACTER */
00086 /*          Specifies the value to be returned in DLANSF as described */
00087 /*          above. */
00088 
00089 /*  TRANSR  (input) CHARACTER */
00090 /*          Specifies whether the RFP format of A is normal or */
00091 /*          transposed format. */
00092 /*          = 'N':  RFP format is Normal; */
00093 /*          = 'T':  RFP format is Transpose. */
00094 
00095 /*  UPLO    (input) CHARACTER */
00096 /*           On entry, UPLO specifies whether the RFP matrix A came from */
00097 /*           an upper or lower triangular matrix as follows: */
00098 /*           = 'U': RFP A came from an upper triangular matrix; */
00099 /*           = 'L': RFP A came from a lower triangular matrix. */
00100 
00101 /*  N       (input) INTEGER */
00102 /*          The order of the matrix A. N >= 0. When N = 0, DLANSF is */
00103 /*          set to zero. */
00104 
00105 /*  A       (input) DOUBLE PRECISION array, dimension ( N*(N+1)/2 ); */
00106 /*          On entry, the upper (if UPLO = 'U') or lower (if UPLO = 'L') */
00107 /*          part of the symmetric matrix A stored in RFP format. See the */
00108 /*          "Notes" below for more details. */
00109 /*          Unchanged on exit. */
00110 
00111 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)), */
00112 /*          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise, */
00113 /*          WORK is not referenced. */
00114 
00115 /*  Notes */
00116 /*  ===== */
00117 
00118 /*  We first consider Rectangular Full Packed (RFP) Format when N is */
00119 /*  even. We give an example where N = 6. */
00120 
00121 /*      AP is Upper             AP is Lower */
00122 
00123 /*   00 01 02 03 04 05       00 */
00124 /*      11 12 13 14 15       10 11 */
00125 /*         22 23 24 25       20 21 22 */
00126 /*            33 34 35       30 31 32 33 */
00127 /*               44 45       40 41 42 43 44 */
00128 /*                  55       50 51 52 53 54 55 */
00129 
00130 
00131 /*  Let TRANSR = 'N'. RFP holds AP as follows: */
00132 /*  For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last */
00133 /*  three columns of AP upper. The lower triangle A(4:6,0:2) consists of */
00134 /*  the transpose of the first three columns of AP upper. */
00135 /*  For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first */
00136 /*  three columns of AP lower. The upper triangle A(0:2,0:2) consists of */
00137 /*  the transpose of the last three columns of AP lower. */
00138 /*  This covers the case N even and TRANSR = 'N'. */
00139 
00140 /*         RFP A                   RFP A */
00141 
00142 /*        03 04 05                33 43 53 */
00143 /*        13 14 15                00 44 54 */
00144 /*        23 24 25                10 11 55 */
00145 /*        33 34 35                20 21 22 */
00146 /*        00 44 45                30 31 32 */
00147 /*        01 11 55                40 41 42 */
00148 /*        02 12 22                50 51 52 */
00149 
00150 /*  Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */
00151 /*  transpose of RFP A above. One therefore gets: */
00152 
00153 
00154 /*           RFP A                   RFP A */
00155 
00156 /*     03 13 23 33 00 01 02    33 00 10 20 30 40 50 */
00157 /*     04 14 24 34 44 11 12    43 44 11 21 31 41 51 */
00158 /*     05 15 25 35 45 55 22    53 54 55 22 32 42 52 */
00159 
00160 
00161 /*  We first consider Rectangular Full Packed (RFP) Format when N is */
00162 /*  odd. We give an example where N = 5. */
00163 
00164 /*     AP is Upper                 AP is Lower */
00165 
00166 /*   00 01 02 03 04              00 */
00167 /*      11 12 13 14              10 11 */
00168 /*         22 23 24              20 21 22 */
00169 /*            33 34              30 31 32 33 */
00170 /*               44              40 41 42 43 44 */
00171 
00172 
00173 /*  Let TRANSR = 'N'. RFP holds AP as follows: */
00174 /*  For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last */
00175 /*  three columns of AP upper. The lower triangle A(3:4,0:1) consists of */
00176 /*  the transpose of the first two columns of AP upper. */
00177 /*  For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first */
00178 /*  three columns of AP lower. The upper triangle A(0:1,1:2) consists of */
00179 /*  the transpose of the last two columns of AP lower. */
00180 /*  This covers the case N odd and TRANSR = 'N'. */
00181 
00182 /*         RFP A                   RFP A */
00183 
00184 /*        02 03 04                00 33 43 */
00185 /*        12 13 14                10 11 44 */
00186 /*        22 23 24                20 21 22 */
00187 /*        00 33 34                30 31 32 */
00188 /*        01 11 44                40 41 42 */
00189 
00190 /*  Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */
00191 /*  transpose of RFP A above. One therefore gets: */
00192 
00193 /*           RFP A                   RFP A */
00194 
00195 /*     02 12 22 00 01             00 10 20 30 40 50 */
00196 /*     03 13 23 33 11             33 11 21 31 41 51 */
00197 /*     04 14 24 34 44             43 44 22 32 42 52 */
00198 
00199 /*  Reference */
00200 /*  ========= */
00201 
00202 /*  ===================================================================== */
00203 
00204 /*     .. Parameters .. */
00205 /*     .. */
00206 /*     .. Local Scalars .. */
00207 /*     .. */
00208 /*     .. External Functions .. */
00209 /*     .. */
00210 /*     .. External Subroutines .. */
00211 /*     .. */
00212 /*     .. Intrinsic Functions .. */
00213 /*     .. */
00214 /*     .. Executable Statements .. */
00215 
00216     if (*n == 0) {
00217         ret_val = 0.;
00218         return ret_val;
00219     }
00220 
00221 /*     set noe = 1 if n is odd. if n is even set noe=0 */
00222 
00223     noe = 1;
00224     if (*n % 2 == 0) {
00225         noe = 0;
00226     }
00227 
00228 /*     set ifm = 0 when form='T or 't' and 1 otherwise */
00229 
00230     ifm = 1;
00231     if (lsame_(transr, "T")) {
00232         ifm = 0;
00233     }
00234 
00235 /*     set ilu = 0 when uplo='U or 'u' and 1 otherwise */
00236 
00237     ilu = 1;
00238     if (lsame_(uplo, "U")) {
00239         ilu = 0;
00240     }
00241 
00242 /*     set lda = (n+1)/2 when ifm = 0 */
00243 /*     set lda = n when ifm = 1 and noe = 1 */
00244 /*     set lda = n+1 when ifm = 1 and noe = 0 */
00245 
00246     if (ifm == 1) {
00247         if (noe == 1) {
00248             lda = *n;
00249         } else {
00250 /*           noe=0 */
00251             lda = *n + 1;
00252         }
00253     } else {
00254 /*        ifm=0 */
00255         lda = (*n + 1) / 2;
00256     }
00257 
00258     if (lsame_(norm, "M")) {
00259 
00260 /*       Find max(abs(A(i,j))). */
00261 
00262         k = (*n + 1) / 2;
00263         value = 0.;
00264         if (noe == 1) {
00265 /*           n is odd */
00266             if (ifm == 1) {
00267 /*           A is n by k */
00268                 i__1 = k - 1;
00269                 for (j = 0; j <= i__1; ++j) {
00270                     i__2 = *n - 1;
00271                     for (i__ = 0; i__ <= i__2; ++i__) {
00272 /* Computing MAX */
00273                         d__2 = value, d__3 = (d__1 = a[i__ + j * lda], abs(
00274                                 d__1));
00275                         value = max(d__2,d__3);
00276                     }
00277                 }
00278             } else {
00279 /*              xpose case; A is k by n */
00280                 i__1 = *n - 1;
00281                 for (j = 0; j <= i__1; ++j) {
00282                     i__2 = k - 1;
00283                     for (i__ = 0; i__ <= i__2; ++i__) {
00284 /* Computing MAX */
00285                         d__2 = value, d__3 = (d__1 = a[i__ + j * lda], abs(
00286                                 d__1));
00287                         value = max(d__2,d__3);
00288                     }
00289                 }
00290             }
00291         } else {
00292 /*           n is even */
00293             if (ifm == 1) {
00294 /*              A is n+1 by k */
00295                 i__1 = k - 1;
00296                 for (j = 0; j <= i__1; ++j) {
00297                     i__2 = *n;
00298                     for (i__ = 0; i__ <= i__2; ++i__) {
00299 /* Computing MAX */
00300                         d__2 = value, d__3 = (d__1 = a[i__ + j * lda], abs(
00301                                 d__1));
00302                         value = max(d__2,d__3);
00303                     }
00304                 }
00305             } else {
00306 /*              xpose case; A is k by n+1 */
00307                 i__1 = *n;
00308                 for (j = 0; j <= i__1; ++j) {
00309                     i__2 = k - 1;
00310                     for (i__ = 0; i__ <= i__2; ++i__) {
00311 /* Computing MAX */
00312                         d__2 = value, d__3 = (d__1 = a[i__ + j * lda], abs(
00313                                 d__1));
00314                         value = max(d__2,d__3);
00315                     }
00316                 }
00317             }
00318         }
00319     } else if (lsame_(norm, "I") || lsame_(norm, "O") || *(unsigned char *)norm == '1') {
00320 
00321 /*        Find normI(A) ( = norm1(A), since A is symmetric). */
00322 
00323         if (ifm == 1) {
00324             k = *n / 2;
00325             if (noe == 1) {
00326 /*              n is odd */
00327                 if (ilu == 0) {
00328                     i__1 = k - 1;
00329                     for (i__ = 0; i__ <= i__1; ++i__) {
00330                         work[i__] = 0.;
00331                     }
00332                     i__1 = k;
00333                     for (j = 0; j <= i__1; ++j) {
00334                         s = 0.;
00335                         i__2 = k + j - 1;
00336                         for (i__ = 0; i__ <= i__2; ++i__) {
00337                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00338 /*                       -> A(i,j+k) */
00339                             s += aa;
00340                             work[i__] += aa;
00341                         }
00342                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00343 /*                    -> A(j+k,j+k) */
00344                         work[j + k] = s + aa;
00345                         if (i__ == k + k) {
00346                             goto L10;
00347                         }
00348                         ++i__;
00349                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00350 /*                    -> A(j,j) */
00351                         work[j] += aa;
00352                         s = 0.;
00353                         i__2 = k - 1;
00354                         for (l = j + 1; l <= i__2; ++l) {
00355                             ++i__;
00356                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00357 /*                       -> A(l,j) */
00358                             s += aa;
00359                             work[l] += aa;
00360                         }
00361                         work[j] += s;
00362                     }
00363 L10:
00364                     i__ = idamax_(n, work, &c__1);
00365                     value = work[i__ - 1];
00366                 } else {
00367 /*                 ilu = 1 */
00368                     ++k;
00369 /*                 k=(n+1)/2 for n odd and ilu=1 */
00370                     i__1 = *n - 1;
00371                     for (i__ = k; i__ <= i__1; ++i__) {
00372                         work[i__] = 0.;
00373                     }
00374                     for (j = k - 1; j >= 0; --j) {
00375                         s = 0.;
00376                         i__1 = j - 2;
00377                         for (i__ = 0; i__ <= i__1; ++i__) {
00378                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00379 /*                       -> A(j+k,i+k) */
00380                             s += aa;
00381                             work[i__ + k] += aa;
00382                         }
00383                         if (j > 0) {
00384                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00385 /*                       -> A(j+k,j+k) */
00386                             s += aa;
00387                             work[i__ + k] += s;
00388 /*                       i=j */
00389                             ++i__;
00390                         }
00391                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00392 /*                    -> A(j,j) */
00393                         work[j] = aa;
00394                         s = 0.;
00395                         i__1 = *n - 1;
00396                         for (l = j + 1; l <= i__1; ++l) {
00397                             ++i__;
00398                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00399 /*                       -> A(l,j) */
00400                             s += aa;
00401                             work[l] += aa;
00402                         }
00403                         work[j] += s;
00404                     }
00405                     i__ = idamax_(n, work, &c__1);
00406                     value = work[i__ - 1];
00407                 }
00408             } else {
00409 /*              n is even */
00410                 if (ilu == 0) {
00411                     i__1 = k - 1;
00412                     for (i__ = 0; i__ <= i__1; ++i__) {
00413                         work[i__] = 0.;
00414                     }
00415                     i__1 = k - 1;
00416                     for (j = 0; j <= i__1; ++j) {
00417                         s = 0.;
00418                         i__2 = k + j - 1;
00419                         for (i__ = 0; i__ <= i__2; ++i__) {
00420                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00421 /*                       -> A(i,j+k) */
00422                             s += aa;
00423                             work[i__] += aa;
00424                         }
00425                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00426 /*                    -> A(j+k,j+k) */
00427                         work[j + k] = s + aa;
00428                         ++i__;
00429                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00430 /*                    -> A(j,j) */
00431                         work[j] += aa;
00432                         s = 0.;
00433                         i__2 = k - 1;
00434                         for (l = j + 1; l <= i__2; ++l) {
00435                             ++i__;
00436                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00437 /*                       -> A(l,j) */
00438                             s += aa;
00439                             work[l] += aa;
00440                         }
00441                         work[j] += s;
00442                     }
00443                     i__ = idamax_(n, work, &c__1);
00444                     value = work[i__ - 1];
00445                 } else {
00446 /*                 ilu = 1 */
00447                     i__1 = *n - 1;
00448                     for (i__ = k; i__ <= i__1; ++i__) {
00449                         work[i__] = 0.;
00450                     }
00451                     for (j = k - 1; j >= 0; --j) {
00452                         s = 0.;
00453                         i__1 = j - 1;
00454                         for (i__ = 0; i__ <= i__1; ++i__) {
00455                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00456 /*                       -> A(j+k,i+k) */
00457                             s += aa;
00458                             work[i__ + k] += aa;
00459                         }
00460                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00461 /*                    -> A(j+k,j+k) */
00462                         s += aa;
00463                         work[i__ + k] += s;
00464 /*                    i=j */
00465                         ++i__;
00466                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00467 /*                    -> A(j,j) */
00468                         work[j] = aa;
00469                         s = 0.;
00470                         i__1 = *n - 1;
00471                         for (l = j + 1; l <= i__1; ++l) {
00472                             ++i__;
00473                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00474 /*                       -> A(l,j) */
00475                             s += aa;
00476                             work[l] += aa;
00477                         }
00478                         work[j] += s;
00479                     }
00480                     i__ = idamax_(n, work, &c__1);
00481                     value = work[i__ - 1];
00482                 }
00483             }
00484         } else {
00485 /*           ifm=0 */
00486             k = *n / 2;
00487             if (noe == 1) {
00488 /*              n is odd */
00489                 if (ilu == 0) {
00490                     n1 = k;
00491 /*                 n/2 */
00492                     ++k;
00493 /*                 k is the row size and lda */
00494                     i__1 = *n - 1;
00495                     for (i__ = n1; i__ <= i__1; ++i__) {
00496                         work[i__] = 0.;
00497                     }
00498                     i__1 = n1 - 1;
00499                     for (j = 0; j <= i__1; ++j) {
00500                         s = 0.;
00501                         i__2 = k - 1;
00502                         for (i__ = 0; i__ <= i__2; ++i__) {
00503                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00504 /*                       A(j,n1+i) */
00505                             work[i__ + n1] += aa;
00506                             s += aa;
00507                         }
00508                         work[j] = s;
00509                     }
00510 /*                 j=n1=k-1 is special */
00511                     s = (d__1 = a[j * lda], abs(d__1));
00512 /*                 A(k-1,k-1) */
00513                     i__1 = k - 1;
00514                     for (i__ = 1; i__ <= i__1; ++i__) {
00515                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00516 /*                    A(k-1,i+n1) */
00517                         work[i__ + n1] += aa;
00518                         s += aa;
00519                     }
00520                     work[j] += s;
00521                     i__1 = *n - 1;
00522                     for (j = k; j <= i__1; ++j) {
00523                         s = 0.;
00524                         i__2 = j - k - 1;
00525                         for (i__ = 0; i__ <= i__2; ++i__) {
00526                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00527 /*                       A(i,j-k) */
00528                             work[i__] += aa;
00529                             s += aa;
00530                         }
00531 /*                    i=j-k */
00532                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00533 /*                    A(j-k,j-k) */
00534                         s += aa;
00535                         work[j - k] += s;
00536                         ++i__;
00537                         s = (d__1 = a[i__ + j * lda], abs(d__1));
00538 /*                    A(j,j) */
00539                         i__2 = *n - 1;
00540                         for (l = j + 1; l <= i__2; ++l) {
00541                             ++i__;
00542                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00543 /*                       A(j,l) */
00544                             work[l] += aa;
00545                             s += aa;
00546                         }
00547                         work[j] += s;
00548                     }
00549                     i__ = idamax_(n, work, &c__1);
00550                     value = work[i__ - 1];
00551                 } else {
00552 /*                 ilu=1 */
00553                     ++k;
00554 /*                 k=(n+1)/2 for n odd and ilu=1 */
00555                     i__1 = *n - 1;
00556                     for (i__ = k; i__ <= i__1; ++i__) {
00557                         work[i__] = 0.;
00558                     }
00559                     i__1 = k - 2;
00560                     for (j = 0; j <= i__1; ++j) {
00561 /*                    process */
00562                         s = 0.;
00563                         i__2 = j - 1;
00564                         for (i__ = 0; i__ <= i__2; ++i__) {
00565                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00566 /*                       A(j,i) */
00567                             work[i__] += aa;
00568                             s += aa;
00569                         }
00570                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00571 /*                    i=j so process of A(j,j) */
00572                         s += aa;
00573                         work[j] = s;
00574 /*                    is initialised here */
00575                         ++i__;
00576 /*                    i=j process A(j+k,j+k) */
00577                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00578                         s = aa;
00579                         i__2 = *n - 1;
00580                         for (l = k + j + 1; l <= i__2; ++l) {
00581                             ++i__;
00582                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00583 /*                       A(l,k+j) */
00584                             s += aa;
00585                             work[l] += aa;
00586                         }
00587                         work[k + j] += s;
00588                     }
00589 /*                 j=k-1 is special :process col A(k-1,0:k-1) */
00590                     s = 0.;
00591                     i__1 = k - 2;
00592                     for (i__ = 0; i__ <= i__1; ++i__) {
00593                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00594 /*                    A(k,i) */
00595                         work[i__] += aa;
00596                         s += aa;
00597                     }
00598 /*                 i=k-1 */
00599                     aa = (d__1 = a[i__ + j * lda], abs(d__1));
00600 /*                 A(k-1,k-1) */
00601                     s += aa;
00602                     work[i__] = s;
00603 /*                 done with col j=k+1 */
00604                     i__1 = *n - 1;
00605                     for (j = k; j <= i__1; ++j) {
00606 /*                    process col j of A = A(j,0:k-1) */
00607                         s = 0.;
00608                         i__2 = k - 1;
00609                         for (i__ = 0; i__ <= i__2; ++i__) {
00610                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00611 /*                       A(j,i) */
00612                             work[i__] += aa;
00613                             s += aa;
00614                         }
00615                         work[j] += s;
00616                     }
00617                     i__ = idamax_(n, work, &c__1);
00618                     value = work[i__ - 1];
00619                 }
00620             } else {
00621 /*              n is even */
00622                 if (ilu == 0) {
00623                     i__1 = *n - 1;
00624                     for (i__ = k; i__ <= i__1; ++i__) {
00625                         work[i__] = 0.;
00626                     }
00627                     i__1 = k - 1;
00628                     for (j = 0; j <= i__1; ++j) {
00629                         s = 0.;
00630                         i__2 = k - 1;
00631                         for (i__ = 0; i__ <= i__2; ++i__) {
00632                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00633 /*                       A(j,i+k) */
00634                             work[i__ + k] += aa;
00635                             s += aa;
00636                         }
00637                         work[j] = s;
00638                     }
00639 /*                 j=k */
00640                     aa = (d__1 = a[j * lda], abs(d__1));
00641 /*                 A(k,k) */
00642                     s = aa;
00643                     i__1 = k - 1;
00644                     for (i__ = 1; i__ <= i__1; ++i__) {
00645                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00646 /*                    A(k,k+i) */
00647                         work[i__ + k] += aa;
00648                         s += aa;
00649                     }
00650                     work[j] += s;
00651                     i__1 = *n - 1;
00652                     for (j = k + 1; j <= i__1; ++j) {
00653                         s = 0.;
00654                         i__2 = j - 2 - k;
00655                         for (i__ = 0; i__ <= i__2; ++i__) {
00656                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00657 /*                       A(i,j-k-1) */
00658                             work[i__] += aa;
00659                             s += aa;
00660                         }
00661 /*                     i=j-1-k */
00662                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00663 /*                    A(j-k-1,j-k-1) */
00664                         s += aa;
00665                         work[j - k - 1] += s;
00666                         ++i__;
00667                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00668 /*                    A(j,j) */
00669                         s = aa;
00670                         i__2 = *n - 1;
00671                         for (l = j + 1; l <= i__2; ++l) {
00672                             ++i__;
00673                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00674 /*                       A(j,l) */
00675                             work[l] += aa;
00676                             s += aa;
00677                         }
00678                         work[j] += s;
00679                     }
00680 /*                 j=n */
00681                     s = 0.;
00682                     i__1 = k - 2;
00683                     for (i__ = 0; i__ <= i__1; ++i__) {
00684                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00685 /*                    A(i,k-1) */
00686                         work[i__] += aa;
00687                         s += aa;
00688                     }
00689 /*                 i=k-1 */
00690                     aa = (d__1 = a[i__ + j * lda], abs(d__1));
00691 /*                 A(k-1,k-1) */
00692                     s += aa;
00693                     work[i__] += s;
00694                     i__ = idamax_(n, work, &c__1);
00695                     value = work[i__ - 1];
00696                 } else {
00697 /*                 ilu=1 */
00698                     i__1 = *n - 1;
00699                     for (i__ = k; i__ <= i__1; ++i__) {
00700                         work[i__] = 0.;
00701                     }
00702 /*                 j=0 is special :process col A(k:n-1,k) */
00703                     s = abs(a[0]);
00704 /*                 A(k,k) */
00705                     i__1 = k - 1;
00706                     for (i__ = 1; i__ <= i__1; ++i__) {
00707                         aa = (d__1 = a[i__], abs(d__1));
00708 /*                    A(k+i,k) */
00709                         work[i__ + k] += aa;
00710                         s += aa;
00711                     }
00712                     work[k] += s;
00713                     i__1 = k - 1;
00714                     for (j = 1; j <= i__1; ++j) {
00715 /*                    process */
00716                         s = 0.;
00717                         i__2 = j - 2;
00718                         for (i__ = 0; i__ <= i__2; ++i__) {
00719                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00720 /*                       A(j-1,i) */
00721                             work[i__] += aa;
00722                             s += aa;
00723                         }
00724                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00725 /*                    i=j-1 so process of A(j-1,j-1) */
00726                         s += aa;
00727                         work[j - 1] = s;
00728 /*                    is initialised here */
00729                         ++i__;
00730 /*                    i=j process A(j+k,j+k) */
00731                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00732                         s = aa;
00733                         i__2 = *n - 1;
00734                         for (l = k + j + 1; l <= i__2; ++l) {
00735                             ++i__;
00736                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00737 /*                       A(l,k+j) */
00738                             s += aa;
00739                             work[l] += aa;
00740                         }
00741                         work[k + j] += s;
00742                     }
00743 /*                 j=k is special :process col A(k,0:k-1) */
00744                     s = 0.;
00745                     i__1 = k - 2;
00746                     for (i__ = 0; i__ <= i__1; ++i__) {
00747                         aa = (d__1 = a[i__ + j * lda], abs(d__1));
00748 /*                    A(k,i) */
00749                         work[i__] += aa;
00750                         s += aa;
00751                     }
00752 /*                 i=k-1 */
00753                     aa = (d__1 = a[i__ + j * lda], abs(d__1));
00754 /*                 A(k-1,k-1) */
00755                     s += aa;
00756                     work[i__] = s;
00757 /*                 done with col j=k+1 */
00758                     i__1 = *n;
00759                     for (j = k + 1; j <= i__1; ++j) {
00760 /*                    process col j-1 of A = A(j-1,0:k-1) */
00761                         s = 0.;
00762                         i__2 = k - 1;
00763                         for (i__ = 0; i__ <= i__2; ++i__) {
00764                             aa = (d__1 = a[i__ + j * lda], abs(d__1));
00765 /*                       A(j-1,i) */
00766                             work[i__] += aa;
00767                             s += aa;
00768                         }
00769                         work[j - 1] += s;
00770                     }
00771                     i__ = idamax_(n, work, &c__1);
00772                     value = work[i__ - 1];
00773                 }
00774             }
00775         }
00776     } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
00777 
00778 /*       Find normF(A). */
00779 
00780         k = (*n + 1) / 2;
00781         scale = 0.;
00782         s = 1.;
00783         if (noe == 1) {
00784 /*           n is odd */
00785             if (ifm == 1) {
00786 /*              A is normal */
00787                 if (ilu == 0) {
00788 /*                 A is upper */
00789                     i__1 = k - 3;
00790                     for (j = 0; j <= i__1; ++j) {
00791                         i__2 = k - j - 2;
00792                         dlassq_(&i__2, &a[k + j + 1 + j * lda], &c__1, &scale, 
00793                                  &s);
00794 /*                    L at A(k,0) */
00795                     }
00796                     i__1 = k - 1;
00797                     for (j = 0; j <= i__1; ++j) {
00798                         i__2 = k + j - 1;
00799                         dlassq_(&i__2, &a[j * lda], &c__1, &scale, &s);
00800 /*                    trap U at A(0,0) */
00801                     }
00802                     s += s;
00803 /*                 double s for the off diagonal elements */
00804                     i__1 = k - 1;
00805                     i__2 = lda + 1;
00806                     dlassq_(&i__1, &a[k], &i__2, &scale, &s);
00807 /*                 tri L at A(k,0) */
00808                     i__1 = lda + 1;
00809                     dlassq_(&k, &a[k - 1], &i__1, &scale, &s);
00810 /*                 tri U at A(k-1,0) */
00811                 } else {
00812 /*                 ilu=1 & A is lower */
00813                     i__1 = k - 1;
00814                     for (j = 0; j <= i__1; ++j) {
00815                         i__2 = *n - j - 1;
00816                         dlassq_(&i__2, &a[j + 1 + j * lda], &c__1, &scale, &s)
00817                                 ;
00818 /*                    trap L at A(0,0) */
00819                     }
00820                     i__1 = k - 2;
00821                     for (j = 0; j <= i__1; ++j) {
00822                         dlassq_(&j, &a[(j + 1) * lda], &c__1, &scale, &s);
00823 /*                    U at A(0,1) */
00824                     }
00825                     s += s;
00826 /*                 double s for the off diagonal elements */
00827                     i__1 = lda + 1;
00828                     dlassq_(&k, a, &i__1, &scale, &s);
00829 /*                 tri L at A(0,0) */
00830                     i__1 = k - 1;
00831                     i__2 = lda + 1;
00832                     dlassq_(&i__1, &a[lda], &i__2, &scale, &s);
00833 /*                 tri U at A(0,1) */
00834                 }
00835             } else {
00836 /*              A is xpose */
00837                 if (ilu == 0) {
00838 /*                 A' is upper */
00839                     i__1 = k - 2;
00840                     for (j = 1; j <= i__1; ++j) {
00841                         dlassq_(&j, &a[(k + j) * lda], &c__1, &scale, &s);
00842 /*                    U at A(0,k) */
00843                     }
00844                     i__1 = k - 2;
00845                     for (j = 0; j <= i__1; ++j) {
00846                         dlassq_(&k, &a[j * lda], &c__1, &scale, &s);
00847 /*                    k by k-1 rect. at A(0,0) */
00848                     }
00849                     i__1 = k - 2;
00850                     for (j = 0; j <= i__1; ++j) {
00851                         i__2 = k - j - 1;
00852                         dlassq_(&i__2, &a[j + 1 + (j + k - 1) * lda], &c__1, &
00853                                 scale, &s);
00854 /*                    L at A(0,k-1) */
00855                     }
00856                     s += s;
00857 /*                 double s for the off diagonal elements */
00858                     i__1 = k - 1;
00859                     i__2 = lda + 1;
00860                     dlassq_(&i__1, &a[k * lda], &i__2, &scale, &s);
00861 /*                 tri U at A(0,k) */
00862                     i__1 = lda + 1;
00863                     dlassq_(&k, &a[(k - 1) * lda], &i__1, &scale, &s);
00864 /*                 tri L at A(0,k-1) */
00865                 } else {
00866 /*                 A' is lower */
00867                     i__1 = k - 1;
00868                     for (j = 1; j <= i__1; ++j) {
00869                         dlassq_(&j, &a[j * lda], &c__1, &scale, &s);
00870 /*                    U at A(0,0) */
00871                     }
00872                     i__1 = *n - 1;
00873                     for (j = k; j <= i__1; ++j) {
00874                         dlassq_(&k, &a[j * lda], &c__1, &scale, &s);
00875 /*                    k by k-1 rect. at A(0,k) */
00876                     }
00877                     i__1 = k - 3;
00878                     for (j = 0; j <= i__1; ++j) {
00879                         i__2 = k - j - 2;
00880                         dlassq_(&i__2, &a[j + 2 + j * lda], &c__1, &scale, &s)
00881                                 ;
00882 /*                    L at A(1,0) */
00883                     }
00884                     s += s;
00885 /*                 double s for the off diagonal elements */
00886                     i__1 = lda + 1;
00887                     dlassq_(&k, a, &i__1, &scale, &s);
00888 /*                 tri U at A(0,0) */
00889                     i__1 = k - 1;
00890                     i__2 = lda + 1;
00891                     dlassq_(&i__1, &a[1], &i__2, &scale, &s);
00892 /*                 tri L at A(1,0) */
00893                 }
00894             }
00895         } else {
00896 /*           n is even */
00897             if (ifm == 1) {
00898 /*              A is normal */
00899                 if (ilu == 0) {
00900 /*                 A is upper */
00901                     i__1 = k - 2;
00902                     for (j = 0; j <= i__1; ++j) {
00903                         i__2 = k - j - 1;
00904                         dlassq_(&i__2, &a[k + j + 2 + j * lda], &c__1, &scale, 
00905                                  &s);
00906 /*                    L at A(k+1,0) */
00907                     }
00908                     i__1 = k - 1;
00909                     for (j = 0; j <= i__1; ++j) {
00910                         i__2 = k + j;
00911                         dlassq_(&i__2, &a[j * lda], &c__1, &scale, &s);
00912 /*                    trap U at A(0,0) */
00913                     }
00914                     s += s;
00915 /*                 double s for the off diagonal elements */
00916                     i__1 = lda + 1;
00917                     dlassq_(&k, &a[k + 1], &i__1, &scale, &s);
00918 /*                 tri L at A(k+1,0) */
00919                     i__1 = lda + 1;
00920                     dlassq_(&k, &a[k], &i__1, &scale, &s);
00921 /*                 tri U at A(k,0) */
00922                 } else {
00923 /*                 ilu=1 & A is lower */
00924                     i__1 = k - 1;
00925                     for (j = 0; j <= i__1; ++j) {
00926                         i__2 = *n - j - 1;
00927                         dlassq_(&i__2, &a[j + 2 + j * lda], &c__1, &scale, &s)
00928                                 ;
00929 /*                    trap L at A(1,0) */
00930                     }
00931                     i__1 = k - 1;
00932                     for (j = 1; j <= i__1; ++j) {
00933                         dlassq_(&j, &a[j * lda], &c__1, &scale, &s);
00934 /*                    U at A(0,0) */
00935                     }
00936                     s += s;
00937 /*                 double s for the off diagonal elements */
00938                     i__1 = lda + 1;
00939                     dlassq_(&k, &a[1], &i__1, &scale, &s);
00940 /*                 tri L at A(1,0) */
00941                     i__1 = lda + 1;
00942                     dlassq_(&k, a, &i__1, &scale, &s);
00943 /*                 tri U at A(0,0) */
00944                 }
00945             } else {
00946 /*              A is xpose */
00947                 if (ilu == 0) {
00948 /*                 A' is upper */
00949                     i__1 = k - 1;
00950                     for (j = 1; j <= i__1; ++j) {
00951                         dlassq_(&j, &a[(k + 1 + j) * lda], &c__1, &scale, &s);
00952 /*                    U at A(0,k+1) */
00953                     }
00954                     i__1 = k - 1;
00955                     for (j = 0; j <= i__1; ++j) {
00956                         dlassq_(&k, &a[j * lda], &c__1, &scale, &s);
00957 /*                    k by k rect. at A(0,0) */
00958                     }
00959                     i__1 = k - 2;
00960                     for (j = 0; j <= i__1; ++j) {
00961                         i__2 = k - j - 1;
00962                         dlassq_(&i__2, &a[j + 1 + (j + k) * lda], &c__1, &
00963                                 scale, &s);
00964 /*                    L at A(0,k) */
00965                     }
00966                     s += s;
00967 /*                 double s for the off diagonal elements */
00968                     i__1 = lda + 1;
00969                     dlassq_(&k, &a[(k + 1) * lda], &i__1, &scale, &s);
00970 /*                 tri U at A(0,k+1) */
00971                     i__1 = lda + 1;
00972                     dlassq_(&k, &a[k * lda], &i__1, &scale, &s);
00973 /*                 tri L at A(0,k) */
00974                 } else {
00975 /*                 A' is lower */
00976                     i__1 = k - 1;
00977                     for (j = 1; j <= i__1; ++j) {
00978                         dlassq_(&j, &a[(j + 1) * lda], &c__1, &scale, &s);
00979 /*                    U at A(0,1) */
00980                     }
00981                     i__1 = *n;
00982                     for (j = k + 1; j <= i__1; ++j) {
00983                         dlassq_(&k, &a[j * lda], &c__1, &scale, &s);
00984 /*                    k by k rect. at A(0,k+1) */
00985                     }
00986                     i__1 = k - 2;
00987                     for (j = 0; j <= i__1; ++j) {
00988                         i__2 = k - j - 1;
00989                         dlassq_(&i__2, &a[j + 1 + j * lda], &c__1, &scale, &s)
00990                                 ;
00991 /*                    L at A(0,0) */
00992                     }
00993                     s += s;
00994 /*                 double s for the off diagonal elements */
00995                     i__1 = lda + 1;
00996                     dlassq_(&k, &a[lda], &i__1, &scale, &s);
00997 /*                 tri L at A(0,1) */
00998                     i__1 = lda + 1;
00999                     dlassq_(&k, a, &i__1, &scale, &s);
01000 /*                 tri U at A(0,0) */
01001                 }
01002             }
01003         }
01004         value = scale * sqrt(s);
01005     }
01006 
01007     ret_val = value;
01008     return ret_val;
01009 
01010 /*     End of DLANSF */
01011 
01012 } /* dlansf_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:46