3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SORMTR + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sormtr.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sormtr.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sormtr.f">
21 * SUBROUTINE SORMTR( SIDE, UPLO, TRANS, M, N, A, LDA, TAU, C, LDC,
24 * .. Scalar Arguments ..
25 * CHARACTER SIDE, TRANS, UPLO
26 * INTEGER INFO, LDA, LDC, LWORK, M, N
28 * .. Array Arguments ..
29 * REAL A( LDA, * ), C( LDC, * ), TAU( * ),
39 *> SORMTR overwrites the general real M-by-N matrix C with
41 *> SIDE = 'L' SIDE = 'R'
42 *> TRANS = 'N': Q * C C * Q
43 *> TRANS = 'T': Q**T * C C * Q**T
45 *> where Q is a real orthogonal matrix of order nq, with nq = m if
46 *> SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
47 *> nq-1 elementary reflectors, as returned by SSYTRD:
49 *> if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
51 *> if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
59 *> SIDE is CHARACTER*1
60 *> = 'L': apply Q or Q**T from the Left;
61 *> = 'R': apply Q or Q**T from the Right.
66 *> UPLO is CHARACTER*1
67 *> = 'U': Upper triangle of A contains elementary reflectors
69 *> = 'L': Lower triangle of A contains elementary reflectors
75 *> TRANS is CHARACTER*1
76 *> = 'N': No transpose, apply Q;
77 *> = 'T': Transpose, apply Q**T.
83 *> The number of rows of the matrix C. M >= 0.
89 *> The number of columns of the matrix C. N >= 0.
94 *> A is REAL array, dimension
95 *> (LDA,M) if SIDE = 'L'
96 *> (LDA,N) if SIDE = 'R'
97 *> The vectors which define the elementary reflectors, as
98 *> returned by SSYTRD.
104 *> The leading dimension of the array A.
105 *> LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'.
110 *> TAU is REAL array, dimension
111 *> (M-1) if SIDE = 'L'
112 *> (N-1) if SIDE = 'R'
113 *> TAU(i) must contain the scalar factor of the elementary
114 *> reflector H(i), as returned by SSYTRD.
119 *> C is REAL array, dimension (LDC,N)
120 *> On entry, the M-by-N matrix C.
121 *> On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
127 *> The leading dimension of the array C. LDC >= max(1,M).
132 *> WORK is REAL array, dimension (MAX(1,LWORK))
133 *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
139 *> The dimension of the array WORK.
140 *> If SIDE = 'L', LWORK >= max(1,N);
141 *> if SIDE = 'R', LWORK >= max(1,M).
142 *> For optimum performance LWORK >= N*NB if SIDE = 'L', and
143 *> LWORK >= M*NB if SIDE = 'R', where NB is the optimal
146 *> If LWORK = -1, then a workspace query is assumed; the routine
147 *> only calculates the optimal size of the WORK array, returns
148 *> this value as the first entry of the WORK array, and no error
149 *> message related to LWORK is issued by XERBLA.
155 *> = 0: successful exit
156 *> < 0: if INFO = -i, the i-th argument had an illegal value
162 *> \author Univ. of Tennessee
163 *> \author Univ. of California Berkeley
164 *> \author Univ. of Colorado Denver
167 *> \date November 2011
169 *> \ingroup realOTHERcomputational
171 * =====================================================================
172 SUBROUTINE SORMTR( SIDE, UPLO, TRANS, M, N, A, LDA, TAU, C, LDC,
173 $ WORK, LWORK, INFO )
175 * -- LAPACK computational routine (version 3.4.0) --
176 * -- LAPACK is a software package provided by Univ. of Tennessee, --
177 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
180 * .. Scalar Arguments ..
181 CHARACTER SIDE, TRANS, UPLO
182 INTEGER INFO, LDA, LDC, LWORK, M, N
184 * .. Array Arguments ..
185 REAL A( LDA, * ), C( LDC, * ), TAU( * ),
189 * =====================================================================
191 * .. Local Scalars ..
192 LOGICAL LEFT, LQUERY, UPPER
193 INTEGER I1, I2, IINFO, LWKOPT, MI, NI, NB, NQ, NW
195 * .. External Functions ..
198 EXTERNAL ILAENV, LSAME
200 * .. External Subroutines ..
201 EXTERNAL SORMQL, SORMQR, XERBLA
203 * .. Intrinsic Functions ..
206 * .. Executable Statements ..
208 * Test the input arguments
211 LEFT = LSAME( SIDE, 'L' )
212 UPPER = LSAME( UPLO, 'U' )
213 LQUERY = ( LWORK.EQ.-1 )
215 * NQ is the order of Q and NW is the minimum dimension of WORK
224 IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
226 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
228 ELSE IF( .NOT.LSAME( TRANS, 'N' ) .AND. .NOT.LSAME( TRANS, 'T' ) )
231 ELSE IF( M.LT.0 ) THEN
233 ELSE IF( N.LT.0 ) THEN
235 ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN
237 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
239 ELSE IF( LWORK.LT.MAX( 1, NW ) .AND. .NOT.LQUERY ) THEN
246 NB = ILAENV( 1, 'SORMQL', SIDE // TRANS, M-1, N, M-1,
249 NB = ILAENV( 1, 'SORMQL', SIDE // TRANS, M, N-1, N-1,
254 NB = ILAENV( 1, 'SORMQR', SIDE // TRANS, M-1, N, M-1,
257 NB = ILAENV( 1, 'SORMQR', SIDE // TRANS, M, N-1, N-1,
261 LWKOPT = MAX( 1, NW )*NB
266 CALL XERBLA( 'SORMTR', -INFO )
268 ELSE IF( LQUERY ) THEN
272 * Quick return if possible
274 IF( M.EQ.0 .OR. N.EQ.0 .OR. NQ.EQ.1 ) THEN
289 * Q was determined by a call to SSYTRD with UPLO = 'U'
291 CALL SORMQL( SIDE, TRANS, MI, NI, NQ-1, A( 1, 2 ), LDA, TAU, C,
292 $ LDC, WORK, LWORK, IINFO )
295 * Q was determined by a call to SSYTRD with UPLO = 'L'
304 CALL SORMQR( SIDE, TRANS, MI, NI, NQ-1, A( 2, 1 ), LDA, TAU,
305 $ C( I1, I2 ), LDC, WORK, LWORK, IINFO )