1 *> \brief \b DORML2 multiplies a general matrix by the orthogonal matrix from a LQ factorization determined by sgelqf (unblocked algorithm).
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DORML2 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dorml2.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dorml2.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dorml2.f">
21 * SUBROUTINE DORML2( 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 *> DORML2 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(k) . . . H(2) H(1)
53 *> as returned by DGELQF. 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
98 *> (LDA,M) if SIDE = 'L',
99 *> (LDA,N) if SIDE = 'R'
100 *> The i-th row must contain the vector which defines the
101 *> elementary reflector H(i), for i = 1,2,...,k, as returned by
102 *> DGELQF in the first k rows of its array argument A.
103 *> A is modified by the routine but restored on exit.
109 *> The leading dimension of the array A. LDA >= max(1,K).
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 DGELQF.
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 DORML2( 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, K ) ) THEN
223 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
227 CALL XERBLA( 'DORML2', -INFO )
231 * Quick return if possible
233 IF( M.EQ.0 .OR. N.EQ.0 .OR. K.EQ.0 )
236 IF( ( LEFT .AND. NOTRAN ) .OR. ( .NOT.LEFT .AND. .NOT.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 ), LDA, TAU( I ),
275 $ C( IC, JC ), LDC, WORK )