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


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