LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ sorml2()

subroutine sorml2 ( character side,
character trans,
integer m,
integer n,
integer k,
real, dimension( lda, * ) a,
integer lda,
real, dimension( * ) tau,
real, dimension( ldc, * ) c,
integer ldc,
real, dimension( * ) work,
integer info )

SORML2 multiplies a general matrix by the orthogonal matrix from a LQ factorization determined by sgelqf (unblocked algorithm).

Download SORML2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> SORML2 overwrites the general real m by n matrix C with
!>
!>       Q * C  if SIDE = 'L' and TRANS = 'N', or
!>
!>       Q**T* C  if SIDE = 'L' and TRANS = 'T', or
!>
!>       C * Q  if SIDE = 'R' and TRANS = 'N', or
!>
!>       C * Q**T if SIDE = 'R' and TRANS = 'T',
!>
!> where Q is a real orthogonal matrix defined as the product of k
!> elementary reflectors
!>
!>       Q = H(k) . . . H(2) H(1)
!>
!> as returned by SGELQF. Q is of order m if SIDE = 'L' and of order n
!> if SIDE = 'R'.
!> 
Parameters
[in]SIDE
!>          SIDE is CHARACTER*1
!>          = 'L': apply Q or Q**T from the Left
!>          = 'R': apply Q or Q**T from the Right
!> 
[in]TRANS
!>          TRANS is CHARACTER*1
!>          = 'N': apply Q  (No transpose)
!>          = 'T': apply Q**T (Transpose)
!> 
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix C. M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix C. N >= 0.
!> 
[in]K
!>          K is INTEGER
!>          The number of elementary reflectors whose product defines
!>          the matrix Q.
!>          If SIDE = 'L', M >= K >= 0;
!>          if SIDE = 'R', N >= K >= 0.
!> 
[in]A
!>          A is REAL array, dimension
!>                               (LDA,M) if SIDE = 'L',
!>                               (LDA,N) if SIDE = 'R'
!>          The i-th row must contain the vector which defines the
!>          elementary reflector H(i), for i = 1,2,...,k, as returned by
!>          SGELQF in the first k rows of its array argument A.
!>          A is modified by the routine but restored on exit.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A. LDA >= max(1,K).
!> 
[in]TAU
!>          TAU is REAL array, dimension (K)
!>          TAU(i) must contain the scalar factor of the elementary
!>          reflector H(i), as returned by SGELQF.
!> 
[in,out]C
!>          C is REAL array, dimension (LDC,N)
!>          On entry, the m by n matrix C.
!>          On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
!> 
[in]LDC
!>          LDC is INTEGER
!>          The leading dimension of the array C. LDC >= max(1,M).
!> 
[out]WORK
!>          WORK is REAL array, dimension
!>                                   (N) if SIDE = 'L',
!>                                   (M) if SIDE = 'R'
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0: successful exit
!>          < 0: if INFO = -i, the i-th argument had an illegal value
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 155 of file sorml2.f.

157*
158* -- LAPACK computational routine --
159* -- LAPACK is a software package provided by Univ. of Tennessee, --
160* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
161*
162* .. Scalar Arguments ..
163 CHARACTER SIDE, TRANS
164 INTEGER INFO, K, LDA, LDC, M, N
165* ..
166* .. Array Arguments ..
167 REAL A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
168* ..
169*
170* =====================================================================
171*
172* .. Local Scalars ..
173 LOGICAL LEFT, NOTRAN
174 INTEGER I, I1, I2, I3, IC, JC, MI, NI, NQ
175* ..
176* .. External Functions ..
177 LOGICAL LSAME
178 EXTERNAL lsame
179* ..
180* .. External Subroutines ..
181 EXTERNAL slarf1f, xerbla
182* ..
183* .. Intrinsic Functions ..
184 INTRINSIC max
185* ..
186* .. Executable Statements ..
187*
188* Test the input arguments
189*
190 info = 0
191 left = lsame( side, 'L' )
192 notran = lsame( trans, 'N' )
193*
194* NQ is the order of Q
195*
196 IF( left ) THEN
197 nq = m
198 ELSE
199 nq = n
200 END IF
201 IF( .NOT.left .AND. .NOT.lsame( side, 'R' ) ) THEN
202 info = -1
203 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) ) THEN
204 info = -2
205 ELSE IF( m.LT.0 ) THEN
206 info = -3
207 ELSE IF( n.LT.0 ) THEN
208 info = -4
209 ELSE IF( k.LT.0 .OR. k.GT.nq ) THEN
210 info = -5
211 ELSE IF( lda.LT.max( 1, k ) ) THEN
212 info = -7
213 ELSE IF( ldc.LT.max( 1, m ) ) THEN
214 info = -10
215 END IF
216 IF( info.NE.0 ) THEN
217 CALL xerbla( 'SORML2', -info )
218 RETURN
219 END IF
220*
221* Quick return if possible
222*
223 IF( m.EQ.0 .OR. n.EQ.0 .OR. k.EQ.0 )
224 $ RETURN
225*
226 IF( ( left .AND. notran ) .OR. ( .NOT.left .AND. .NOT.notran ) )
227 $ THEN
228 i1 = 1
229 i2 = k
230 i3 = 1
231 ELSE
232 i1 = k
233 i2 = 1
234 i3 = -1
235 END IF
236*
237 IF( left ) THEN
238 ni = n
239 jc = 1
240 ELSE
241 mi = m
242 ic = 1
243 END IF
244*
245 DO 10 i = i1, i2, i3
246 IF( left ) THEN
247*
248* H(i) is applied to C(i:m,1:n)
249*
250 mi = m - i + 1
251 ic = i
252 ELSE
253*
254* H(i) is applied to C(1:m,i:n)
255*
256 ni = n - i + 1
257 jc = i
258 END IF
259*
260* Apply H(i)
261*
262 CALL slarf1f( side, mi, ni, a( i, i ), lda, tau( i ),
263 $ c( ic, jc ), ldc, work )
264 10 CONTINUE
265 RETURN
266*
267* End of SORML2
268*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine slarf1f(side, m, n, v, incv, tau, c, ldc, work)
SLARF1F applies an elementary reflector to a general rectangular
Definition slarf1f.f:123
Here is the call graph for this function:
Here is the caller graph for this function: