160 SUBROUTINE zunm22( SIDE, TRANS, M, N, N1, N2, Q, LDQ, C, LDC,
161 $ WORK, LWORK, INFO )
170 CHARACTER SIDE, TRANS
171 INTEGER M, N, N1, N2, LDQ, LDC, LWORK, INFO
174 COMPLEX*16 Q( LDQ, * ), C( LDC, * ), WORK( * )
181 parameter( one = ( 1.0d+0, 0.0d+0 ) )
184 LOGICAL LEFT, LQUERY, NOTRAN
185 INTEGER I, LDWORK, LEN, LWKOPT, NB, NQ, NW
195 INTRINSIC dcmplx, max, min
202 left = lsame( side,
'L' )
203 notran = lsame( trans,
'N' )
204 lquery = ( lwork.EQ.-1 )
215 IF( n1.EQ.0 .OR. n2.EQ.0 ) nw = 1
216 IF( .NOT.left .AND. .NOT.lsame( side,
'R' ) )
THEN
218 ELSE IF( .NOT.lsame( trans,
'N' ) .AND. .NOT.lsame( trans,
'C' ) )
221 ELSE IF( m.LT.0 )
THEN
223 ELSE IF( n.LT.0 )
THEN
225 ELSE IF( n1.LT.0 .OR. n1+n2.NE.nq )
THEN
227 ELSE IF( n2.LT.0 )
THEN
229 ELSE IF( ldq.LT.max( 1, nq ) )
THEN
231 ELSE IF( ldc.LT.max( 1, m ) )
THEN
233 ELSE IF( lwork.LT.nw .AND. .NOT.lquery )
THEN
239 work( 1 ) = dcmplx( lwkopt )
243 CALL xerbla(
'ZUNM22', -info )
245 ELSE IF( lquery )
THEN
251 IF( m.EQ.0 .OR. n.EQ.0 )
THEN
259 CALL ztrmm( side,
'Upper', trans,
'Non-Unit', m, n, one,
263 ELSE IF( n2.EQ.0 )
THEN
264 CALL ztrmm( side,
'Lower', trans,
'Non-Unit', m, n, one,
272 nb = max( 1, min( lwork, lwkopt ) / nq )
277 len = min( nb, n-i+1 )
282 CALL zlacpy(
'All', n1, len, c( n2+1, i ), ldc, work,
284 CALL ztrmm(
'Left',
'Lower',
'No Transpose',
'Non-Unit',
285 $ n1, len, one, q( 1, n2+1 ), ldq, work,
290 CALL zgemm(
'No Transpose',
'No Transpose', n1, len, n2,
291 $ one, q, ldq, c( 1, i ), ldc, one, work,
296 CALL zlacpy(
'All', n2, len, c( 1, i ), ldc,
297 $ work( n1+1 ), ldwork )
298 CALL ztrmm(
'Left',
'Upper',
'No Transpose',
'Non-Unit',
299 $ n2, len, one, q( n1+1, 1 ), ldq,
300 $ work( n1+1 ), ldwork )
304 CALL zgemm(
'No Transpose',
'No Transpose', n2, len, n1,
305 $ one, q( n1+1, n2+1 ), ldq, c( n2+1, i ), ldc,
306 $ one, work( n1+1 ), ldwork )
310 CALL zlacpy(
'All', m, len, work, ldwork, c( 1, i ),
315 len = min( nb, n-i+1 )
320 CALL zlacpy(
'All', n2, len, c( n1+1, i ), ldc, work,
322 CALL ztrmm(
'Left',
'Upper',
'Conjugate',
'Non-Unit',
323 $ n2, len, one, q( n1+1, 1 ), ldq, work,
328 CALL zgemm(
'Conjugate',
'No Transpose', n2, len, n1,
329 $ one, q, ldq, c( 1, i ), ldc, one, work,
334 CALL zlacpy(
'All', n1, len, c( 1, i ), ldc,
335 $ work( n2+1 ), ldwork )
336 CALL ztrmm(
'Left',
'Lower',
'Conjugate',
'Non-Unit',
337 $ n1, len, one, q( 1, n2+1 ), ldq,
338 $ work( n2+1 ), ldwork )
342 CALL zgemm(
'Conjugate',
'No Transpose', n1, len, n2,
343 $ one, q( n1+1, n2+1 ), ldq, c( n1+1, i ), ldc,
344 $ one, work( n2+1 ), ldwork )
348 CALL zlacpy(
'All', m, len, work, ldwork, c( 1, i ),
355 len = min( nb, m-i+1 )
360 CALL zlacpy(
'All', len, n2, c( i, n1+1 ), ldc, work,
362 CALL ztrmm(
'Right',
'Upper',
'No Transpose',
'Non-Unit',
363 $ len, n2, one, q( n1+1, 1 ), ldq, work,
368 CALL zgemm(
'No Transpose',
'No Transpose', len, n2, n1,
369 $ one, c( i, 1 ), ldc, q, ldq, one, work,
374 CALL zlacpy(
'All', len, n1, c( i, 1 ), ldc,
375 $ work( 1 + n2*ldwork ), ldwork )
376 CALL ztrmm(
'Right',
'Lower',
'No Transpose',
'Non-Unit',
377 $ len, n1, one, q( 1, n2+1 ), ldq,
378 $ work( 1 + n2*ldwork ), ldwork )
382 CALL zgemm(
'No Transpose',
'No Transpose', len, n1, n2,
383 $ one, c( i, n1+1 ), ldc, q( n1+1, n2+1 ), ldq,
384 $ one, work( 1 + n2*ldwork ), ldwork )
388 CALL zlacpy(
'All', len, n, work, ldwork, c( i, 1 ),
393 len = min( nb, m-i+1 )
398 CALL zlacpy(
'All', len, n1, c( i, n2+1 ), ldc, work,
400 CALL ztrmm(
'Right',
'Lower',
'Conjugate',
'Non-Unit',
401 $ len, n1, one, q( 1, n2+1 ), ldq, work,
406 CALL zgemm(
'No Transpose',
'Conjugate', len, n1, n2,
407 $ one, c( i, 1 ), ldc, q, ldq, one, work,
412 CALL zlacpy(
'All', len, n2, c( i, 1 ), ldc,
413 $ work( 1 + n1*ldwork ), ldwork )
414 CALL ztrmm(
'Right',
'Upper',
'Conjugate',
'Non-Unit',
415 $ len, n2, one, q( n1+1, 1 ), ldq,
416 $ work( 1 + n1*ldwork ), ldwork )
420 CALL zgemm(
'No Transpose',
'Conjugate', len, n2, n1,
421 $ one, c( i, n2+1 ), ldc, q( n1+1, n2+1 ), ldq,
422 $ one, work( 1 + n1*ldwork ), ldwork )
426 CALL zlacpy(
'All', len, n, work, ldwork, c( i, 1 ),
432 work( 1 ) = dcmplx( lwkopt )
subroutine xerbla(srname, info)
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine ztrmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
ZTRMM
subroutine zunm22(side, trans, m, n, n1, n2, q, ldq, c, ldc, work, lwork, info)
ZUNM22 multiplies a general matrix by a banded unitary matrix.