234 SUBROUTINE zgsvj1( JOBV, M, N, N1, A, LDA, D, SVA, MV, V, LDV,
235 $ EPS, SFMIN, TOL, NSWEEP, WORK, LWORK, INFO )
243 DOUBLE PRECISION EPS, SFMIN, TOL
244 INTEGER INFO, LDA, LDV, LWORK, M, MV, N, N1, NSWEEP
248 COMPLEX*16 A( LDA, * ), D( N ), V( LDV, * ), WORK( LWORK )
249 DOUBLE PRECISION SVA( N )
255 DOUBLE PRECISION ZERO, HALF, ONE
256 parameter( zero = 0.0d0, half = 0.5d0, one = 1.0d0)
259 COMPLEX*16 AAPQ, OMPQ
260 DOUBLE PRECISION AAPP, AAPP0, AAPQ1, AAQQ, APOAQ, AQOAP, BIG,
261 $ bigtheta, cs, mxaapq, mxsinj, rootbig,
262 $ rooteps, rootsfmin, roottol, small, sn, t,
263 $ temp1, theta, thsign
264 INTEGER BLSKIP, EMPTSW, i, ibr, igl, IERR, IJBLSK,
265 $ iswrot, jbc, jgl, kbl, mvl, notrot, nblc, nblr,
266 $ p, pskipped, q, rowskip, swband
267 LOGICAL APPLV, ROTOK, RSVEC
271 INTRINSIC abs, conjg, max, dble, min, sign, sqrt
274 DOUBLE PRECISION DZNRM2
278 EXTERNAL idamax, lsame, zdotc, dznrm2
290 applv = lsame( jobv,
'A' )
291 rsvec = lsame( jobv,
'V' )
292 IF( .NOT.( rsvec .OR. applv .OR. lsame( jobv,
'N' ) ) )
THEN
294 ELSE IF( m.LT.0 )
THEN
296 ELSE IF( ( n.LT.0 ) .OR. ( n.GT.m ) )
THEN
298 ELSE IF( n1.LT.0 )
THEN
300 ELSE IF( lda.LT.m )
THEN
302 ELSE IF( ( rsvec.OR.applv ) .AND. ( mv.LT.0 ) )
THEN
304 ELSE IF( ( rsvec.AND.( ldv.LT.n ) ).OR.
305 $ ( applv.AND.( ldv.LT.mv ) ) )
THEN
307 ELSE IF( tol.LE.eps )
THEN
309 ELSE IF( nsweep.LT.0 )
THEN
311 ELSE IF( lwork.LT.m )
THEN
319 CALL xerbla(
'ZGSVJ1', -info )
325 ELSE IF( applv )
THEN
328 rsvec = rsvec .OR. applv
330 rooteps = sqrt( eps )
331 rootsfmin = sqrt( sfmin )
334 rootbig = one / rootsfmin
336 bigtheta = one / rooteps
337 roottol = sqrt( tol )
350 IF( ( nblr*kbl ).NE.n1 )nblr = nblr + 1
354 nblc = ( n-n1 ) / kbl
355 IF( ( nblc*kbl ).NE.( n-n1 ) )nblc = nblc + 1
356 blskip = ( kbl**2 ) + 1
359 rowskip = min( 5, kbl )
375 DO 1993 i = 1, nsweep
391 DO 2000 ibr = 1, nblr
393 igl = ( ibr-1 )*kbl + 1
399 igl = ( ibr-1 )*kbl + 1
402 DO 2010 jbc = 1, nblc
404 jgl = ( jbc-1 )*kbl + n1 + 1
409 DO 2100 p = igl, min( igl+kbl-1, n1 )
412 IF( aapp.GT.zero )
THEN
416 DO 2200 q = jgl, min( jgl+kbl-1, n )
419 IF( aaqq.GT.zero )
THEN
426 IF( aaqq.GE.one )
THEN
427 IF( aapp.GE.aaqq )
THEN
428 rotok = ( small*aapp ).LE.aaqq
430 rotok = ( small*aaqq ).LE.aapp
432 IF( aapp.LT.( big / aaqq ) )
THEN
433 aapq = ( zdotc( m, a( 1, p ), 1,
434 $ a( 1, q ), 1 ) / aaqq ) / aapp
436 CALL zcopy( m, a( 1, p ), 1,
438 CALL zlascl(
'G', 0, 0, aapp,
441 aapq = zdotc( m, work, 1,
442 $ a( 1, q ), 1 ) / aaqq
445 IF( aapp.GE.aaqq )
THEN
446 rotok = aapp.LE.( aaqq / small )
448 rotok = aaqq.LE.( aapp / small )
450 IF( aapp.GT.( small / aaqq ) )
THEN
451 aapq = ( zdotc( m, a( 1, p ), 1,
452 $ a( 1, q ), 1 ) / max(aaqq,aapp) )
455 CALL zcopy( m, a( 1, q ), 1,
457 CALL zlascl(
'G', 0, 0, aaqq,
460 aapq = zdotc( m, a( 1, p ), 1,
467 mxaapq = max( mxaapq, -aapq1 )
471 IF( abs( aapq1 ).GT.tol )
THEN
472 ompq = aapq / abs(aapq)
482 theta = -half*abs( aqoap-apoaq )/ aapq1
483 IF( aaqq.GT.aapp0 )theta = -theta
485 IF( abs( theta ).GT.bigtheta )
THEN
488 CALL zrot( m, a(1,p), 1, a(1,q), 1,
489 $ cs, conjg(ompq)*t )
491 CALL zrot( mvl, v(1,p), 1,
492 $ v(1,q), 1, cs, conjg(ompq)*t )
494 sva( q ) = aaqq*sqrt( max( zero,
495 $ one+t*apoaq*aapq1 ) )
496 aapp = aapp*sqrt( max( zero,
497 $ one-t*aqoap*aapq1 ) )
498 mxsinj = max( mxsinj, abs( t ) )
503 thsign = -sign( one, aapq1 )
504 IF( aaqq.GT.aapp0 )thsign = -thsign
505 t = one / ( theta+thsign*
506 $ sqrt( one+theta*theta ) )
507 cs = sqrt( one / ( one+t*t ) )
509 mxsinj = max( mxsinj, abs( sn ) )
510 sva( q ) = aaqq*sqrt( max( zero,
511 $ one+t*apoaq*aapq1 ) )
512 aapp = aapp*sqrt( max( zero,
513 $ one-t*aqoap*aapq1 ) )
515 CALL zrot( m, a(1,p), 1, a(1,q), 1,
516 $ cs, conjg(ompq)*sn )
518 CALL zrot( mvl, v(1,p), 1,
519 $ v(1,q), 1, cs, conjg(ompq)*sn )
526 IF( aapp.GT.aaqq )
THEN
527 CALL zcopy( m, a( 1, p ), 1,
529 CALL zlascl(
'G', 0, 0, aapp, one,
532 CALL zlascl(
'G', 0, 0, aaqq, one,
533 $ m, 1, a( 1, q ), lda,
535 CALL zaxpy( m, -aapq, work,
537 CALL zlascl(
'G', 0, 0, one, aaqq,
538 $ m, 1, a( 1, q ), lda,
540 sva( q ) = aaqq*sqrt( max( zero,
541 $ one-aapq1*aapq1 ) )
542 mxsinj = max( mxsinj, sfmin )
544 CALL zcopy( m, a( 1, q ), 1,
546 CALL zlascl(
'G', 0, 0, aaqq, one,
549 CALL zlascl(
'G', 0, 0, aapp, one,
550 $ m, 1, a( 1, p ), lda,
552 CALL zaxpy( m, -conjg(aapq),
553 $ work, 1, a( 1, p ), 1 )
554 CALL zlascl(
'G', 0, 0, one, aapp,
555 $ m, 1, a( 1, p ), lda,
557 sva( p ) = aapp*sqrt( max( zero,
558 $ one-aapq1*aapq1 ) )
559 mxsinj = max( mxsinj, sfmin )
566 IF( ( sva( q ) / aaqq )**2.LE.rooteps )
568 IF( ( aaqq.LT.rootbig ) .AND.
569 $ ( aaqq.GT.rootsfmin ) )
THEN
570 sva( q ) = dznrm2( m, a( 1, q ), 1)
574 CALL zlassq( m, a( 1, q ), 1, t,
576 sva( q ) = t*sqrt( aaqq )
579 IF( ( aapp / aapp0 )**2.LE.rooteps )
THEN
580 IF( ( aapp.LT.rootbig ) .AND.
581 $ ( aapp.GT.rootsfmin ) )
THEN
582 aapp = dznrm2( m, a( 1, p ), 1 )
586 CALL zlassq( m, a( 1, p ), 1, t,
588 aapp = t*sqrt( aapp )
596 pskipped = pskipped + 1
601 pskipped = pskipped + 1
605 IF( ( i.LE.swband ) .AND. ( ijblsk.GE.blskip ) )
611 IF( ( i.LE.swband ) .AND.
612 $ ( pskipped.GT.rowskip ) )
THEN
626 IF( aapp.EQ.zero )notrot = notrot +
627 $ min( jgl+kbl-1, n ) - jgl + 1
628 IF( aapp.LT.zero )notrot = 0
638 DO 2012 p = igl, min( igl+kbl-1, n )
639 sva( p ) = abs( sva( p ) )
646 IF( ( sva( n ).LT.rootbig ) .AND. ( sva( n ).GT.rootsfmin ) )
648 sva( n ) = dznrm2( m, a( 1, n ), 1 )
652 CALL zlassq( m, a( 1, n ), 1, t, aapp )
653 sva( n ) = t*sqrt( aapp )
658 IF( ( i.LT.swband ) .AND. ( ( mxaapq.LE.roottol ) .OR.
659 $ ( iswrot.LE.n ) ) )swband = i
661 IF( ( i.GT.swband+1 ) .AND. ( mxaapq.LT.sqrt( dble( n ) )*
662 $ tol ) .AND. ( dble( n )*mxaapq*mxsinj.LT.tol ) )
THEN
666 IF( notrot.GE.emptsw )
GO TO 1994
685 q = idamax( n-p+1, sva( p ), 1 ) + p - 1
693 CALL zswap( m, a( 1, p ), 1, a( 1, q ), 1 )
694 IF( rsvec )
CALL zswap( mvl, v( 1, p ), 1, v( 1, q ), 1 )
subroutine xerbla(srname, info)
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
subroutine zgsvj1(jobv, m, n, n1, a, lda, d, sva, mv, v, ldv, eps, sfmin, tol, nsweep, work, lwork, info)
ZGSVJ1 pre-processor for the routine zgesvj, applies Jacobi rotations targeting only particular pivot...
subroutine zlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine zlassq(n, x, incx, scale, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.
subroutine zrot(n, cx, incx, cy, incy, c, s)
ZROT applies a plane rotation with real cosine and complex sine to a pair of complex vectors.
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP