1 *> \brief \b DORGR2 generates all or part of the orthogonal matrix Q from an RQ factorization determined by sgerqf (unblocked algorithm).
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DORGR2 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dorgr2.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dorgr2.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dorgr2.f">
21 * SUBROUTINE DORGR2( M, N, K, A, LDA, TAU, WORK, INFO )
23 * .. Scalar Arguments ..
24 * INTEGER INFO, K, LDA, M, N
26 * .. Array Arguments ..
27 * DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
36 *> DORGR2 generates an m by n real matrix Q with orthonormal rows,
37 *> which is defined as the last m rows of a product of k elementary
38 *> reflectors of order n
40 *> Q = H(1) H(2) . . . H(k)
42 *> as returned by DGERQF.
51 *> The number of rows of the matrix Q. M >= 0.
57 *> The number of columns of the matrix Q. N >= M.
63 *> The number of elementary reflectors whose product defines the
64 *> matrix Q. M >= K >= 0.
69 *> A is DOUBLE PRECISION array, dimension (LDA,N)
70 *> On entry, the (m-k+i)-th row must contain the vector which
71 *> defines the elementary reflector H(i), for i = 1,2,...,k, as
72 *> returned by DGERQF in the last k rows of its array argument
74 *> On exit, the m by n matrix Q.
80 *> The first dimension of the array A. LDA >= max(1,M).
85 *> TAU is DOUBLE PRECISION array, dimension (K)
86 *> TAU(i) must contain the scalar factor of the elementary
87 *> reflector H(i), as returned by DGERQF.
92 *> WORK is DOUBLE PRECISION array, dimension (M)
98 *> = 0: successful exit
99 *> < 0: if INFO = -i, the i-th argument has an illegal value
105 *> \author Univ. of Tennessee
106 *> \author Univ. of California Berkeley
107 *> \author Univ. of Colorado Denver
110 *> \date September 2012
112 *> \ingroup doubleOTHERcomputational
114 * =====================================================================
115 SUBROUTINE DORGR2( M, N, K, A, LDA, TAU, WORK, INFO )
117 * -- LAPACK computational routine (version 3.4.2) --
118 * -- LAPACK is a software package provided by Univ. of Tennessee, --
119 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
122 * .. Scalar Arguments ..
123 INTEGER INFO, K, LDA, M, N
125 * .. Array Arguments ..
126 DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
129 * =====================================================================
132 DOUBLE PRECISION ONE, ZERO
133 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
135 * .. Local Scalars ..
138 * .. External Subroutines ..
139 EXTERNAL DLARF, DSCAL, XERBLA
141 * .. Intrinsic Functions ..
144 * .. Executable Statements ..
146 * Test the input arguments
151 ELSE IF( N.LT.M ) THEN
153 ELSE IF( K.LT.0 .OR. K.GT.M ) THEN
155 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
159 CALL XERBLA( 'DORGR2', -INFO )
163 * Quick return if possible
170 * Initialise rows 1:m-k to rows of the unit matrix
176 IF( J.GT.N-M .AND. J.LE.N-K )
177 $ A( M-N+J, J ) = ONE
184 * Apply H(i) to A(1:m-k+i,1:n-k+i) from the right
186 A( II, N-M+II ) = ONE
187 CALL DLARF( 'Right', II-1, N-M+II, A( II, 1 ), LDA, TAU( I ),
189 CALL DSCAL( N-M+II-1, -TAU( I ), A( II, 1 ), LDA )
190 A( II, N-M+II ) = ONE - TAU( I )
192 * Set A(m-k+i,n-k+i+1:n) to zero
194 DO 30 L = N - M + II + 1, N