236 SUBROUTINE zgsvj1( JOBV, M, N, N1, A, LDA, D, SVA, MV, V, LDV,
237 $ eps, sfmin, tol, nsweep, work, lwork, info )
246 DOUBLE PRECISION EPS, SFMIN, TOL
247 INTEGER INFO, LDA, LDV, LWORK, M, MV, N, N1, NSWEEP
251 COMPLEX*16 A( lda, * ), D( n ), V( ldv, * ), WORK( lwork )
252 DOUBLE PRECISION SVA( n )
258 DOUBLE PRECISION ZERO, HALF, ONE
259 parameter ( zero = 0.0d0, half = 0.5d0, one = 1.0d0)
262 COMPLEX*16 AAPQ, OMPQ
263 DOUBLE PRECISION AAPP, AAPP0, AAPQ1, AAQQ, APOAQ, AQOAP, BIG,
264 $ bigtheta, cs, large, mxaapq, mxsinj, rootbig,
265 $ rooteps, rootsfmin, roottol, small, sn, t,
266 $ temp1, theta, thsign
267 INTEGER BLSKIP, EMPTSW, i, ibr, igl, IERR, IJBLSK,
268 $ iswrot, jbc, jgl, kbl, mvl, notrot, nblc, nblr,
269 $ p, pskipped, q, rowskip, swband
270 LOGICAL APPLV, ROTOK, RSVEC
274 INTRINSIC abs, dconjg, dmax1, dble, min0, dsign, dsqrt
277 DOUBLE PRECISION DZNRM2
281 EXTERNAL idamax, lsame, zdotc, dznrm2
293 applv = lsame( jobv,
'A' )
294 rsvec = lsame( jobv,
'V' )
295 IF( .NOT.( rsvec .OR. applv .OR. lsame( jobv,
'N' ) ) )
THEN
297 ELSE IF( m.LT.0 )
THEN
299 ELSE IF( ( n.LT.0 ) .OR. ( n.GT.m ) )
THEN
301 ELSE IF( n1.LT.0 )
THEN
303 ELSE IF( lda.LT.m )
THEN
305 ELSE IF( ( rsvec.OR.applv ) .AND. ( mv.LT.0 ) )
THEN
307 ELSE IF( ( rsvec.AND.( ldv.LT.n ) ).OR.
308 $ ( applv.AND.( ldv.LT.mv ) ) )
THEN
310 ELSE IF( tol.LE.eps )
THEN
312 ELSE IF( nsweep.LT.0 )
THEN
314 ELSE IF( lwork.LT.m )
THEN
322 CALL xerbla(
'ZGSVJ1', -info )
328 ELSE IF( applv )
THEN
331 rsvec = rsvec .OR. applv
333 rooteps = dsqrt( eps )
334 rootsfmin = dsqrt( sfmin )
337 rootbig = one / rootsfmin
338 large = big / dsqrt( dble( m*n ) )
339 bigtheta = one / rooteps
340 roottol = dsqrt( tol )
353 IF( ( nblr*kbl ).NE.n1 )nblr = nblr + 1
357 nblc = ( n-n1 ) / kbl
358 IF( ( nblc*kbl ).NE.( n-n1 ) )nblc = nblc + 1
359 blskip = ( kbl**2 ) + 1
362 rowskip = min0( 5, kbl )
378 DO 1993 i = 1, nsweep
394 DO 2000 ibr = 1, nblr
396 igl = ( ibr-1 )*kbl + 1
402 igl = ( ibr-1 )*kbl + 1
405 DO 2010 jbc = 1, nblc
407 jgl = ( jbc-1 )*kbl + n1 + 1
412 DO 2100 p = igl, min0( igl+kbl-1, n1 )
415 IF( aapp.GT.zero )
THEN
419 DO 2200 q = jgl, min0( jgl+kbl-1, n )
422 IF( aaqq.GT.zero )
THEN
429 IF( aaqq.GE.one )
THEN
430 IF( aapp.GE.aaqq )
THEN
431 rotok = ( small*aapp ).LE.aaqq
433 rotok = ( small*aaqq ).LE.aapp
435 IF( aapp.LT.( big / aaqq ) )
THEN
436 aapq = ( zdotc( m, a( 1, p ), 1,
437 $ a( 1, q ), 1 ) / aaqq ) / aapp
439 CALL zcopy( m, a( 1, p ), 1,
441 CALL zlascl(
'G', 0, 0, aapp,
444 aapq = zdotc( m, work, 1,
445 $ a( 1, q ), 1 ) / aaqq
448 IF( aapp.GE.aaqq )
THEN
449 rotok = aapp.LE.( aaqq / small )
451 rotok = aaqq.LE.( aapp / small )
453 IF( aapp.GT.( small / aaqq ) )
THEN
454 aapq = ( zdotc( m, a( 1, p ), 1,
455 $ a( 1, q ), 1 ) / aaqq ) / aapp
457 CALL zcopy( m, a( 1, q ), 1,
459 CALL zlascl(
'G', 0, 0, aaqq,
462 aapq = zdotc( m, a( 1, p ), 1,
467 ompq = aapq / abs(aapq)
470 mxaapq = dmax1( mxaapq, -aapq1 )
474 IF( abs( aapq1 ).GT.tol )
THEN
484 theta = -half*abs( aqoap-apoaq )/ aapq1
485 IF( aaqq.GT.aapp0 )theta = -theta
487 IF( abs( theta ).GT.bigtheta )
THEN
490 CALL zrot( m, a(1,p), 1, a(1,q), 1,
491 $ cs, dconjg(ompq)*t )
493 CALL zrot( mvl, v(1,p), 1,
494 $ v(1,q), 1, cs, dconjg(ompq)*t )
496 sva( q ) = aaqq*dsqrt( dmax1( zero,
497 $ one+t*apoaq*aapq1 ) )
498 aapp = aapp*dsqrt( dmax1( zero,
499 $ one-t*aqoap*aapq1 ) )
500 mxsinj = dmax1( mxsinj, abs( t ) )
505 thsign = -dsign( one, aapq1 )
506 IF( aaqq.GT.aapp0 )thsign = -thsign
507 t = one / ( theta+thsign*
508 $ dsqrt( one+theta*theta ) )
509 cs = dsqrt( one / ( one+t*t ) )
511 mxsinj = dmax1( mxsinj, abs( sn ) )
512 sva( q ) = aaqq*dsqrt( dmax1( zero,
513 $ one+t*apoaq*aapq1 ) )
514 aapp = aapp*dsqrt( dmax1( zero,
515 $ one-t*aqoap*aapq1 ) )
517 CALL zrot( m, a(1,p), 1, a(1,q), 1,
518 $ cs, dconjg(ompq)*sn )
520 CALL zrot( mvl, v(1,p), 1,
521 $ v(1,q), 1, cs, dconjg(ompq)*sn )
528 IF( aapp.GT.aaqq )
THEN
529 CALL zcopy( m, a( 1, p ), 1,
531 CALL zlascl(
'G', 0, 0, aapp, one,
534 CALL zlascl(
'G', 0, 0, aaqq, one,
535 $ m, 1, a( 1, q ), lda,
537 CALL zaxpy( m, -aapq, work,
539 CALL zlascl(
'G', 0, 0, one, aaqq,
540 $ m, 1, a( 1, q ), lda,
542 sva( q ) = aaqq*dsqrt( dmax1( zero,
543 $ one-aapq1*aapq1 ) )
544 mxsinj = dmax1( mxsinj, sfmin )
546 CALL zcopy( m, a( 1, q ), 1,
548 CALL zlascl(
'G', 0, 0, aaqq, one,
551 CALL zlascl(
'G', 0, 0, aapp, one,
552 $ m, 1, a( 1, p ), lda,
554 CALL zaxpy( m, -dconjg(aapq),
555 $ work, 1, a( 1, p ), 1 )
556 CALL zlascl(
'G', 0, 0, one, aapp,
557 $ m, 1, a( 1, p ), lda,
559 sva( p ) = aapp*dsqrt( dmax1( zero,
560 $ one-aapq1*aapq1 ) )
561 mxsinj = dmax1( mxsinj, sfmin )
568 IF( ( sva( q ) / aaqq )**2.LE.rooteps )
570 IF( ( aaqq.LT.rootbig ) .AND.
571 $ ( aaqq.GT.rootsfmin ) )
THEN
572 sva( q ) = dznrm2( m, a( 1, q ), 1)
576 CALL zlassq( m, a( 1, q ), 1, t,
578 sva( q ) = t*dsqrt( aaqq )
581 IF( ( aapp / aapp0 )**2.LE.rooteps )
THEN
582 IF( ( aapp.LT.rootbig ) .AND.
583 $ ( aapp.GT.rootsfmin ) )
THEN
584 aapp = dznrm2( m, a( 1, p ), 1 )
588 CALL zlassq( m, a( 1, p ), 1, t,
590 aapp = t*dsqrt( aapp )
598 pskipped = pskipped + 1
603 pskipped = pskipped + 1
607 IF( ( i.LE.swband ) .AND. ( ijblsk.GE.blskip ) )
613 IF( ( i.LE.swband ) .AND.
614 $ ( pskipped.GT.rowskip ) )
THEN
628 IF( aapp.EQ.zero )notrot = notrot +
629 $ min0( jgl+kbl-1, n ) - jgl + 1
630 IF( aapp.LT.zero )notrot = 0
640 DO 2012 p = igl, min0( igl+kbl-1, n )
641 sva( p ) = abs( sva( p ) )
648 IF( ( sva( n ).LT.rootbig ) .AND. ( sva( n ).GT.rootsfmin ) )
650 sva( n ) = dznrm2( m, a( 1, n ), 1 )
654 CALL zlassq( m, a( 1, n ), 1, t, aapp )
655 sva( n ) = t*dsqrt( aapp )
660 IF( ( i.LT.swband ) .AND. ( ( mxaapq.LE.roottol ) .OR.
661 $ ( iswrot.LE.n ) ) )swband = i
663 IF( ( i.GT.swband+1 ) .AND. ( mxaapq.LT.dsqrt( dble( n ) )*
664 $ tol ) .AND. ( dble( n )*mxaapq*mxsinj.LT.tol ) )
THEN
668 IF( notrot.GE.emptsw )
GO TO 1994
687 q = idamax( n-p+1, sva( p ), 1 ) + p - 1
695 CALL zswap( m, a( 1, p ), 1, a( 1, q ), 1 )
696 IF( rsvec )
CALL zswap( mvl, v( 1, p ), 1, v( 1, q ), 1 )
subroutine zcopy(N, ZX, INCX, ZY, INCY)
ZCOPY
subroutine zswap(N, ZX, INCX, ZY, INCY)
ZSWAP
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 xerbla(SRNAME, INFO)
XERBLA
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 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 zaxpy(N, ZA, ZX, INCX, ZY, INCY)
ZAXPY