Annotation of rpl/lapack/lapack/zggsvp3.f, revision 1.7

1.1       bertrand    1: *> \brief \b ZGGSVP3
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.4       bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.1       bertrand    7: *
                      8: *> \htmlonly
1.4       bertrand    9: *> Download ZGGSVP3 + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zggsvp3.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zggsvp3.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zggsvp3.f">
1.1       bertrand   15: *> [TXT]</a>
1.4       bertrand   16: *> \endhtmlonly
1.1       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE ZGGSVP3( JOBU, JOBV, JOBQ, M, P, N, A, LDA, B, LDB,
                     22: *                           TOLA, TOLB, K, L, U, LDU, V, LDV, Q, LDQ,
                     23: *                           IWORK, RWORK, TAU, WORK, LWORK, INFO )
1.4       bertrand   24: *
1.1       bertrand   25: *       .. Scalar Arguments ..
                     26: *       CHARACTER          JOBQ, JOBU, JOBV
                     27: *       INTEGER            INFO, K, L, LDA, LDB, LDQ, LDU, LDV, M, N, P, LWORK
                     28: *       DOUBLE PRECISION   TOLA, TOLB
                     29: *       ..
                     30: *       .. Array Arguments ..
                     31: *       INTEGER            IWORK( * )
                     32: *       DOUBLE PRECISION   RWORK( * )
                     33: *       COMPLEX*16         A( LDA, * ), B( LDB, * ), Q( LDQ, * ),
                     34: *      $                   TAU( * ), U( LDU, * ), V( LDV, * ), WORK( * )
                     35: *       ..
1.4       bertrand   36: *
1.1       bertrand   37: *
                     38: *> \par Purpose:
                     39: *  =============
                     40: *>
                     41: *> \verbatim
                     42: *>
                     43: *> ZGGSVP3 computes unitary matrices U, V and Q such that
                     44: *>
                     45: *>                    N-K-L  K    L
                     46: *>  U**H*A*Q =     K ( 0    A12  A13 )  if M-K-L >= 0;
                     47: *>                 L ( 0     0   A23 )
                     48: *>             M-K-L ( 0     0    0  )
                     49: *>
                     50: *>                  N-K-L  K    L
                     51: *>         =     K ( 0    A12  A13 )  if M-K-L < 0;
                     52: *>             M-K ( 0     0   A23 )
                     53: *>
                     54: *>                  N-K-L  K    L
                     55: *>  V**H*B*Q =   L ( 0     0   B13 )
                     56: *>             P-L ( 0     0    0  )
                     57: *>
                     58: *> where the K-by-K matrix A12 and L-by-L matrix B13 are nonsingular
                     59: *> upper triangular; A23 is L-by-L upper triangular if M-K-L >= 0,
                     60: *> otherwise A23 is (M-K)-by-L upper trapezoidal.  K+L = the effective
