1 *> \brief \b CGSVJ0 pre-processor for the routine cgesvj.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CGSVJ0 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgsvj0.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgsvj0.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgsvj0.f">
21 * SUBROUTINE CGSVJ0( JOBV, M, N, A, LDA, D, SVA, MV, V, LDV, EPS,
22 * SFMIN, TOL, NSWEEP, WORK, LWORK, INFO )
24 * .. Scalar Arguments ..
25 * INTEGER INFO, LDA, LDV, LWORK, M, MV, N, NSWEEP
26 * REAL EPS, SFMIN, TOL
29 * .. Array Arguments ..
30 * COMPLEX A( LDA, * ), D( N ), V( LDV, * ), WORK( LWORK )
40 *> CGSVJ0 is called from CGESVJ as a pre-processor and that is its main
41 *> purpose. It applies Jacobi rotations in the same way as CGESVJ does, but
42 *> it does not check convergence (stopping criterion). Few tuning
43 *> parameters (marked by [TP]) are available for the implementer.
51 *> JOBV is CHARACTER*1
52 *> Specifies whether the output from this procedure is used
53 *> to compute the matrix V:
54 *> = 'V': the product of the Jacobi rotations is accumulated
55 *> by postmulyiplying the N-by-N array V.
56 *> (See the description of V.)
57 *> = 'A': the product of the Jacobi rotations is accumulated
58 *> by postmulyiplying the MV-by-N array V.
59 *> (See the descriptions of MV and V.)
60 *> = 'N': the Jacobi rotations are not accumulated.
66 *> The number of rows of the input matrix A. M >= 0.
72 *> The number of columns of the input matrix A.
78 *> A is COMPLEX array, dimension (LDA,N)
79 *> On entry, M-by-N matrix A, such that A*diag(D) represents
82 *> A_onexit * diag(D_onexit) represents the input matrix A*diag(D)
83 *> post-multiplied by a sequence of Jacobi rotations, where the
84 *> rotation threshold and the total number of sweeps are given in
85 *> TOL and NSWEEP, respectively.
86 *> (See the descriptions of D, TOL and NSWEEP.)
92 *> The leading dimension of the array A. LDA >= max(1,M).
97 *> D is COMPLEX array, dimension (N)
98 *> The array D accumulates the scaling factors from the complex scaled
100 *> On entry, A*diag(D) represents the input matrix.
101 *> On exit, A_onexit*diag(D_onexit) represents the input matrix
102 *> post-multiplied by a sequence of Jacobi rotations, where the
103 *> rotation threshold and the total number of sweeps are given in
104 *> TOL and NSWEEP, respectively.
105 *> (See the descriptions of A, TOL and NSWEEP.)
108 *> \param[in,out] SVA
110 *> SVA is REAL array, dimension (N)
111 *> On entry, SVA contains the Euclidean norms of the columns of
112 *> the matrix A*diag(D).
113 *> On exit, SVA contains the Euclidean norms of the columns of
114 *> the matrix A_onexit*diag(D_onexit).
120 *> If JOBV .EQ. 'A', then MV rows of V are post-multipled by a
121 *> sequence of Jacobi rotations.
122 *> If JOBV = 'N', then MV is not referenced.
127 *> V is COMPLEX array, dimension (LDV,N)
128 *> If JOBV .EQ. 'V' then N rows of V are post-multipled by a
129 *> sequence of Jacobi rotations.
130 *> If JOBV .EQ. 'A' then MV rows of V are post-multipled by a
131 *> sequence of Jacobi rotations.
132 *> If JOBV = 'N', then V is not referenced.
138 *> The leading dimension of the array V, LDV >= 1.
139 *> If JOBV = 'V', LDV .GE. N.
140 *> If JOBV = 'A', LDV .GE. MV.
146 *> EPS = SLAMCH('Epsilon')
152 *> SFMIN = SLAMCH('Safe Minimum')
158 *> TOL is the threshold for Jacobi rotations. For a pair
159 *> A(:,p), A(:,q) of pivot columns, the Jacobi rotation is
160 *> applied only if ABS(COS(angle(A(:,p),A(:,q)))) .GT. TOL.
166 *> NSWEEP is the number of sweeps of Jacobi rotations to be
172 *> WORK is COMPLEX array, dimension LWORK.
178 *> LWORK is the dimension of WORK. LWORK .GE. M.
184 *> = 0 : successful exit.
185 *> < 0 : if INFO = -i, then the i-th argument had an illegal value
191 *> \author Univ. of Tennessee
192 *> \author Univ. of California Berkeley
193 *> \author Univ. of Colorado Denver
198 *> \ingroup complexOTHERcomputational
200 *> \par Further Details:
201 * =====================
203 *> CGSVJ0 is used just to enable CGESVJ to call a simplified version of
204 *> itself to work on a submatrix of the original matrix.
206 *> \par Contributors:
209 *> Zlatko Drmac (Zagreb, Croatia) and Kresimir Veselic (Hagen, Germany)
211 *> \par Bugs, Examples and Comments:
212 * =================================
214 *> Please report all bugs and send interesting test examples and comments to
215 *> drmac@math.hr. Thank you.
217 * =====================================================================
218 SUBROUTINE CGSVJ0( JOBV, M, N, A, LDA, D, SVA, MV, V, LDV, EPS,
219 $ SFMIN, TOL, NSWEEP, WORK, LWORK, INFO )
221 * -- LAPACK computational routine (version 3.6.1) --
222 * -- LAPACK is a software package provided by Univ. of Tennessee, --
223 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
227 * .. Scalar Arguments ..
228 INTEGER INFO, LDA, LDV, LWORK, M, MV, N, NSWEEP
232 * .. Array Arguments ..
233 COMPLEX A( LDA, * ), D( N ), V( LDV, * ), WORK( LWORK )
237 * =====================================================================
239 * .. Local Parameters ..
241 PARAMETER ( ZERO = 0.0E0, HALF = 0.5E0, ONE = 1.0E0)
243 PARAMETER ( CZERO = (0.0E0, 0.0E0), CONE = (1.0E0, 0.0E0) )
245 * .. Local Scalars ..
247 REAL AAPP, AAPP0, AAPQ1, AAQQ, APOAQ, AQOAP, BIG,
248 $ BIGTHETA, CS, MXAAPQ, MXSINJ, ROOTBIG, ROOTEPS,
249 $ ROOTSFMIN, ROOTTOL, SMALL, SN, T, TEMP1, THETA,
251 INTEGER BLSKIP, EMPTSW, i, ibr, IERR, igl, IJBLSK, ir1,
252 $ ISWROT, jbc, jgl, KBL, LKAHEAD, MVL, NBL,
253 $ NOTROT, p, PSKIPPED, q, ROWSKIP, SWBAND
254 LOGICAL APPLV, ROTOK, RSVEC
257 * .. Intrinsic Functions ..
258 INTRINSIC ABS, AMAX1, CONJG, FLOAT, MIN0, SIGN, SQRT
260 * .. External Functions ..
265 EXTERNAL ISAMAX, LSAME, CDOTC, SCNRM2
268 * .. External Subroutines ..
271 EXTERNAL CCOPY, CROT, CSSCAL, CSWAP
273 EXTERNAL CLASCL, CLASSQ, XERBLA
275 * .. Executable Statements ..
277 * Test the input parameters.
279 APPLV = LSAME( JOBV, 'A' )
280 RSVEC = LSAME( JOBV, 'V' )
281 IF( .NOT.( RSVEC .OR. APPLV .OR. LSAME( JOBV, 'N' ) ) ) THEN
283 ELSE IF( M.LT.0 ) THEN
285 ELSE IF( ( N.LT.0 ) .OR. ( N.GT.M ) ) THEN
287 ELSE IF( LDA.LT.M ) THEN
289 ELSE IF( ( RSVEC.OR.APPLV ) .AND. ( MV.LT.0 ) ) THEN
291 ELSE IF( ( RSVEC.AND.( LDV.LT.N ) ).OR.
292 $ ( APPLV.AND.( LDV.LT.MV ) ) ) THEN
294 ELSE IF( TOL.LE.EPS ) THEN
296 ELSE IF( NSWEEP.LT.0 ) THEN
298 ELSE IF( LWORK.LT.M ) THEN
306 CALL XERBLA( 'CGSVJ0', -INFO )
312 ELSE IF( APPLV ) THEN
315 RSVEC = RSVEC .OR. APPLV
317 ROOTEPS = SQRT( EPS )
318 ROOTSFMIN = SQRT( SFMIN )
321 ROOTBIG = ONE / ROOTSFMIN
322 BIGTHETA = ONE / ROOTEPS
323 ROOTTOL = SQRT( TOL )
325 * .. Row-cyclic Jacobi SVD algorithm with column pivoting ..
327 EMPTSW = ( N*( N-1 ) ) / 2
330 * .. Row-cyclic pivot strategy with de Rijk's pivoting ..
334 *[TP] SWBAND is a tuning parameter [TP]. It is meaningful and effective
335 * if CGESVJ is used as a computational routine in the preconditioned
336 * Jacobi SVD algorithm CGEJSV. For sweeps i=1:SWBAND the procedure
337 * works on pivots inside a band-like region around the diagonal.
338 * The boundaries are determined dynamically, based on the number of
339 * pivots above a threshold.
342 *[TP] KBL is a tuning parameter that defines the tile size in the
343 * tiling of the p-q loops of pivot pairs. In general, an optimal
344 * value of KBL depends on the matrix dimensions and on the
345 * parameters of the computer's memory.
348 IF( ( NBL*KBL ).NE.N )NBL = NBL + 1
351 *[TP] BLKSKIP is a tuning parameter that depends on SWBAND and KBL.
353 ROWSKIP = MIN0( 5, KBL )
354 *[TP] ROWSKIP is a tuning parameter.
357 *[TP] LKAHEAD is a tuning parameter.
359 * Quasi block transformations, using the lower (upper) triangular
360 * structure of the input matrix. The quasi-block-cycling usually
361 * invokes cubic convergence. Big part of this cycle is done inside
362 * canonical subspaces of dimensions less than M.
365 * .. Row-cyclic pivot strategy with de Rijk's pivoting ..
367 DO 1993 i = 1, NSWEEP
378 * Each sweep is unrolled using KBL-by-KBL tiles over the pivot pairs
379 * 1 <= p < q <= N. This is the first step toward a blocked implementation
380 * of the rotations. New implementation, based on block transformations,
381 * is under development.
385 igl = ( ibr-1 )*KBL + 1
387 DO 1002 ir1 = 0, MIN0( LKAHEAD, NBL-ibr )
391 DO 2001 p = igl, MIN0( igl+KBL-1, N-1 )
393 * .. de Rijk's pivoting
395 q = ISAMAX( N-p+1, SVA( p ), 1 ) + p - 1
397 CALL CSWAP( M, A( 1, p ), 1, A( 1, q ), 1 )
398 IF( RSVEC )CALL CSWAP( MVL, V( 1, p ), 1,
410 * Column norms are periodically updated by explicit
413 * Unfortunately, some BLAS implementations compute SNCRM2(M,A(1,p),1)
414 * as SQRT(S=CDOTC(M,A(1,p),1,A(1,p),1)), which may cause the result to
415 * overflow for ||A(:,p)||_2 > SQRT(overflow_threshold), and to
416 * underflow for ||A(:,p)||_2 < SQRT(underflow_threshold).
417 * Hence, SCNRM2 cannot be trusted, not even in the case when
418 * the true norm is far from the under(over)flow boundaries.
419 * If properly implemented SCNRM2 is available, the IF-THEN-ELSE-END IF
420 * below should be replaced with "AAPP = SCNRM2( M, A(1,p), 1 )".
422 IF( ( SVA( p ).LT.ROOTBIG ) .AND.
423 $ ( SVA( p ).GT.ROOTSFMIN ) ) THEN
424 SVA( p ) = SCNRM2( M, A( 1, p ), 1 )
428 CALL CLASSQ( M, A( 1, p ), 1, TEMP1, AAPP )
429 SVA( p ) = TEMP1*SQRT( AAPP )
436 IF( AAPP.GT.ZERO ) THEN
440 DO 2002 q = p + 1, MIN0( igl+KBL-1, N )
444 IF( AAQQ.GT.ZERO ) THEN
447 IF( AAQQ.GE.ONE ) THEN
448 ROTOK = ( SMALL*AAPP ).LE.AAQQ
449 IF( AAPP.LT.( BIG / AAQQ ) ) THEN
450 AAPQ = ( CDOTC( M, A( 1, p ), 1,
451 $ A( 1, q ), 1 ) / AAQQ ) / AAPP
453 CALL CCOPY( M, A( 1, p ), 1,
455 CALL CLASCL( 'G', 0, 0, AAPP, ONE,
456 $ M, 1, WORK, LDA, IERR )
457 AAPQ = CDOTC( M, WORK, 1,
458 $ A( 1, q ), 1 ) / AAQQ
461 ROTOK = AAPP.LE.( AAQQ / SMALL )
462 IF( AAPP.GT.( SMALL / AAQQ ) ) THEN
463 AAPQ = ( CDOTC( M, A( 1, p ), 1,
464 $ A( 1, q ), 1 ) / AAQQ ) / AAPP
466 CALL CCOPY( M, A( 1, q ), 1,
468 CALL CLASCL( 'G', 0, 0, AAQQ,
471 AAPQ = CDOTC( M, A( 1, p ), 1,
476 OMPQ = AAPQ / ABS(AAPQ)
477 * AAPQ = AAPQ * CONJG( CWORK(p) ) * CWORK(q)
479 MXAAPQ = AMAX1( MXAAPQ, -AAPQ1 )
481 * TO rotate or NOT to rotate, THAT is the question ...
483 IF( ABS( AAPQ1 ).GT.TOL ) THEN
486 *[RTD] ROTATED = ROTATED + ONE
498 THETA = -HALF*ABS( AQOAP-APOAQ )/AAPQ1
500 IF( ABS( THETA ).GT.BIGTHETA ) THEN
505 CALL CROT( M, A(1,p), 1, A(1,q), 1,
506 $ CS, CONJG(OMPQ)*T )
508 CALL CROT( MVL, V(1,p), 1,
509 $ V(1,q), 1, CS, CONJG(OMPQ)*T )
512 SVA( q ) = AAQQ*SQRT( AMAX1( ZERO,
513 $ ONE+T*APOAQ*AAPQ1 ) )
514 AAPP = AAPP*SQRT( AMAX1( ZERO,
515 $ ONE-T*AQOAP*AAPQ1 ) )
516 MXSINJ = AMAX1( MXSINJ, ABS( T ) )
520 * .. choose correct signum for THETA and rotate
522 THSIGN = -SIGN( ONE, AAPQ1 )
523 T = ONE / ( THETA+THSIGN*
524 $ SQRT( ONE+THETA*THETA ) )
525 CS = SQRT( ONE / ( ONE+T*T ) )
528 MXSINJ = AMAX1( MXSINJ, ABS( SN ) )
529 SVA( q ) = AAQQ*SQRT( AMAX1( ZERO,
530 $ ONE+T*APOAQ*AAPQ1 ) )
531 AAPP = AAPP*SQRT( AMAX1( ZERO,
532 $ ONE-T*AQOAP*AAPQ1 ) )
534 CALL CROT( M, A(1,p), 1, A(1,q), 1,
535 $ CS, CONJG(OMPQ)*SN )
537 CALL CROT( MVL, V(1,p), 1,
538 $ V(1,q), 1, CS, CONJG(OMPQ)*SN )
544 * .. have to use modified Gram-Schmidt like transformation
545 CALL CCOPY( M, A( 1, p ), 1,
547 CALL CLASCL( 'G', 0, 0, AAPP, ONE, M,
550 CALL CLASCL( 'G', 0, 0, AAQQ, ONE, M,
551 $ 1, A( 1, q ), LDA, IERR )
552 CALL CAXPY( M, -AAPQ, WORK, 1,
554 CALL CLASCL( 'G', 0, 0, ONE, AAQQ, M,
555 $ 1, A( 1, q ), LDA, IERR )
556 SVA( q ) = AAQQ*SQRT( AMAX1( ZERO,
557 $ ONE-AAPQ1*AAPQ1 ) )
558 MXSINJ = AMAX1( MXSINJ, SFMIN )
560 * END IF ROTOK THEN ... ELSE
562 * In the case of cancellation in updating SVA(q), SVA(p)
563 * recompute SVA(q), SVA(p).
565 IF( ( SVA( q ) / AAQQ )**2.LE.ROOTEPS )
567 IF( ( AAQQ.LT.ROOTBIG ) .AND.
568 $ ( AAQQ.GT.ROOTSFMIN ) ) THEN
569 SVA( q ) = SCNRM2( M, A( 1, q ), 1 )
573 CALL CLASSQ( M, A( 1, q ), 1, T,
575 SVA( q ) = T*SQRT( AAQQ )
578 IF( ( AAPP / AAPP0 ).LE.ROOTEPS ) THEN
579 IF( ( AAPP.LT.ROOTBIG ) .AND.
580 $ ( AAPP.GT.ROOTSFMIN ) ) THEN
581 AAPP = SCNRM2( M, A( 1, p ), 1 )
585 CALL CLASSQ( M, A( 1, p ), 1, T,
587 AAPP = T*SQRT( AAPP )
593 * A(:,p) and A(:,q) already numerically orthogonal
594 IF( ir1.EQ.0 )NOTROT = NOTROT + 1
595 *[RTD] SKIPPED = SKIPPED + 1
596 PSKIPPED = PSKIPPED + 1
599 * A(:,q) is zero column
600 IF( ir1.EQ.0 )NOTROT = NOTROT + 1
601 PSKIPPED = PSKIPPED + 1
604 IF( ( i.LE.SWBAND ) .AND.
605 $ ( PSKIPPED.GT.ROWSKIP ) ) THEN
606 IF( ir1.EQ.0 )AAPP = -AAPP
615 * bailed out of q-loop
621 IF( ( ir1.EQ.0 ) .AND. ( AAPP.EQ.ZERO ) )
622 $ NOTROT = NOTROT + MIN0( igl+KBL-1, N ) - p
627 * end of doing the block ( ibr, ibr )
631 * ... go to the off diagonal blocks
633 igl = ( ibr-1 )*KBL + 1
635 DO 2010 jbc = ibr + 1, NBL
637 jgl = ( jbc-1 )*KBL + 1
639 * doing the block at ( ibr, jbc )
642 DO 2100 p = igl, MIN0( igl+KBL-1, N )
645 IF( AAPP.GT.ZERO ) THEN
649 DO 2200 q = jgl, MIN0( jgl+KBL-1, N )
652 IF( AAQQ.GT.ZERO ) THEN
655 * .. M x 2 Jacobi SVD ..
657 * Safe Gram matrix computation
659 IF( AAQQ.GE.ONE ) THEN
660 IF( AAPP.GE.AAQQ ) THEN
661 ROTOK = ( SMALL*AAPP ).LE.AAQQ
663 ROTOK = ( SMALL*AAQQ ).LE.AAPP
665 IF( AAPP.LT.( BIG / AAQQ ) ) THEN
666 AAPQ = ( CDOTC( M, A( 1, p ), 1,
667 $ A( 1, q ), 1 ) / AAQQ ) / AAPP
669 CALL CCOPY( M, A( 1, p ), 1,
671 CALL CLASCL( 'G', 0, 0, AAPP,
674 AAPQ = CDOTC( M, WORK, 1,
675 $ A( 1, q ), 1 ) / AAQQ
678 IF( AAPP.GE.AAQQ ) THEN
679 ROTOK = AAPP.LE.( AAQQ / SMALL )
681 ROTOK = AAQQ.LE.( AAPP / SMALL )
683 IF( AAPP.GT.( SMALL / AAQQ ) ) THEN
684 AAPQ = ( CDOTC( M, A( 1, p ), 1,
685 $ A( 1, q ), 1 ) / AAQQ ) / AAPP
687 CALL CCOPY( M, A( 1, q ), 1,
689 CALL CLASCL( 'G', 0, 0, AAQQ,
692 AAPQ = CDOTC( M, A( 1, p ), 1,
697 OMPQ = AAPQ / ABS(AAPQ)
698 * AAPQ = AAPQ * CONJG(CWORK(p))*CWORK(q)
700 MXAAPQ = AMAX1( MXAAPQ, -AAPQ1 )
702 * TO rotate or NOT to rotate, THAT is the question ...
704 IF( ABS( AAPQ1 ).GT.TOL ) THEN
706 *[RTD] ROTATED = ROTATED + 1
714 THETA = -HALF*ABS( AQOAP-APOAQ )/ AAPQ1
715 IF( AAQQ.GT.AAPP0 )THETA = -THETA
717 IF( ABS( THETA ).GT.BIGTHETA ) THEN
720 CALL CROT( M, A(1,p), 1, A(1,q), 1,
721 $ CS, CONJG(OMPQ)*T )
723 CALL CROT( MVL, V(1,p), 1,
724 $ V(1,q), 1, CS, CONJG(OMPQ)*T )
726 SVA( q ) = AAQQ*SQRT( AMAX1( ZERO,
727 $ ONE+T*APOAQ*AAPQ1 ) )
728 AAPP = AAPP*SQRT( AMAX1( ZERO,
729 $ ONE-T*AQOAP*AAPQ1 ) )
730 MXSINJ = AMAX1( MXSINJ, ABS( T ) )
733 * .. choose correct signum for THETA and rotate
735 THSIGN = -SIGN( ONE, AAPQ1 )
736 IF( AAQQ.GT.AAPP0 )THSIGN = -THSIGN
737 T = ONE / ( THETA+THSIGN*
738 $ SQRT( ONE+THETA*THETA ) )
739 CS = SQRT( ONE / ( ONE+T*T ) )
741 MXSINJ = AMAX1( MXSINJ, ABS( SN ) )
742 SVA( q ) = AAQQ*SQRT( AMAX1( ZERO,
743 $ ONE+T*APOAQ*AAPQ1 ) )
744 AAPP = AAPP*SQRT( AMAX1( ZERO,
745 $ ONE-T*AQOAP*AAPQ1 ) )
747 CALL CROT( M, A(1,p), 1, A(1,q), 1,
748 $ CS, CONJG(OMPQ)*SN )
750 CALL CROT( MVL, V(1,p), 1,
751 $ V(1,q), 1, CS, CONJG(OMPQ)*SN )
757 * .. have to use modified Gram-Schmidt like transformation
758 IF( AAPP.GT.AAQQ ) THEN
759 CALL CCOPY( M, A( 1, p ), 1,
761 CALL CLASCL( 'G', 0, 0, AAPP, ONE,
764 CALL CLASCL( 'G', 0, 0, AAQQ, ONE,
765 $ M, 1, A( 1, q ), LDA,
767 CALL CAXPY( M, -AAPQ, WORK,
769 CALL CLASCL( 'G', 0, 0, ONE, AAQQ,
770 $ M, 1, A( 1, q ), LDA,
772 SVA( q ) = AAQQ*SQRT( AMAX1( ZERO,
773 $ ONE-AAPQ1*AAPQ1 ) )
774 MXSINJ = AMAX1( MXSINJ, SFMIN )
776 CALL CCOPY( M, A( 1, q ), 1,
778 CALL CLASCL( 'G', 0, 0, AAQQ, ONE,
781 CALL CLASCL( 'G', 0, 0, AAPP, ONE,
782 $ M, 1, A( 1, p ), LDA,
784 CALL CAXPY( M, -CONJG(AAPQ),
785 $ WORK, 1, A( 1, p ), 1 )
786 CALL CLASCL( 'G', 0, 0, ONE, AAPP,
787 $ M, 1, A( 1, p ), LDA,
789 SVA( p ) = AAPP*SQRT( AMAX1( ZERO,
790 $ ONE-AAPQ1*AAPQ1 ) )
791 MXSINJ = AMAX1( MXSINJ, SFMIN )
794 * END IF ROTOK THEN ... ELSE
796 * In the case of cancellation in updating SVA(q), SVA(p)
797 * .. recompute SVA(q), SVA(p)
798 IF( ( SVA( q ) / AAQQ )**2.LE.ROOTEPS )
800 IF( ( AAQQ.LT.ROOTBIG ) .AND.
801 $ ( AAQQ.GT.ROOTSFMIN ) ) THEN
802 SVA( q ) = SCNRM2( M, A( 1, q ), 1)
806 CALL CLASSQ( M, A( 1, q ), 1, T,
808 SVA( q ) = T*SQRT( AAQQ )
811 IF( ( AAPP / AAPP0 )**2.LE.ROOTEPS ) THEN
812 IF( ( AAPP.LT.ROOTBIG ) .AND.
813 $ ( AAPP.GT.ROOTSFMIN ) ) THEN
814 AAPP = SCNRM2( M, A( 1, p ), 1 )
818 CALL CLASSQ( M, A( 1, p ), 1, T,
820 AAPP = T*SQRT( AAPP )
827 *[RTD] SKIPPED = SKIPPED + 1
828 PSKIPPED = PSKIPPED + 1
833 PSKIPPED = PSKIPPED + 1
837 IF( ( i.LE.SWBAND ) .AND. ( IJBLSK.GE.BLSKIP ) )
843 IF( ( i.LE.SWBAND ) .AND.
844 $ ( PSKIPPED.GT.ROWSKIP ) ) THEN
858 IF( AAPP.EQ.ZERO )NOTROT = NOTROT +
859 $ MIN0( jgl+KBL-1, N ) - jgl + 1
860 IF( AAPP.LT.ZERO )NOTROT = 0
867 * end of the jbc-loop
869 *2011 bailed out of the jbc-loop
870 DO 2012 p = igl, MIN0( igl+KBL-1, N )
871 SVA( p ) = ABS( SVA( p ) )
875 *2000 :: end of the ibr-loop
878 IF( ( SVA( N ).LT.ROOTBIG ) .AND. ( SVA( N ).GT.ROOTSFMIN ) )
880 SVA( N ) = SCNRM2( M, A( 1, N ), 1 )
884 CALL CLASSQ( M, A( 1, N ), 1, T, AAPP )
885 SVA( N ) = T*SQRT( AAPP )
888 * Additional steering devices
890 IF( ( i.LT.SWBAND ) .AND. ( ( MXAAPQ.LE.ROOTTOL ) .OR.
891 $ ( ISWROT.LE.N ) ) )SWBAND = i
893 IF( ( i.GT.SWBAND+1 ) .AND. ( MXAAPQ.LT.SQRT( FLOAT( N ) )*
894 $ TOL ) .AND. ( FLOAT( N )*MXAAPQ*MXSINJ.LT.TOL ) ) THEN
898 IF( NOTROT.GE.EMPTSW )GO TO 1994
901 * end i=1:NSWEEP loop
903 * #:( Reaching this point means that the procedure has not converged.
908 * #:) Reaching this point means numerical convergence after the i-th
912 * #:) INFO = 0 confirms successful iterations.
915 * Sort the vector SVA() of column norms.
917 q = ISAMAX( N-p+1, SVA( p ), 1 ) + p - 1
925 CALL CSWAP( M, A( 1, p ), 1, A( 1, q ), 1 )
926 IF( RSVEC )CALL CSWAP( MVL, V( 1, p ), 1, V( 1, q ), 1 )