dlaeda.c
Go to the documentation of this file.
00001 /* dlaeda.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__2 = 2;
00019 static integer c__1 = 1;
00020 static doublereal c_b24 = 1.;
00021 static doublereal c_b26 = 0.;
00022 
00023 /* Subroutine */ int dlaeda_(integer *n, integer *tlvls, integer *curlvl, 
00024         integer *curpbm, integer *prmptr, integer *perm, integer *givptr, 
00025         integer *givcol, doublereal *givnum, doublereal *q, integer *qptr, 
00026         doublereal *z__, doublereal *ztemp, integer *info)
00027 {
00028     /* System generated locals */
00029     integer i__1, i__2, i__3;
00030 
00031     /* Builtin functions */
00032     integer pow_ii(integer *, integer *);
00033     double sqrt(doublereal);
00034 
00035     /* Local variables */
00036     integer i__, k, mid, ptr;
00037     extern /* Subroutine */ int drot_(integer *, doublereal *, integer *, 
00038             doublereal *, integer *, doublereal *, doublereal *);
00039     integer curr, bsiz1, bsiz2, psiz1, psiz2, zptr1;
00040     extern /* Subroutine */ int dgemv_(char *, integer *, integer *, 
00041             doublereal *, doublereal *, integer *, doublereal *, integer *, 
00042             doublereal *, doublereal *, integer *), dcopy_(integer *, 
00043             doublereal *, integer *, doublereal *, integer *), xerbla_(char *, 
00044              integer *);
00045 
00046 
00047 /*  -- LAPACK routine (version 3.2) -- */
00048 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00049 /*     November 2006 */
00050 
00051 /*     .. Scalar Arguments .. */
00052 /*     .. */
00053 /*     .. Array Arguments .. */
00054 /*     .. */
00055 
00056 /*  Purpose */
00057 /*  ======= */
00058 
00059 /*  DLAEDA computes the Z vector corresponding to the merge step in the */
00060 /*  CURLVLth step of the merge process with TLVLS steps for the CURPBMth */
00061 /*  problem. */
00062 
00063 /*  Arguments */
00064 /*  ========= */
00065 
00066 /*  N      (input) INTEGER */
00067 /*         The dimension of the symmetric tridiagonal matrix.  N >= 0. */
00068 
00069 /*  TLVLS  (input) INTEGER */
00070 /*         The total number of merging levels in the overall divide and */
00071 /*         conquer tree. */
00072 
00073 /*  CURLVL (input) INTEGER */
00074 /*         The current level in the overall merge routine, */
00075 /*         0 <= curlvl <= tlvls. */
00076 
00077 /*  CURPBM (input) INTEGER */
00078 /*         The current problem in the current level in the overall */
00079 /*         merge routine (counting from upper left to lower right). */
00080 
00081 /*  PRMPTR (input) INTEGER array, dimension (N lg N) */
00082 /*         Contains a list of pointers which indicate where in PERM a */
00083 /*         level's permutation is stored.  PRMPTR(i+1) - PRMPTR(i) */
00084 /*         indicates the size of the permutation and incidentally the */
00085 /*         size of the full, non-deflated problem. */
00086 
00087 /*  PERM   (input) INTEGER array, dimension (N lg N) */
00088 /*         Contains the permutations (from deflation and sorting) to be */
00089 /*         applied to each eigenblock. */
00090 
00091 /*  GIVPTR (input) INTEGER array, dimension (N lg N) */
00092 /*         Contains a list of pointers which indicate where in GIVCOL a */
00093 /*         level's Givens rotations are stored.  GIVPTR(i+1) - GIVPTR(i) */
00094 /*         indicates the number of Givens rotations. */
00095 
00096 /*  GIVCOL (input) INTEGER array, dimension (2, N lg N) */
00097 /*         Each pair of numbers indicates a pair of columns to take place */
00098 /*         in a Givens rotation. */
00099 
00100 /*  GIVNUM (input) DOUBLE PRECISION array, dimension (2, N lg N) */
00101 /*         Each number indicates the S value to be used in the */
00102 /*         corresponding Givens rotation. */
00103 
00104 /*  Q      (input) DOUBLE PRECISION array, dimension (N**2) */
00105 /*         Contains the square eigenblocks from previous levels, the */
00106 /*         starting positions for blocks are given by QPTR. */
00107 
00108 /*  QPTR   (input) INTEGER array, dimension (N+2) */
00109 /*         Contains a list of pointers which indicate where in Q an */
00110 /*         eigenblock is stored.  SQRT( QPTR(i+1) - QPTR(i) ) indicates */
00111 /*         the size of the block. */
00112 
00113 /*  Z      (output) DOUBLE PRECISION array, dimension (N) */
00114 /*         On output this vector contains the updating vector (the last */
00115 /*         row of the first sub-eigenvector matrix and the first row of */
00116 /*         the second sub-eigenvector matrix). */
00117 
00118 /*  ZTEMP  (workspace) DOUBLE PRECISION array, dimension (N) */
00119 
00120 /*  INFO   (output) INTEGER */
00121 /*          = 0:  successful exit. */
00122 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00123 
00124 /*  Further Details */
00125 /*  =============== */
00126 
00127 /*  Based on contributions by */
00128 /*     Jeff Rutter, Computer Science Division, University of California */
00129 /*     at Berkeley, USA */
00130 
00131 /*  ===================================================================== */
00132 
00133 /*     .. Parameters .. */
00134 /*     .. */
00135 /*     .. Local Scalars .. */
00136 /*     .. */
00137 /*     .. External Subroutines .. */
00138 /*     .. */
00139 /*     .. Intrinsic Functions .. */
00140 /*     .. */
00141 /*     .. Executable Statements .. */
00142 
00143 /*     Test the input parameters. */
00144 
00145     /* Parameter adjustments */
00146     --ztemp;
00147     --z__;
00148     --qptr;
00149     --q;
00150     givnum -= 3;
00151     givcol -= 3;
00152     --givptr;
00153     --perm;
00154     --prmptr;
00155 
00156     /* Function Body */
00157     *info = 0;
00158 
00159     if (*n < 0) {
00160         *info = -1;
00161     }
00162     if (*info != 0) {
00163         i__1 = -(*info);
00164         xerbla_("DLAEDA", &i__1);
00165         return 0;
00166     }
00167 
00168 /*     Quick return if possible */
00169 
00170     if (*n == 0) {
00171         return 0;
00172     }
00173 
00174 /*     Determine location of first number in second half. */
00175 
00176     mid = *n / 2 + 1;
00177 
00178 /*     Gather last/first rows of appropriate eigenblocks into center of Z */
00179 
00180     ptr = 1;
00181 
00182 /*     Determine location of lowest level subproblem in the full storage */
00183 /*     scheme */
00184 
00185     i__1 = *curlvl - 1;
00186     curr = ptr + *curpbm * pow_ii(&c__2, curlvl) + pow_ii(&c__2, &i__1) - 1;
00187 
00188 /*     Determine size of these matrices.  We add HALF to the value of */
00189 /*     the SQRT in case the machine underestimates one of these square */
00190 /*     roots. */
00191 
00192     bsiz1 = (integer) (sqrt((doublereal) (qptr[curr + 1] - qptr[curr])) + .5);
00193     bsiz2 = (integer) (sqrt((doublereal) (qptr[curr + 2] - qptr[curr + 1])) + 
00194             .5);
00195     i__1 = mid - bsiz1 - 1;
00196     for (k = 1; k <= i__1; ++k) {
00197         z__[k] = 0.;
00198 /* L10: */
00199     }
00200     dcopy_(&bsiz1, &q[qptr[curr] + bsiz1 - 1], &bsiz1, &z__[mid - bsiz1], &
00201             c__1);
00202     dcopy_(&bsiz2, &q[qptr[curr + 1]], &bsiz2, &z__[mid], &c__1);
00203     i__1 = *n;
00204     for (k = mid + bsiz2; k <= i__1; ++k) {
00205         z__[k] = 0.;
00206 /* L20: */
00207     }
00208 
00209 /*     Loop thru remaining levels 1 -> CURLVL applying the Givens */
00210 /*     rotations and permutation and then multiplying the center matrices */
00211 /*     against the current Z. */
00212 
00213     ptr = pow_ii(&c__2, tlvls) + 1;
00214     i__1 = *curlvl - 1;
00215     for (k = 1; k <= i__1; ++k) {
00216         i__2 = *curlvl - k;
00217         i__3 = *curlvl - k - 1;
00218         curr = ptr + *curpbm * pow_ii(&c__2, &i__2) + pow_ii(&c__2, &i__3) - 
00219                 1;
00220         psiz1 = prmptr[curr + 1] - prmptr[curr];
00221         psiz2 = prmptr[curr + 2] - prmptr[curr + 1];
00222         zptr1 = mid - psiz1;
00223 
00224 /*       Apply Givens at CURR and CURR+1 */
00225 
00226         i__2 = givptr[curr + 1] - 1;
00227         for (i__ = givptr[curr]; i__ <= i__2; ++i__) {
00228             drot_(&c__1, &z__[zptr1 + givcol[(i__ << 1) + 1] - 1], &c__1, &
00229                     z__[zptr1 + givcol[(i__ << 1) + 2] - 1], &c__1, &givnum[(
00230                     i__ << 1) + 1], &givnum[(i__ << 1) + 2]);
00231 /* L30: */
00232         }
00233         i__2 = givptr[curr + 2] - 1;
00234         for (i__ = givptr[curr + 1]; i__ <= i__2; ++i__) {
00235             drot_(&c__1, &z__[mid - 1 + givcol[(i__ << 1) + 1]], &c__1, &z__[
00236                     mid - 1 + givcol[(i__ << 1) + 2]], &c__1, &givnum[(i__ << 
00237                     1) + 1], &givnum[(i__ << 1) + 2]);
00238 /* L40: */
00239         }
00240         psiz1 = prmptr[curr + 1] - prmptr[curr];
00241         psiz2 = prmptr[curr + 2] - prmptr[curr + 1];
00242         i__2 = psiz1 - 1;
00243         for (i__ = 0; i__ <= i__2; ++i__) {
00244             ztemp[i__ + 1] = z__[zptr1 + perm[prmptr[curr] + i__] - 1];
00245 /* L50: */
00246         }
00247         i__2 = psiz2 - 1;
00248         for (i__ = 0; i__ <= i__2; ++i__) {
00249             ztemp[psiz1 + i__ + 1] = z__[mid + perm[prmptr[curr + 1] + i__] - 
00250                     1];
00251 /* L60: */
00252         }
00253 
00254 /*        Multiply Blocks at CURR and CURR+1 */
00255 
00256 /*        Determine size of these matrices.  We add HALF to the value of */
00257 /*        the SQRT in case the machine underestimates one of these */
00258 /*        square roots. */
00259 
00260         bsiz1 = (integer) (sqrt((doublereal) (qptr[curr + 1] - qptr[curr])) + 
00261                 .5);
00262         bsiz2 = (integer) (sqrt((doublereal) (qptr[curr + 2] - qptr[curr + 1])
00263                 ) + .5);
00264         if (bsiz1 > 0) {
00265             dgemv_("T", &bsiz1, &bsiz1, &c_b24, &q[qptr[curr]], &bsiz1, &
00266                     ztemp[1], &c__1, &c_b26, &z__[zptr1], &c__1);
00267         }
00268         i__2 = psiz1 - bsiz1;
00269         dcopy_(&i__2, &ztemp[bsiz1 + 1], &c__1, &z__[zptr1 + bsiz1], &c__1);
00270         if (bsiz2 > 0) {
00271             dgemv_("T", &bsiz2, &bsiz2, &c_b24, &q[qptr[curr + 1]], &bsiz2, &
00272                     ztemp[psiz1 + 1], &c__1, &c_b26, &z__[mid], &c__1);
00273         }
00274         i__2 = psiz2 - bsiz2;
00275         dcopy_(&i__2, &ztemp[psiz1 + bsiz2 + 1], &c__1, &z__[mid + bsiz2], &
00276                 c__1);
00277 
00278         i__2 = *tlvls - k;
00279         ptr += pow_ii(&c__2, &i__2);
00280 /* L70: */
00281     }
00282 
00283     return 0;
00284 
00285 /*     End of DLAEDA */
00286 
00287 } /* dlaeda_ */


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