File:  [local] / rpl / lapack / lapack / dorgtr.f
Revision 1.17: download - view: text, annotated - select for diffs - revision graph
Mon Aug 7 08:39:02 2023 UTC (8 months, 3 weeks ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_35, rpl-4_1_34, HEAD
Première mise à jour de lapack et blas.

    1: *> \brief \b DORGTR
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *> \htmlonly
    9: *> Download DORGTR + dependencies
   10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dorgtr.f">
   11: *> [TGZ]</a>
   12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dorgtr.f">
   13: *> [ZIP]</a>
   14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dorgtr.f">
   15: *> [TXT]</a>
   16: *> \endhtmlonly
   17: *
   18: *  Definition:
   19: *  ===========
   20: *
   21: *       SUBROUTINE DORGTR( UPLO, N, A, LDA, TAU, WORK, LWORK, INFO )
   22: *
   23: *       .. Scalar Arguments ..
   24: *       CHARACTER          UPLO
   25: *       INTEGER            INFO, LDA, LWORK, N
   26: *       ..
   27: *       .. Array Arguments ..
   28: *       DOUBLE PRECISION   A( LDA, * ), TAU( * ), WORK( * )
   29: *       ..
   30: *
   31: *
   32: *> \par Purpose:
   33: *  =============
   34: *>
   35: *> \verbatim
   36: *>
   37: *> DORGTR generates a real orthogonal matrix Q which is defined as the
   38: *> product of n-1 elementary reflectors of order N, as returned by
   39: *> DSYTRD:
   40: *>
   41: *> if UPLO = 'U', Q = H(n-1) . . . H(2) H(1),
   42: *>
   43: *> if UPLO = 'L', Q = H(1) H(2) . . . H(n-1).
   44: *> \endverbatim
   45: *
   46: *  Arguments:
   47: *  ==========
   48: *
   49: *> \param[in] UPLO
   50: *> \verbatim
   51: *>          UPLO is CHARACTER*1
   52: *>          = 'U': Upper triangle of A contains elementary reflectors
   53: *>                 from DSYTRD;
   54: *>          = 'L': Lower triangle of A contains elementary reflectors
   55: *>                 from DSYTRD.
   56: *> \endverbatim
   57: *>
   58: *> \param[in] N
   59: *> \verbatim
   60: *>          N is INTEGER
   61: *>          The order of the matrix Q. N >= 0.
   62: *> \endverbatim
   63: *>
   64: *> \param[in,out] A
   65: *> \verbatim
   66: *>          A is DOUBLE PRECISION array, dimension (LDA,N)
   67: *>          On entry, the vectors which define the elementary reflectors,
   68: *>          as returned by DSYTRD.
   69: *>          On exit, the N-by-N orthogonal matrix Q.
   70: *> \endverbatim
   71: *>
   72: *> \param[in] LDA
   73: *> \verbatim
   74: *>          LDA is INTEGER
   75: *>          The leading dimension of the array A. LDA >= max(1,N).
   76: *> \endverbatim
   77: *>
   78: *> \param[in] TAU
   79: *> \verbatim
   80: *>          TAU is DOUBLE PRECISION array, dimension (N-1)
   81: *>          TAU(i) must contain the scalar factor of the elementary
   82: *>          reflector H(i), as returned by DSYTRD.
   83: *> \endverbatim
   84: *>
   85: *> \param[out] WORK
   86: *> \verbatim
   87: *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
   88: *>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
   89: *> \endverbatim
   90: *>
   91: *> \param[in] LWORK
   92: *> \verbatim
   93: *>          LWORK is INTEGER
   94: *>          The dimension of the array WORK. LWORK >= max(1,N-1).
   95: *>          For optimum performance LWORK >= (N-1)*NB, where NB is
   96: *>          the optimal blocksize.
   97: *>
   98: *>          If LWORK = -1, then a workspace query is assumed; the routine
   99: *>          only calculates the optimal size of the WORK array, returns
  100: *>          this value as the first entry of the WORK array, and no error
  101: *>          message related to LWORK is issued by XERBLA.
  102: *> \endverbatim
  103: *>
  104: *> \param[out] INFO
  105: *> \verbatim
  106: *>          INFO is INTEGER
  107: *>          = 0:  successful exit
  108: *>          < 0:  if INFO = -i, the i-th argument had an illegal value
  109: *> \endverbatim
  110: *
  111: *  Authors:
  112: *  ========
  113: *
  114: *> \author Univ. of Tennessee
  115: *> \author Univ. of California Berkeley
  116: *> \author Univ. of Colorado Denver
  117: *> \author NAG Ltd.
  118: *
  119: *> \ingroup doubleOTHERcomputational
  120: *
  121: *  =====================================================================
  122:       SUBROUTINE DORGTR( UPLO, N, A, LDA, TAU, WORK, LWORK, INFO )
  123: *
  124: *  -- LAPACK computational routine --
  125: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  126: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  127: *
  128: *     .. Scalar Arguments ..
  129:       CHARACTER          UPLO
  130:       INTEGER            INFO, LDA, LWORK, N
  131: *     ..
  132: *     .. Array Arguments ..
  133:       DOUBLE PRECISION   A( LDA, * ), TAU( * ), WORK( * )
  134: *     ..
  135: *
  136: *  =====================================================================
  137: *
  138: *     .. Parameters ..
  139:       DOUBLE PRECISION   ZERO, ONE
  140:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
  141: *     ..
  142: *     .. Local Scalars ..
  143:       LOGICAL            LQUERY, UPPER
  144:       INTEGER            I, IINFO, J, LWKOPT, NB
  145: *     ..
  146: *     .. External Functions ..
  147:       LOGICAL            LSAME
  148:       INTEGER            ILAENV
  149:       EXTERNAL           LSAME, ILAENV
  150: *     ..
  151: *     .. External Subroutines ..
  152:       EXTERNAL           DORGQL, DORGQR, XERBLA
  153: *     ..
  154: *     .. Intrinsic Functions ..
  155:       INTRINSIC          MAX
  156: *     ..
  157: *     .. Executable Statements ..
  158: *
  159: *     Test the input arguments
  160: *
  161:       INFO = 0
  162:       LQUERY = ( LWORK.EQ.-1 )
  163:       UPPER = LSAME( UPLO, 'U' )
  164:       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
  165:          INFO = -1
  166:       ELSE IF( N.LT.0 ) THEN
  167:          INFO = -2
  168:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  169:          INFO = -4
  170:       ELSE IF( LWORK.LT.MAX( 1, N-1 ) .AND. .NOT.LQUERY ) THEN
  171:          INFO = -7
  172:       END IF
  173: *
  174:       IF( INFO.EQ.0 ) THEN
  175:          IF( UPPER ) THEN
  176:             NB = ILAENV( 1, 'DORGQL', ' ', N-1, N-1, N-1, -1 )
  177:          ELSE
  178:             NB = ILAENV( 1, 'DORGQR', ' ', N-1, N-1, N-1, -1 )
  179:          END IF
  180:          LWKOPT = MAX( 1, N-1 )*NB
  181:          WORK( 1 ) = LWKOPT
  182:       END IF
  183: *
  184:       IF( INFO.NE.0 ) THEN
  185:          CALL XERBLA( 'DORGTR', -INFO )
  186:          RETURN
  187:       ELSE IF( LQUERY ) THEN
  188:          RETURN
  189:       END IF
  190: *
  191: *     Quick return if possible
  192: *
  193:       IF( N.EQ.0 ) THEN
  194:          WORK( 1 ) = 1
  195:          RETURN
  196:       END IF
  197: *
  198:       IF( UPPER ) THEN
  199: *
  200: *        Q was determined by a call to DSYTRD with UPLO = 'U'
  201: *
  202: *        Shift the vectors which define the elementary reflectors one
  203: *        column to the left, and set the last row and column of Q to
  204: *        those of the unit matrix
  205: *
  206:          DO 20 J = 1, N - 1
  207:             DO 10 I = 1, J - 1
  208:                A( I, J ) = A( I, J+1 )
  209:    10       CONTINUE
  210:             A( N, J ) = ZERO
  211:    20    CONTINUE
  212:          DO 30 I = 1, N - 1
  213:             A( I, N ) = ZERO
  214:    30    CONTINUE
  215:          A( N, N ) = ONE
  216: *
  217: *        Generate Q(1:n-1,1:n-1)
  218: *
  219:          CALL DORGQL( N-1, N-1, N-1, A, LDA, TAU, WORK, LWORK, IINFO )
  220: *
  221:       ELSE
  222: *
  223: *        Q was determined by a call to DSYTRD with UPLO = 'L'.
  224: *
  225: *        Shift the vectors which define the elementary reflectors one
  226: *        column to the right, and set the first row and column of Q to
  227: *        those of the unit matrix
  228: *
  229:          DO 50 J = N, 2, -1
  230:             A( 1, J ) = ZERO
  231:             DO 40 I = J + 1, N
  232:                A( I, J ) = A( I, J-1 )
  233:    40       CONTINUE
  234:    50    CONTINUE
  235:          A( 1, 1 ) = ONE
  236:          DO 60 I = 2, N
  237:             A( I, 1 ) = ZERO
  238:    60    CONTINUE
  239:          IF( N.GT.1 ) THEN
  240: *
  241: *           Generate Q(2:n,2:n)
  242: *
  243:             CALL DORGQR( N-1, N-1, N-1, A( 2, 2 ), LDA, TAU, WORK,
  244:      $                   LWORK, IINFO )
  245:          END IF
  246:       END IF
  247:       WORK( 1 ) = LWKOPT
  248:       RETURN
  249: *
  250: *     End of DORGTR
  251: *
  252:       END

CVSweb interface <joel.bertrand@systella.fr>