LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zgsvj1.f
Go to the documentation of this file.
1*> \brief \b ZGSVJ1 pre-processor for the routine zgesvj, applies Jacobi rotations targeting only particular pivots.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZGSVJ1 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgsvj1.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgsvj1.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgsvj1.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZGSVJ1( JOBV, M, N, N1, A, LDA, D, SVA, MV, V, LDV,
20* EPS, SFMIN, TOL, NSWEEP, WORK, LWORK, INFO )
21*
22* .. Scalar Arguments ..
23* DOUBLE PRECISION EPS, SFMIN, TOL
24* INTEGER INFO, LDA, LDV, LWORK, M, MV, N, N1, NSWEEP
25* CHARACTER*1 JOBV
26* ..
27* .. Array Arguments ..
28* COMPLEX*16 A( LDA, * ), D( N ), V( LDV, * ), WORK( LWORK )
29* DOUBLE PRECISION SVA( N )
30* ..
31*
32*
33*> \par Purpose:
34* =============
35*>
36*> \verbatim
37*>
38*> ZGSVJ1 is called from ZGESVJ as a pre-processor and that is its main
39*> purpose. It applies Jacobi rotations in the same way as ZGESVJ does, but
40*> it targets only particular pivots and it does not check convergence
41*> (stopping criterion). Few tuning parameters (marked by [TP]) are
42*> available for the implementer.
43*>
44*> Further Details
45*> ~~~~~~~~~~~~~~~
46*> ZGSVJ1 applies few sweeps of Jacobi rotations in the column space of
47*> the input M-by-N matrix A. The pivot pairs are taken from the (1,2)
48*> off-diagonal block in the corresponding N-by-N Gram matrix A^T * A. The
49*> block-entries (tiles) of the (1,2) off-diagonal block are marked by the
50*> [x]'s in the following scheme:
51*>
52*> | * * * [x] [x] [x]|
53*> | * * * [x] [x] [x]| Row-cycling in the nblr-by-nblc [x] blocks.
54*> | * * * [x] [x] [x]| Row-cyclic pivoting inside each [x] block.
55*> |[x] [x] [x] * * * |
56*> |[x] [x] [x] * * * |
57*> |[x] [x] [x] * * * |
58*>
59*> In terms of the columns of A, the first N1 columns are rotated 'against'
60*> the remaining N-N1 columns, trying to increase the angle between the
61*> corresponding subspaces. The off-diagonal block is N1-by(N-N1) and it is
62*> tiled using quadratic tiles of side KBL. Here, KBL is a tuning parameter.
63*> The number of sweeps is given in NSWEEP and the orthogonality threshold
64*> is given in TOL.
65*> \endverbatim
66*
67* Arguments:
68* ==========
69*
70*> \param[in] JOBV
71*> \verbatim
72*> JOBV is CHARACTER*1
73*> Specifies whether the output from this procedure is used
74*> to compute the matrix V:
75*> = 'V': the product of the Jacobi rotations is accumulated
76*> by postmultiplying the N-by-N array V.
77*> (See the description of V.)
78*> = 'A': the product of the Jacobi rotations is accumulated
79*> by postmultiplying the MV-by-N array V.
80*> (See the descriptions of MV and V.)
81*> = 'N': the Jacobi rotations are not accumulated.
82*> \endverbatim
83*>
84*> \param[in] M
85*> \verbatim
86*> M is INTEGER
87*> The number of rows of the input matrix A. M >= 0.
88*> \endverbatim
89*>
90*> \param[in] N
91*> \verbatim
92*> N is INTEGER
93*> The number of columns of the input matrix A.
94*> M >= N >= 0.
95*> \endverbatim
96*>
97*> \param[in] N1
98*> \verbatim
99*> N1 is INTEGER
100*> N1 specifies the 2 x 2 block partition, the first N1 columns are
101*> rotated 'against' the remaining N-N1 columns of A.
102*> \endverbatim
103*>
104*> \param[in,out] A
105*> \verbatim
106*> A is COMPLEX*16 array, dimension (LDA,N)
107*> On entry, M-by-N matrix A, such that A*diag(D) represents
108*> the input matrix.
109*> On exit,
110*> A_onexit * D_onexit represents the input matrix A*diag(D)
111*> post-multiplied by a sequence of Jacobi rotations, where the
112*> rotation threshold and the total number of sweeps are given in
113*> TOL and NSWEEP, respectively.
114*> (See the descriptions of N1, D, TOL and NSWEEP.)
115*> \endverbatim
116*>
117*> \param[in] LDA
118*> \verbatim
119*> LDA is INTEGER
120*> The leading dimension of the array A. LDA >= max(1,M).
121*> \endverbatim
122*>
123*> \param[in,out] D
124*> \verbatim
125*> D is COMPLEX*16 array, dimension (N)
126*> The array D accumulates the scaling factors from the fast scaled
127*> Jacobi rotations.
128*> On entry, A*diag(D) represents the input matrix.
129*> On exit, A_onexit*diag(D_onexit) represents the input matrix
130*> post-multiplied by a sequence of Jacobi rotations, where the
131*> rotation threshold and the total number of sweeps are given in
132*> TOL and NSWEEP, respectively.
133*> (See the descriptions of N1, A, TOL and NSWEEP.)
134*> \endverbatim
135*>
136*> \param[in,out] SVA
137*> \verbatim
138*> SVA is DOUBLE PRECISION array, dimension (N)
139*> On entry, SVA contains the Euclidean norms of the columns of
140*> the matrix A*diag(D).
141*> On exit, SVA contains the Euclidean norms of the columns of
142*> the matrix onexit*diag(D_onexit).
143*> \endverbatim
144*>
145*> \param[in] MV
146*> \verbatim
147*> MV is INTEGER
148*> If JOBV = 'A', then MV rows of V are post-multiplied by a
149*> sequence of Jacobi rotations.
150*> If JOBV = 'N', then MV is not referenced.
151*> \endverbatim
152*>
153*> \param[in,out] V
154*> \verbatim
155*> V is COMPLEX*16 array, dimension (LDV,N)
156*> If JOBV = 'V' then N rows of V are post-multiplied by a
157*> sequence of Jacobi rotations.
158*> If JOBV = 'A' then MV rows of V are post-multiplied by a
159*> sequence of Jacobi rotations.
160*> If JOBV = 'N', then V is not referenced.
161*> \endverbatim
162*>
163*> \param[in] LDV
164*> \verbatim
165*> LDV is INTEGER
166*> The leading dimension of the array V, LDV >= 1.
167*> If JOBV = 'V', LDV >= N.
168*> If JOBV = 'A', LDV >= MV.
169*> \endverbatim
170*>
171*> \param[in] EPS
172*> \verbatim
173*> EPS is DOUBLE PRECISION
174*> EPS = DLAMCH('Epsilon')
175*> \endverbatim
176*>
177*> \param[in] SFMIN
178*> \verbatim
179*> SFMIN is DOUBLE PRECISION
180*> SFMIN = DLAMCH('Safe Minimum')
181*> \endverbatim
182*>
183*> \param[in] TOL
184*> \verbatim
185*> TOL is DOUBLE PRECISION
186*> TOL is the threshold for Jacobi rotations. For a pair
187*> A(:,p), A(:,q) of pivot columns, the Jacobi rotation is
188*> applied only if ABS(COS(angle(A(:,p),A(:,q)))) > TOL.
189*> \endverbatim
190*>
191*> \param[in] NSWEEP
192*> \verbatim
193*> NSWEEP is INTEGER
194*> NSWEEP is the number of sweeps of Jacobi rotations to be
195*> performed.
196*> \endverbatim
197*>
198*> \param[out] WORK
199*> \verbatim
200*> WORK is COMPLEX*16 array, dimension (LWORK)
201*> \endverbatim
202*>
203*> \param[in] LWORK
204*> \verbatim
205*> LWORK is INTEGER
206*> LWORK is the dimension of WORK. LWORK >= M.
207*> \endverbatim
208*>
209*> \param[out] INFO
210*> \verbatim
211*> INFO is INTEGER
212*> = 0: successful exit.
213*> < 0: if INFO = -i, then the i-th argument had an illegal value
214*> \endverbatim
215*
216* Authors:
217* ========
218*
219*> \author Univ. of Tennessee
220*> \author Univ. of California Berkeley
221*> \author Univ. of Colorado Denver
222*> \author NAG Ltd.
223*
224*> \ingroup gsvj1
225*
226*> \par Contributor:
227* ==================
228*>
229*> Zlatko Drmac (Zagreb, Croatia)
230*
231* =====================================================================
232 SUBROUTINE zgsvj1( JOBV, M, N, N1, A, LDA, D, SVA, MV, V, LDV,
233 $ EPS, SFMIN, TOL, NSWEEP, WORK, LWORK, INFO )
234*
235* -- LAPACK computational routine --
236* -- LAPACK is a software package provided by Univ. of Tennessee, --
237* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
238*
239 IMPLICIT NONE
240* .. Scalar Arguments ..
241 DOUBLE PRECISION EPS, SFMIN, TOL
242 INTEGER INFO, LDA, LDV, LWORK, M, MV, N, N1, NSWEEP
243 CHARACTER*1 JOBV
244* ..
245* .. Array Arguments ..
246 COMPLEX*16 A( LDA, * ), D( N ), V( LDV, * ), WORK( LWORK )
247 DOUBLE PRECISION SVA( N )
248* ..
249*
250* =====================================================================
251*
252* .. Local Parameters ..
253 DOUBLE PRECISION ZERO, HALF, ONE
254 parameter( zero = 0.0d0, half = 0.5d0, one = 1.0d0)
255* ..
256* .. Local Scalars ..
257 COMPLEX*16 AAPQ, OMPQ
258 DOUBLE PRECISION AAPP, AAPP0, AAPQ1, AAQQ, APOAQ, AQOAP, BIG,
259 $ bigtheta, cs, mxaapq, mxsinj, rootbig,
260 $ rooteps, rootsfmin, roottol, small, sn, t,
261 $ temp1, theta, thsign
262 INTEGER BLSKIP, EMPTSW, i, ibr, igl, IERR, IJBLSK,
263 $ iswrot, jbc, jgl, kbl, mvl, notrot, nblc, nblr,
264 $ p, pskipped, q, rowskip, swband
265 LOGICAL APPLV, ROTOK, RSVEC
266* ..
267* ..
268* .. Intrinsic Functions ..
269 INTRINSIC abs, conjg, max, dble, min, sign, sqrt
270* ..
271* .. External Functions ..
272 DOUBLE PRECISION DZNRM2
273 COMPLEX*16 ZDOTC
274 INTEGER IDAMAX
275 LOGICAL LSAME
276 EXTERNAL idamax, lsame, zdotc, dznrm2
277* ..
278* .. External Subroutines ..
279* .. from BLAS
280 EXTERNAL zcopy, zrot, zswap, zaxpy
281* .. from LAPACK
282 EXTERNAL zlascl, zlassq, xerbla
283* ..
284* .. Executable Statements ..
285*
286* Test the input parameters.
287*
288 applv = lsame( jobv, 'A' )
289 rsvec = lsame( jobv, 'V' )
290 IF( .NOT.( rsvec .OR. applv .OR. lsame( jobv, 'N' ) ) ) THEN
291 info = -1
292 ELSE IF( m.LT.0 ) THEN
293 info = -2
294 ELSE IF( ( n.LT.0 ) .OR. ( n.GT.m ) ) THEN
295 info = -3
296 ELSE IF( n1.LT.0 ) THEN
297 info = -4
298 ELSE IF( lda.LT.m ) THEN
299 info = -6
300 ELSE IF( ( rsvec.OR.applv ) .AND. ( mv.LT.0 ) ) THEN
301 info = -9
302 ELSE IF( ( rsvec.AND.( ldv.LT.n ) ).OR.
303 $ ( applv.AND.( ldv.LT.mv ) ) ) THEN
304 info = -11
305 ELSE IF( tol.LE.eps ) THEN
306 info = -14
307 ELSE IF( nsweep.LT.0 ) THEN
308 info = -15
309 ELSE IF( lwork.LT.m ) THEN
310 info = -17
311 ELSE
312 info = 0
313 END IF
314*
315* #:(
316 IF( info.NE.0 ) THEN
317 CALL xerbla( 'ZGSVJ1', -info )
318 RETURN
319 END IF
320*
321 IF( rsvec ) THEN
322 mvl = n
323 ELSE IF( applv ) THEN
324 mvl = mv
325 END IF
326 rsvec = rsvec .OR. applv
327
328 rooteps = sqrt( eps )
329 rootsfmin = sqrt( sfmin )
330 small = sfmin / eps
331 big = one / sfmin
332 rootbig = one / rootsfmin
333* LARGE = BIG / SQRT( DBLE( M*N ) )
334 bigtheta = one / rooteps
335 roottol = sqrt( tol )
336*
337* .. Initialize the right singular vector matrix ..
338*
339* RSVEC = LSAME( JOBV, 'Y' )
340*
341 emptsw = n1*( n-n1 )
342 notrot = 0
343*
344* .. Row-cyclic pivot strategy with de Rijk's pivoting ..
345*
346 kbl = min( 8, n )
347 nblr = n1 / kbl
348 IF( ( nblr*kbl ).NE.n1 )nblr = nblr + 1
349
350* .. the tiling is nblr-by-nblc [tiles]
351
352 nblc = ( n-n1 ) / kbl
353 IF( ( nblc*kbl ).NE.( n-n1 ) )nblc = nblc + 1
354 blskip = ( kbl**2 ) + 1
355*[TP] BLKSKIP is a tuning parameter that depends on SWBAND and KBL.
356
357 rowskip = min( 5, kbl )
358*[TP] ROWSKIP is a tuning parameter.
359 swband = 0
360*[TP] SWBAND is a tuning parameter. It is meaningful and effective
361* if ZGESVJ is used as a computational routine in the preconditioned
362* Jacobi SVD algorithm ZGEJSV.
363*
364*
365* | * * * [x] [x] [x]|
366* | * * * [x] [x] [x]| Row-cycling in the nblr-by-nblc [x] blocks.
367* | * * * [x] [x] [x]| Row-cyclic pivoting inside each [x] block.
368* |[x] [x] [x] * * * |
369* |[x] [x] [x] * * * |
370* |[x] [x] [x] * * * |
371*
372*
373 DO 1993 i = 1, nsweep
374*
375* .. go go go ...
376*
377 mxaapq = zero
378 mxsinj = zero
379 iswrot = 0
380*
381 notrot = 0
382 pskipped = 0
383*
384* Each sweep is unrolled using KBL-by-KBL tiles over the pivot pairs
385* 1 <= p < q <= N. This is the first step toward a blocked implementation
386* of the rotations. New implementation, based on block transformations,
387* is under development.
388*
389 DO 2000 ibr = 1, nblr
390*
391 igl = ( ibr-1 )*kbl + 1
392*
393
394*
395* ... go to the off diagonal blocks
396*
397 igl = ( ibr-1 )*kbl + 1
398*
399* DO 2010 jbc = ibr + 1, NBL
400 DO 2010 jbc = 1, nblc
401*
402 jgl = ( jbc-1 )*kbl + n1 + 1
403*
404* doing the block at ( ibr, jbc )
405*
406 ijblsk = 0
407 DO 2100 p = igl, min( igl+kbl-1, n1 )
408*
409 aapp = sva( p )
410 IF( aapp.GT.zero ) THEN
411*
412 pskipped = 0
413*
414 DO 2200 q = jgl, min( jgl+kbl-1, n )
415*
416 aaqq = sva( q )
417 IF( aaqq.GT.zero ) THEN
418 aapp0 = aapp
419*
420* .. M x 2 Jacobi SVD ..
421*
422* Safe Gram matrix computation
423*
424 IF( aaqq.GE.one ) THEN
425 IF( aapp.GE.aaqq ) THEN
426 rotok = ( small*aapp ).LE.aaqq
427 ELSE
428 rotok = ( small*aaqq ).LE.aapp
429 END IF
430 IF( aapp.LT.( big / aaqq ) ) THEN
431 aapq = ( zdotc( m, a( 1, p ), 1,
432 $ a( 1, q ), 1 ) / aaqq ) / aapp
433 ELSE
434 CALL zcopy( m, a( 1, p ), 1,
435 $ work, 1 )
436 CALL zlascl( 'G', 0, 0, aapp,
437 $ one, m, 1,
438 $ work, lda, ierr )
439 aapq = zdotc( m, work, 1,
440 $ a( 1, q ), 1 ) / aaqq
441 END IF
442 ELSE
443 IF( aapp.GE.aaqq ) THEN
444 rotok = aapp.LE.( aaqq / small )
445 ELSE
446 rotok = aaqq.LE.( aapp / small )
447 END IF
448 IF( aapp.GT.( small / aaqq ) ) THEN
449 aapq = ( zdotc( m, a( 1, p ), 1,
450 $ a( 1, q ), 1 ) / max(aaqq,aapp) )
451 $ / min(aaqq,aapp)
452 ELSE
453 CALL zcopy( m, a( 1, q ), 1,
454 $ work, 1 )
455 CALL zlascl( 'G', 0, 0, aaqq,
456 $ one, m, 1,
457 $ work, lda, ierr )
458 aapq = zdotc( m, a( 1, p ), 1,
459 $ work, 1 ) / aapp
460 END IF
461 END IF
462*
463* AAPQ = AAPQ * CONJG(CWORK(p))*CWORK(q)
464 aapq1 = -abs(aapq)
465 mxaapq = max( mxaapq, -aapq1 )
466*
467* TO rotate or NOT to rotate, THAT is the question ...
468*
469 IF( abs( aapq1 ).GT.tol ) THEN
470 ompq = aapq / abs(aapq)
471 notrot = 0
472*[RTD] ROTATED = ROTATED + 1
473 pskipped = 0
474 iswrot = iswrot + 1
475*
476 IF( rotok ) THEN
477*
478 aqoap = aaqq / aapp
479 apoaq = aapp / aaqq
480 theta = -half*abs( aqoap-apoaq )/ aapq1
481 IF( aaqq.GT.aapp0 )theta = -theta
482*
483 IF( abs( theta ).GT.bigtheta ) THEN
484 t = half / theta
485 cs = one
486 CALL zrot( m, a(1,p), 1, a(1,q),
487 $ 1,
488 $ cs, conjg(ompq)*t )
489 IF( rsvec ) THEN
490 CALL zrot( mvl, v(1,p), 1,
491 $ v(1,q), 1, cs, conjg(ompq)*t )
492 END IF
493 sva( q ) = aaqq*sqrt( max( zero,
494 $ one+t*apoaq*aapq1 ) )
495 aapp = aapp*sqrt( max( zero,
496 $ one-t*aqoap*aapq1 ) )
497 mxsinj = max( mxsinj, abs( t ) )
498 ELSE
499*
500* .. choose correct signum for THETA and rotate
501*
502 thsign = -sign( one, aapq1 )
503 IF( aaqq.GT.aapp0 )thsign = -thsign
504 t = one / ( theta+thsign*
505 $ sqrt( one+theta*theta ) )
506 cs = sqrt( one / ( one+t*t ) )
507 sn = t*cs
508 mxsinj = max( mxsinj, abs( sn ) )
509 sva( q ) = aaqq*sqrt( max( zero,
510 $ one+t*apoaq*aapq1 ) )
511 aapp = aapp*sqrt( max( zero,
512 $ one-t*aqoap*aapq1 ) )
513*
514 CALL zrot( m, a(1,p), 1, a(1,q),
515 $ 1,
516 $ cs, conjg(ompq)*sn )
517 IF( rsvec ) THEN
518 CALL zrot( mvl, v(1,p), 1,
519 $ v(1,q), 1, cs, conjg(ompq)*sn )
520 END IF
521 END IF
522 d(p) = -d(q) * ompq
523*
524 ELSE
525* .. have to use modified Gram-Schmidt like transformation
526 IF( aapp.GT.aaqq ) THEN
527 CALL zcopy( m, a( 1, p ), 1,
528 $ work, 1 )
529 CALL zlascl( 'G', 0, 0, aapp,
530 $ one,
531 $ m, 1, work,lda,
532 $ ierr )
533 CALL zlascl( 'G', 0, 0, aaqq,
534 $ one,
535 $ m, 1, a( 1, q ), lda,
536 $ ierr )
537 CALL zaxpy( m, -aapq, work,
538 $ 1, a( 1, q ), 1 )
539 CALL zlascl( 'G', 0, 0, one,
540 $ aaqq,
541 $ m, 1, a( 1, q ), lda,
542 $ ierr )
543 sva( q ) = aaqq*sqrt( max( zero,
544 $ one-aapq1*aapq1 ) )
545 mxsinj = max( mxsinj, sfmin )
546 ELSE
547 CALL zcopy( m, a( 1, q ), 1,
548 $ work, 1 )
549 CALL zlascl( 'G', 0, 0, aaqq,
550 $ one,
551 $ m, 1, work,lda,
552 $ ierr )
553 CALL zlascl( 'G', 0, 0, aapp,
554 $ one,
555 $ m, 1, a( 1, p ), lda,
556 $ ierr )
557 CALL zaxpy( m, -conjg(aapq),
558 $ work, 1, a( 1, p ), 1 )
559 CALL zlascl( 'G', 0, 0, one,
560 $ aapp,
561 $ m, 1, a( 1, p ), lda,
562 $ ierr )
563 sva( p ) = aapp*sqrt( max( zero,
564 $ one-aapq1*aapq1 ) )
565 mxsinj = max( mxsinj, sfmin )
566 END IF
567 END IF
568* END IF ROTOK THEN ... ELSE
569*
570* In the case of cancellation in updating SVA(q), SVA(p)
571* .. recompute SVA(q), SVA(p)
572 IF( ( sva( q ) / aaqq )**2.LE.rooteps )
573 $ THEN
574 IF( ( aaqq.LT.rootbig ) .AND.
575 $ ( aaqq.GT.rootsfmin ) ) THEN
576 sva( q ) = dznrm2( m, a( 1, q ),
577 $ 1)
578 ELSE
579 t = zero
580 aaqq = one
581 CALL zlassq( m, a( 1, q ), 1, t,
582 $ aaqq )
583 sva( q ) = t*sqrt( aaqq )
584 END IF
585 END IF
586 IF( ( aapp / aapp0 )**2.LE.rooteps ) THEN
587 IF( ( aapp.LT.rootbig ) .AND.
588 $ ( aapp.GT.rootsfmin ) ) THEN
589 aapp = dznrm2( m, a( 1, p ), 1 )
590 ELSE
591 t = zero
592 aapp = one
593 CALL zlassq( m, a( 1, p ), 1, t,
594 $ aapp )
595 aapp = t*sqrt( aapp )
596 END IF
597 sva( p ) = aapp
598 END IF
599* end of OK rotation
600 ELSE
601 notrot = notrot + 1
602*[RTD] SKIPPED = SKIPPED + 1
603 pskipped = pskipped + 1
604 ijblsk = ijblsk + 1
605 END IF
606 ELSE
607 notrot = notrot + 1
608 pskipped = pskipped + 1
609 ijblsk = ijblsk + 1
610 END IF
611*
612 IF( ( i.LE.swband ) .AND. ( ijblsk.GE.blskip ) )
613 $ THEN
614 sva( p ) = aapp
615 notrot = 0
616 GO TO 2011
617 END IF
618 IF( ( i.LE.swband ) .AND.
619 $ ( pskipped.GT.rowskip ) ) THEN
620 aapp = -aapp
621 notrot = 0
622 GO TO 2203
623 END IF
624*
625 2200 CONTINUE
626* end of the q-loop
627 2203 CONTINUE
628*
629 sva( p ) = aapp
630*
631 ELSE
632*
633 IF( aapp.EQ.zero )notrot = notrot +
634 $ min( jgl+kbl-1, n ) - jgl + 1
635 IF( aapp.LT.zero )notrot = 0
636*
637 END IF
638*
639 2100 CONTINUE
640* end of the p-loop
641 2010 CONTINUE
642* end of the jbc-loop
643 2011 CONTINUE
644*2011 bailed out of the jbc-loop
645 DO 2012 p = igl, min( igl+kbl-1, n )
646 sva( p ) = abs( sva( p ) )
647 2012 CONTINUE
648***
649 2000 CONTINUE
650*2000 :: end of the ibr-loop
651*
652* .. update SVA(N)
653 IF( ( sva( n ).LT.rootbig ) .AND. ( sva( n ).GT.rootsfmin ) )
654 $ THEN
655 sva( n ) = dznrm2( m, a( 1, n ), 1 )
656 ELSE
657 t = zero
658 aapp = one
659 CALL zlassq( m, a( 1, n ), 1, t, aapp )
660 sva( n ) = t*sqrt( aapp )
661 END IF
662*
663* Additional steering devices
664*
665 IF( ( i.LT.swband ) .AND. ( ( mxaapq.LE.roottol ) .OR.
666 $ ( iswrot.LE.n ) ) )swband = i
667*
668 IF( ( i.GT.swband+1 ) .AND. ( mxaapq.LT.sqrt( dble( n ) )*
669 $ tol ) .AND. ( dble( n )*mxaapq*mxsinj.LT.tol ) ) THEN
670 GO TO 1994
671 END IF
672*
673 IF( notrot.GE.emptsw )GO TO 1994
674*
675 1993 CONTINUE
676* end i=1:NSWEEP loop
677*
678* #:( Reaching this point means that the procedure has not converged.
679 info = nsweep - 1
680 GO TO 1995
681*
682 1994 CONTINUE
683* #:) Reaching this point means numerical convergence after the i-th
684* sweep.
685*
686 info = 0
687* #:) INFO = 0 confirms successful iterations.
688 1995 CONTINUE
689*
690* Sort the vector SVA() of column norms.
691 DO 5991 p = 1, n - 1
692 q = idamax( n-p+1, sva( p ), 1 ) + p - 1
693 IF( p.NE.q ) THEN
694 temp1 = sva( p )
695 sva( p ) = sva( q )
696 sva( q ) = temp1
697 aapq = d( p )
698 d( p ) = d( q )
699 d( q ) = aapq
700 CALL zswap( m, a( 1, p ), 1, a( 1, q ), 1 )
701 IF( rsvec )CALL zswap( mvl, v( 1, p ), 1, v( 1, q ), 1 )
702 END IF
703 5991 CONTINUE
704*
705*
706 RETURN
707* ..
708* .. END OF ZGSVJ1
709* ..
710 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
Definition zaxpy.f:88
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
Definition zcopy.f:81
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...
Definition zgsvj1.f:234
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.
Definition zlascl.f:142
subroutine zlassq(n, x, incx, scale, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.
Definition zlassq.f90:122
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.
Definition zrot.f:101
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81