155 SUBROUTINE ctrsyl( TRANA, TRANB, ISGN, M, N, A, LDA, B, LDB, C,
163 CHARACTER TRANA, TRANB
164 INTEGER INFO, ISGN, LDA, LDB, LDC, M, N
168 COMPLEX A( LDA, * ), B( LDB, * ), C( LDC, * )
175 parameter( one = 1.0e+0 )
178 LOGICAL NOTRNA, NOTRNB
180 REAL BIGNUM, DA11, DB, EPS, SCALOC, SGN, SMIN,
182 COMPLEX A11, SUML, SUMR, VEC, X11
190 COMPLEX CDOTC, CDOTU, CLADIV
191 EXTERNAL lsame, clange, slamch, cdotc, cdotu, cladiv
197 INTRINSIC abs, aimag, cmplx, conjg, max, min, real
203 notrna = lsame( trana,
'N' )
204 notrnb = lsame( tranb,
'N' )
207 IF( .NOT.notrna .AND. .NOT.lsame( trana,
'C' ) )
THEN
209 ELSE IF( .NOT.notrnb .AND. .NOT.lsame( tranb,
'C' ) )
THEN
211 ELSE IF( isgn.NE.1 .AND. isgn.NE.-1 )
THEN
213 ELSE IF( m.LT.0 )
THEN
215 ELSE IF( n.LT.0 )
THEN
217 ELSE IF( lda.LT.max( 1, m ) )
THEN
219 ELSE IF( ldb.LT.max( 1, n ) )
THEN
221 ELSE IF( ldc.LT.max( 1, m ) )
THEN
225 CALL xerbla(
'CTRSYL', -info )
232 IF( m.EQ.0 .OR. n.EQ.0 )
238 smlnum = slamch(
'S' )
239 bignum = one / smlnum
240 smlnum = smlnum*real( m*n ) / eps
241 bignum = one / smlnum
242 smin = max( smlnum, eps*clange(
'M', m, m, a, lda, dum ),
243 $ eps*clange(
'M', n, n, b, ldb, dum ) )
246 IF( notrna .AND. notrnb )
THEN
263 suml = cdotu( m-k, a( k, min( k+1, m ) ), lda,
264 $ c( min( k+1, m ), l ), 1 )
265 sumr = cdotu( l-1, c( k, 1 ), ldc, b( 1, l ), 1 )
266 vec = c( k, l ) - ( suml+sgn*sumr )
269 a11 = a( k, k ) + sgn*b( l, l )
270 da11 = abs( real( a11 ) ) + abs( aimag( a11 ) )
271 IF( da11.LE.smin )
THEN
276 db = abs( real( vec ) ) + abs( aimag( vec ) )
277 IF( da11.LT.one .AND. db.GT.one )
THEN
278 IF( db.GT.bignum*da11 )
281 x11 = cladiv( vec*cmplx( scaloc ), a11 )
283 IF( scaloc.NE.one )
THEN
285 CALL csscal( m, scaloc, c( 1, j ), 1 )
294 ELSE IF( .NOT.notrna .AND. notrnb )
THEN
311 suml = cdotc( k-1, a( 1, k ), 1, c( 1, l ), 1 )
312 sumr = cdotu( l-1, c( k, 1 ), ldc, b( 1, l ), 1 )
313 vec = c( k, l ) - ( suml+sgn*sumr )
316 a11 = conjg( a( k, k ) ) + sgn*b( l, l )
317 da11 = abs( real( a11 ) ) + abs( aimag( a11 ) )
318 IF( da11.LE.smin )
THEN
323 db = abs( real( vec ) ) + abs( aimag( vec ) )
324 IF( da11.LT.one .AND. db.GT.one )
THEN
325 IF( db.GT.bignum*da11 )
329 x11 = cladiv( vec*cmplx( scaloc ), a11 )
331 IF( scaloc.NE.one )
THEN
333 CALL csscal( m, scaloc, c( 1, j ), 1 )
342 ELSE IF( .NOT.notrna .AND. .NOT.notrnb )
THEN
362 suml = cdotc( k-1, a( 1, k ), 1, c( 1, l ), 1 )
363 sumr = cdotc( n-l, c( k, min( l+1, n ) ), ldc,
364 $ b( l, min( l+1, n ) ), ldb )
365 vec = c( k, l ) - ( suml+sgn*conjg( sumr ) )
368 a11 = conjg( a( k, k )+sgn*b( l, l ) )
369 da11 = abs( real( a11 ) ) + abs( aimag( a11 ) )
370 IF( da11.LE.smin )
THEN
375 db = abs( real( vec ) ) + abs( aimag( vec ) )
376 IF( da11.LT.one .AND. db.GT.one )
THEN
377 IF( db.GT.bignum*da11 )
381 x11 = cladiv( vec*cmplx( scaloc ), a11 )
383 IF( scaloc.NE.one )
THEN
385 CALL csscal( m, scaloc, c( 1, j ), 1 )
394 ELSE IF( notrna .AND. .NOT.notrnb )
THEN
411 suml = cdotu( m-k, a( k, min( k+1, m ) ), lda,
412 $ c( min( k+1, m ), l ), 1 )
413 sumr = cdotc( n-l, c( k, min( l+1, n ) ), ldc,
414 $ b( l, min( l+1, n ) ), ldb )
415 vec = c( k, l ) - ( suml+sgn*conjg( sumr ) )
418 a11 = a( k, k ) + sgn*conjg( b( l, l ) )
419 da11 = abs( real( a11 ) ) + abs( aimag( a11 ) )
420 IF( da11.LE.smin )
THEN
425 db = abs( real( vec ) ) + abs( aimag( vec ) )
426 IF( da11.LT.one .AND. db.GT.one )
THEN
427 IF( db.GT.bignum*da11 )
431 x11 = cladiv( vec*cmplx( scaloc ), a11 )
433 IF( scaloc.NE.one )
THEN
435 CALL csscal( m, scaloc, c( 1, j ), 1 )
subroutine xerbla(srname, info)
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine ctrsyl(trana, tranb, isgn, m, n, a, lda, b, ldb, c, ldc, scale, info)
CTRSYL