1.4       bertrand   61: *> numerical rank of the (M+P)-by-N matrix (A**H,B**H)**H.
1.1       bertrand   62: *>
                     63: *> This decomposition is the preprocessing step for computing the
                     64: *> Generalized Singular Value Decomposition (GSVD), see subroutine
                     65: *> ZGGSVD3.
                     66: *> \endverbatim
                     67: *
                     68: *  Arguments:
                     69: *  ==========
                     70: *
                     71: *> \param[in] JOBU
                     72: *> \verbatim
                     73: *>          JOBU is CHARACTER*1
                     74: *>          = 'U':  Unitary matrix U is computed;
                     75: *>          = 'N':  U is not computed.
                     76: *> \endverbatim
                     77: *>
                     78: *> \param[in] JOBV
                     79: *> \verbatim
                     80: *>          JOBV is CHARACTER*1
                     81: *>          = 'V':  Unitary matrix V is computed;
                     82: *>          = 'N':  V is not computed.
                     83: *> \endverbatim
                     84: *>
                     85: *> \param[in] JOBQ
                     86: *> \verbatim
                     87: *>          JOBQ is CHARACTER*1
                     88: *>          = 'Q':  Unitary matrix Q is computed;
                     89: *>          = 'N':  Q is not computed.
                     90: *> \endverbatim
                     91: *>
                     92: *> \param[in] M
                     93: *> \verbatim
                     94: *>          M is INTEGER
                     95: *>          The number of rows of the matrix A.  M >= 0.
                     96: *> \endverbatim
                     97: *>
                     98: *> \param[in] P
                     99: *> \verbatim
                    100: *>          P is INTEGER
                    101: *>          The number of rows of the matrix B.  P >= 0.
                    102: *> \endverbatim
                    103: *>
                    104: *> \param[in] N
                    105: *> \verbatim
                    106: *>          N is INTEGER
                    107: *>          The number of columns of the matrices A and B.  N >= 0.
                    108: *> \endverbatim
                    109: *>
                    110: *> \param[in,out] A
                    111: *> \verbatim
                    112: *>          A is COMPLEX*16 array, dimension (LDA,N)
                    113: *>          On entry, the M-by-N matrix A.
                    114: *>          On exit, A contains the triangular (or trapezoidal) matrix
                    115: *>          described in the Purpose section.
                    116: *> \endverbatim
                    117: *>
                    118: *> \param[in] LDA
                    119: *> \verbatim
                    120: *>          LDA is INTEGER
                    121: *>          The leading dimension of the array A. LDA >= max(1,M).
                    122: *> \endverbatim
                    123: *>
                    124: *> \param[in,out] B
                    125: *> \verbatim
                    126: *>          B is COMPLEX*16 array, dimension (LDB,N)
                    127: *>          On entry, the P-by-N matrix B.
                    128: *>          On exit, B contains the triangular matrix described in
                    129: *>          the Purpose section.
                    130: *> \endverbatim
                    131: *>
                    132: *> \param[in] LDB
                    133: *> \verbatim
                    134: *>          LDB is INTEGER
                    135: *>          The leading dimension of the array B. LDB >= max(1,P).
                    136: *> \endverbatim
                    137: *>
                    138: *> \param[in] TOLA
                    139: *> \verbatim
                    140: *>          TOLA is DOUBLE PRECISION
                    141: *> \endverbatim
                    142: *>
                    143: *> \param[in] TOLB
                    144: *> \verbatim
                    145: *>          TOLB is DOUBLE PRECISION
                    146: *>
                    147: *>          TOLA and TOLB are the thresholds to determine the effective
                    148: *>          numerical rank of matrix B and a subblock of A. Generally,
                    149: *>          they are set to
                    150: *>             TOLA = MAX(M,N)*norm(A)*MAZHEPS,
                    151: *>             TOLB = MAX(P,N)*norm(B)*MAZHEPS.
                    152: *>          The size of TOLA and TOLB may affect the size of backward
                    153: *>          errors of the decomposition.
                    154: *> \endverbatim
                    155: *>
                    156: *> \param[out] K
                    157: *> \verbatim
                    158: *>          K is INTEGER
                    159: *> \endverbatim
                    160: *>
                    161: *> \param[out] L
                    162: *> \verbatim
                    163: *>          L is INTEGER
                    164: *>
                    165: *>          On exit, K and L specify the dimension of the subblocks
                    166: *>          described in Purpose section.
                    167: *>          K + L = effective numerical rank of (A**H,B**H)**H.
                    168: *> \endverbatim
                    169: *>
                    170: *> \param[out] U
                    171: *> \verbatim
                    172: *>          U is COMPLEX*16 array, dimension (LDU,M)
                    173: *>          If JOBU = 'U', U contains the unitary matrix U.
                    174: *>          If JOBU = 'N', U is not referenced.
                    175: *> \endverbatim
                    176: *>
                    177: *> \param[in] LDU
                    178: *> \verbatim
                    179: *>          LDU is INTEGER
                    180: *>          The leading dimension of the array U. LDU >= max(1,M) if
                    181: *>          JOBU = 'U'; LDU >= 1 otherwise.
                    182: *> \endverbatim
                    183: *>
                    184: *> \param[out] V
                    185: *> \verbatim
                    186: *>          V is COMPLEX*16 array, dimension (LDV,P)
                    187: *>          If JOBV = 'V', V contains the unitary matrix V.
                    188: *>          If JOBV = 'N', V is not referenced.
                    189: *> \endverbatim
                    190: *>
                    191: *> \param[in] LDV
                    192: *> \verbatim
                    193: *>          LDV is INTEGER
                    194: *>          The leading dimension of the array V. LDV >= max(1,P) if
                    195: *>          JOBV = 'V'; LDV >= 1 otherwise.
                    196: *> \endverbatim
                    197: *>
                    198: *> \param[out] Q
                    199: *> \verbatim
                    200: *>          Q is COMPLEX*16 array, dimension (LDQ,N)
                    201: *>          If JOBQ = 'Q', Q contains the unitary matrix Q.
                    202: *>          If JOBQ = 'N', Q is not referenced.
                    203: *> \endverbatim
                    204: *>
                    205: *> \param[in] LDQ
                    206: *> \verbatim
                    207: *>          LDQ is INTEGER
                    208: *>          The leading dimension of the array Q. LDQ >= max(1,N) if
                    209: *>          JOBQ = 'Q'; LDQ >= 1 otherwise.
                    210: *> \endverbatim
                    211: *>
                    212: *> \param[out] IWORK
                    213: *> \verbatim
                    214: *>          IWORK is INTEGER array, dimension (N)
                    215: *> \endverbatim
                    216: *>
                    217: *> \param[out] RWORK
                    218: *> \verbatim
                    219: *>          RWORK is DOUBLE PRECISION array, dimension (2*N)
                    220: *> \endverbatim
                    221: *>
                    222: *> \param[out] TAU
                    223: *> \verbatim
                    224: *>          TAU is COMPLEX*16 array, dimension (N)
                    225: *> \endverbatim
                    226: *>
                    227: *> \param[out] WORK
                    228: *> \verbatim
                    229: *>          WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
                    230: *>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
                    231: *> \endverbatim
                    232: *>
                    233: *> \param[in] LWORK
                    234: *> \verbatim
                    235: *>          LWORK is INTEGER
                    236: *>          The dimension of the array WORK.
                    237: *>
                    238: *>          If LWORK = -1, then a workspace query is assumed; the routine
                    239: *>          only calculates the optimal size of the WORK array, returns
                    240: *>          this value as the first entry of the WORK array, and no error
                    241: *>          message related to LWORK is issued by XERBLA.
                    242: *> \endverbatim
                    243: *>
                    244: *> \param[out] INFO
                    245: *> \verbatim
                    246: *>          INFO is INTEGER
                    247: *>          = 0:  successful exit
                    248: *>          < 0:  if INFO = -i, the i-th argument had an illegal value.
                    249: *> \endverbatim
                    250: *
                    251: *  Authors:
                    252: *  ========
                    253: *
