Télécharger dgeqr2.eso

Retour à la liste

Numérotation des lignes :

dgeqr2
  1. C DGEQR2 SOURCE BP208322 18/07/10 21:15:01 9872
  2. *> \brief \b DGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm.
  3. *
  4. * =========== DOCUMENTATION ===========
  5. *
  6. * Online html documentation available at
  7. * http://www.netlib.org/lapack/explore-html/
  8. *
  9. *> \htmlonly
  10. *> Download DGEQR2 + dependencies
  11. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgeqr2.f">
  12. *> [TGZ]</a>
  13. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgeqr2.f">
  14. *> [ZIP]</a>
  15. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgeqr2.f">
  16. *> [TXT]</a>
  17. *> \endhtmlonly
  18. *
  19. * Definition:
  20. * ===========
  21. *
  22. * SUBROUTINE DGEQR2( M, N, A, LDA, TAU, WORK, INFO )
  23. *
  24. * .. Scalar Arguments ..
  25. * INTEGER INFO, LDA, M, N
  26. * ..
  27. * .. Array Arguments ..
  28. * REAL*8 A( LDA, * ), TAU( * ), WORK( * )
  29. * ..
  30. *
  31. *
  32. *> \par Purpose:
  33. * =============
  34. *>
  35. *> \verbatim
  36. *>
  37. *> DGEQR2 computes a QR factorization of a real m by n matrix A:
  38. *> A = Q * R.
  39. *> \endverbatim
  40. *
  41. * Arguments:
  42. * ==========
  43. *
  44. *> \param[in] M
  45. *> \verbatim
  46. *> M is INTEGER
  47. *> The number of rows of the matrix A. M >= 0.
  48. *> \endverbatim
  49. *>
  50. *> \param[in] N
  51. *> \verbatim
  52. *> N is INTEGER
  53. *> The number of columns of the matrix A. N >= 0.
  54. *> \endverbatim
  55. *>
  56. *> \param[in,out] A
  57. *> \verbatim
  58. *> A is DOUBLE PRECISION array, dimension (LDA,N)
  59. *> On entry, the m by n matrix A.
  60. *> On exit, the elements on and above the diagonal of the array
  61. *> contain the min(m,n) by n upper trapezoidal matrix R (R is
  62. *> upper triangular if m >= n); the elements below the diagonal,
  63. *> with the array TAU, represent the orthogonal matrix Q as a
  64. *> product of elementary reflectors (see Further 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 (N)
  83. *> \endverbatim
  84. *>
  85. *> \param[out] INFO
  86. *> \verbatim
  87. *> INFO is INTEGER
  88. *> = 0: successful exit
  89. *> < 0: if INFO = -i, the i-th argument had an illegal value
  90. *> \endverbatim
  91. *
  92. * Authors:
  93. * ========
  94. *
  95. *> \author Univ. of Tennessee
  96. *> \author Univ. of California Berkeley
  97. *> \author Univ. of Colorado Denver
  98. *> \author NAG Ltd.
  99. *
  100. *> \date December 2016
  101. *
  102. *> \ingroup doubleGEcomputational
  103. *
  104. *> \par Further Details:
  105. * =====================
  106. *>
  107. *> \verbatim
  108. *>
  109. *> The matrix Q is represented as a product of elementary reflectors
  110. *>
  111. *> Q = H(1) H(2) . . . H(k), where k = min(m,n).
  112. *>
  113. *> Each H(i) has the form
  114. *>
  115. *> H(i) = I - tau * v * v**T
  116. *>
  117. *> where tau is a real scalar, and v is a real vector with
  118. *> v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i),
  119. *> and tau in TAU(i).
  120. *> \endverbatim
  121. *>
  122. * =====================================================================
  123. SUBROUTINE DGEQR2( M, N, A, LDA, TAU, WORK, INFO )
  124. *
  125. * -- LAPACK computational routine (version 3.7.0) --
  126. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  127. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  128. * December 2016
  129. *
  130. * .. Scalar Arguments ..
  131. INTEGER INFO, LDA, M, N
  132. * ..
  133. * .. Array Arguments ..
  134. REAL*8 A( LDA, * ), TAU( * ), WORK( * )
  135. * ..
  136. *
  137. * =====================================================================
  138. *
  139. * .. Parameters ..
  140. REAL*8 ONE
  141. PARAMETER ( ONE = 1.0D+0 )
  142. * ..
  143. * .. Local Scalars ..
  144. INTEGER I, K
  145. REAL*8 AII
  146. * ..
  147. * .. External Subroutines ..
  148. EXTERNAL DLARF, DLARFG, XERBLA
  149. * ..
  150. ** .. Intrinsic Functions ..
  151. * INTRINSIC MAX, MIN
  152. ** ..
  153. ** .. Executable Statements ..
  154. *
  155. * Test the input arguments
  156. *
  157. INFO = 0
  158. IF( M.LT.0 ) THEN
  159. INFO = -1
  160. ELSE IF( N.LT.0 ) THEN
  161. INFO = -2
  162. ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
  163. INFO = -4
  164. END IF
  165. IF( INFO.NE.0 ) THEN
  166. CALL XERBLA( 'DGEQR2', -INFO )
  167. RETURN
  168. END IF
  169. *
  170. K = MIN( M, N )
  171. *
  172. DO 10 I = 1, K
  173. *
  174. * Generate elementary reflector H(i) to annihilate A(i+1:m,i)
  175. *
  176. CALL DLARFG( M-I+1, A( I, I ), A( MIN( I+1, M ), I ), 1,
  177. $ TAU( I ) )
  178. IF( I.LT.N ) THEN
  179. *
  180. * Apply H(i) to A(i:m,i+1:n) from the left
  181. *
  182. AII = A( I, I )
  183. A( I, I ) = ONE
  184. CALL DLARF( 'Left', M-I+1, N-I, A( I, I ), 1, TAU( I ),
  185. $ A( I, I+1 ), LDA, WORK )
  186. A( I, I ) = AII
  187. END IF
  188. 10 CONTINUE
  189. RETURN
  190. *
  191. * End of DGEQR2
  192. *
  193. END
  194.  
  195.  
  196.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales