1
*> \brief \b DORM2R multiplies a general matrix by the orthogonal matrix from a QR factorization determined by sgeqrf (unblocked algorithm).
3
* =========== DOCUMENTATION ===========
5
* Online html documentation available at
6
* http://www.netlib.org/lapack/explore-html/
9
*> Download DORM2R + dependencies
10
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dorm2r.f">
12
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dorm2r.f">
14
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dorm2r.f">
21
* SUBROUTINE DORM2R( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC,
24
* .. Scalar Arguments ..
25
* CHARACTER SIDE, TRANS
26
* INTEGER INFO, K, LDA, LDC, M, N
28
* .. Array Arguments ..
29
* DOUBLE PRECISION A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
38
*> DORM2R overwrites the general real m by n matrix C with
40
*> Q * C if SIDE = 'L' and TRANS = 'N', or
42
*> Q**T* C if SIDE = 'L' and TRANS = 'T', or
44
*> C * Q if SIDE = 'R' and TRANS = 'N', or
46
*> C * Q**T if SIDE = 'R' and TRANS = 'T',
48
*> where Q is a real orthogonal matrix defined as the product of k
49
*> elementary reflectors
51
*> Q = H(1) H(2) . . . H(k)
53
*> as returned by DGEQRF. Q is of order m if SIDE = 'L' and of order n
62
*> SIDE is CHARACTER*1
63
*> = 'L': apply Q or Q**T from the Left
64
*> = 'R': apply Q or Q**T from the Right
69
*> TRANS is CHARACTER*1
70
*> = 'N': apply Q (No transpose)
71
*> = 'T': apply Q**T (Transpose)
77
*> The number of rows of the matrix C. M >= 0.
83
*> The number of columns of the matrix C. N >= 0.
89
*> The number of elementary reflectors whose product defines
91
*> If SIDE = 'L', M >= K >= 0;
92
*> if SIDE = 'R', N >= K >= 0.
97
*> A is DOUBLE PRECISION array, dimension (LDA,K)
98
*> The i-th column must contain the vector which defines the
99
*> elementary reflector H(i), for i = 1,2,...,k, as returned by
100
*> DGEQRF in the first k columns of its array argument A.
101
*> A is modified by the routine but restored on exit.
107
*> The leading dimension of the array A.
108
*> If SIDE = 'L', LDA >= max(1,M);
109
*> if SIDE = 'R', LDA >= max(1,N).
114
*> TAU is DOUBLE PRECISION array, dimension (K)
115
*> TAU(i) must contain the scalar factor of the elementary
116
*> reflector H(i), as returned by DGEQRF.
121
*> C is DOUBLE PRECISION array, dimension (LDC,N)
122
*> On entry, the m by n matrix C.
123
*> On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
129
*> The leading dimension of the array C. LDC >= max(1,M).
134
*> WORK is DOUBLE PRECISION array, dimension
135
*> (N) if SIDE = 'L',
142
*> = 0: successful exit
143
*> < 0: if INFO = -i, the i-th argument had an illegal value
149
*> \author Univ. of Tennessee
150
*> \author Univ. of California Berkeley
151
*> \author Univ. of Colorado Denver
154
*> \date September 2012
156
*> \ingroup doubleOTHERcomputational
158
* =====================================================================
159
SUBROUTINE DORM2R( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC,
162
* -- LAPACK computational routine (version 3.4.2) --
163
* -- LAPACK is a software package provided by Univ. of Tennessee, --
164
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
167
* .. Scalar Arguments ..
168
CHARACTER SIDE, TRANS
169
INTEGER INFO, K, LDA, LDC, M, N
171
* .. Array Arguments ..
172
DOUBLE PRECISION A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
175
* =====================================================================
179
PARAMETER ( ONE = 1.0D+0 )
181
* .. Local Scalars ..
183
INTEGER I, I1, I2, I3, IC, JC, MI, NI, NQ
186
* .. External Functions ..
190
* .. External Subroutines ..
191
EXTERNAL DLARF, XERBLA
193
* .. Intrinsic Functions ..
196
* .. Executable Statements ..
198
* Test the input arguments
201
LEFT = LSAME( SIDE, 'L' )
202
NOTRAN = LSAME( TRANS, 'N' )
204
* NQ is the order of Q
211
IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
213
ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'T' ) ) THEN
215
ELSE IF( M.LT.0 ) THEN
217
ELSE IF( N.LT.0 ) THEN
219
ELSE IF( K.LT.0 .OR. K.GT.NQ ) THEN
221
ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN
223
ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
227
CALL XERBLA( 'DORM2R', -INFO )
231
* Quick return if possible
233
IF( M.EQ.0 .OR. N.EQ.0 .OR. K.EQ.0 )
236
IF( ( LEFT .AND. .NOT.NOTRAN ) .OR. ( .NOT.LEFT .AND. NOTRAN ) )
258
* H(i) is applied to C(i:m,1:n)
264
* H(i) is applied to C(1:m,i:n)
274
CALL DLARF( SIDE, MI, NI, A( I, I ), 1, TAU( I ), C( IC, JC ),