zunmhr.c
Go to the documentation of this file.
00001 /* zunmhr.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 static integer c_n1 = -1;
00020 static integer c__2 = 2;
00021 
00022 /* Subroutine */ int zunmhr_(char *side, char *trans, integer *m, integer *n, 
00023         integer *ilo, integer *ihi, doublecomplex *a, integer *lda, 
00024         doublecomplex *tau, doublecomplex *c__, integer *ldc, doublecomplex *
00025         work, integer *lwork, integer *info)
00026 {
00027     /* System generated locals */
00028     address a__1[2];
00029     integer a_dim1, a_offset, c_dim1, c_offset, i__1[2], i__2;
00030     char ch__1[2];
00031 
00032     /* Builtin functions */
00033     /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen);
00034 
00035     /* Local variables */
00036     integer i1, i2, nb, mi, nh, ni, nq, nw;
00037     logical left;
00038     extern logical lsame_(char *, char *);
00039     integer iinfo;
00040     extern /* Subroutine */ int xerbla_(char *, integer *);
00041     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00042             integer *, integer *);
00043     integer lwkopt;
00044     logical lquery;
00045     extern /* Subroutine */ int zunmqr_(char *, char *, integer *, integer *, 
00046             integer *, doublecomplex *, integer *, doublecomplex *, 
00047             doublecomplex *, integer *, doublecomplex *, integer *, integer *);
00048 
00049 
00050 /*  -- LAPACK routine (version 3.2) -- */
00051 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00052 /*     November 2006 */
00053 
00054 /*     .. Scalar Arguments .. */
00055 /*     .. */
00056 /*     .. Array Arguments .. */
00057 /*     .. */
00058 
00059 /*  Purpose */
00060 /*  ======= */
00061 
00062 /*  ZUNMHR overwrites the general complex M-by-N matrix C with */
00063 
00064 /*                  SIDE = 'L'     SIDE = 'R' */
00065 /*  TRANS = 'N':      Q * C          C * Q */
00066 /*  TRANS = 'C':      Q**H * C       C * Q**H */
00067 
00068 /*  where Q is a complex unitary matrix of order nq, with nq = m if */
00069 /*  SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of */
00070 /*  IHI-ILO elementary reflectors, as returned by ZGEHRD: */
00071 
00072 /*  Q = H(ilo) H(ilo+1) . . . H(ihi-1). */
00073 
00074 /*  Arguments */
00075 /*  ========= */
00076 
00077 /*  SIDE    (input) CHARACTER*1 */
00078 /*          = 'L': apply Q or Q**H from the Left; */
00079 /*          = 'R': apply Q or Q**H from the Right. */
00080 
00081 /*  TRANS   (input) CHARACTER*1 */
00082 /*          = 'N': apply Q  (No transpose) */
00083 /*          = 'C': apply Q**H (Conjugate transpose) */
00084 
00085 /*  M       (input) INTEGER */
00086 /*          The number of rows of the matrix C. M >= 0. */
00087 
00088 /*  N       (input) INTEGER */
00089 /*          The number of columns of the matrix C. N >= 0. */
00090 
00091 /*  ILO     (input) INTEGER */
00092 /*  IHI     (input) INTEGER */
00093 /*          ILO and IHI must have the same values as in the previous call */
00094 /*          of ZGEHRD. Q is equal to the unit matrix except in the */
00095 /*          submatrix Q(ilo+1:ihi,ilo+1:ihi). */
00096 /*          If SIDE = 'L', then 1 <= ILO <= IHI <= M, if M > 0, and */
00097 /*          ILO = 1 and IHI = 0, if M = 0; */
00098 /*          if SIDE = 'R', then 1 <= ILO <= IHI <= N, if N > 0, and */
00099 /*          ILO = 1 and IHI = 0, if N = 0. */
00100 
00101 /*  A       (input) COMPLEX*16 array, dimension */
00102 /*                               (LDA,M) if SIDE = 'L' */
00103 /*                               (LDA,N) if SIDE = 'R' */
00104 /*          The vectors which define the elementary reflectors, as */
00105 /*          returned by ZGEHRD. */
00106 
00107 /*  LDA     (input) INTEGER */
00108 /*          The leading dimension of the array A. */
00109 /*          LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'. */
00110 
00111 /*  TAU     (input) COMPLEX*16 array, dimension */
00112 /*                               (M-1) if SIDE = 'L' */
00113 /*                               (N-1) if SIDE = 'R' */
00114 /*          TAU(i) must contain the scalar factor of the elementary */
00115 /*          reflector H(i), as returned by ZGEHRD. */
00116 
00117 /*  C       (input/output) COMPLEX*16 array, dimension (LDC,N) */
00118 /*          On entry, the M-by-N matrix C. */
00119 /*          On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q. */
00120 
00121 /*  LDC     (input) INTEGER */
00122 /*          The leading dimension of the array C. LDC >= max(1,M). */
00123 
00124 /*  WORK    (workspace/output) COMPLEX*16 array, dimension (MAX(1,LWORK)) */
00125 /*          On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */
00126 
00127 /*  LWORK   (input) INTEGER */
00128 /*          The dimension of the array WORK. */
00129 /*          If SIDE = 'L', LWORK >= max(1,N); */
00130 /*          if SIDE = 'R', LWORK >= max(1,M). */
00131 /*          For optimum performance LWORK >= N*NB if SIDE = 'L', and */
00132 /*          LWORK >= M*NB if SIDE = 'R', where NB is the optimal */
00133 /*          blocksize. */
00134 
00135 /*          If LWORK = -1, then a workspace query is assumed; the routine */
00136 /*          only calculates the optimal size of the WORK array, returns */
00137 /*          this value as the first entry of the WORK array, and no error */
00138 /*          message related to LWORK is issued by XERBLA. */
00139 
00140 /*  INFO    (output) INTEGER */
00141 /*          = 0:  successful exit */
00142 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00143 
00144 /*  ===================================================================== */
00145 
00146 /*     .. Local Scalars .. */
00147 /*     .. */
00148 /*     .. External Functions .. */
00149 /*     .. */
00150 /*     .. External Subroutines .. */
00151 /*     .. */
00152 /*     .. Intrinsic Functions .. */
00153 /*     .. */
00154 /*     .. Executable Statements .. */
00155 
00156 /*     Test the input arguments */
00157 
00158     /* Parameter adjustments */
00159     a_dim1 = *lda;
00160     a_offset = 1 + a_dim1;
00161     a -= a_offset;
00162     --tau;
00163     c_dim1 = *ldc;
00164     c_offset = 1 + c_dim1;
00165     c__ -= c_offset;
00166     --work;
00167 
00168     /* Function Body */
00169     *info = 0;
00170     nh = *ihi - *ilo;
00171     left = lsame_(side, "L");
00172     lquery = *lwork == -1;
00173 
00174 /*     NQ is the order of Q and NW is the minimum dimension of WORK */
00175 
00176     if (left) {
00177         nq = *m;
00178         nw = *n;
00179     } else {
00180         nq = *n;
00181         nw = *m;
00182     }
00183     if (! left && ! lsame_(side, "R")) {
00184         *info = -1;
00185     } else if (! lsame_(trans, "N") && ! lsame_(trans, 
00186             "C")) {
00187         *info = -2;
00188     } else if (*m < 0) {
00189         *info = -3;
00190     } else if (*n < 0) {
00191         *info = -4;
00192     } else if (*ilo < 1 || *ilo > max(1,nq)) {
00193         *info = -5;
00194     } else if (*ihi < min(*ilo,nq) || *ihi > nq) {
00195         *info = -6;
00196     } else if (*lda < max(1,nq)) {
00197         *info = -8;
00198     } else if (*ldc < max(1,*m)) {
00199         *info = -11;
00200     } else if (*lwork < max(1,nw) && ! lquery) {
00201         *info = -13;
00202     }
00203 
00204     if (*info == 0) {
00205         if (left) {
00206 /* Writing concatenation */
00207             i__1[0] = 1, a__1[0] = side;
00208             i__1[1] = 1, a__1[1] = trans;
00209             s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2);
00210             nb = ilaenv_(&c__1, "ZUNMQR", ch__1, &nh, n, &nh, &c_n1);
00211         } else {
00212 /* Writing concatenation */
00213             i__1[0] = 1, a__1[0] = side;
00214             i__1[1] = 1, a__1[1] = trans;
00215             s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2);
00216             nb = ilaenv_(&c__1, "ZUNMQR", ch__1, m, &nh, &nh, &c_n1);
00217         }
00218         lwkopt = max(1,nw) * nb;
00219         work[1].r = (doublereal) lwkopt, work[1].i = 0.;
00220     }
00221 
00222     if (*info != 0) {
00223         i__2 = -(*info);
00224         xerbla_("ZUNMHR", &i__2);
00225         return 0;
00226     } else if (lquery) {
00227         return 0;
00228     }
00229 
00230 /*     Quick return if possible */
00231 
00232     if (*m == 0 || *n == 0 || nh == 0) {
00233         work[1].r = 1., work[1].i = 0.;
00234         return 0;
00235     }
00236 
00237     if (left) {
00238         mi = nh;
00239         ni = *n;
00240         i1 = *ilo + 1;
00241         i2 = 1;
00242     } else {
00243         mi = *m;
00244         ni = nh;
00245         i1 = 1;
00246         i2 = *ilo + 1;
00247     }
00248 
00249     zunmqr_(side, trans, &mi, &ni, &nh, &a[*ilo + 1 + *ilo * a_dim1], lda, &
00250             tau[*ilo], &c__[i1 + i2 * c_dim1], ldc, &work[1], lwork, &iinfo);
00251 
00252     work[1].r = (doublereal) lwkopt, work[1].i = 0.;
00253     return 0;
00254 
00255 /*     End of ZUNMHR */
00256 
00257 } /* zunmhr_ */


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