zlalsa.c
Go to the documentation of this file.
00001 /* zlalsa.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 doublereal c_b9 = 1.;
00019 static doublereal c_b10 = 0.;
00020 static integer c__2 = 2;
00021 
00022 /* Subroutine */ int zlalsa_(integer *icompq, integer *smlsiz, integer *n, 
00023         integer *nrhs, doublecomplex *b, integer *ldb, doublecomplex *bx, 
00024         integer *ldbx, doublereal *u, integer *ldu, doublereal *vt, integer *
00025         k, doublereal *difl, doublereal *difr, doublereal *z__, doublereal *
00026         poles, integer *givptr, integer *givcol, integer *ldgcol, integer *
00027         perm, doublereal *givnum, doublereal *c__, doublereal *s, doublereal *
00028         rwork, integer *iwork, integer *info)
00029 {
00030     /* System generated locals */
00031     integer givcol_dim1, givcol_offset, perm_dim1, perm_offset, difl_dim1, 
00032             difl_offset, difr_dim1, difr_offset, givnum_dim1, givnum_offset, 
00033             poles_dim1, poles_offset, u_dim1, u_offset, vt_dim1, vt_offset, 
00034             z_dim1, z_offset, b_dim1, b_offset, bx_dim1, bx_offset, i__1, 
00035             i__2, i__3, i__4, i__5, i__6;
00036     doublecomplex z__1;
00037 
00038     /* Builtin functions */
00039     double d_imag(doublecomplex *);
00040     integer pow_ii(integer *, integer *);
00041 
00042     /* Local variables */
00043     integer i__, j, i1, ic, lf, nd, ll, nl, nr, im1, nlf, nrf, lvl, ndb1, 
00044             nlp1, lvl2, nrp1, jcol, nlvl, sqre, jrow, jimag;
00045     extern /* Subroutine */ int dgemm_(char *, char *, integer *, integer *, 
00046             integer *, doublereal *, doublereal *, integer *, doublereal *, 
00047             integer *, doublereal *, doublereal *, integer *);
00048     integer jreal, inode, ndiml, ndimr;
00049     extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *, 
00050             doublecomplex *, integer *), zlals0_(integer *, integer *, 
00051             integer *, integer *, integer *, doublecomplex *, integer *, 
00052             doublecomplex *, integer *, integer *, integer *, integer *, 
00053             integer *, doublereal *, integer *, doublereal *, doublereal *, 
00054             doublereal *, doublereal *, integer *, doublereal *, doublereal *, 
00055              doublereal *, integer *), dlasdt_(integer *, integer *, integer *
00056 , integer *, integer *, integer *, integer *), xerbla_(char *, 
00057             integer *);
00058 
00059 
00060 /*  -- LAPACK routine (version 3.2) -- */
00061 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00062 /*     November 2006 */
00063 
00064 /*     .. Scalar Arguments .. */
00065 /*     .. */
00066 /*     .. Array Arguments .. */
00067 /*     .. */
00068 
00069 /*  Purpose */
00070 /*  ======= */
00071 
00072 /*  ZLALSA is an itermediate step in solving the least squares problem */
00073 /*  by computing the SVD of the coefficient matrix in compact form (The */
00074 /*  singular vectors are computed as products of simple orthorgonal */
00075 /*  matrices.). */
00076 
00077 /*  If ICOMPQ = 0, ZLALSA applies the inverse of the left singular vector */
00078 /*  matrix of an upper bidiagonal matrix to the right hand side; and if */
00079 /*  ICOMPQ = 1, ZLALSA applies the right singular vector matrix to the */
00080 /*  right hand side. The singular vector matrices were generated in */
00081 /*  compact form by ZLALSA. */
00082 
00083 /*  Arguments */
00084 /*  ========= */
00085 
00086 /*  ICOMPQ (input) INTEGER */
00087 /*         Specifies whether the left or the right singular vector */
00088 /*         matrix is involved. */
00089 /*         = 0: Left singular vector matrix */
00090 /*         = 1: Right singular vector matrix */
00091 
00092 /*  SMLSIZ (input) INTEGER */
00093 /*         The maximum size of the subproblems at the bottom of the */
00094 /*         computation tree. */
00095 
00096 /*  N      (input) INTEGER */
00097 /*         The row and column dimensions of the upper bidiagonal matrix. */
00098 
00099 /*  NRHS   (input) INTEGER */
00100 /*         The number of columns of B and BX. NRHS must be at least 1. */
00101 
00102 /*  B      (input/output) COMPLEX*16 array, dimension ( LDB, NRHS ) */
00103 /*         On input, B contains the right hand sides of the least */
00104 /*         squares problem in rows 1 through M. */
00105 /*         On output, B contains the solution X in rows 1 through N. */
00106 
00107 /*  LDB    (input) INTEGER */
00108 /*         The leading dimension of B in the calling subprogram. */
00109 /*         LDB must be at least max(1,MAX( M, N ) ). */
00110 
00111 /*  BX     (output) COMPLEX*16 array, dimension ( LDBX, NRHS ) */
00112 /*         On exit, the result of applying the left or right singular */
00113 /*         vector matrix to B. */
00114 
00115 /*  LDBX   (input) INTEGER */
00116 /*         The leading dimension of BX. */
00117 
00118 /*  U      (input) DOUBLE PRECISION array, dimension ( LDU, SMLSIZ ). */
00119 /*         On entry, U contains the left singular vector matrices of all */
00120 /*         subproblems at the bottom level. */
00121 
00122 /*  LDU    (input) INTEGER, LDU = > N. */
00123 /*         The leading dimension of arrays U, VT, DIFL, DIFR, */
00124 /*         POLES, GIVNUM, and Z. */
00125 
00126 /*  VT     (input) DOUBLE PRECISION array, dimension ( LDU, SMLSIZ+1 ). */
00127 /*         On entry, VT' contains the right singular vector matrices of */
00128 /*         all subproblems at the bottom level. */
00129 
00130 /*  K      (input) INTEGER array, dimension ( N ). */
00131 
00132 /*  DIFL   (input) DOUBLE PRECISION array, dimension ( LDU, NLVL ). */
00133 /*         where NLVL = INT(log_2 (N/(SMLSIZ+1))) + 1. */
00134 
00135 /*  DIFR   (input) DOUBLE PRECISION array, dimension ( LDU, 2 * NLVL ). */
00136 /*         On entry, DIFL(*, I) and DIFR(*, 2 * I -1) record */
00137 /*         distances between singular values on the I-th level and */
00138 /*         singular values on the (I -1)-th level, and DIFR(*, 2 * I) */
00139 /*         record the normalizing factors of the right singular vectors */
00140 /*         matrices of subproblems on I-th level. */
00141 
00142 /*  Z      (input) DOUBLE PRECISION array, dimension ( LDU, NLVL ). */
00143 /*         On entry, Z(1, I) contains the components of the deflation- */
00144 /*         adjusted updating row vector for subproblems on the I-th */
00145 /*         level. */
00146 
00147 /*  POLES  (input) DOUBLE PRECISION array, dimension ( LDU, 2 * NLVL ). */
00148 /*         On entry, POLES(*, 2 * I -1: 2 * I) contains the new and old */
00149 /*         singular values involved in the secular equations on the I-th */
00150 /*         level. */
00151 
00152 /*  GIVPTR (input) INTEGER array, dimension ( N ). */
00153 /*         On entry, GIVPTR( I ) records the number of Givens */
00154 /*         rotations performed on the I-th problem on the computation */
00155 /*         tree. */
00156 
00157 /*  GIVCOL (input) INTEGER array, dimension ( LDGCOL, 2 * NLVL ). */
00158 /*         On entry, for each I, GIVCOL(*, 2 * I - 1: 2 * I) records the */
00159 /*         locations of Givens rotations performed on the I-th level on */
00160 /*         the computation tree. */
00161 
00162 /*  LDGCOL (input) INTEGER, LDGCOL = > N. */
00163 /*         The leading dimension of arrays GIVCOL and PERM. */
00164 
00165 /*  PERM   (input) INTEGER array, dimension ( LDGCOL, NLVL ). */
00166 /*         On entry, PERM(*, I) records permutations done on the I-th */
00167 /*         level of the computation tree. */
00168 
00169 /*  GIVNUM (input) DOUBLE PRECISION array, dimension ( LDU, 2 * NLVL ). */
00170 /*         On entry, GIVNUM(*, 2 *I -1 : 2 * I) records the C- and S- */
00171 /*         values of Givens rotations performed on the I-th level on the */
00172 /*         computation tree. */
00173 
00174 /*  C      (input) DOUBLE PRECISION array, dimension ( N ). */
00175 /*         On entry, if the I-th subproblem is not square, */
00176 /*         C( I ) contains the C-value of a Givens rotation related to */
00177 /*         the right null space of the I-th subproblem. */
00178 
00179 /*  S      (input) DOUBLE PRECISION array, dimension ( N ). */
00180 /*         On entry, if the I-th subproblem is not square, */
00181 /*         S( I ) contains the S-value of a Givens rotation related to */
00182 /*         the right null space of the I-th subproblem. */
00183 
00184 /*  RWORK  (workspace) DOUBLE PRECISION array, dimension at least */
00185 /*         max ( N, (SMLSZ+1)*NRHS*3 ). */
00186 
00187 /*  IWORK  (workspace) INTEGER array. */
00188 /*         The dimension must be at least 3 * N */
00189 
00190 /*  INFO   (output) INTEGER */
00191 /*          = 0:  successful exit. */
00192 /*          < 0:  if INFO = -i, the i-th argument had an illegal value. */
00193 
00194 /*  Further Details */
00195 /*  =============== */
00196 
00197 /*  Based on contributions by */
00198 /*     Ming Gu and Ren-Cang Li, Computer Science Division, University of */
00199 /*       California at Berkeley, USA */
00200 /*     Osni Marques, LBNL/NERSC, USA */
00201 
00202 /*  ===================================================================== */
00203 
00204 /*     .. Parameters .. */
00205 /*     .. */
00206 /*     .. Local Scalars .. */
00207 /*     .. */
00208 /*     .. External Subroutines .. */
00209 /*     .. */
00210 /*     .. Intrinsic Functions .. */
00211 /*     .. */
00212 /*     .. Executable Statements .. */
00213 
00214 /*     Test the input parameters. */
00215 
00216     /* Parameter adjustments */
00217     b_dim1 = *ldb;
00218     b_offset = 1 + b_dim1;
00219     b -= b_offset;
00220     bx_dim1 = *ldbx;
00221     bx_offset = 1 + bx_dim1;
00222     bx -= bx_offset;
00223     givnum_dim1 = *ldu;
00224     givnum_offset = 1 + givnum_dim1;
00225     givnum -= givnum_offset;
00226     poles_dim1 = *ldu;
00227     poles_offset = 1 + poles_dim1;
00228     poles -= poles_offset;
00229     z_dim1 = *ldu;
00230     z_offset = 1 + z_dim1;
00231     z__ -= z_offset;
00232     difr_dim1 = *ldu;
00233     difr_offset = 1 + difr_dim1;
00234     difr -= difr_offset;
00235     difl_dim1 = *ldu;
00236     difl_offset = 1 + difl_dim1;
00237     difl -= difl_offset;
00238     vt_dim1 = *ldu;
00239     vt_offset = 1 + vt_dim1;
00240     vt -= vt_offset;
00241     u_dim1 = *ldu;
00242     u_offset = 1 + u_dim1;
00243     u -= u_offset;
00244     --k;
00245     --givptr;
00246     perm_dim1 = *ldgcol;
00247     perm_offset = 1 + perm_dim1;
00248     perm -= perm_offset;
00249     givcol_dim1 = *ldgcol;
00250     givcol_offset = 1 + givcol_dim1;
00251     givcol -= givcol_offset;
00252     --c__;
00253     --s;
00254     --rwork;
00255     --iwork;
00256 
00257     /* Function Body */
00258     *info = 0;
00259 
00260     if (*icompq < 0 || *icompq > 1) {
00261         *info = -1;
00262     } else if (*smlsiz < 3) {
00263         *info = -2;
00264     } else if (*n < *smlsiz) {
00265         *info = -3;
00266     } else if (*nrhs < 1) {
00267         *info = -4;
00268     } else if (*ldb < *n) {
00269         *info = -6;
00270     } else if (*ldbx < *n) {
00271         *info = -8;
00272     } else if (*ldu < *n) {
00273         *info = -10;
00274     } else if (*ldgcol < *n) {
00275         *info = -19;
00276     }
00277     if (*info != 0) {
00278         i__1 = -(*info);
00279         xerbla_("ZLALSA", &i__1);
00280         return 0;
00281     }
00282 
00283 /*     Book-keeping and  setting up the computation tree. */
00284 
00285     inode = 1;
00286     ndiml = inode + *n;
00287     ndimr = ndiml + *n;
00288 
00289     dlasdt_(n, &nlvl, &nd, &iwork[inode], &iwork[ndiml], &iwork[ndimr], 
00290             smlsiz);
00291 
00292 /*     The following code applies back the left singular vector factors. */
00293 /*     For applying back the right singular vector factors, go to 170. */
00294 
00295     if (*icompq == 1) {
00296         goto L170;
00297     }
00298 
00299 /*     The nodes on the bottom level of the tree were solved */
00300 /*     by DLASDQ. The corresponding left and right singular vector */
00301 /*     matrices are in explicit form. First apply back the left */
00302 /*     singular vector matrices. */
00303 
00304     ndb1 = (nd + 1) / 2;
00305     i__1 = nd;
00306     for (i__ = ndb1; i__ <= i__1; ++i__) {
00307 
00308 /*        IC : center row of each node */
00309 /*        NL : number of rows of left  subproblem */
00310 /*        NR : number of rows of right subproblem */
00311 /*        NLF: starting row of the left   subproblem */
00312 /*        NRF: starting row of the right  subproblem */
00313 
00314         i1 = i__ - 1;
00315         ic = iwork[inode + i1];
00316         nl = iwork[ndiml + i1];
00317         nr = iwork[ndimr + i1];
00318         nlf = ic - nl;
00319         nrf = ic + 1;
00320 
00321 /*        Since B and BX are complex, the following call to DGEMM */
00322 /*        is performed in two steps (real and imaginary parts). */
00323 
00324 /*        CALL DGEMM( 'T', 'N', NL, NRHS, NL, ONE, U( NLF, 1 ), LDU, */
00325 /*     $               B( NLF, 1 ), LDB, ZERO, BX( NLF, 1 ), LDBX ) */
00326 
00327         j = nl * *nrhs << 1;
00328         i__2 = *nrhs;
00329         for (jcol = 1; jcol <= i__2; ++jcol) {
00330             i__3 = nlf + nl - 1;
00331             for (jrow = nlf; jrow <= i__3; ++jrow) {
00332                 ++j;
00333                 i__4 = jrow + jcol * b_dim1;
00334                 rwork[j] = b[i__4].r;
00335 /* L10: */
00336             }
00337 /* L20: */
00338         }
00339         dgemm_("T", "N", &nl, nrhs, &nl, &c_b9, &u[nlf + u_dim1], ldu, &rwork[
00340                 (nl * *nrhs << 1) + 1], &nl, &c_b10, &rwork[1], &nl);
00341         j = nl * *nrhs << 1;
00342         i__2 = *nrhs;
00343         for (jcol = 1; jcol <= i__2; ++jcol) {
00344             i__3 = nlf + nl - 1;
00345             for (jrow = nlf; jrow <= i__3; ++jrow) {
00346                 ++j;
00347                 rwork[j] = d_imag(&b[jrow + jcol * b_dim1]);
00348 /* L30: */
00349             }
00350 /* L40: */
00351         }
00352         dgemm_("T", "N", &nl, nrhs, &nl, &c_b9, &u[nlf + u_dim1], ldu, &rwork[
00353                 (nl * *nrhs << 1) + 1], &nl, &c_b10, &rwork[nl * *nrhs + 1], &
00354                 nl);
00355         jreal = 0;
00356         jimag = nl * *nrhs;
00357         i__2 = *nrhs;
00358         for (jcol = 1; jcol <= i__2; ++jcol) {
00359             i__3 = nlf + nl - 1;
00360             for (jrow = nlf; jrow <= i__3; ++jrow) {
00361                 ++jreal;
00362                 ++jimag;
00363                 i__4 = jrow + jcol * bx_dim1;
00364                 i__5 = jreal;
00365                 i__6 = jimag;
00366                 z__1.r = rwork[i__5], z__1.i = rwork[i__6];
00367                 bx[i__4].r = z__1.r, bx[i__4].i = z__1.i;
00368 /* L50: */
00369             }
00370 /* L60: */
00371         }
00372 
00373 /*        Since B and BX are complex, the following call to DGEMM */
00374 /*        is performed in two steps (real and imaginary parts). */
00375 
00376 /*        CALL DGEMM( 'T', 'N', NR, NRHS, NR, ONE, U( NRF, 1 ), LDU, */
00377 /*    $               B( NRF, 1 ), LDB, ZERO, BX( NRF, 1 ), LDBX ) */
00378 
00379         j = nr * *nrhs << 1;
00380         i__2 = *nrhs;
00381         for (jcol = 1; jcol <= i__2; ++jcol) {
00382             i__3 = nrf + nr - 1;
00383             for (jrow = nrf; jrow <= i__3; ++jrow) {
00384                 ++j;
00385                 i__4 = jrow + jcol * b_dim1;
00386                 rwork[j] = b[i__4].r;
00387 /* L70: */
00388             }
00389 /* L80: */
00390         }
00391         dgemm_("T", "N", &nr, nrhs, &nr, &c_b9, &u[nrf + u_dim1], ldu, &rwork[
00392                 (nr * *nrhs << 1) + 1], &nr, &c_b10, &rwork[1], &nr);
00393         j = nr * *nrhs << 1;
00394         i__2 = *nrhs;
00395         for (jcol = 1; jcol <= i__2; ++jcol) {
00396             i__3 = nrf + nr - 1;
00397             for (jrow = nrf; jrow <= i__3; ++jrow) {
00398                 ++j;
00399                 rwork[j] = d_imag(&b[jrow + jcol * b_dim1]);
00400 /* L90: */
00401             }
00402 /* L100: */
00403         }
00404         dgemm_("T", "N", &nr, nrhs, &nr, &c_b9, &u[nrf + u_dim1], ldu, &rwork[
00405                 (nr * *nrhs << 1) + 1], &nr, &c_b10, &rwork[nr * *nrhs + 1], &
00406                 nr);
00407         jreal = 0;
00408         jimag = nr * *nrhs;
00409         i__2 = *nrhs;
00410         for (jcol = 1; jcol <= i__2; ++jcol) {
00411             i__3 = nrf + nr - 1;
00412             for (jrow = nrf; jrow <= i__3; ++jrow) {
00413                 ++jreal;
00414                 ++jimag;
00415                 i__4 = jrow + jcol * bx_dim1;
00416                 i__5 = jreal;
00417                 i__6 = jimag;
00418                 z__1.r = rwork[i__5], z__1.i = rwork[i__6];
00419                 bx[i__4].r = z__1.r, bx[i__4].i = z__1.i;
00420 /* L110: */
00421             }
00422 /* L120: */
00423         }
00424 
00425 /* L130: */
00426     }
00427 
00428 /*     Next copy the rows of B that correspond to unchanged rows */
00429 /*     in the bidiagonal matrix to BX. */
00430 
00431     i__1 = nd;
00432     for (i__ = 1; i__ <= i__1; ++i__) {
00433         ic = iwork[inode + i__ - 1];
00434         zcopy_(nrhs, &b[ic + b_dim1], ldb, &bx[ic + bx_dim1], ldbx);
00435 /* L140: */
00436     }
00437 
00438 /*     Finally go through the left singular vector matrices of all */
00439 /*     the other subproblems bottom-up on the tree. */
00440 
00441     j = pow_ii(&c__2, &nlvl);
00442     sqre = 0;
00443 
00444     for (lvl = nlvl; lvl >= 1; --lvl) {
00445         lvl2 = (lvl << 1) - 1;
00446 
00447 /*        find the first node LF and last node LL on */
00448 /*        the current level LVL */
00449 
00450         if (lvl == 1) {
00451             lf = 1;
00452             ll = 1;
00453         } else {
00454             i__1 = lvl - 1;
00455             lf = pow_ii(&c__2, &i__1);
00456             ll = (lf << 1) - 1;
00457         }
00458         i__1 = ll;
00459         for (i__ = lf; i__ <= i__1; ++i__) {
00460             im1 = i__ - 1;
00461             ic = iwork[inode + im1];
00462             nl = iwork[ndiml + im1];
00463             nr = iwork[ndimr + im1];
00464             nlf = ic - nl;
00465             nrf = ic + 1;
00466             --j;
00467             zlals0_(icompq, &nl, &nr, &sqre, nrhs, &bx[nlf + bx_dim1], ldbx, &
00468                     b[nlf + b_dim1], ldb, &perm[nlf + lvl * perm_dim1], &
00469                     givptr[j], &givcol[nlf + lvl2 * givcol_dim1], ldgcol, &
00470                     givnum[nlf + lvl2 * givnum_dim1], ldu, &poles[nlf + lvl2 *
00471                      poles_dim1], &difl[nlf + lvl * difl_dim1], &difr[nlf + 
00472                     lvl2 * difr_dim1], &z__[nlf + lvl * z_dim1], &k[j], &c__[
00473                     j], &s[j], &rwork[1], info);
00474 /* L150: */
00475         }
00476 /* L160: */
00477     }
00478     goto L330;
00479 
00480 /*     ICOMPQ = 1: applying back the right singular vector factors. */
00481 
00482 L170:
00483 
00484 /*     First now go through the right singular vector matrices of all */
00485 /*     the tree nodes top-down. */
00486 
00487     j = 0;
00488     i__1 = nlvl;
00489     for (lvl = 1; lvl <= i__1; ++lvl) {
00490         lvl2 = (lvl << 1) - 1;
00491 
00492 /*        Find the first node LF and last node LL on */
00493 /*        the current level LVL. */
00494 
00495         if (lvl == 1) {
00496             lf = 1;
00497             ll = 1;
00498         } else {
00499             i__2 = lvl - 1;
00500             lf = pow_ii(&c__2, &i__2);
00501             ll = (lf << 1) - 1;
00502         }
00503         i__2 = lf;
00504         for (i__ = ll; i__ >= i__2; --i__) {
00505             im1 = i__ - 1;
00506             ic = iwork[inode + im1];
00507             nl = iwork[ndiml + im1];
00508             nr = iwork[ndimr + im1];
00509             nlf = ic - nl;
00510             nrf = ic + 1;
00511             if (i__ == ll) {
00512                 sqre = 0;
00513             } else {
00514                 sqre = 1;
00515             }
00516             ++j;
00517             zlals0_(icompq, &nl, &nr, &sqre, nrhs, &b[nlf + b_dim1], ldb, &bx[
00518                     nlf + bx_dim1], ldbx, &perm[nlf + lvl * perm_dim1], &
00519                     givptr[j], &givcol[nlf + lvl2 * givcol_dim1], ldgcol, &
00520                     givnum[nlf + lvl2 * givnum_dim1], ldu, &poles[nlf + lvl2 *
00521                      poles_dim1], &difl[nlf + lvl * difl_dim1], &difr[nlf + 
00522                     lvl2 * difr_dim1], &z__[nlf + lvl * z_dim1], &k[j], &c__[
00523                     j], &s[j], &rwork[1], info);
00524 /* L180: */
00525         }
00526 /* L190: */
00527     }
00528 
00529 /*     The nodes on the bottom level of the tree were solved */
00530 /*     by DLASDQ. The corresponding right singular vector */
00531 /*     matrices are in explicit form. Apply them back. */
00532 
00533     ndb1 = (nd + 1) / 2;
00534     i__1 = nd;
00535     for (i__ = ndb1; i__ <= i__1; ++i__) {
00536         i1 = i__ - 1;
00537         ic = iwork[inode + i1];
00538         nl = iwork[ndiml + i1];
00539         nr = iwork[ndimr + i1];
00540         nlp1 = nl + 1;
00541         if (i__ == nd) {
00542             nrp1 = nr;
00543         } else {
00544             nrp1 = nr + 1;
00545         }
00546         nlf = ic - nl;
00547         nrf = ic + 1;
00548 
00549 /*        Since B and BX are complex, the following call to DGEMM is */
00550 /*        performed in two steps (real and imaginary parts). */
00551 
00552 /*        CALL DGEMM( 'T', 'N', NLP1, NRHS, NLP1, ONE, VT( NLF, 1 ), LDU, */
00553 /*    $               B( NLF, 1 ), LDB, ZERO, BX( NLF, 1 ), LDBX ) */
00554 
00555         j = nlp1 * *nrhs << 1;
00556         i__2 = *nrhs;
00557         for (jcol = 1; jcol <= i__2; ++jcol) {
00558             i__3 = nlf + nlp1 - 1;
00559             for (jrow = nlf; jrow <= i__3; ++jrow) {
00560                 ++j;
00561                 i__4 = jrow + jcol * b_dim1;
00562                 rwork[j] = b[i__4].r;
00563 /* L200: */
00564             }
00565 /* L210: */
00566         }
00567         dgemm_("T", "N", &nlp1, nrhs, &nlp1, &c_b9, &vt[nlf + vt_dim1], ldu, &
00568                 rwork[(nlp1 * *nrhs << 1) + 1], &nlp1, &c_b10, &rwork[1], &
00569                 nlp1);
00570         j = nlp1 * *nrhs << 1;
00571         i__2 = *nrhs;
00572         for (jcol = 1; jcol <= i__2; ++jcol) {
00573             i__3 = nlf + nlp1 - 1;
00574             for (jrow = nlf; jrow <= i__3; ++jrow) {
00575                 ++j;
00576                 rwork[j] = d_imag(&b[jrow + jcol * b_dim1]);
00577 /* L220: */
00578             }
00579 /* L230: */
00580         }
00581         dgemm_("T", "N", &nlp1, nrhs, &nlp1, &c_b9, &vt[nlf + vt_dim1], ldu, &
00582                 rwork[(nlp1 * *nrhs << 1) + 1], &nlp1, &c_b10, &rwork[nlp1 * *
00583                 nrhs + 1], &nlp1);
00584         jreal = 0;
00585         jimag = nlp1 * *nrhs;
00586         i__2 = *nrhs;
00587         for (jcol = 1; jcol <= i__2; ++jcol) {
00588             i__3 = nlf + nlp1 - 1;
00589             for (jrow = nlf; jrow <= i__3; ++jrow) {
00590                 ++jreal;
00591                 ++jimag;
00592                 i__4 = jrow + jcol * bx_dim1;
00593                 i__5 = jreal;
00594                 i__6 = jimag;
00595                 z__1.r = rwork[i__5], z__1.i = rwork[i__6];
00596                 bx[i__4].r = z__1.r, bx[i__4].i = z__1.i;
00597 /* L240: */
00598             }
00599 /* L250: */
00600         }
00601 
00602 /*        Since B and BX are complex, the following call to DGEMM is */
00603 /*        performed in two steps (real and imaginary parts). */
00604 
00605 /*        CALL DGEMM( 'T', 'N', NRP1, NRHS, NRP1, ONE, VT( NRF, 1 ), LDU, */
00606 /*    $               B( NRF, 1 ), LDB, ZERO, BX( NRF, 1 ), LDBX ) */
00607 
00608         j = nrp1 * *nrhs << 1;
00609         i__2 = *nrhs;
00610         for (jcol = 1; jcol <= i__2; ++jcol) {
00611             i__3 = nrf + nrp1 - 1;
00612             for (jrow = nrf; jrow <= i__3; ++jrow) {
00613                 ++j;
00614                 i__4 = jrow + jcol * b_dim1;
00615                 rwork[j] = b[i__4].r;
00616 /* L260: */
00617             }
00618 /* L270: */
00619         }
00620         dgemm_("T", "N", &nrp1, nrhs, &nrp1, &c_b9, &vt[nrf + vt_dim1], ldu, &
00621                 rwork[(nrp1 * *nrhs << 1) + 1], &nrp1, &c_b10, &rwork[1], &
00622                 nrp1);
00623         j = nrp1 * *nrhs << 1;
00624         i__2 = *nrhs;
00625         for (jcol = 1; jcol <= i__2; ++jcol) {
00626             i__3 = nrf + nrp1 - 1;
00627             for (jrow = nrf; jrow <= i__3; ++jrow) {
00628                 ++j;
00629                 rwork[j] = d_imag(&b[jrow + jcol * b_dim1]);
00630 /* L280: */
00631             }
00632 /* L290: */
00633         }
00634         dgemm_("T", "N", &nrp1, nrhs, &nrp1, &c_b9, &vt[nrf + vt_dim1], ldu, &
00635                 rwork[(nrp1 * *nrhs << 1) + 1], &nrp1, &c_b10, &rwork[nrp1 * *
00636                 nrhs + 1], &nrp1);
00637         jreal = 0;
00638         jimag = nrp1 * *nrhs;
00639         i__2 = *nrhs;
00640         for (jcol = 1; jcol <= i__2; ++jcol) {
00641             i__3 = nrf + nrp1 - 1;
00642             for (jrow = nrf; jrow <= i__3; ++jrow) {
00643                 ++jreal;
00644                 ++jimag;
00645                 i__4 = jrow + jcol * bx_dim1;
00646                 i__5 = jreal;
00647                 i__6 = jimag;
00648                 z__1.r = rwork[i__5], z__1.i = rwork[i__6];
00649                 bx[i__4].r = z__1.r, bx[i__4].i = z__1.i;
00650 /* L300: */
00651             }
00652 /* L310: */
00653         }
00654 
00655 /* L320: */
00656     }
00657 
00658 L330:
00659 
00660     return 0;
00661 
00662 /*     End of ZLALSA */
00663 
00664 } /* zlalsa_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:41