zupmtr.c
Go to the documentation of this file.
00001 /* zupmtr.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 /* Subroutine */ int zupmtr_(char *side, char *uplo, char *trans, integer *m, 
00021         integer *n, doublecomplex *ap, doublecomplex *tau, doublecomplex *c__, 
00022          integer *ldc, doublecomplex *work, integer *info)
00023 {
00024     /* System generated locals */
00025     integer c_dim1, c_offset, i__1, i__2, i__3;
00026     doublecomplex z__1;
00027 
00028     /* Builtin functions */
00029     void d_cnjg(doublecomplex *, doublecomplex *);
00030 
00031     /* Local variables */
00032     integer i__, i1, i2, i3, ic, jc, ii, mi, ni, nq;
00033     doublecomplex aii;
00034     logical left;
00035     doublecomplex taui;
00036     extern logical lsame_(char *, char *);
00037     extern /* Subroutine */ int zlarf_(char *, integer *, integer *, 
00038             doublecomplex *, integer *, doublecomplex *, doublecomplex *, 
00039             integer *, doublecomplex *);
00040     logical upper;
00041     extern /* Subroutine */ int xerbla_(char *, integer *);
00042     logical notran, forwrd;
00043 
00044 
00045 /*  -- LAPACK routine (version 3.2) -- */
00046 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00047 /*     November 2006 */
00048 
00049 /*     .. Scalar Arguments .. */
00050 /*     .. */
00051 /*     .. Array Arguments .. */
00052 /*     .. */
00053 
00054 /*  Purpose */
00055 /*  ======= */
00056 
00057 /*  ZUPMTR overwrites the general complex M-by-N matrix C with */
00058 
00059 /*                  SIDE = 'L'     SIDE = 'R' */
00060 /*  TRANS = 'N':      Q * C          C * Q */
00061 /*  TRANS = 'C':      Q**H * C       C * Q**H */
00062 
00063 /*  where Q is a complex unitary matrix of order nq, with nq = m if */
00064 /*  SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of */
00065 /*  nq-1 elementary reflectors, as returned by ZHPTRD using packed */
00066 /*  storage: */
00067 
00068 /*  if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1); */
00069 
00070 /*  if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1). */
00071 
00072 /*  Arguments */
00073 /*  ========= */
00074 
00075 /*  SIDE    (input) CHARACTER*1 */
00076 /*          = 'L': apply Q or Q**H from the Left; */
00077 /*          = 'R': apply Q or Q**H from the Right. */
00078 
00079 /*  UPLO    (input) CHARACTER*1 */
00080 /*          = 'U': Upper triangular packed storage used in previous */
00081 /*                 call to ZHPTRD; */
00082 /*          = 'L': Lower triangular packed storage used in previous */
00083 /*                 call to ZHPTRD. */
00084 
00085 /*  TRANS   (input) CHARACTER*1 */
00086 /*          = 'N':  No transpose, apply Q; */
00087 /*          = 'C':  Conjugate transpose, apply Q**H. */
00088 
00089 /*  M       (input) INTEGER */
00090 /*          The number of rows of the matrix C. M >= 0. */
00091 
00092 /*  N       (input) INTEGER */
00093 /*          The number of columns of the matrix C. N >= 0. */
00094 
00095 /*  AP      (input) COMPLEX*16 array, dimension */
00096 /*                               (M*(M+1)/2) if SIDE = 'L' */
00097 /*                               (N*(N+1)/2) if SIDE = 'R' */
00098 /*          The vectors which define the elementary reflectors, as */
00099 /*          returned by ZHPTRD.  AP is modified by the routine but */
00100 /*          restored on exit. */
00101 
00102 /*  TAU     (input) COMPLEX*16 array, dimension (M-1) if SIDE = 'L' */
00103 /*                                     or (N-1) if SIDE = 'R' */
00104 /*          TAU(i) must contain the scalar factor of the elementary */
00105 /*          reflector H(i), as returned by ZHPTRD. */
00106 
00107 /*  C       (input/output) COMPLEX*16 array, dimension (LDC,N) */
00108 /*          On entry, the M-by-N matrix C. */
00109 /*          On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q. */
00110 
00111 /*  LDC     (input) INTEGER */
00112 /*          The leading dimension of the array C. LDC >= max(1,M). */
00113 
00114 /*  WORK    (workspace) COMPLEX*16 array, dimension */
00115 /*                                   (N) if SIDE = 'L' */
00116 /*                                   (M) if SIDE = 'R' */
00117 
00118 /*  INFO    (output) INTEGER */
00119 /*          = 0:  successful exit */
00120 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00121 
00122 /*  ===================================================================== */
00123 
00124 /*     .. Parameters .. */
00125 /*     .. */
00126 /*     .. Local Scalars .. */
00127 /*     .. */
00128 /*     .. External Functions .. */
00129 /*     .. */
00130 /*     .. External Subroutines .. */
00131 /*     .. */
00132 /*     .. Intrinsic Functions .. */
00133 /*     .. */
00134 /*     .. Executable Statements .. */
00135 
00136 /*     Test the input arguments */
00137 
00138     /* Parameter adjustments */
00139     --ap;
00140     --tau;
00141     c_dim1 = *ldc;
00142     c_offset = 1 + c_dim1;
00143     c__ -= c_offset;
00144     --work;
00145 
00146     /* Function Body */
00147     *info = 0;
00148     left = lsame_(side, "L");
00149     notran = lsame_(trans, "N");
00150     upper = lsame_(uplo, "U");
00151 
00152 /*     NQ is the order of Q */
00153 
00154     if (left) {
00155         nq = *m;
00156     } else {
00157         nq = *n;
00158     }
00159     if (! left && ! lsame_(side, "R")) {
00160         *info = -1;
00161     } else if (! upper && ! lsame_(uplo, "L")) {
00162         *info = -2;
00163     } else if (! notran && ! lsame_(trans, "C")) {
00164         *info = -3;
00165     } else if (*m < 0) {
00166         *info = -4;
00167     } else if (*n < 0) {
00168         *info = -5;
00169     } else if (*ldc < max(1,*m)) {
00170         *info = -9;
00171     }
00172     if (*info != 0) {
00173         i__1 = -(*info);
00174         xerbla_("ZUPMTR", &i__1);
00175         return 0;
00176     }
00177 
00178 /*     Quick return if possible */
00179 
00180     if (*m == 0 || *n == 0) {
00181         return 0;
00182     }
00183 
00184     if (upper) {
00185 
00186 /*        Q was determined by a call to ZHPTRD with UPLO = 'U' */
00187 
00188         forwrd = left && notran || ! left && ! notran;
00189 
00190         if (forwrd) {
00191             i1 = 1;
00192             i2 = nq - 1;
00193             i3 = 1;
00194             ii = 2;
00195         } else {
00196             i1 = nq - 1;
00197             i2 = 1;
00198             i3 = -1;
00199             ii = nq * (nq + 1) / 2 - 1;
00200         }
00201 
00202         if (left) {
00203             ni = *n;
00204         } else {
00205             mi = *m;
00206         }
00207 
00208         i__1 = i2;
00209         i__2 = i3;
00210         for (i__ = i1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00211             if (left) {
00212 
00213 /*              H(i) or H(i)' is applied to C(1:i,1:n) */
00214 
00215                 mi = i__;
00216             } else {
00217 
00218 /*              H(i) or H(i)' is applied to C(1:m,1:i) */
00219 
00220                 ni = i__;
00221             }
00222 
00223 /*           Apply H(i) or H(i)' */
00224 
00225             if (notran) {
00226                 i__3 = i__;
00227                 taui.r = tau[i__3].r, taui.i = tau[i__3].i;
00228             } else {
00229                 d_cnjg(&z__1, &tau[i__]);
00230                 taui.r = z__1.r, taui.i = z__1.i;
00231             }
00232             i__3 = ii;
00233             aii.r = ap[i__3].r, aii.i = ap[i__3].i;
00234             i__3 = ii;
00235             ap[i__3].r = 1., ap[i__3].i = 0.;
00236             zlarf_(side, &mi, &ni, &ap[ii - i__ + 1], &c__1, &taui, &c__[
00237                     c_offset], ldc, &work[1]);
00238             i__3 = ii;
00239             ap[i__3].r = aii.r, ap[i__3].i = aii.i;
00240 
00241             if (forwrd) {
00242                 ii = ii + i__ + 2;
00243             } else {
00244                 ii = ii - i__ - 1;
00245             }
00246 /* L10: */
00247         }
00248     } else {
00249 
00250 /*        Q was determined by a call to ZHPTRD with UPLO = 'L'. */
00251 
00252         forwrd = left && ! notran || ! left && notran;
00253 
00254         if (forwrd) {
00255             i1 = 1;
00256             i2 = nq - 1;
00257             i3 = 1;
00258             ii = 2;
00259         } else {
00260             i1 = nq - 1;
00261             i2 = 1;
00262             i3 = -1;
00263             ii = nq * (nq + 1) / 2 - 1;
00264         }
00265 
00266         if (left) {
00267             ni = *n;
00268             jc = 1;
00269         } else {
00270             mi = *m;
00271             ic = 1;
00272         }
00273 
00274         i__2 = i2;
00275         i__1 = i3;
00276         for (i__ = i1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {
00277             i__3 = ii;
00278             aii.r = ap[i__3].r, aii.i = ap[i__3].i;
00279             i__3 = ii;
00280             ap[i__3].r = 1., ap[i__3].i = 0.;
00281             if (left) {
00282 
00283 /*              H(i) or H(i)' is applied to C(i+1:m,1:n) */
00284 
00285                 mi = *m - i__;
00286                 ic = i__ + 1;
00287             } else {
00288 
00289 /*              H(i) or H(i)' is applied to C(1:m,i+1:n) */
00290 
00291                 ni = *n - i__;
00292                 jc = i__ + 1;
00293             }
00294 
00295 /*           Apply H(i) or H(i)' */
00296 
00297             if (notran) {
00298                 i__3 = i__;
00299                 taui.r = tau[i__3].r, taui.i = tau[i__3].i;
00300             } else {
00301                 d_cnjg(&z__1, &tau[i__]);
00302                 taui.r = z__1.r, taui.i = z__1.i;
00303             }
00304             zlarf_(side, &mi, &ni, &ap[ii], &c__1, &taui, &c__[ic + jc * 
00305                     c_dim1], ldc, &work[1]);
00306             i__3 = ii;
00307             ap[i__3].r = aii.r, ap[i__3].i = aii.i;
00308 
00309             if (forwrd) {
00310                 ii = ii + nq - i__ + 1;
00311             } else {
00312                 ii = ii - nq + i__ - 2;
00313             }
00314 /* L20: */
00315         }
00316     }
00317     return 0;
00318 
00319 /*     End of ZUPMTR */
00320 
00321 } /* zupmtr_ */


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