LAPACK 3.3.1
Linear Algebra PACKage

zunmhr.f

Go to the documentation of this file.
00001       SUBROUTINE ZUNMHR( SIDE, TRANS, M, N, ILO, IHI, A, LDA, TAU, C,
00002      $                   LDC, WORK, LWORK, INFO )
00003 *
00004 *  -- LAPACK routine (version 3.2) --
00005 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00006 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00007 *     November 2006
00008 *
00009 *     .. Scalar Arguments ..
00010       CHARACTER          SIDE, TRANS
00011       INTEGER            IHI, ILO, INFO, LDA, LDC, LWORK, M, N
00012 *     ..
00013 *     .. Array Arguments ..
00014       COMPLEX*16         A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  ZUNMHR overwrites the general complex M-by-N matrix C with
00021 *
00022 *                  SIDE = 'L'     SIDE = 'R'
00023 *  TRANS = 'N':      Q * C          C * Q
00024 *  TRANS = 'C':      Q**H * C       C * Q**H
00025 *
00026 *  where Q is a complex unitary matrix of order nq, with nq = m if
00027 *  SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
00028 *  IHI-ILO elementary reflectors, as returned by ZGEHRD:
00029 *
00030 *  Q = H(ilo) H(ilo+1) . . . H(ihi-1).
00031 *
00032 *  Arguments
00033 *  =========
00034 *
00035 *  SIDE    (input) CHARACTER*1
00036 *          = 'L': apply Q or Q**H from the Left;
00037 *          = 'R': apply Q or Q**H from the Right.
00038 *
00039 *  TRANS   (input) CHARACTER*1
00040 *          = 'N': apply Q  (No transpose)
00041 *          = 'C': apply Q**H (Conjugate transpose)
00042 *
00043 *  M       (input) INTEGER
00044 *          The number of rows of the matrix C. M >= 0.
00045 *
00046 *  N       (input) INTEGER
00047 *          The number of columns of the matrix C. N >= 0.
00048 *
00049 *  ILO     (input) INTEGER
00050 *  IHI     (input) INTEGER
00051 *          ILO and IHI must have the same values as in the previous call
00052 *          of ZGEHRD. Q is equal to the unit matrix except in the
00053 *          submatrix Q(ilo+1:ihi,ilo+1:ihi).
00054 *          If SIDE = 'L', then 1 <= ILO <= IHI <= M, if M > 0, and
00055 *          ILO = 1 and IHI = 0, if M = 0;
00056 *          if SIDE = 'R', then 1 <= ILO <= IHI <= N, if N > 0, and
00057 *          ILO = 1 and IHI = 0, if N = 0.
00058 *
00059 *  A       (input) COMPLEX*16 array, dimension
00060 *                               (LDA,M) if SIDE = 'L'
00061 *                               (LDA,N) if SIDE = 'R'
00062 *          The vectors which define the elementary reflectors, as
00063 *          returned by ZGEHRD.
00064 *
00065 *  LDA     (input) INTEGER
00066 *          The leading dimension of the array A.
00067 *          LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'.
00068 *
00069 *  TAU     (input) COMPLEX*16 array, dimension
00070 *                               (M-1) if SIDE = 'L'
00071 *                               (N-1) if SIDE = 'R'
00072 *          TAU(i) must contain the scalar factor of the elementary
00073 *          reflector H(i), as returned by ZGEHRD.
00074 *
00075 *  C       (input/output) COMPLEX*16 array, dimension (LDC,N)
00076 *          On entry, the M-by-N matrix C.
00077 *          On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q.
00078 *
00079 *  LDC     (input) INTEGER
00080 *          The leading dimension of the array C. LDC >= max(1,M).
00081 *
00082 *  WORK    (workspace/output) COMPLEX*16 array, dimension (MAX(1,LWORK))
00083 *          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
00084 *
00085 *  LWORK   (input) INTEGER
00086 *          The dimension of the array WORK.
00087 *          If SIDE = 'L', LWORK >= max(1,N);
00088 *          if SIDE = 'R', LWORK >= max(1,M).
00089 *          For optimum performance LWORK >= N*NB if SIDE = 'L', and
00090 *          LWORK >= M*NB if SIDE = 'R', where NB is the optimal
00091 *          blocksize.
00092 *
00093 *          If LWORK = -1, then a workspace query is assumed; the routine
00094 *          only calculates the optimal size of the WORK array, returns
00095 *          this value as the first entry of the WORK array, and no error
00096 *          message related to LWORK is issued by XERBLA.
00097 *
00098 *  INFO    (output) INTEGER
00099 *          = 0:  successful exit
00100 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00101 *
00102 *  =====================================================================
00103 *
00104 *     .. Local Scalars ..
00105       LOGICAL            LEFT, LQUERY
00106       INTEGER            I1, I2, IINFO, LWKOPT, MI, NB, NH, NI, NQ, NW
00107 *     ..
00108 *     .. External Functions ..
00109       LOGICAL            LSAME
00110       INTEGER            ILAENV
00111       EXTERNAL           LSAME, ILAENV
00112 *     ..
00113 *     .. External Subroutines ..
00114       EXTERNAL           XERBLA, ZUNMQR
00115 *     ..
00116 *     .. Intrinsic Functions ..
00117       INTRINSIC          MAX, MIN
00118 *     ..
00119 *     .. Executable Statements ..
00120 *
00121 *     Test the input arguments
00122 *
00123       INFO = 0
00124       NH = IHI - ILO
00125       LEFT = LSAME( SIDE, 'L' )
00126       LQUERY = ( LWORK.EQ.-1 )
00127 *
00128 *     NQ is the order of Q and NW is the minimum dimension of WORK
00129 *
00130       IF( LEFT ) THEN
00131          NQ = M
00132          NW = N
00133       ELSE
00134          NQ = N
00135          NW = M
00136       END IF
00137       IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
00138          INFO = -1
00139       ELSE IF( .NOT.LSAME( TRANS, 'N' ) .AND. .NOT.LSAME( TRANS, 'C' ) )
00140      $          THEN
00141          INFO = -2
00142       ELSE IF( M.LT.0 ) THEN
00143          INFO = -3
00144       ELSE IF( N.LT.0 ) THEN
00145          INFO = -4
00146       ELSE IF( ILO.LT.1 .OR. ILO.GT.MAX( 1, NQ ) ) THEN
00147          INFO = -5
00148       ELSE IF( IHI.LT.MIN( ILO, NQ ) .OR. IHI.GT.NQ ) THEN
00149          INFO = -6
00150       ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN
00151          INFO = -8
00152       ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
00153          INFO = -11
00154       ELSE IF( LWORK.LT.MAX( 1, NW ) .AND. .NOT.LQUERY ) THEN
00155          INFO = -13
00156       END IF
00157 *
00158       IF( INFO.EQ.0 ) THEN
00159          IF( LEFT ) THEN
00160             NB = ILAENV( 1, 'ZUNMQR', SIDE // TRANS, NH, N, NH, -1 )
00161          ELSE
00162             NB = ILAENV( 1, 'ZUNMQR', SIDE // TRANS, M, NH, NH, -1 )
00163          END IF
00164          LWKOPT = MAX( 1, NW )*NB
00165          WORK( 1 ) = LWKOPT
00166       END IF
00167 *
00168       IF( INFO.NE.0 ) THEN
00169          CALL XERBLA( 'ZUNMHR', -INFO )
00170          RETURN
00171       ELSE IF( LQUERY ) THEN
00172          RETURN
00173       END IF
00174 *
00175 *     Quick return if possible
00176 *
00177       IF( M.EQ.0 .OR. N.EQ.0 .OR. NH.EQ.0 ) THEN
00178          WORK( 1 ) = 1
00179          RETURN
00180       END IF
00181 *
00182       IF( LEFT ) THEN
00183          MI = NH
00184          NI = N
00185          I1 = ILO + 1
00186          I2 = 1
00187       ELSE
00188          MI = M
00189          NI = NH
00190          I1 = 1
00191          I2 = ILO + 1
00192       END IF
00193 *
00194       CALL ZUNMQR( SIDE, TRANS, MI, NI, NH, A( ILO+1, ILO ), LDA,
00195      $             TAU( ILO ), C( I1, I2 ), LDC, WORK, LWORK, IINFO )
00196 *
00197       WORK( 1 ) = LWKOPT
00198       RETURN
00199 *
00200 *     End of ZUNMHR
00201 *
00202       END
 All Files Functions