160 SUBROUTINE cunm22( 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 Q( LDQ, * ), C( LDC, * ), WORK( * )
181 parameter( one = ( 1.0e+0, 0.0e+0 ) )
184 LOGICAL LEFT, LQUERY, NOTRAN
185 INTEGER I, LDWORK, LEN, LWKOPT, NB, NQ, NW
195 INTRINSIC cmplx, 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 ) = cmplx( lwkopt )
243 CALL xerbla(
'CUNM22', -info )
245 ELSE IF( lquery )
THEN
251 IF( m.EQ.0 .OR. n.EQ.0 )
THEN
259 CALL ctrmm( side,
'Upper', trans,
'Non-Unit', m, n, one,
263 ELSE IF( n2.EQ.0 )
THEN
264 CALL ctrmm( 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 clacpy(
'All', n1, len, c( n2+1, i ), ldc, work,
284 CALL ctrmm(
'Left',
'Lower',
'No Transpose',
'Non-Unit',
285 $ n1, len, one, q( 1, n2+1 ), ldq, work,
290 CALL cgemm(
'No Transpose',
'No Transpose', n1, len, n2,
291 $ one, q, ldq, c( 1, i ), ldc, one, work,
296 CALL clacpy(
'All', n2, len, c( 1, i ), ldc,
297 $ work( n1+1 ), ldwork )
298 CALL ctrmm(
'Left',
'Upper',
'No Transpose',
'Non-Unit',
299 $ n2, len, one, q( n1+1, 1 ), ldq,
300 $ work( n1+1 ), ldwork )
304 CALL cgemm(
'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 clacpy(
'All', m, len, work, ldwork, c( 1, i ),
315 len = min( nb, n-i+1 )
320 CALL clacpy(
'All', n2, len, c( n1+1, i ), ldc, work,
322 CALL ctrmm(
'Left',
'Upper',
'Conjugate',
'Non-Unit',
323 $ n2, len, one, q( n1+1, 1 ), ldq, work,
328 CALL cgemm(
'Conjugate',
'No Transpose', n2, len, n1,
329 $ one, q, ldq, c( 1, i ), ldc, one, work,
334 CALL clacpy(
'All', n1, len, c( 1, i ), ldc,
335 $ work( n2+1 ), ldwork )
336 CALL ctrmm(
'Left',
'Lower',
'Conjugate',
'Non-Unit',
337 $ n1, len, one, q( 1, n2+1 ), ldq,
338 $ work( n2+1 ), ldwork )
342 CALL cgemm(
'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 clacpy(
'All', m, len, work, ldwork, c( 1, i ),
355 len = min( nb, m-i+1 )
360 CALL clacpy(
'All', len, n2, c( i, n1+1 ), ldc, work,
362 CALL ctrmm(
'Right',
'Upper',
'No Transpose',
'Non-Unit',
363 $ len, n2, one, q( n1+1, 1 ), ldq, work,
368 CALL cgemm(
'No Transpose',
'No Transpose', len, n2, n1,
369 $ one, c( i, 1 ), ldc, q, ldq, one, work,
374 CALL clacpy(
'All', len, n1, c( i, 1 ), ldc,
375 $ work( 1 + n2*ldwork ), ldwork )
376 CALL ctrmm(
'Right',
'Lower',
'No Transpose',
'Non-Unit',
377 $ len, n1, one, q( 1, n2+1 ), ldq,
378 $ work( 1 + n2*ldwork ), ldwork )
382 CALL cgemm(
'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 clacpy(
'All', len, n, work, ldwork, c( i, 1 ),
393 len = min( nb, m-i+1 )
398 CALL clacpy(
'All', len, n1, c( i, n2+1 ), ldc, work,
400 CALL ctrmm(
'Right',
'Lower',
'Conjugate',
'Non-Unit',
401 $ len, n1, one, q( 1, n2+1 ), ldq, work,
406 CALL cgemm(
'No Transpose',
'Conjugate', len, n1, n2,
407 $ one, c( i, 1 ), ldc, q, ldq, one, work,
412 CALL clacpy(
'All', len, n2, c( i, 1 ), ldc,
413 $ work( 1 + n1*ldwork ), ldwork )
414 CALL ctrmm(
'Right',
'Upper',
'Conjugate',
'Non-Unit',
415 $ len, n2, one, q( n1+1, 1 ), ldq,
416 $ work( 1 + n1*ldwork ), ldwork )
420 CALL cgemm(
'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 clacpy(
'All', len, n, work, ldwork, c( i, 1 ),
432 work( 1 ) = cmplx( lwkopt )
subroutine xerbla(srname, info)
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine ctrmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
CTRMM
subroutine cunm22(side, trans, m, n, n1, n2, q, ldq, c, ldc, work, lwork, info)
CUNM22 multiplies a general matrix by a banded unitary matrix.