1 *> \brief \b DGEQR2P computes the QR factorization of a general rectangular matrix with non-negative diagonal elements using an unblocked algorithm.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DGEQR2P + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgeqr2p.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgeqr2p.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgeqr2p.f">
21 * SUBROUTINE DGEQR2P( M, N, A, LDA, TAU, WORK, INFO )
23 * .. Scalar Arguments ..
24 * INTEGER INFO, LDA, M, N
26 * .. Array Arguments ..
27 * DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
36 *> DGEQR2 computes a QR factorization of a real m by n matrix A:
37 *> A = Q * R. The diagonal entries of R are nonnegative.
46 *> The number of rows of the matrix A. M >= 0.
52 *> The number of columns of the matrix A. N >= 0.
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 diagonal entries of R are
62 *> nonnegative; 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).
70 *> The leading dimension of the array A. LDA >= max(1,M).
75 *> TAU is DOUBLE PRECISION array, dimension (min(M,N))
76 *> The scalar factors of the elementary reflectors (see Further
82 *> WORK is DOUBLE PRECISION array, dimension (N)
88 *> = 0: successful exit
89 *> < 0: if INFO = -i, the i-th argument had an illegal value
95 *> \author Univ. of Tennessee
96 *> \author Univ. of California Berkeley
97 *> \author Univ. of Colorado Denver
100 *> \date November 2015
102 *> \ingroup doubleGEcomputational
104 *> \par Further Details:
105 * =====================
109 *> The matrix Q is represented as a product of elementary reflectors
111 *> Q = H(1) H(2) . . . H(k), where k = min(m,n).
113 *> Each H(i) has the form
115 *> H(i) = I - tau * v * v**T
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).
121 *> See Lapack Working Note 203 for details
124 * =====================================================================
125 SUBROUTINE DGEQR2P( M, N, A, LDA, TAU, WORK, INFO )
127 * -- LAPACK computational routine (version 3.6.0) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * .. Scalar Arguments ..
133 INTEGER INFO, LDA, M, N
135 * .. Array Arguments ..
136 DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
139 * =====================================================================
143 PARAMETER ( ONE = 1.0D+0 )
145 * .. Local Scalars ..
149 * .. External Subroutines ..
150 EXTERNAL DLARF, DLARFGP, XERBLA
152 * .. Intrinsic Functions ..
155 * .. Executable Statements ..
157 * Test the input arguments
162 ELSE IF( N.LT.0 ) THEN
164 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
168 CALL XERBLA( 'DGEQR2P', -INFO )
176 * Generate elementary reflector H(i) to annihilate A(i+1:m,i)
178 CALL DLARFGP( M-I+1, A( I, I ), A( MIN( I+1, M ), I ), 1,
182 * Apply H(i) to A(i:m,i+1:n) from the left
186 CALL DLARF( 'Left', M-I+1, N-I, A( I, I ), 1, TAU( I ),
187 $ A( I, I+1 ), LDA, WORK )