root / src / lapack / double / dgelqf.f @ 3
Historique | Voir | Annoter | Télécharger (5,72 ko)
| 1 | 1 | pfleura2 | SUBROUTINE DGELQF( M, N, A, LDA, TAU, WORK, LWORK, INFO ) |
|---|---|---|---|
| 2 | 1 | pfleura2 | * |
| 3 | 1 | pfleura2 | * -- LAPACK routine (version 3.2) -- |
| 4 | 1 | pfleura2 | * -- LAPACK is a software package provided by Univ. of Tennessee, -- |
| 5 | 1 | pfleura2 | * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
| 6 | 1 | pfleura2 | * November 2006 |
| 7 | 1 | pfleura2 | * |
| 8 | 1 | pfleura2 | * .. Scalar Arguments .. |
| 9 | 1 | pfleura2 | INTEGER INFO, LDA, LWORK, M, N |
| 10 | 1 | pfleura2 | * .. |
| 11 | 1 | pfleura2 | * .. Array Arguments .. |
| 12 | 1 | pfleura2 | DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * ) |
| 13 | 1 | pfleura2 | * .. |
| 14 | 1 | pfleura2 | * |
| 15 | 1 | pfleura2 | * Purpose |
| 16 | 1 | pfleura2 | * ======= |
| 17 | 1 | pfleura2 | * |
| 18 | 1 | pfleura2 | * DGELQF computes an LQ factorization of a real M-by-N matrix A: |
| 19 | 1 | pfleura2 | * A = L * Q. |
| 20 | 1 | pfleura2 | * |
| 21 | 1 | pfleura2 | * Arguments |
| 22 | 1 | pfleura2 | * ========= |
| 23 | 1 | pfleura2 | * |
| 24 | 1 | pfleura2 | * M (input) INTEGER |
| 25 | 1 | pfleura2 | * The number of rows of the matrix A. M >= 0. |
| 26 | 1 | pfleura2 | * |
| 27 | 1 | pfleura2 | * N (input) INTEGER |
| 28 | 1 | pfleura2 | * The number of columns of the matrix A. N >= 0. |
| 29 | 1 | pfleura2 | * |
| 30 | 1 | pfleura2 | * A (input/output) DOUBLE PRECISION array, dimension (LDA,N) |
| 31 | 1 | pfleura2 | * On entry, the M-by-N matrix A. |
| 32 | 1 | pfleura2 | * On exit, the elements on and below the diagonal of the array |
| 33 | 1 | pfleura2 | * contain the m-by-min(m,n) lower trapezoidal matrix L (L is |
| 34 | 1 | pfleura2 | * lower triangular if m <= n); the elements above the diagonal, |
| 35 | 1 | pfleura2 | * with the array TAU, represent the orthogonal matrix Q as a |
| 36 | 1 | pfleura2 | * product of elementary reflectors (see Further Details). |
| 37 | 1 | pfleura2 | * |
| 38 | 1 | pfleura2 | * LDA (input) INTEGER |
| 39 | 1 | pfleura2 | * The leading dimension of the array A. LDA >= max(1,M). |
| 40 | 1 | pfleura2 | * |
| 41 | 1 | pfleura2 | * TAU (output) DOUBLE PRECISION array, dimension (min(M,N)) |
| 42 | 1 | pfleura2 | * The scalar factors of the elementary reflectors (see Further |
| 43 | 1 | pfleura2 | * Details). |
| 44 | 1 | pfleura2 | * |
| 45 | 1 | pfleura2 | * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK)) |
| 46 | 1 | pfleura2 | * On exit, if INFO = 0, WORK(1) returns the optimal LWORK. |
| 47 | 1 | pfleura2 | * |
| 48 | 1 | pfleura2 | * LWORK (input) INTEGER |
| 49 | 1 | pfleura2 | * The dimension of the array WORK. LWORK >= max(1,M). |
| 50 | 1 | pfleura2 | * For optimum performance LWORK >= M*NB, where NB is the |
| 51 | 1 | pfleura2 | * optimal blocksize. |
| 52 | 1 | pfleura2 | * |
| 53 | 1 | pfleura2 | * If LWORK = -1, then a workspace query is assumed; the routine |
| 54 | 1 | pfleura2 | * only calculates the optimal size of the WORK array, returns |
| 55 | 1 | pfleura2 | * this value as the first entry of the WORK array, and no error |
| 56 | 1 | pfleura2 | * message related to LWORK is issued by XERBLA. |
| 57 | 1 | pfleura2 | * |
| 58 | 1 | pfleura2 | * INFO (output) INTEGER |
| 59 | 1 | pfleura2 | * = 0: successful exit |
| 60 | 1 | pfleura2 | * < 0: if INFO = -i, the i-th argument had an illegal value |
| 61 | 1 | pfleura2 | * |
| 62 | 1 | pfleura2 | * Further Details |
| 63 | 1 | pfleura2 | * =============== |
| 64 | 1 | pfleura2 | * |
| 65 | 1 | pfleura2 | * The matrix Q is represented as a product of elementary reflectors |
| 66 | 1 | pfleura2 | * |
| 67 | 1 | pfleura2 | * Q = H(k) . . . H(2) H(1), where k = min(m,n). |
| 68 | 1 | pfleura2 | * |
| 69 | 1 | pfleura2 | * Each H(i) has the form |
| 70 | 1 | pfleura2 | * |
| 71 | 1 | pfleura2 | * H(i) = I - tau * v * v' |
| 72 | 1 | pfleura2 | * |
| 73 | 1 | pfleura2 | * where tau is a real scalar, and v is a real vector with |
| 74 | 1 | pfleura2 | * v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n), |
| 75 | 1 | pfleura2 | * and tau in TAU(i). |
| 76 | 1 | pfleura2 | * |
| 77 | 1 | pfleura2 | * ===================================================================== |
| 78 | 1 | pfleura2 | * |
| 79 | 1 | pfleura2 | * .. Local Scalars .. |
| 80 | 1 | pfleura2 | LOGICAL LQUERY |
| 81 | 1 | pfleura2 | INTEGER I, IB, IINFO, IWS, K, LDWORK, LWKOPT, NB, |
| 82 | 1 | pfleura2 | $ NBMIN, NX |
| 83 | 1 | pfleura2 | * .. |
| 84 | 1 | pfleura2 | * .. External Subroutines .. |
| 85 | 1 | pfleura2 | EXTERNAL DGELQ2, DLARFB, DLARFT, XERBLA |
| 86 | 1 | pfleura2 | * .. |
| 87 | 1 | pfleura2 | * .. Intrinsic Functions .. |
| 88 | 1 | pfleura2 | INTRINSIC MAX, MIN |
| 89 | 1 | pfleura2 | * .. |
| 90 | 1 | pfleura2 | * .. External Functions .. |
| 91 | 1 | pfleura2 | INTEGER ILAENV |
| 92 | 1 | pfleura2 | EXTERNAL ILAENV |
| 93 | 1 | pfleura2 | * .. |
| 94 | 1 | pfleura2 | * .. Executable Statements .. |
| 95 | 1 | pfleura2 | * |
| 96 | 1 | pfleura2 | * Test the input arguments |
| 97 | 1 | pfleura2 | * |
| 98 | 1 | pfleura2 | INFO = 0 |
| 99 | 1 | pfleura2 | NB = ILAENV( 1, 'DGELQF', ' ', M, N, -1, -1 ) |
| 100 | 1 | pfleura2 | LWKOPT = M*NB |
| 101 | 1 | pfleura2 | WORK( 1 ) = LWKOPT |
| 102 | 1 | pfleura2 | LQUERY = ( LWORK.EQ.-1 ) |
| 103 | 1 | pfleura2 | IF( M.LT.0 ) THEN |
| 104 | 1 | pfleura2 | INFO = -1 |
| 105 | 1 | pfleura2 | ELSE IF( N.LT.0 ) THEN |
| 106 | 1 | pfleura2 | INFO = -2 |
| 107 | 1 | pfleura2 | ELSE IF( LDA.LT.MAX( 1, M ) ) THEN |
| 108 | 1 | pfleura2 | INFO = -4 |
| 109 | 1 | pfleura2 | ELSE IF( LWORK.LT.MAX( 1, M ) .AND. .NOT.LQUERY ) THEN |
| 110 | 1 | pfleura2 | INFO = -7 |
| 111 | 1 | pfleura2 | END IF |
| 112 | 1 | pfleura2 | IF( INFO.NE.0 ) THEN |
| 113 | 1 | pfleura2 | CALL XERBLA( 'DGELQF', -INFO ) |
| 114 | 1 | pfleura2 | RETURN |
| 115 | 1 | pfleura2 | ELSE IF( LQUERY ) THEN |
| 116 | 1 | pfleura2 | RETURN |
| 117 | 1 | pfleura2 | END IF |
| 118 | 1 | pfleura2 | * |
| 119 | 1 | pfleura2 | * Quick return if possible |
| 120 | 1 | pfleura2 | * |
| 121 | 1 | pfleura2 | K = MIN( M, N ) |
| 122 | 1 | pfleura2 | IF( K.EQ.0 ) THEN |
| 123 | 1 | pfleura2 | WORK( 1 ) = 1 |
| 124 | 1 | pfleura2 | RETURN |
| 125 | 1 | pfleura2 | END IF |
| 126 | 1 | pfleura2 | * |
| 127 | 1 | pfleura2 | NBMIN = 2 |
| 128 | 1 | pfleura2 | NX = 0 |
| 129 | 1 | pfleura2 | IWS = M |
| 130 | 1 | pfleura2 | IF( NB.GT.1 .AND. NB.LT.K ) THEN |
| 131 | 1 | pfleura2 | * |
| 132 | 1 | pfleura2 | * Determine when to cross over from blocked to unblocked code. |
| 133 | 1 | pfleura2 | * |
| 134 | 1 | pfleura2 | NX = MAX( 0, ILAENV( 3, 'DGELQF', ' ', M, N, -1, -1 ) ) |
| 135 | 1 | pfleura2 | IF( NX.LT.K ) THEN |
| 136 | 1 | pfleura2 | * |
| 137 | 1 | pfleura2 | * Determine if workspace is large enough for blocked code. |
| 138 | 1 | pfleura2 | * |
| 139 | 1 | pfleura2 | LDWORK = M |
| 140 | 1 | pfleura2 | IWS = LDWORK*NB |
| 141 | 1 | pfleura2 | IF( LWORK.LT.IWS ) THEN |
| 142 | 1 | pfleura2 | * |
| 143 | 1 | pfleura2 | * Not enough workspace to use optimal NB: reduce NB and |
| 144 | 1 | pfleura2 | * determine the minimum value of NB. |
| 145 | 1 | pfleura2 | * |
| 146 | 1 | pfleura2 | NB = LWORK / LDWORK |
| 147 | 1 | pfleura2 | NBMIN = MAX( 2, ILAENV( 2, 'DGELQF', ' ', M, N, -1, |
| 148 | 1 | pfleura2 | $ -1 ) ) |
| 149 | 1 | pfleura2 | END IF |
| 150 | 1 | pfleura2 | END IF |
| 151 | 1 | pfleura2 | END IF |
| 152 | 1 | pfleura2 | * |
| 153 | 1 | pfleura2 | IF( NB.GE.NBMIN .AND. NB.LT.K .AND. NX.LT.K ) THEN |
| 154 | 1 | pfleura2 | * |
| 155 | 1 | pfleura2 | * Use blocked code initially |
| 156 | 1 | pfleura2 | * |
| 157 | 1 | pfleura2 | DO 10 I = 1, K - NX, NB |
| 158 | 1 | pfleura2 | IB = MIN( K-I+1, NB ) |
| 159 | 1 | pfleura2 | * |
| 160 | 1 | pfleura2 | * Compute the LQ factorization of the current block |
| 161 | 1 | pfleura2 | * A(i:i+ib-1,i:n) |
| 162 | 1 | pfleura2 | * |
| 163 | 1 | pfleura2 | CALL DGELQ2( IB, N-I+1, A( I, I ), LDA, TAU( I ), WORK, |
| 164 | 1 | pfleura2 | $ IINFO ) |
| 165 | 1 | pfleura2 | IF( I+IB.LE.M ) THEN |
| 166 | 1 | pfleura2 | * |
| 167 | 1 | pfleura2 | * Form the triangular factor of the block reflector |
| 168 | 1 | pfleura2 | * H = H(i) H(i+1) . . . H(i+ib-1) |
| 169 | 1 | pfleura2 | * |
| 170 | 1 | pfleura2 | CALL DLARFT( 'Forward', 'Rowwise', N-I+1, IB, A( I, I ), |
| 171 | 1 | pfleura2 | $ LDA, TAU( I ), WORK, LDWORK ) |
| 172 | 1 | pfleura2 | * |
| 173 | 1 | pfleura2 | * Apply H to A(i+ib:m,i:n) from the right |
| 174 | 1 | pfleura2 | * |
| 175 | 1 | pfleura2 | CALL DLARFB( 'Right', 'No transpose', 'Forward', |
| 176 | 1 | pfleura2 | $ 'Rowwise', M-I-IB+1, N-I+1, IB, A( I, I ), |
| 177 | 1 | pfleura2 | $ LDA, WORK, LDWORK, A( I+IB, I ), LDA, |
| 178 | 1 | pfleura2 | $ WORK( IB+1 ), LDWORK ) |
| 179 | 1 | pfleura2 | END IF |
| 180 | 1 | pfleura2 | 10 CONTINUE |
| 181 | 1 | pfleura2 | ELSE |
| 182 | 1 | pfleura2 | I = 1 |
| 183 | 1 | pfleura2 | END IF |
| 184 | 1 | pfleura2 | * |
| 185 | 1 | pfleura2 | * Use unblocked code to factor the last or only block. |
| 186 | 1 | pfleura2 | * |
| 187 | 1 | pfleura2 | IF( I.LE.K ) |
| 188 | 1 | pfleura2 | $ CALL DGELQ2( M-I+1, N-I+1, A( I, I ), LDA, TAU( I ), WORK, |
| 189 | 1 | pfleura2 | $ IINFO ) |
| 190 | 1 | pfleura2 | * |
| 191 | 1 | pfleura2 | WORK( 1 ) = IWS |
| 192 | 1 | pfleura2 | RETURN |
| 193 | 1 | pfleura2 | * |
| 194 | 1 | pfleura2 | * End of DGELQF |
| 195 | 1 | pfleura2 | * |
| 196 | 1 | pfleura2 | END |