File:  [local] / rpl / lapack / lapack / dgeqrfp.f
Revision 1.10: download - view: text, annotated - select for diffs - revision graph
Mon Jan 27 09:28:16 2014 UTC (10 years, 3 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_23, rpl-4_1_22, rpl-4_1_21, rpl-4_1_20, rpl-4_1_19, rpl-4_1_18, rpl-4_1_17, HEAD
Cohérence.

    1: *> \brief \b DGEQRFP
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at 
    6: *            http://www.netlib.org/lapack/explore-html/ 
    7: *
    8: *> \htmlonly
    9: *> Download DGEQRFP + dependencies 
   10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgeqrfp.f"> 
   11: *> [TGZ]</a> 
   12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgeqrfp.f"> 
   13: *> [ZIP]</a> 
   14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgeqrfp.f"> 
   15: *> [TXT]</a>
   16: *> \endhtmlonly 
   17: *
   18: *  Definition:
   19: *  ===========
   20: *
   21: *       SUBROUTINE DGEQRFP( M, N, A, LDA, TAU, WORK, LWORK, INFO )
   22:    23: *       .. Scalar Arguments ..
   24: *       INTEGER            INFO, LDA, LWORK, M, N
   25: *       ..
   26: *       .. Array Arguments ..
   27: *       DOUBLE PRECISION   A( LDA, * ), TAU( * ), WORK( * )
   28: *       ..
   29: *  
   30: *
   31: *> \par Purpose:
   32: *  =============
   33: *>
   34: *> \verbatim
   35: *>
   36: *> DGEQRFP computes a QR factorization of a real M-by-N matrix A:
   37: *> A = Q * R.
   38: *> \endverbatim
   39: *
   40: *  Arguments:
   41: *  ==========
   42: *
   43: *> \param[in] M
   44: *> \verbatim
   45: *>          M is INTEGER
   46: *>          The number of rows of the matrix A.  M >= 0.
   47: *> \endverbatim
   48: *>
   49: *> \param[in] N
   50: *> \verbatim
   51: *>          N is INTEGER
   52: *>          The number of columns of the matrix A.  N >= 0.
   53: *> \endverbatim
   54: *>
   55: *> \param[in,out] A
   56: *> \verbatim
   57: *>          A is DOUBLE PRECISION array, dimension (LDA,N)
   58: *>          On entry, the M-by-N matrix A.
   59: *>          On exit, the elements on and above the diagonal of the array
   60: *>          contain the min(M,N)-by-N upper trapezoidal matrix R (R is
   61: *>          upper triangular if m >= n); the elements below the diagonal,
   62: *>          with the array TAU, represent the orthogonal matrix Q as a
   63: *>          product of min(m,n) elementary reflectors (see Further
   64: *>          Details).
   65: *> \endverbatim
   66: *>
   67: *> \param[in] LDA
   68: *> \verbatim
   69: *>          LDA is INTEGER
   70: *>          The leading dimension of the array A.  LDA >= max(1,M).
   71: *> \endverbatim
   72: *>
   73: *> \param[out] TAU
   74: *> \verbatim
   75: *>          TAU is DOUBLE PRECISION array, dimension (min(M,N))
   76: *>          The scalar factors of the elementary reflectors (see Further
   77: *>          Details).
   78: *> \endverbatim
   79: *>
   80: *> \param[out] WORK
   81: *> \verbatim
   82: *>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
   83: *>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
   84: *> \endverbatim
   85: *>
   86: *> \param[in] LWORK
   87: *> \verbatim
   88: *>          LWORK is INTEGER
   89: *>          The dimension of the array WORK.  LWORK >= max(1,N).
   90: *>          For optimum performance LWORK >= N*NB, where NB is
   91: *>          the optimal blocksize.
   92: *>
   93: *>          If LWORK = -1, then a workspace query is assumed; the routine
   94: *>          only calculates the optimal size of the WORK array, returns
   95: *>          this value as the first entry of the WORK array, and no error
   96: *>          message related to LWORK is issued by XERBLA.
   97: *> \endverbatim
   98: *>
   99: *> \param[out] INFO
  100: *> \verbatim
  101: *>          INFO is INTEGER
  102: *>          = 0:  successful exit
  103: *>          < 0:  if INFO = -i, the i-th argument had an illegal value
  104: *> \endverbatim
  105: *
  106: *  Authors:
  107: *  ========
  108: *
  109: *> \author Univ. of Tennessee 
  110: *> \author Univ. of California Berkeley 
  111: *> \author Univ. of Colorado Denver 
  112: *> \author NAG Ltd. 
  113: *
  114: *> \date November 2011
  115: *
  116: *> \ingroup doubleGEcomputational
  117: *
  118: *> \par Further Details:
  119: *  =====================
  120: *>
  121: *> \verbatim
  122: *>
  123: *>  The matrix Q is represented as a product of elementary reflectors
  124: *>
  125: *>     Q = H(1) H(2) . . . H(k), where k = min(m,n).
  126: *>
  127: *>  Each H(i) has the form
  128: *>
  129: *>     H(i) = I - tau * v * v**T
  130: *>
  131: *>  where tau is a real scalar, and v is a real vector with
  132: *>  v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i),
  133: *>  and tau in TAU(i).
  134: *> \endverbatim
  135: *>
  136: *  =====================================================================
  137:       SUBROUTINE DGEQRFP( M, N, A, LDA, TAU, WORK, LWORK, INFO )
  138: *
  139: *  -- LAPACK computational routine (version 3.4.0) --
  140: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
  141: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  142: *     November 2011
  143: *
  144: *     .. Scalar Arguments ..
  145:       INTEGER            INFO, LDA, LWORK, M, N
  146: *     ..
  147: *     .. Array Arguments ..
  148:       DOUBLE PRECISION   A( LDA, * ), TAU( * ), WORK( * )
  149: *     ..
  150: *
  151: *  =====================================================================
  152: *
  153: *     .. Local Scalars ..
  154:       LOGICAL            LQUERY
  155:       INTEGER            I, IB, IINFO, IWS, K, LDWORK, LWKOPT, NB,
  156:      $                   NBMIN, NX
  157: *     ..
  158: *     .. External Subroutines ..
  159:       EXTERNAL           DGEQR2P, DLARFB, DLARFT, XERBLA
  160: *     ..
  161: *     .. Intrinsic Functions ..
  162:       INTRINSIC          MAX, MIN
  163: *     ..
  164: *     .. External Functions ..
  165:       INTEGER            ILAENV
  166:       EXTERNAL           ILAENV
  167: *     ..
  168: *     .. Executable Statements ..
  169: *
  170: *     Test the input arguments
  171: *
  172:       INFO = 0
  173:       NB = ILAENV( 1, 'DGEQRF', ' ', M, N, -1, -1 )
  174:       LWKOPT = N*NB
  175:       WORK( 1 ) = LWKOPT
  176:       LQUERY = ( LWORK.EQ.-1 )
  177:       IF( M.LT.0 ) THEN
  178:          INFO = -1
  179:       ELSE IF( N.LT.0 ) THEN
  180:          INFO = -2
  181:       ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
  182:          INFO = -4
  183:       ELSE IF( LWORK.LT.MAX( 1, N ) .AND. .NOT.LQUERY ) THEN
  184:          INFO = -7
  185:       END IF
  186:       IF( INFO.NE.0 ) THEN
  187:          CALL XERBLA( 'DGEQRFP', -INFO )
  188:          RETURN
  189:       ELSE IF( LQUERY ) THEN
  190:          RETURN
  191:       END IF
  192: *
  193: *     Quick return if possible
  194: *
  195:       K = MIN( M, N )
  196:       IF( K.EQ.0 ) THEN
  197:          WORK( 1 ) = 1
  198:          RETURN
  199:       END IF
  200: *
  201:       NBMIN = 2
  202:       NX = 0
  203:       IWS = N
  204:       IF( NB.GT.1 .AND. NB.LT.K ) THEN
  205: *
  206: *        Determine when to cross over from blocked to unblocked code.
  207: *
  208:          NX = MAX( 0, ILAENV( 3, 'DGEQRF', ' ', M, N, -1, -1 ) )
  209:          IF( NX.LT.K ) THEN
  210: *
  211: *           Determine if workspace is large enough for blocked code.
  212: *
  213:             LDWORK = N
  214:             IWS = LDWORK*NB
  215:             IF( LWORK.LT.IWS ) THEN
  216: *
  217: *              Not enough workspace to use optimal NB:  reduce NB and
  218: *              determine the minimum value of NB.
  219: *
  220:                NB = LWORK / LDWORK
  221:                NBMIN = MAX( 2, ILAENV( 2, 'DGEQRF', ' ', M, N, -1,
  222:      $                 -1 ) )
  223:             END IF
  224:          END IF
  225:       END IF
  226: *
  227:       IF( NB.GE.NBMIN .AND. NB.LT.K .AND. NX.LT.K ) THEN
  228: *
  229: *        Use blocked code initially
  230: *
  231:          DO 10 I = 1, K - NX, NB
  232:             IB = MIN( K-I+1, NB )
  233: *
  234: *           Compute the QR factorization of the current block
  235: *           A(i:m,i:i+ib-1)
  236: *
  237:             CALL DGEQR2P( M-I+1, IB, A( I, I ), LDA, TAU( I ), WORK,
  238:      $                   IINFO )
  239:             IF( I+IB.LE.N ) THEN
  240: *
  241: *              Form the triangular factor of the block reflector
  242: *              H = H(i) H(i+1) . . . H(i+ib-1)
  243: *
  244:                CALL DLARFT( 'Forward', 'Columnwise', M-I+1, IB,
  245:      $                      A( I, I ), LDA, TAU( I ), WORK, LDWORK )
  246: *
  247: *              Apply H**T to A(i:m,i+ib:n) from the left
  248: *
  249:                CALL DLARFB( 'Left', 'Transpose', 'Forward',
  250:      $                      'Columnwise', M-I+1, N-I-IB+1, IB,
  251:      $                      A( I, I ), LDA, WORK, LDWORK, A( I, I+IB ),
  252:      $                      LDA, WORK( IB+1 ), LDWORK )
  253:             END IF
  254:    10    CONTINUE
  255:       ELSE
  256:          I = 1
  257:       END IF
  258: *
  259: *     Use unblocked code to factor the last or only block.
  260: *
  261:       IF( I.LE.K )
  262:      $   CALL DGEQR2P( M-I+1, N-I+1, A( I, I ), LDA, TAU( I ), WORK,
  263:      $                IINFO )
  264: *
  265:       WORK( 1 ) = IWS
  266:       RETURN
  267: *
  268: *     End of DGEQRFP
  269: *
  270:       END

CVSweb interface <joel.bertrand@systella.fr>