161 SUBROUTINE sorm22( SIDE, TRANS, M, N, N1, N2, Q, LDQ, C, LDC,
162 $ WORK, LWORK, INFO )
171 CHARACTER SIDE, TRANS
172 INTEGER M, N, N1, N2, LDQ, LDC, LWORK, INFO
175 REAL Q( LDQ, * ), C( LDC, * ), WORK( * )
182 parameter( one = 1.0e+0 )
185 LOGICAL LEFT, LQUERY, NOTRAN
186 INTEGER I, LDWORK, LEN, LWKOPT, NB, NQ, NW
191 EXTERNAL lsame, sroundup_lwork
204 left = lsame( side,
'L' )
205 notran = lsame( trans,
'N' )
206 lquery = ( lwork.EQ.-1 )
217 IF( n1.EQ.0 .OR. n2.EQ.0 ) nw = 1
218 IF( .NOT.left .AND. .NOT.lsame( side,
'R' ) )
THEN
220 ELSE IF( .NOT.lsame( trans,
'N' ) .AND. .NOT.lsame( trans,
'T' ) )
223 ELSE IF( m.LT.0 )
THEN
225 ELSE IF( n.LT.0 )
THEN
227 ELSE IF( n1.LT.0 .OR. n1+n2.NE.nq )
THEN
229 ELSE IF( n2.LT.0 )
THEN
231 ELSE IF( ldq.LT.max( 1, nq ) )
THEN
233 ELSE IF( ldc.LT.max( 1, m ) )
THEN
235 ELSE IF( lwork.LT.nw .AND. .NOT.lquery )
THEN
241 work( 1 ) = sroundup_lwork( lwkopt )
245 CALL xerbla(
'SORM22', -info )
247 ELSE IF( lquery )
THEN
253 IF( m.EQ.0 .OR. n.EQ.0 )
THEN
261 CALL strmm( side,
'Upper', trans,
'Non-Unit', m, n, one,
265 ELSE IF( n2.EQ.0 )
THEN
266 CALL strmm( side,
'Lower', trans,
'Non-Unit', m, n, one,
274 nb = max( 1, min( lwork, lwkopt ) / nq )
279 len = min( nb, n-i+1 )
284 CALL slacpy(
'All', n1, len, c( n2+1, i ), ldc, work,
286 CALL strmm(
'Left',
'Lower',
'No Transpose',
'Non-Unit',
287 $ n1, len, one, q( 1, n2+1 ), ldq, work,
292 CALL sgemm(
'No Transpose',
'No Transpose', n1, len, n2,
293 $ one, q, ldq, c( 1, i ), ldc, one, work,
298 CALL slacpy(
'All', n2, len, c( 1, i ), ldc,
299 $ work( n1+1 ), ldwork )
300 CALL strmm(
'Left',
'Upper',
'No Transpose',
'Non-Unit',
301 $ n2, len, one, q( n1+1, 1 ), ldq,
302 $ work( n1+1 ), ldwork )
306 CALL sgemm(
'No Transpose',
'No Transpose', n2, len, n1,
307 $ one, q( n1+1, n2+1 ), ldq, c( n2+1, i ), ldc,
308 $ one, work( n1+1 ), ldwork )
312 CALL slacpy(
'All', m, len, work, ldwork, c( 1, i ),
317 len = min( nb, n-i+1 )
322 CALL slacpy(
'All', n2, len, c( n1+1, i ), ldc, work,
324 CALL strmm(
'Left',
'Upper',
'Transpose',
'Non-Unit',
325 $ n2, len, one, q( n1+1, 1 ), ldq, work,
330 CALL sgemm(
'Transpose',
'No Transpose', n2, len, n1,
331 $ one, q, ldq, c( 1, i ), ldc, one, work,
336 CALL slacpy(
'All', n1, len, c( 1, i ), ldc,
337 $ work( n2+1 ), ldwork )
338 CALL strmm(
'Left',
'Lower',
'Transpose',
'Non-Unit',
339 $ n1, len, one, q( 1, n2+1 ), ldq,
340 $ work( n2+1 ), ldwork )
344 CALL sgemm(
'Transpose',
'No Transpose', n1, len, n2,
345 $ one, q( n1+1, n2+1 ), ldq, c( n1+1, i ), ldc,
346 $ one, work( n2+1 ), ldwork )
350 CALL slacpy(
'All', m, len, work, ldwork, c( 1, i ),
357 len = min( nb, m-i+1 )
362 CALL slacpy(
'All', len, n2, c( i, n1+1 ), ldc, work,
364 CALL strmm(
'Right',
'Upper',
'No Transpose',
'Non-Unit',
365 $ len, n2, one, q( n1+1, 1 ), ldq, work,
370 CALL sgemm(
'No Transpose',
'No Transpose', len, n2, n1,
371 $ one, c( i, 1 ), ldc, q, ldq, one, work,
376 CALL slacpy(
'All', len, n1, c( i, 1 ), ldc,
377 $ work( 1 + n2*ldwork ), ldwork )
378 CALL strmm(
'Right',
'Lower',
'No Transpose',
'Non-Unit',
379 $ len, n1, one, q( 1, n2+1 ), ldq,
380 $ work( 1 + n2*ldwork ), ldwork )
384 CALL sgemm(
'No Transpose',
'No Transpose', len, n1, n2,
385 $ one, c( i, n1+1 ), ldc, q( n1+1, n2+1 ), ldq,
386 $ one, work( 1 + n2*ldwork ), ldwork )
390 CALL slacpy(
'All', len, n, work, ldwork, c( i, 1 ),
395 len = min( nb, m-i+1 )
400 CALL slacpy(
'All', len, n1, c( i, n2+1 ), ldc, work,
402 CALL strmm(
'Right',
'Lower',
'Transpose',
'Non-Unit',
403 $ len, n1, one, q( 1, n2+1 ), ldq, work,
408 CALL sgemm(
'No Transpose',
'Transpose', len, n1, n2,
409 $ one, c( i, 1 ), ldc, q, ldq, one, work,
414 CALL slacpy(
'All', len, n2, c( i, 1 ), ldc,
415 $ work( 1 + n1*ldwork ), ldwork )
416 CALL strmm(
'Right',
'Upper',
'Transpose',
'Non-Unit',
417 $ len, n2, one, q( n1+1, 1 ), ldq,
418 $ work( 1 + n1*ldwork ), ldwork )
422 CALL sgemm(
'No Transpose',
'Transpose', len, n2, n1,
423 $ one, c( i, n2+1 ), ldc, q( n1+1, n2+1 ), ldq,
424 $ one, work( 1 + n1*ldwork ), ldwork )
428 CALL slacpy(
'All', len, n, work, ldwork, c( i, 1 ),
434 work( 1 ) = sroundup_lwork( lwkopt )
subroutine xerbla(srname, info)
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
subroutine strmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
STRMM
subroutine sorm22(side, trans, m, n, n1, n2, q, ldq, c, ldc, work, lwork, info)
SORM22 multiplies a general matrix by a banded orthogonal matrix.