1 *> \brief \b SORM2L multiplies a general matrix by the orthogonal matrix from a QL factorization determined by sgeqlf (unblocked algorithm).
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SORM2L + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sorm2l.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sorm2l.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sorm2l.f">
21 * SUBROUTINE SORM2L( 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 * REAL A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
38 *> SORM2L 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 SGEQLF. 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 REAL 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 *> SGEQLF in the last 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 REAL array, dimension (K)
115 *> TAU(i) must contain the scalar factor of the elementary
116 *> reflector H(i), as returned by SGEQLF.
121 *> C is REAL 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 REAL 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 realOTHERcomputational
158 * =====================================================================
159 SUBROUTINE SORM2L( 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 REAL A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
175 * =====================================================================
179 PARAMETER ( ONE = 1.0E+0 )
181 * .. Local Scalars ..
183 INTEGER I, I1, I2, I3, MI, NI, NQ
186 * .. External Functions ..
190 * .. External Subroutines ..
191 EXTERNAL SLARF, 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( 'SORM2L', -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 ) )
256 * H(i) is applied to C(1:m-k+i,1:n)
261 * H(i) is applied to C(1:m,1:n-k+i)
270 CALL SLARF( SIDE, MI, NI, A( 1, I ), 1, TAU( I ), C, LDC,