199 SUBROUTINE slamtsqr( SIDE, TRANS, M, N, K, MB, NB, A, LDA, T,
200 $ LDT, C, LDC, WORK, LWORK, INFO )
207 CHARACTER SIDE, TRANS
208 INTEGER INFO, LDA, M, N, K, MB, NB, LDT, LWORK, LDC
211 REAL A( LDA, * ), WORK( * ), C( LDC, * ),
219 LOGICAL LEFT, RIGHT, TRAN, NOTRAN, LQUERY
220 INTEGER I, II, KK, LW, CTR, Q, MINMNK, LWMIN
226 EXTERNAL sroundup_lwork
236 lquery = ( lwork.EQ.-1 )
237 notran = lsame( trans,
'N' )
238 tran = lsame( trans,
'T' )
239 left = lsame( side,
'L' )
240 right = lsame( side,
'R' )
249 minmnk = min( m, n, k )
250 IF( minmnk.EQ.0 )
THEN
256 IF( .NOT.left .AND. .NOT.right )
THEN
258 ELSE IF( .NOT.tran .AND. .NOT.notran )
THEN
260 ELSE IF( m.LT.k )
THEN
262 ELSE IF( n.LT.0 )
THEN
264 ELSE IF( k.LT.0 )
THEN
266 ELSE IF( k.LT.nb .OR. nb.LT.1 )
THEN
268 ELSE IF( lda.LT.max( 1, q ) )
THEN
270 ELSE IF( ldt.LT.max( 1, nb ) )
THEN
272 ELSE IF( ldc.LT.max( 1, m ) )
THEN
274 ELSE IF( lwork.LT.lwmin. and. (.NOT.lquery) )
THEN
279 work( 1 ) = sroundup_lwork( lwmin )
283 CALL xerbla(
'SLAMTSQR', -info )
285 ELSE IF( lquery )
THEN
291 IF( minmnk.EQ.0 )
THEN
297 IF((mb.LE.k).OR.(mb.GE.max(m,n,k)))
THEN
298 CALL sgemqrt( side, trans, m, n, k, nb, a, lda,
299 $ t, ldt, c, ldc, work, info )
303 IF(left.AND.notran)
THEN
307 kk = mod((m-k),(mb-k))
311 CALL stpmqrt(
'L',
'N',kk , n, k, 0, nb, a(ii,1), lda,
312 $ t(1,ctr*k+1),ldt , c(1,1), ldc,
313 $ c(ii,1), ldc, work, info )
318 DO i=ii-(mb-k),mb+1,-(mb-k)
323 CALL stpmqrt(
'L',
'N',mb-k , n, k, 0,nb, a(i,1), lda,
324 $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
325 $ c(i,1), ldc, work, info )
331 CALL sgemqrt(
'L',
'N',mb , n, k, nb, a(1,1), lda, t
332 $ ,ldt ,c(1,1), ldc, work, info )
334 ELSE IF (left.AND.tran)
THEN
338 kk = mod((m-k),(mb-k))
341 CALL sgemqrt(
'L',
'T',mb , n, k, nb, a(1,1), lda, t
342 $ ,ldt ,c(1,1), ldc, work, info )
344 DO i=mb+1,ii-mb+k,(mb-k)
348 CALL stpmqrt(
'L',
'T',mb-k , n, k, 0,nb, a(i,1), lda,
349 $ t(1,ctr * k + 1),ldt, c(1,1), ldc,
350 $ c(i,1), ldc, work, info )
358 CALL stpmqrt(
'L',
'T',kk , n, k, 0,nb, a(ii,1), lda,
359 $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
360 $ c(ii,1), ldc, work, info )
364 ELSE IF(right.AND.tran)
THEN
368 kk = mod((n-k),(mb-k))
372 CALL stpmqrt(
'R',
'T',m , kk, k, 0, nb, a(ii,1), lda,
373 $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
374 $ c(1,ii), ldc, work, info )
379 DO i=ii-(mb-k),mb+1,-(mb-k)
384 CALL stpmqrt(
'R',
'T',m , mb-k, k, 0,nb, a(i,1), lda,
385 $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
386 $ c(1,i), ldc, work, info )
392 CALL sgemqrt(
'R',
'T',m , mb, k, nb, a(1,1), lda, t
393 $ ,ldt ,c(1,1), ldc, work, info )
395 ELSE IF (right.AND.notran)
THEN
399 kk = mod((n-k),(mb-k))
402 CALL sgemqrt(
'R',
'N', m, mb , k, nb, a(1,1), lda, t
403 $ ,ldt ,c(1,1), ldc, work, info )
405 DO i=mb+1,ii-mb+k,(mb-k)
409 CALL stpmqrt(
'R',
'N', m, mb-k, k, 0,nb, a(i,1), lda,
410 $ t(1, ctr * k + 1),ldt, c(1,1), ldc,
411 $ c(1,i), ldc, work, info )
419 CALL stpmqrt(
'R',
'N', m, kk , k, 0,nb, a(ii,1), lda,
420 $ t(1, ctr * k + 1),ldt, c(1,1), ldc,
421 $ c(1,ii), ldc, work, info )
427 work( 1 ) = sroundup_lwork( lwmin )