1.4       bertrand  254: *> \author Univ. of Tennessee
                    255: *> \author Univ. of California Berkeley
                    256: *> \author Univ. of Colorado Denver
                    257: *> \author NAG Ltd.
1.1       bertrand  258: *
                    259: *> \ingroup complex16OTHERcomputational
                    260: *
                    261: *> \par Further Details:
                    262: *  =====================
                    263: *
                    264: *> \verbatim
                    265: *>
                    266: *>  The subroutine uses LAPACK subroutine ZGEQP3 for the QR factorization
                    267: *>  with column pivoting to detect the effective numerical rank of the
                    268: *>  a matrix. It may be replaced by a better rank determination strategy.
                    269: *>
                    270: *>  ZGGSVP3 replaces the deprecated subroutine ZGGSVP.
                    271: *>
                    272: *> \endverbatim
                    273: *>
                    274: * =====================================================================
                    275:       SUBROUTINE ZGGSVP3( JOBU, JOBV, JOBQ, M, P, N, A, LDA, B, LDB,
                    276:      $                    TOLA, TOLB, K, L, U, LDU, V, LDV, Q, LDQ,
                    277:      $                    IWORK, RWORK, TAU, WORK, LWORK, INFO )
                    278: *
1.7     ! bertrand  279: *  -- LAPACK computational routine --
1.1       bertrand  280: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    281: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
                    282: *
                    283:       IMPLICIT NONE
                    284: *
                    285: *     .. Scalar Arguments ..
                    286:       CHARACTER          JOBQ, JOBU, JOBV
                    287:       INTEGER            INFO, K, L, LDA, LDB, LDQ, LDU, LDV, M, N, P,
                    288:      $                   LWORK
                    289:       DOUBLE PRECISION   TOLA, TOLB
                    290: *     ..
                    291: *     .. Array Arguments ..
                    292:       INTEGER            IWORK( * )
                    293:       DOUBLE PRECISION   RWORK( * )
                    294:       COMPLEX*16         A( LDA, * ), B( LDB, * ), Q( LDQ, * ),
                    295:      $                   TAU( * ), U( LDU, * ), V( LDV, * ), WORK( * )
                    296: *     ..
                    297: *
                    298: *  =====================================================================
                    299: *
                    300: *     .. Parameters ..
                    301:       COMPLEX*16         CZERO, CONE
                    302:       PARAMETER          ( CZERO = ( 0.0D+0, 0.0D+0 ),
                    303:      $                   CONE = ( 1.0D+0, 0.0D+0 ) )
                    304: *     ..
                    305: *     .. Local Scalars ..
                    306:       LOGICAL            FORWRD, WANTQ, WANTU, WANTV, LQUERY
                    307:       INTEGER            I, J, LWKOPT
                    308: *     ..
                    309: *     .. External Functions ..
                    310:       LOGICAL            LSAME
                    311:       EXTERNAL           LSAME
                    312: *     ..
                    313: *     .. External Subroutines ..
                    314:       EXTERNAL           XERBLA, ZGEQP3, ZGEQR2, ZGERQ2, ZLACPY, ZLAPMT,
                    315:      $                   ZLASET, ZUNG2R, ZUNM2R, ZUNMR2
                    316: *     ..
                    317: *     .. Intrinsic Functions ..
                    318:       INTRINSIC          ABS, DBLE, DIMAG, MAX, MIN
                    319: *     ..
                    320: *     .. Executable Statements ..
                    321: *
                    322: *     Test the input parameters
                    323: *
                    324:       WANTU = LSAME( JOBU, 'U' )
                    325:       WANTV = LSAME( JOBV, 'V' )
                    326:       WANTQ = LSAME( JOBQ, 'Q' )
                    327:       FORWRD = .TRUE.
                    328:       LQUERY = ( LWORK.EQ.-1 )
                    329:       LWKOPT = 1
                    330: *
                    331: *     Test the input arguments
                    332: *
                    333:       INFO = 0
                    334:       IF( .NOT.( WANTU .OR. LSAME( JOBU, 'N' ) ) ) THEN
                    335:          INFO = -1
                    336:       ELSE IF( .NOT.( WANTV .OR. LSAME( JOBV, 'N' ) ) ) THEN
                    337:          INFO = -2
                    338:       ELSE IF( .NOT.( WANTQ .OR. LSAME( JOBQ, 'N' ) ) ) THEN
                    339:          INFO = -3
                    340:       ELSE IF( M.LT.0 ) THEN
                    341:          INFO = -4
                    342:       ELSE IF( P.LT.0 ) THEN
                    343:          INFO = -5
                    344:       ELSE IF( N.LT.0 ) THEN
                    345:          INFO = -6
                    346:       ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
                    347:          INFO = -8
                    348:       ELSE IF( LDB.LT.MAX( 1, P ) ) THEN
                    349:          INFO = -10
                    350:       ELSE IF( LDU.LT.1 .OR. ( WANTU .AND. LDU.LT.M ) ) THEN
                    351:          INFO = -16
                    352:       ELSE IF( LDV.LT.1 .OR. ( WANTV .AND. LDV.LT.P ) ) THEN
                    353:          INFO = -18
                    354:       ELSE IF( LDQ.LT.1 .OR. ( WANTQ .AND. LDQ.LT.N ) ) THEN
                    355:          INFO = -20
                    356:       ELSE IF( LWORK.LT.1 .AND. .NOT.LQUERY ) THEN
                    357:          INFO = -24
                    358:       END IF
                    359: *
                    360: *     Compute workspace
                    361: *
                    362:       IF( INFO.EQ.0 ) THEN
                    363:          CALL ZGEQP3( P, N, B, LDB, IWORK, TAU, WORK, -1, RWORK, INFO )
                    364:          LWKOPT = INT( WORK ( 1 ) )
                    365:          IF( WANTV ) THEN
                    366:             LWKOPT = MAX( LWKOPT, P )
                    367:          END IF
                    368:          LWKOPT = MAX( LWKOPT, MIN( N, P ) )
                    369:          LWKOPT = MAX( LWKOPT, M )
                    370:          IF( WANTQ ) THEN
                    371:             LWKOPT = MAX( LWKOPT, N )
                    372:          END IF
                    373:          CALL ZGEQP3( M, N, A, LDA, IWORK, TAU, WORK, -1, RWORK, INFO )
                    374:          LWKOPT = MAX( LWKOPT, INT( WORK ( 1 ) ) )
                    375:          LWKOPT = MAX( 1, LWKOPT )
                    376:          WORK( 1 ) = DCMPLX( LWKOPT )
                    377:       END IF
                    378: *
                    379:       IF( INFO.NE.0 ) THEN
                    380:          CALL XERBLA( 'ZGGSVP3', -INFO )
                    381:          RETURN
                    382:       END IF
                    383:       IF( LQUERY ) THEN
                    384:          RETURN
                    385:       ENDIF
                    386: *
                    387: *     QR with column pivoting of B: B*P = V*( S11 S12 )
                    388: *                                           (  0   0  )
                    389: *
                    390:       DO 10 I = 1, N
                    391:          IWORK( I ) = 0
                    392:    10 CONTINUE
                    393:       CALL ZGEQP3( P, N, B, LDB, IWORK, TAU, WORK, LWORK, RWORK, INFO )
                    394: *
                    395: *     Update A := A*P
                    396: *
                    397:       CALL ZLAPMT( FORWRD, M, N, A, LDA, IWORK )
                    398: *
                    399: *     Determine the effective rank of matrix B.
                    400: *
                    401:       L = 0
                    402:       DO 20 I = 1, MIN( P, N )
                    403:          IF( ABS( B( I, I ) ).GT.TOLB )
                    404:      $      L = L + 1
                    405:    20 CONTINUE
                    406: *
                    407:       IF( WANTV ) THEN
                    408: *
                    409: *        Copy the details of V, and form V.
                    410: *
                    411:          CALL ZLASET( 'Full', P, P, CZERO, CZERO, V, LDV )
                    412:          IF( P.GT.1 )
                    413:      $      CALL ZLACPY( 'Lower', P-1, N, B( 2, 1 ), LDB, V( 2, 1 ),
                    414:      $                   LDV )
                    415:          CALL ZUNG2R( P, P, MIN( P, N ), V, LDV, TAU, WORK, INFO )
                    416:       END IF
                    417: *
                    418: *     Clean up B
                    419: *
                    420:       DO 40 J = 1, L - 1
                    421:          DO 30 I = J + 1, L
                    422:             B( I, J ) = CZERO
                    423:    30    CONTINUE
                    424:    40 CONTINUE
                    425:       IF( P.GT.L )
                    426:      $   CALL ZLASET( 'Full', P-L, N, CZERO, CZERO, B( L+1, 1 ), LDB )
                    427: *
                    428:       IF( WANTQ ) THEN
                    429: *
                    430: *        Set Q = I and Update Q := Q*P
                    431: *
                    432:          CALL ZLASET( 'Full', N, N, CZERO, CONE, Q, LDQ )
                    433:          CALL ZLAPMT( FORWRD, N, N, Q, LDQ, IWORK )
                    434:       END IF
                    435: *
                    436:       IF( P.GE.L .AND. N.NE.L ) THEN
                    437: *
                    438: *        RQ factorization of ( S11 S12 ) = ( 0 S12 )*Z
                    439: *
                    440:          CALL ZGERQ2( L, N, B, LDB, TAU, WORK, INFO )
                    441: *
                    442: *        Update A := A*Z**H
                    443: *
                    444:          CALL ZUNMR2( 'Right', 'Conjugate transpose', M, N, L, B, LDB,
                    445:      $                TAU, A, LDA, WORK, INFO )
                    446:          IF( WANTQ ) THEN
                    447: *
                    448: *           Update Q := Q*Z**H
                    449: *
                    450:             CALL ZUNMR2( 'Right', 'Conjugate transpose', N, N, L, B,
                    451:      $                   LDB, TAU, Q, LDQ, WORK, INFO )
                    452:          END IF
                    453: *
                    454: *        Clean up B
                    455: *
                    456:          CALL ZLASET( 'Full', L, N-L, CZERO, CZERO, B, LDB )
                    457:          DO 60 J = N - L + 1, N
                    458:             DO 50 I = J - N + L + 1, L
                    459:                B( I, J ) = CZERO
                    460:    50       CONTINUE
                    461:    60    CONTINUE
                    462: *
                    463:       END IF
                    464: *
                    465: *     Let              N-L     L
                    466: *                A = ( A11    A12 ) M,
                    467: *
                    468: *     then the following does the complete QR decomposition of A11:
                    469: *
                    470: *              A11 = U*(  0  T12 )*P1**H
                    471: *                      (  0   0  )
                    472: *
                    473:       DO 70 I = 1, N - L
                    474:          IWORK( I ) = 0
                    475:    70 CONTINUE
                    476:       CALL ZGEQP3( M, N-L, A, LDA, IWORK, TAU, WORK, LWORK, RWORK,
                    477:      $             INFO )
                    478: *
                    479: *     Determine the effective rank of A11
                    480: *
                    481:       K = 0
                    482:       DO 80 I = 1, MIN( M, N-L )
                    483:          IF( ABS( A( I, I ) ).GT.TOLA )
                    484:      $      K = K + 1
                    485:    80 CONTINUE
                    486: *
                    487: *     Update A12 := U**H*A12, where A12 = A( 1:M, N-L+1:N )
                    488: *
                    489:       CALL ZUNM2R( 'Left', 'Conjugate transpose', M, L, MIN( M, N-L ),
                    490:      $             A, LDA, TAU, A( 1, N-L+1 ), LDA, WORK, INFO )
                    491: *
                    492:       IF( WANTU ) THEN
                    493: *
                    494: *        Copy the details of U, and form U
                    495: *
                    496:          CALL ZLASET( 'Full', M, M, CZERO, CZERO, U, LDU )
                    497:          IF( M.GT.1 )
                    498:      $      CALL ZLACPY( 'Lower', M-1, N-L, A( 2, 1 ), LDA, U( 2, 1 ),
                    499:      $                   LDU )
                    500:          CALL ZUNG2R( M, M, MIN( M, N-L ), U, LDU, TAU, WORK, INFO )
                    501:       END IF
                    502: *
                    503:       IF( WANTQ ) THEN
                    504: *
                    505: *        Update Q( 1:N, 1:N-L )  = Q( 1:N, 1:N-L )*P1
                    506: *
                    507:          CALL ZLAPMT( FORWRD, N, N-L, Q, LDQ, IWORK )
                    508:       END IF
                    509: *
                    510: *     Clean up A: set the strictly lower triangular part of
                    511: *     A(1:K, 1:K) = 0, and A( K+1:M, 1:N-L ) = 0.
                    512: *
                    513:       DO 100 J = 1, K - 1
                    514:          DO 90 I = J + 1, K
                    515:             A( I, J ) = CZERO
                    516:    90    CONTINUE
                    517:   100 CONTINUE
                    518:       IF( M.GT.K )
                    519:      $   CALL ZLASET( 'Full', M-K, N-L, CZERO, CZERO, A( K+1, 1 ), LDA )
                    520: *
                    521:       IF( N-L.GT.K ) THEN
                    522: *
                    523: *        RQ factorization of ( T11 T12 ) = ( 0 T12 )*Z1
                    524: *
                    525:          CALL ZGERQ2( K, N-L, A, LDA, TAU, WORK, INFO )
                    526: *
                    527:          IF( WANTQ ) THEN
                    528: *
                    529: *           Update Q( 1:N,1:N-L ) = Q( 1:N,1:N-L )*Z1**H
                    530: *
                    531:             CALL ZUNMR2( 'Right', 'Conjugate transpose', N, N-L, K, A,
                    532:      $                   LDA, TAU, Q, LDQ, WORK, INFO )
                    533:          END IF
                    534: *
                    535: *        Clean up A
                    536: *
                    537:          CALL ZLASET( 'Full', K, N-L-K, CZERO, CZERO, A, LDA )
                    538:          DO 120 J = N - L - K + 1, N - L
                    539:             DO 110 I = J - N + L + K + 1, K
                    540:                A( I, J ) = CZERO
                    541:   110       CONTINUE
                    542:   120    CONTINUE
                    543: *
                    544:       END IF
                    545: *
                    546:       IF( M.GT.K ) THEN
                    547: *
                    548: *        QR factorization of A( K+1:M,N-L+1:N )
                    549: *
                    550:          CALL ZGEQR2( M-K, L, A( K+1, N-L+1 ), LDA, TAU, WORK, INFO )
                    551: *
                    552:          IF( WANTU ) THEN
                    553: *
                    554: *           Update U(:,K+1:M) := U(:,K+1:M)*U1
                    555: *
                    556:             CALL ZUNM2R( 'Right', 'No transpose', M, M-K, MIN( M-K, L ),
                    557:      $                   A( K+1, N-L+1 ), LDA, TAU, U( 1, K+1 ), LDU,
                    558:      $                   WORK, INFO )
                    559:          END IF
                    560: *
                    561: *        Clean up
                    562: *
                    563:          DO 140 J = N - L + 1, N
                    564:             DO 130 I = J - N + K + L + 1, M
                    565:                A( I, J ) = CZERO
                    566:   130       CONTINUE
                    567:   140    CONTINUE
                    568: *
                    569:       END IF
                    570: *
                    571:       WORK( 1 ) = DCMPLX( LWKOPT )
                    572:       RETURN
                    573: *
                    574: *     End of ZGGSVP3
                    575: *
                    576:       END

CVSweb interface <joel.bertrand@systella.fr>