3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SGESVJ + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sgesvj.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sgesvj.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgesvj.f">
21 * SUBROUTINE SGESVJ( JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V,
22 * LDV, WORK, LWORK, INFO )
24 * .. Scalar Arguments ..
25 * INTEGER INFO, LDA, LDV, LWORK, M, MV, N
26 * CHARACTER*1 JOBA, JOBU, JOBV
28 * .. Array Arguments ..
29 * REAL A( LDA, * ), SVA( N ), V( LDV, * ),
39 *> SGESVJ computes the singular value decomposition (SVD) of a real
40 *> M-by-N matrix A, where M >= N. The SVD of A is written as
41 *> [++] [xx] [x0] [xx]
42 *> A = U * SIGMA * V^t, [++] = [xx] * [ox] * [xx]
44 *> where SIGMA is an N-by-N diagonal matrix, U is an M-by-N orthonormal
45 *> matrix, and V is an N-by-N orthogonal matrix. The diagonal elements
46 *> of SIGMA are the singular values of A. The columns of U and V are the
47 *> left and the right singular vectors of A, respectively.
48 *> SGESVJ can sometimes compute tiny singular values and their singular vectors much
49 *> more accurately than other SVD routines, see below under Further Details.
57 *> JOBA is CHARACTER* 1
58 *> Specifies the structure of A.
59 *> = 'L': The input matrix A is lower triangular;
60 *> = 'U': The input matrix A is upper triangular;
61 *> = 'G': The input matrix A is general M-by-N matrix, M >= N.
66 *> JOBU is CHARACTER*1
67 *> Specifies whether to compute the left singular vectors
69 *> = 'U': The left singular vectors corresponding to the nonzero
70 *> singular values are computed and returned in the leading
71 *> columns of A. See more details in the description of A.
72 *> The default numerical orthogonality threshold is set to
73 *> approximately TOL=CTOL*EPS, CTOL=SQRT(M), EPS=SLAMCH('E').
74 *> = 'C': Analogous to JOBU='U', except that user can control the
75 *> level of numerical orthogonality of the computed left
76 *> singular vectors. TOL can be set to TOL = CTOL*EPS, where
77 *> CTOL is given on input in the array WORK.
78 *> No CTOL smaller than ONE is allowed. CTOL greater
79 *> than 1 / EPS is meaningless. The option 'C'
80 *> can be used if M*EPS is satisfactory orthogonality
81 *> of the computed left singular vectors, so CTOL=M could
82 *> save few sweeps of Jacobi rotations.
83 *> See the descriptions of A and WORK(1).
84 *> = 'N': The matrix U is not computed. However, see the
90 *> JOBV is CHARACTER*1
91 *> Specifies whether to compute the right singular vectors, that
93 *> = 'V' : the matrix V is computed and returned in the array V
94 *> = 'A' : the Jacobi rotations are applied to the MV-by-N
95 *> array V. In other words, the right singular vector
96 *> matrix V is not computed explicitly; instead it is
97 *> applied to an MV-by-N matrix initially stored in the
98 *> first MV rows of V.
99 *> = 'N' : the matrix V is not computed and the array V is not
106 *> The number of rows of the input matrix A. 1/SLAMCH('E') > M >= 0.
112 *> The number of columns of the input matrix A.
118 *> A is REAL array, dimension (LDA,N)
119 *> On entry, the M-by-N matrix A.
121 *> If JOBU .EQ. 'U' .OR. JOBU .EQ. 'C':
123 *> RANKA orthonormal columns of U are returned in the
124 *> leading RANKA columns of the array A. Here RANKA <= N
125 *> is the number of computed singular values of A that are
126 *> above the underflow threshold SLAMCH('S'). The singular
127 *> vectors corresponding to underflowed or zero singular
128 *> values are not computed. The value of RANKA is returned
129 *> in the array WORK as RANKA=NINT(WORK(2)). Also see the
130 *> descriptions of SVA and WORK. The computed columns of U
131 *> are mutually numerically orthogonal up to approximately
132 *> TOL=SQRT(M)*EPS (default); or TOL=CTOL*EPS (JOBU.EQ.'C'),
133 *> see the description of JOBU.
135 *> the procedure SGESVJ did not converge in the given number
136 *> of iterations (sweeps). In that case, the computed
137 *> columns of U may not be orthogonal up to TOL. The output
138 *> U (stored in A), SIGMA (given by the computed singular
139 *> values in SVA(1:N)) and V is still a decomposition of the
140 *> input matrix A in the sense that the residual
141 *> ||A-SCALE*U*SIGMA*V^T||_2 / ||A||_2 is small.
144 *> Note that the left singular vectors are 'for free' in the
145 *> one-sided Jacobi SVD algorithm. However, if only the
146 *> singular values are needed, the level of numerical
147 *> orthogonality of U is not an issue and iterations are
148 *> stopped when the columns of the iterated matrix are
149 *> numerically orthogonal up to approximately M*EPS. Thus,
150 *> on exit, A contains the columns of U scaled with the
151 *> corresponding singular values.
153 *> the procedure SGESVJ did not converge in the given number
154 *> of iterations (sweeps).
160 *> The leading dimension of the array A. LDA >= max(1,M).
165 *> SVA is REAL array, dimension (N)
168 *> depending on the value SCALE = WORK(1), we have:
169 *> If SCALE .EQ. ONE:
170 *> SVA(1:N) contains the computed singular values of A.
171 *> During the computation SVA contains the Euclidean column
172 *> norms of the iterated matrices in the array A.
173 *> If SCALE .NE. ONE:
174 *> The singular values of A are SCALE*SVA(1:N), and this
175 *> factored representation is due to the fact that some of the
176 *> singular values of A might underflow or overflow.
179 *> the procedure SGESVJ did not converge in the given number of
180 *> iterations (sweeps) and SCALE*SVA(1:N) may not be accurate.
186 *> If JOBV .EQ. 'A', then the product of Jacobi rotations in SGESVJ
187 *> is applied to the first MV rows of V. See the description of JOBV.
192 *> V is REAL array, dimension (LDV,N)
193 *> If JOBV = 'V', then V contains on exit the N-by-N matrix of
194 *> the right singular vectors;
195 *> If JOBV = 'A', then V contains the product of the computed right
196 *> singular vector matrix and the initial matrix in
198 *> If JOBV = 'N', then V is not referenced.
204 *> The leading dimension of the array V, LDV .GE. 1.
205 *> If JOBV .EQ. 'V', then LDV .GE. max(1,N).
206 *> If JOBV .EQ. 'A', then LDV .GE. max(1,MV) .
209 *> \param[in,out] WORK
211 *> WORK is REAL array, dimension max(4,M+N).
213 *> If JOBU .EQ. 'C' :
214 *> WORK(1) = CTOL, where CTOL defines the threshold for convergence.
215 *> The process stops if all columns of A are mutually
216 *> orthogonal up to CTOL*EPS, EPS=SLAMCH('E').
217 *> It is required that CTOL >= ONE, i.e. it is not
218 *> allowed to force the routine to obtain orthogonality
221 *> WORK(1) = SCALE is the scaling factor such that SCALE*SVA(1:N)
222 *> are the computed singular vcalues of A.
223 *> (See description of SVA().)
224 *> WORK(2) = NINT(WORK(2)) is the number of the computed nonzero
226 *> WORK(3) = NINT(WORK(3)) is the number of the computed singular
227 *> values that are larger than the underflow threshold.
228 *> WORK(4) = NINT(WORK(4)) is the number of sweeps of Jacobi
229 *> rotations needed for numerical convergence.
230 *> WORK(5) = max_{i.NE.j} |COS(A(:,i),A(:,j))| in the last sweep.
231 *> This is useful information in cases when SGESVJ did
232 *> not converge, as it can be used to estimate whether
233 *> the output is stil useful and for post festum analysis.
234 *> WORK(6) = the largest absolute value over all sines of the
235 *> Jacobi rotation angles in the last sweep. It can be
236 *> useful for a post festum analysis.
242 *> length of WORK, WORK >= MAX(6,M+N)
248 *> = 0 : successful exit.
249 *> < 0 : if INFO = -i, then the i-th argument had an illegal value
250 *> > 0 : SGESVJ did not converge in the maximal allowed number (30)
251 *> of sweeps. The output may still be useful. See the
252 *> description of WORK.
258 *> \author Univ. of Tennessee
259 *> \author Univ. of California Berkeley
260 *> \author Univ. of Colorado Denver
263 *> \date November 2015
265 *> \ingroup realGEcomputational
267 *> \par Further Details:
268 * =====================
270 *> The orthogonal N-by-N matrix V is obtained as a product of Jacobi plane
271 *> rotations. The rotations are implemented as fast scaled rotations of
272 *> Anda and Park [1]. In the case of underflow of the Jacobi angle, a
273 *> modified Jacobi transformation of Drmac [4] is used. Pivot strategy uses
274 *> column interchanges of de Rijk [2]. The relative accuracy of the computed
275 *> singular values and the accuracy of the computed singular vectors (in
276 *> angle metric) is as guaranteed by the theory of Demmel and Veselic [3].
277 *> The condition number that determines the accuracy in the full rank case
278 *> is essentially min_{D=diag} kappa(A*D), where kappa(.) is the
279 *> spectral condition number. The best performance of this Jacobi SVD
280 *> procedure is achieved if used in an accelerated version of Drmac and
281 *> Veselic [5,6], and it is the kernel routine in the SIGMA library [7].
282 *> Some tunning parameters (marked with [TP]) are available for the
284 *> The computational range for the nonzero singular values is the machine
285 *> number interval ( UNDERFLOW , OVERFLOW ). In extreme cases, even
286 *> denormalized singular values can be computed with the corresponding
287 *> gradual loss of accurate digits.
289 *> \par Contributors:
292 *> Zlatko Drmac (Zagreb, Croatia) and Kresimir Veselic (Hagen, Germany)
297 *> [1] A. A. Anda and H. Park: Fast plane rotations with dynamic scaling. \n
298 *> SIAM J. matrix Anal. Appl., Vol. 15 (1994), pp. 162-174. \n\n
299 *> [2] P. P. M. De Rijk: A one-sided Jacobi algorithm for computing the
300 *> singular value decomposition on a vector computer. \n
301 *> SIAM J. Sci. Stat. Comp., Vol. 10 (1998), pp. 359-371. \n\n
302 *> [3] J. Demmel and K. Veselic: Jacobi method is more accurate than QR. \n
303 *> [4] Z. Drmac: Implementation of Jacobi rotations for accurate singular
304 *> value computation in floating point arithmetic. \n
305 *> SIAM J. Sci. Comp., Vol. 18 (1997), pp. 1200-1222. \n\n
306 *> [5] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm I. \n
307 *> SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 1322-1342. \n
308 *> LAPACK Working note 169. \n\n
309 *> [6] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm II. \n
310 *> SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 1343-1362. \n
311 *> LAPACK Working note 170. \n\n
312 *> [7] Z. Drmac: SIGMA - mathematical software library for accurate SVD, PSV,
313 *> QSVD, (H,K)-SVD computations.\n
314 *> Department of Mathematics, University of Zagreb, 2008.
316 *> \par Bugs, Examples and Comments:
317 * =================================
319 *> Please report all bugs and send interesting test examples and comments to
320 *> drmac@math.hr. Thank you.
322 * =====================================================================
323 SUBROUTINE SGESVJ( JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V,
324 $ LDV, WORK, LWORK, INFO )
326 * -- LAPACK computational routine (version 3.6.0) --
327 * -- LAPACK is a software package provided by Univ. of Tennessee, --
328 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
331 * .. Scalar Arguments ..
332 INTEGER INFO, LDA, LDV, LWORK, M, MV, N
333 CHARACTER*1 JOBA, JOBU, JOBV
335 * .. Array Arguments ..
336 REAL A( LDA, * ), SVA( N ), V( LDV, * ),
340 * =====================================================================
342 * .. Local Parameters ..
344 PARAMETER ( ZERO = 0.0E0, HALF = 0.5E0, ONE = 1.0E0)
346 PARAMETER ( NSWEEP = 30 )
348 * .. Local Scalars ..
349 REAL AAPP, AAPP0, AAPQ, AAQQ, APOAQ, AQOAP, BIG,
350 $ BIGTHETA, CS, CTOL, EPSLN, LARGE, MXAAPQ,
351 $ MXSINJ, ROOTBIG, ROOTEPS, ROOTSFMIN, ROOTTOL,
352 $ SKL, SFMIN, SMALL, SN, T, TEMP1, THETA,
354 INTEGER BLSKIP, EMPTSW, i, ibr, IERR, igl, IJBLSK, ir1,
355 $ ISWROT, jbc, jgl, KBL, LKAHEAD, MVL, N2, N34,
356 $ N4, NBL, NOTROT, p, PSKIPPED, q, ROWSKIP,
358 LOGICAL APPLV, GOSCALE, LOWER, LSVEC, NOSCALE, ROTOK,
359 $ RSVEC, UCTOL, UPPER
364 * .. Intrinsic Functions ..
365 INTRINSIC ABS, MAX, MIN, FLOAT, SIGN, SQRT
367 * .. External Functions ..
380 * .. External Subroutines ..
383 EXTERNAL SAXPY, SCOPY, SROTM, SSCAL, SSWAP
385 EXTERNAL SLASCL, SLASET, SLASSQ, XERBLA
387 EXTERNAL SGSVJ0, SGSVJ1
389 * .. Executable Statements ..
391 * Test the input arguments
393 LSVEC = LSAME( JOBU, 'U' )
394 UCTOL = LSAME( JOBU, 'C' )
395 RSVEC = LSAME( JOBV, 'V' )
396 APPLV = LSAME( JOBV, 'A' )
397 UPPER = LSAME( JOBA, 'U' )
398 LOWER = LSAME( JOBA, 'L' )
400 IF( .NOT.( UPPER .OR. LOWER .OR. LSAME( JOBA, 'G' ) ) ) THEN
402 ELSE IF( .NOT.( LSVEC .OR. UCTOL .OR. LSAME( JOBU, 'N' ) ) ) THEN
404 ELSE IF( .NOT.( RSVEC .OR. APPLV .OR. LSAME( JOBV, 'N' ) ) ) THEN
406 ELSE IF( M.LT.0 ) THEN
408 ELSE IF( ( N.LT.0 ) .OR. ( N.GT.M ) ) THEN
410 ELSE IF( LDA.LT.M ) THEN
412 ELSE IF( MV.LT.0 ) THEN
414 ELSE IF( ( RSVEC .AND. ( LDV.LT.N ) ) .OR.
415 $ ( APPLV .AND. ( LDV.LT.MV ) ) ) THEN
417 ELSE IF( UCTOL .AND. ( WORK( 1 ).LE.ONE ) ) THEN
419 ELSE IF( LWORK.LT.MAX( M+N, 6 ) ) THEN
427 CALL XERBLA( 'SGESVJ', -INFO )
431 * #:) Quick return for void matrix
433 IF( ( M.EQ.0 ) .OR. ( N.EQ.0 ) )RETURN
435 * Set numerical parameters
436 * The stopping criterion for Jacobi rotations is
438 * max_{i<>j}|A(:,i)^T * A(:,j)|/(||A(:,i)||*||A(:,j)||) < CTOL*EPS
440 * where EPS is the round-off and CTOL is defined as follows:
443 * ... user controlled
447 IF( LSVEC .OR. RSVEC .OR. APPLV ) THEN
448 CTOL = SQRT( FLOAT( M ) )
453 * ... and the machine dependent parameters are
454 *[!] (Make sure that SLAMCH() works properly on the target machine.)
456 EPSLN = SLAMCH( 'Epsilon' )
457 ROOTEPS = SQRT( EPSLN )
458 SFMIN = SLAMCH( 'SafeMinimum' )
459 ROOTSFMIN = SQRT( SFMIN )
460 SMALL = SFMIN / EPSLN
461 BIG = SLAMCH( 'Overflow' )
463 ROOTBIG = ONE / ROOTSFMIN
464 LARGE = BIG / SQRT( FLOAT( M*N ) )
465 BIGTHETA = ONE / ROOTEPS
468 ROOTTOL = SQRT( TOL )
470 IF( FLOAT( M )*EPSLN.GE.ONE ) THEN
472 CALL XERBLA( 'SGESVJ', -INFO )
476 * Initialize the right singular vector matrix.
480 CALL SLASET( 'A', MVL, N, ZERO, ONE, V, LDV )
481 ELSE IF( APPLV ) THEN
484 RSVEC = RSVEC .OR. APPLV
486 * Initialize SVA( 1:N ) = ( ||A e_i||_2, i = 1:N )
487 *(!) If necessary, scale A to protect the largest singular value
488 * from overflow. It is possible that saving the largest singular
489 * value destroys the information about the small ones.
490 * This initial scaling is almost minimal in the sense that the
491 * goal is to make sure that no column norm overflows, and that
492 * SQRT(N)*max_i SVA(i) does not overflow. If INFinite entries
493 * in A are detected, the procedure returns with INFO=-6.
495 SKL = ONE / SQRT( FLOAT( M )*FLOAT( N ) )
500 * the input matrix is M-by-N lower triangular (trapezoidal)
504 CALL SLASSQ( M-p+1, A( p, p ), 1, AAPP, AAQQ )
505 IF( AAPP.GT.BIG ) THEN
507 CALL XERBLA( 'SGESVJ', -INFO )
511 IF( ( AAPP.LT.( BIG / AAQQ ) ) .AND. NOSCALE ) THEN
515 SVA( p ) = AAPP*( AAQQ*SKL )
519 SVA( q ) = SVA( q )*SKL
524 ELSE IF( UPPER ) THEN
525 * the input matrix is M-by-N upper triangular (trapezoidal)
529 CALL SLASSQ( p, A( 1, p ), 1, AAPP, AAQQ )
530 IF( AAPP.GT.BIG ) THEN
532 CALL XERBLA( 'SGESVJ', -INFO )
536 IF( ( AAPP.LT.( BIG / AAQQ ) ) .AND. NOSCALE ) THEN
540 SVA( p ) = AAPP*( AAQQ*SKL )
544 SVA( q ) = SVA( q )*SKL
550 * the input matrix is M-by-N general dense
554 CALL SLASSQ( M, A( 1, p ), 1, AAPP, AAQQ )
555 IF( AAPP.GT.BIG ) THEN
557 CALL XERBLA( 'SGESVJ', -INFO )
561 IF( ( AAPP.LT.( BIG / AAQQ ) ) .AND. NOSCALE ) THEN
565 SVA( p ) = AAPP*( AAQQ*SKL )
569 SVA( q ) = SVA( q )*SKL
576 IF( NOSCALE )SKL = ONE
578 * Move the smaller part of the spectrum from the underflow threshold
579 *(!) Start by determining the position of the nonzero entries of the
580 * array SVA() relative to ( SFMIN, BIG ).
585 IF( SVA( p ).NE.ZERO )AAQQ = MIN( AAQQ, SVA( p ) )
586 AAPP = MAX( AAPP, SVA( p ) )
589 * #:) Quick return for zero matrix
591 IF( AAPP.EQ.ZERO ) THEN
592 IF( LSVEC )CALL SLASET( 'G', M, N, ZERO, ONE, A, LDA )
602 * #:) Quick return for one-column matrix
605 IF( LSVEC )CALL SLASCL( 'G', 0, 0, SVA( 1 ), SKL, M, 1,
606 $ A( 1, 1 ), LDA, IERR )
607 WORK( 1 ) = ONE / SKL
608 IF( SVA( 1 ).GE.SFMIN ) THEN
620 * Protect small singular values from underflow, and try to
621 * avoid underflows/overflows in computing Jacobi rotations.
623 SN = SQRT( SFMIN / EPSLN )
624 TEMP1 = SQRT( BIG / FLOAT( N ) )
625 IF( ( AAPP.LE.SN ) .OR. ( AAQQ.GE.TEMP1 ) .OR.
626 $ ( ( SN.LE.AAQQ ) .AND. ( AAPP.LE.TEMP1 ) ) ) THEN
627 TEMP1 = MIN( BIG, TEMP1 / AAPP )
630 ELSE IF( ( AAQQ.LE.SN ) .AND. ( AAPP.LE.TEMP1 ) ) THEN
631 TEMP1 = MIN( SN / AAQQ, BIG / ( AAPP*SQRT( FLOAT( N ) ) ) )
634 ELSE IF( ( AAQQ.GE.SN ) .AND. ( AAPP.GE.TEMP1 ) ) THEN
635 TEMP1 = MAX( SN / AAQQ, TEMP1 / AAPP )
638 ELSE IF( ( AAQQ.LE.SN ) .AND. ( AAPP.GE.TEMP1 ) ) THEN
639 TEMP1 = MIN( SN / AAQQ, BIG / ( SQRT( FLOAT( N ) )*AAPP ) )
646 * Scale, if necessary
648 IF( TEMP1.NE.ONE ) THEN
649 CALL SLASCL( 'G', 0, 0, ONE, TEMP1, N, 1, SVA, N, IERR )
652 IF( SKL.NE.ONE ) THEN
653 CALL SLASCL( JOBA, 0, 0, ONE, SKL, M, N, A, LDA, IERR )
657 * Row-cyclic Jacobi SVD algorithm with column pivoting
659 EMPTSW = ( N*( N-1 ) ) / 2
663 * A is represented in factored form A = A * diag(WORK), where diag(WORK)
664 * is initialized to identity. WORK is updated during fast scaled
673 *[TP] SWBAND is a tuning parameter [TP]. It is meaningful and effective
674 * if SGESVJ is used as a computational routine in the preconditioned
675 * Jacobi SVD algorithm SGESVJ. For sweeps i=1:SWBAND the procedure
676 * works on pivots inside a band-like region around the diagonal.
677 * The boundaries are determined dynamically, based on the number of
678 * pivots above a threshold.
681 *[TP] KBL is a tuning parameter that defines the tile size in the
682 * tiling of the p-q loops of pivot pairs. In general, an optimal
683 * value of KBL depends on the matrix dimensions and on the
684 * parameters of the computer's memory.
687 IF( ( NBL*KBL ).NE.N )NBL = NBL + 1
690 *[TP] BLKSKIP is a tuning parameter that depends on SWBAND and KBL.
692 ROWSKIP = MIN( 5, KBL )
693 *[TP] ROWSKIP is a tuning parameter.
696 *[TP] LKAHEAD is a tuning parameter.
698 * Quasi block transformations, using the lower (upper) triangular
699 * structure of the input matrix. The quasi-block-cycling usually
700 * invokes cubic convergence. Big part of this cycle is done inside
701 * canonical subspaces of dimensions less than M.
703 IF( ( LOWER .OR. UPPER ) .AND. ( N.GT.MAX( 64, 4*KBL ) ) ) THEN
704 *[TP] The number of partition levels and the actual partition are
717 * This works very well on lower triangular matrices, in particular
718 * in the framework of the preconditioned Jacobi SVD (xGEJSV).
719 * The idea is simple:
720 * [+ 0 0 0] Note that Jacobi transformations of [0 0]
722 * [+ + x 0] actually work on [x 0] [x 0]
723 * [+ + x x] [x x]. [x x]
725 CALL SGSVJ0( JOBV, M-N34, N-N34, A( N34+1, N34+1 ), LDA,
726 $ WORK( N34+1 ), SVA( N34+1 ), MVL,
727 $ V( N34*q+1, N34+1 ), LDV, EPSLN, SFMIN, TOL,
728 $ 2, WORK( N+1 ), LWORK-N, IERR )
730 CALL SGSVJ0( JOBV, M-N2, N34-N2, A( N2+1, N2+1 ), LDA,
731 $ WORK( N2+1 ), SVA( N2+1 ), MVL,
732 $ V( N2*q+1, N2+1 ), LDV, EPSLN, SFMIN, TOL, 2,
733 $ WORK( N+1 ), LWORK-N, IERR )
735 CALL SGSVJ1( JOBV, M-N2, N-N2, N4, A( N2+1, N2+1 ), LDA,
736 $ WORK( N2+1 ), SVA( N2+1 ), MVL,
737 $ V( N2*q+1, N2+1 ), LDV, EPSLN, SFMIN, TOL, 1,
738 $ WORK( N+1 ), LWORK-N, IERR )
740 CALL SGSVJ0( JOBV, M-N4, N2-N4, A( N4+1, N4+1 ), LDA,
741 $ WORK( N4+1 ), SVA( N4+1 ), MVL,
742 $ V( N4*q+1, N4+1 ), LDV, EPSLN, SFMIN, TOL, 1,
743 $ WORK( N+1 ), LWORK-N, IERR )
745 CALL SGSVJ0( JOBV, M, N4, A, LDA, WORK, SVA, MVL, V, LDV,
746 $ EPSLN, SFMIN, TOL, 1, WORK( N+1 ), LWORK-N,
749 CALL SGSVJ1( JOBV, M, N2, N4, A, LDA, WORK, SVA, MVL, V,
750 $ LDV, EPSLN, SFMIN, TOL, 1, WORK( N+1 ),
754 ELSE IF( UPPER ) THEN
757 CALL SGSVJ0( JOBV, N4, N4, A, LDA, WORK, SVA, MVL, V, LDV,
758 $ EPSLN, SFMIN, TOL, 2, WORK( N+1 ), LWORK-N,
761 CALL SGSVJ0( JOBV, N2, N4, A( 1, N4+1 ), LDA, WORK( N4+1 ),
762 $ SVA( N4+1 ), MVL, V( N4*q+1, N4+1 ), LDV,
763 $ EPSLN, SFMIN, TOL, 1, WORK( N+1 ), LWORK-N,
766 CALL SGSVJ1( JOBV, N2, N2, N4, A, LDA, WORK, SVA, MVL, V,
767 $ LDV, EPSLN, SFMIN, TOL, 1, WORK( N+1 ),
770 CALL SGSVJ0( JOBV, N2+N4, N4, A( 1, N2+1 ), LDA,
771 $ WORK( N2+1 ), SVA( N2+1 ), MVL,
772 $ V( N2*q+1, N2+1 ), LDV, EPSLN, SFMIN, TOL, 1,
773 $ WORK( N+1 ), LWORK-N, IERR )
779 * .. Row-cyclic pivot strategy with de Rijk's pivoting ..
781 DO 1993 i = 1, NSWEEP
792 * Each sweep is unrolled using KBL-by-KBL tiles over the pivot pairs
793 * 1 <= p < q <= N. This is the first step toward a blocked implementation
794 * of the rotations. New implementation, based on block transformations,
795 * is under development.
799 igl = ( ibr-1 )*KBL + 1
801 DO 1002 ir1 = 0, MIN( LKAHEAD, NBL-ibr )
805 DO 2001 p = igl, MIN( igl+KBL-1, N-1 )
807 * .. de Rijk's pivoting
809 q = ISAMAX( N-p+1, SVA( p ), 1 ) + p - 1
811 CALL SSWAP( M, A( 1, p ), 1, A( 1, q ), 1 )
812 IF( RSVEC )CALL SSWAP( MVL, V( 1, p ), 1,
818 WORK( p ) = WORK( q )
824 * Column norms are periodically updated by explicit
827 * Unfortunately, some BLAS implementations compute SNRM2(M,A(1,p),1)
828 * as SQRT(SDOT(M,A(1,p),1,A(1,p),1)), which may cause the result to
829 * overflow for ||A(:,p)||_2 > SQRT(overflow_threshold), and to
830 * underflow for ||A(:,p)||_2 < SQRT(underflow_threshold).
831 * Hence, SNRM2 cannot be trusted, not even in the case when
832 * the true norm is far from the under(over)flow boundaries.
833 * If properly implemented SNRM2 is available, the IF-THEN-ELSE
834 * below should read "AAPP = SNRM2( M, A(1,p), 1 ) * WORK(p)".
836 IF( ( SVA( p ).LT.ROOTBIG ) .AND.
837 $ ( SVA( p ).GT.ROOTSFMIN ) ) THEN
838 SVA( p ) = SNRM2( M, A( 1, p ), 1 )*WORK( p )
842 CALL SLASSQ( M, A( 1, p ), 1, TEMP1, AAPP )
843 SVA( p ) = TEMP1*SQRT( AAPP )*WORK( p )
850 IF( AAPP.GT.ZERO ) THEN
854 DO 2002 q = p + 1, MIN( igl+KBL-1, N )
858 IF( AAQQ.GT.ZERO ) THEN
861 IF( AAQQ.GE.ONE ) THEN
862 ROTOK = ( SMALL*AAPP ).LE.AAQQ
863 IF( AAPP.LT.( BIG / AAQQ ) ) THEN
864 AAPQ = ( SDOT( M, A( 1, p ), 1, A( 1,
865 $ q ), 1 )*WORK( p )*WORK( q ) /
868 CALL SCOPY( M, A( 1, p ), 1,
870 CALL SLASCL( 'G', 0, 0, AAPP,
872 $ WORK( N+1 ), LDA, IERR )
873 AAPQ = SDOT( M, WORK( N+1 ), 1,
874 $ A( 1, q ), 1 )*WORK( q ) / AAQQ
877 ROTOK = AAPP.LE.( AAQQ / SMALL )
878 IF( AAPP.GT.( SMALL / AAQQ ) ) THEN
879 AAPQ = ( SDOT( M, A( 1, p ), 1, A( 1,
880 $ q ), 1 )*WORK( p )*WORK( q ) /
883 CALL SCOPY( M, A( 1, q ), 1,
885 CALL SLASCL( 'G', 0, 0, AAQQ,
887 $ WORK( N+1 ), LDA, IERR )
888 AAPQ = SDOT( M, WORK( N+1 ), 1,
889 $ A( 1, p ), 1 )*WORK( p ) / AAPP
893 MXAAPQ = MAX( MXAAPQ, ABS( AAPQ ) )
895 * TO rotate or NOT to rotate, THAT is the question ...
897 IF( ABS( AAPQ ).GT.TOL ) THEN
900 *[RTD] ROTATED = ROTATED + ONE
912 THETA = -HALF*ABS( AQOAP-APOAQ ) / AAPQ
914 IF( ABS( THETA ).GT.BIGTHETA ) THEN
917 FASTR( 3 ) = T*WORK( p ) / WORK( q )
918 FASTR( 4 ) = -T*WORK( q ) /
920 CALL SROTM( M, A( 1, p ), 1,
921 $ A( 1, q ), 1, FASTR )
922 IF( RSVEC )CALL SROTM( MVL,
926 SVA( q ) = AAQQ*SQRT( MAX( ZERO,
927 $ ONE+T*APOAQ*AAPQ ) )
928 AAPP = AAPP*SQRT( MAX( ZERO,
929 $ ONE-T*AQOAP*AAPQ ) )
930 MXSINJ = MAX( MXSINJ, ABS( T ) )
934 * .. choose correct signum for THETA and rotate
936 THSIGN = -SIGN( ONE, AAPQ )
937 T = ONE / ( THETA+THSIGN*
938 $ SQRT( ONE+THETA*THETA ) )
939 CS = SQRT( ONE / ( ONE+T*T ) )
942 MXSINJ = MAX( MXSINJ, ABS( SN ) )
943 SVA( q ) = AAQQ*SQRT( MAX( ZERO,
944 $ ONE+T*APOAQ*AAPQ ) )
945 AAPP = AAPP*SQRT( MAX( ZERO,
946 $ ONE-T*AQOAP*AAPQ ) )
948 APOAQ = WORK( p ) / WORK( q )
949 AQOAP = WORK( q ) / WORK( p )
950 IF( WORK( p ).GE.ONE ) THEN
951 IF( WORK( q ).GE.ONE ) THEN
953 FASTR( 4 ) = -T*AQOAP
954 WORK( p ) = WORK( p )*CS
955 WORK( q ) = WORK( q )*CS
956 CALL SROTM( M, A( 1, p ), 1,
959 IF( RSVEC )CALL SROTM( MVL,
960 $ V( 1, p ), 1, V( 1, q ),
963 CALL SAXPY( M, -T*AQOAP,
966 CALL SAXPY( M, CS*SN*APOAQ,
969 WORK( p ) = WORK( p )*CS
970 WORK( q ) = WORK( q ) / CS
972 CALL SAXPY( MVL, -T*AQOAP,
982 IF( WORK( q ).GE.ONE ) THEN
983 CALL SAXPY( M, T*APOAQ,
986 CALL SAXPY( M, -CS*SN*AQOAP,
989 WORK( p ) = WORK( p ) / CS
990 WORK( q ) = WORK( q )*CS
992 CALL SAXPY( MVL, T*APOAQ,
1001 IF( WORK( p ).GE.WORK( q ) )
1003 CALL SAXPY( M, -T*AQOAP,
1006 CALL SAXPY( M, CS*SN*APOAQ,
1009 WORK( p ) = WORK( p )*CS
1010 WORK( q ) = WORK( q ) / CS
1022 CALL SAXPY( M, T*APOAQ,
1029 WORK( p ) = WORK( p ) / CS
1030 WORK( q ) = WORK( q )*CS
1033 $ T*APOAQ, V( 1, p ),
1046 * .. have to use modified Gram-Schmidt like transformation
1047 CALL SCOPY( M, A( 1, p ), 1,
1049 CALL SLASCL( 'G', 0, 0, AAPP, ONE, M,
1050 $ 1, WORK( N+1 ), LDA,
1052 CALL SLASCL( 'G', 0, 0, AAQQ, ONE, M,
1053 $ 1, A( 1, q ), LDA, IERR )
1054 TEMP1 = -AAPQ*WORK( p ) / WORK( q )
1055 CALL SAXPY( M, TEMP1, WORK( N+1 ), 1,
1057 CALL SLASCL( 'G', 0, 0, ONE, AAQQ, M,
1058 $ 1, A( 1, q ), LDA, IERR )
1059 SVA( q ) = AAQQ*SQRT( MAX( ZERO,
1061 MXSINJ = MAX( MXSINJ, SFMIN )
1063 * END IF ROTOK THEN ... ELSE
1065 * In the case of cancellation in updating SVA(q), SVA(p)
1066 * recompute SVA(q), SVA(p).
1068 IF( ( SVA( q ) / AAQQ )**2.LE.ROOTEPS )
1070 IF( ( AAQQ.LT.ROOTBIG ) .AND.
1071 $ ( AAQQ.GT.ROOTSFMIN ) ) THEN
1072 SVA( q ) = SNRM2( M, A( 1, q ), 1 )*
1077 CALL SLASSQ( M, A( 1, q ), 1, T,
1079 SVA( q ) = T*SQRT( AAQQ )*WORK( q )
1082 IF( ( AAPP / AAPP0 ).LE.ROOTEPS ) THEN
1083 IF( ( AAPP.LT.ROOTBIG ) .AND.
1084 $ ( AAPP.GT.ROOTSFMIN ) ) THEN
1085 AAPP = SNRM2( M, A( 1, p ), 1 )*
1090 CALL SLASSQ( M, A( 1, p ), 1, T,
1092 AAPP = T*SQRT( AAPP )*WORK( p )
1098 * A(:,p) and A(:,q) already numerically orthogonal
1099 IF( ir1.EQ.0 )NOTROT = NOTROT + 1
1100 *[RTD] SKIPPED = SKIPPED + 1
1101 PSKIPPED = PSKIPPED + 1
1104 * A(:,q) is zero column
1105 IF( ir1.EQ.0 )NOTROT = NOTROT + 1
1106 PSKIPPED = PSKIPPED + 1
1109 IF( ( i.LE.SWBAND ) .AND.
1110 $ ( PSKIPPED.GT.ROWSKIP ) ) THEN
1111 IF( ir1.EQ.0 )AAPP = -AAPP
1120 * bailed out of q-loop
1126 IF( ( ir1.EQ.0 ) .AND. ( AAPP.EQ.ZERO ) )
1127 $ NOTROT = NOTROT + MIN( igl+KBL-1, N ) - p
1132 * end of doing the block ( ibr, ibr )
1136 * ... go to the off diagonal blocks
1138 igl = ( ibr-1 )*KBL + 1
1140 DO 2010 jbc = ibr + 1, NBL
1142 jgl = ( jbc-1 )*KBL + 1
1144 * doing the block at ( ibr, jbc )
1147 DO 2100 p = igl, MIN( igl+KBL-1, N )
1150 IF( AAPP.GT.ZERO ) THEN
1154 DO 2200 q = jgl, MIN( jgl+KBL-1, N )
1157 IF( AAQQ.GT.ZERO ) THEN
1160 * .. M x 2 Jacobi SVD ..
1162 * Safe Gram matrix computation
1164 IF( AAQQ.GE.ONE ) THEN
1165 IF( AAPP.GE.AAQQ ) THEN
1166 ROTOK = ( SMALL*AAPP ).LE.AAQQ
1168 ROTOK = ( SMALL*AAQQ ).LE.AAPP
1170 IF( AAPP.LT.( BIG / AAQQ ) ) THEN
1171 AAPQ = ( SDOT( M, A( 1, p ), 1, A( 1,
1172 $ q ), 1 )*WORK( p )*WORK( q ) /
1175 CALL SCOPY( M, A( 1, p ), 1,
1177 CALL SLASCL( 'G', 0, 0, AAPP,
1179 $ WORK( N+1 ), LDA, IERR )
1180 AAPQ = SDOT( M, WORK( N+1 ), 1,
1181 $ A( 1, q ), 1 )*WORK( q ) / AAQQ
1184 IF( AAPP.GE.AAQQ ) THEN
1185 ROTOK = AAPP.LE.( AAQQ / SMALL )
1187 ROTOK = AAQQ.LE.( AAPP / SMALL )
1189 IF( AAPP.GT.( SMALL / AAQQ ) ) THEN
1190 AAPQ = ( SDOT( M, A( 1, p ), 1, A( 1,
1191 $ q ), 1 )*WORK( p )*WORK( q ) /
1194 CALL SCOPY( M, A( 1, q ), 1,
1196 CALL SLASCL( 'G', 0, 0, AAQQ,
1198 $ WORK( N+1 ), LDA, IERR )
1199 AAPQ = SDOT( M, WORK( N+1 ), 1,
1200 $ A( 1, p ), 1 )*WORK( p ) / AAPP
1204 MXAAPQ = MAX( MXAAPQ, ABS( AAPQ ) )
1206 * TO rotate or NOT to rotate, THAT is the question ...
1208 IF( ABS( AAPQ ).GT.TOL ) THEN
1210 *[RTD] ROTATED = ROTATED + 1
1218 THETA = -HALF*ABS( AQOAP-APOAQ ) / AAPQ
1219 IF( AAQQ.GT.AAPP0 )THETA = -THETA
1221 IF( ABS( THETA ).GT.BIGTHETA ) THEN
1223 FASTR( 3 ) = T*WORK( p ) / WORK( q )
1224 FASTR( 4 ) = -T*WORK( q ) /
1226 CALL SROTM( M, A( 1, p ), 1,
1227 $ A( 1, q ), 1, FASTR )
1228 IF( RSVEC )CALL SROTM( MVL,
1232 SVA( q ) = AAQQ*SQRT( MAX( ZERO,
1233 $ ONE+T*APOAQ*AAPQ ) )
1234 AAPP = AAPP*SQRT( MAX( ZERO,
1235 $ ONE-T*AQOAP*AAPQ ) )
1236 MXSINJ = MAX( MXSINJ, ABS( T ) )
1239 * .. choose correct signum for THETA and rotate
1241 THSIGN = -SIGN( ONE, AAPQ )
1242 IF( AAQQ.GT.AAPP0 )THSIGN = -THSIGN
1243 T = ONE / ( THETA+THSIGN*
1244 $ SQRT( ONE+THETA*THETA ) )
1245 CS = SQRT( ONE / ( ONE+T*T ) )
1247 MXSINJ = MAX( MXSINJ, ABS( SN ) )
1248 SVA( q ) = AAQQ*SQRT( MAX( ZERO,
1249 $ ONE+T*APOAQ*AAPQ ) )
1250 AAPP = AAPP*SQRT( MAX( ZERO,
1251 $ ONE-T*AQOAP*AAPQ ) )
1253 APOAQ = WORK( p ) / WORK( q )
1254 AQOAP = WORK( q ) / WORK( p )
1255 IF( WORK( p ).GE.ONE ) THEN
1257 IF( WORK( q ).GE.ONE ) THEN
1258 FASTR( 3 ) = T*APOAQ
1259 FASTR( 4 ) = -T*AQOAP
1260 WORK( p ) = WORK( p )*CS
1261 WORK( q ) = WORK( q )*CS
1262 CALL SROTM( M, A( 1, p ), 1,
1265 IF( RSVEC )CALL SROTM( MVL,
1266 $ V( 1, p ), 1, V( 1, q ),
1269 CALL SAXPY( M, -T*AQOAP,
1272 CALL SAXPY( M, CS*SN*APOAQ,
1276 CALL SAXPY( MVL, -T*AQOAP,
1284 WORK( p ) = WORK( p )*CS
1285 WORK( q ) = WORK( q ) / CS
1288 IF( WORK( q ).GE.ONE ) THEN
1289 CALL SAXPY( M, T*APOAQ,
1292 CALL SAXPY( M, -CS*SN*AQOAP,
1296 CALL SAXPY( MVL, T*APOAQ,
1304 WORK( p ) = WORK( p ) / CS
1305 WORK( q ) = WORK( q )*CS
1307 IF( WORK( p ).GE.WORK( q ) )
1309 CALL SAXPY( M, -T*AQOAP,
1312 CALL SAXPY( M, CS*SN*APOAQ,
1315 WORK( p ) = WORK( p )*CS
1316 WORK( q ) = WORK( q ) / CS
1328 CALL SAXPY( M, T*APOAQ,
1335 WORK( p ) = WORK( p ) / CS
1336 WORK( q ) = WORK( q )*CS
1339 $ T*APOAQ, V( 1, p ),
1352 IF( AAPP.GT.AAQQ ) THEN
1353 CALL SCOPY( M, A( 1, p ), 1,
1355 CALL SLASCL( 'G', 0, 0, AAPP, ONE,
1356 $ M, 1, WORK( N+1 ), LDA,
1358 CALL SLASCL( 'G', 0, 0, AAQQ, ONE,
1359 $ M, 1, A( 1, q ), LDA,
1361 TEMP1 = -AAPQ*WORK( p ) / WORK( q )
1362 CALL SAXPY( M, TEMP1, WORK( N+1 ),
1364 CALL SLASCL( 'G', 0, 0, ONE, AAQQ,
1365 $ M, 1, A( 1, q ), LDA,
1367 SVA( q ) = AAQQ*SQRT( MAX( ZERO,
1369 MXSINJ = MAX( MXSINJ, SFMIN )
1371 CALL SCOPY( M, A( 1, q ), 1,
1373 CALL SLASCL( 'G', 0, 0, AAQQ, ONE,
1374 $ M, 1, WORK( N+1 ), LDA,
1376 CALL SLASCL( 'G', 0, 0, AAPP, ONE,
1377 $ M, 1, A( 1, p ), LDA,
1379 TEMP1 = -AAPQ*WORK( q ) / WORK( p )
1380 CALL SAXPY( M, TEMP1, WORK( N+1 ),
1382 CALL SLASCL( 'G', 0, 0, ONE, AAPP,
1383 $ M, 1, A( 1, p ), LDA,
1385 SVA( p ) = AAPP*SQRT( MAX( ZERO,
1387 MXSINJ = MAX( MXSINJ, SFMIN )
1390 * END IF ROTOK THEN ... ELSE
1392 * In the case of cancellation in updating SVA(q)
1393 * .. recompute SVA(q)
1394 IF( ( SVA( q ) / AAQQ )**2.LE.ROOTEPS )
1396 IF( ( AAQQ.LT.ROOTBIG ) .AND.
1397 $ ( AAQQ.GT.ROOTSFMIN ) ) THEN
1398 SVA( q ) = SNRM2( M, A( 1, q ), 1 )*
1403 CALL SLASSQ( M, A( 1, q ), 1, T,
1405 SVA( q ) = T*SQRT( AAQQ )*WORK( q )
1408 IF( ( AAPP / AAPP0 )**2.LE.ROOTEPS ) THEN
1409 IF( ( AAPP.LT.ROOTBIG ) .AND.
1410 $ ( AAPP.GT.ROOTSFMIN ) ) THEN
1411 AAPP = SNRM2( M, A( 1, p ), 1 )*
1416 CALL SLASSQ( M, A( 1, p ), 1, T,
1418 AAPP = T*SQRT( AAPP )*WORK( p )
1422 * end of OK rotation
1425 *[RTD] SKIPPED = SKIPPED + 1
1426 PSKIPPED = PSKIPPED + 1
1431 PSKIPPED = PSKIPPED + 1
1435 IF( ( i.LE.SWBAND ) .AND. ( IJBLSK.GE.BLSKIP ) )
1441 IF( ( i.LE.SWBAND ) .AND.
1442 $ ( PSKIPPED.GT.ROWSKIP ) ) THEN
1456 IF( AAPP.EQ.ZERO )NOTROT = NOTROT +
1457 $ MIN( jgl+KBL-1, N ) - jgl + 1
1458 IF( AAPP.LT.ZERO )NOTROT = 0
1465 * end of the jbc-loop
1467 *2011 bailed out of the jbc-loop
1468 DO 2012 p = igl, MIN( igl+KBL-1, N )
1469 SVA( p ) = ABS( SVA( p ) )
1473 *2000 :: end of the ibr-loop
1476 IF( ( SVA( N ).LT.ROOTBIG ) .AND. ( SVA( N ).GT.ROOTSFMIN ) )
1478 SVA( N ) = SNRM2( M, A( 1, N ), 1 )*WORK( N )
1482 CALL SLASSQ( M, A( 1, N ), 1, T, AAPP )
1483 SVA( N ) = T*SQRT( AAPP )*WORK( N )
1486 * Additional steering devices
1488 IF( ( i.LT.SWBAND ) .AND. ( ( MXAAPQ.LE.ROOTTOL ) .OR.
1489 $ ( ISWROT.LE.N ) ) )SWBAND = i
1491 IF( ( i.GT.SWBAND+1 ) .AND. ( MXAAPQ.LT.SQRT( FLOAT( N ) )*
1492 $ TOL ) .AND. ( FLOAT( N )*MXAAPQ*MXSINJ.LT.TOL ) ) THEN
1496 IF( NOTROT.GE.EMPTSW )GO TO 1994
1499 * end i=1:NSWEEP loop
1501 * #:( Reaching this point means that the procedure has not converged.
1506 * #:) Reaching this point means numerical convergence after the i-th
1510 * #:) INFO = 0 confirms successful iterations.
1513 * Sort the singular values and find how many are above
1514 * the underflow threshold.
1518 DO 5991 p = 1, N - 1
1519 q = ISAMAX( N-p+1, SVA( p ), 1 ) + p - 1
1525 WORK( p ) = WORK( q )
1527 CALL SSWAP( M, A( 1, p ), 1, A( 1, q ), 1 )
1528 IF( RSVEC )CALL SSWAP( MVL, V( 1, p ), 1, V( 1, q ), 1 )
1530 IF( SVA( p ).NE.ZERO ) THEN
1532 IF( SVA( p )*SKL.GT.SFMIN )N2 = N2 + 1
1535 IF( SVA( N ).NE.ZERO ) THEN
1537 IF( SVA( N )*SKL.GT.SFMIN )N2 = N2 + 1
1540 * Normalize the left singular vectors.
1542 IF( LSVEC .OR. UCTOL ) THEN
1544 CALL SSCAL( M, WORK( p ) / SVA( p ), A( 1, p ), 1 )
1548 * Scale the product of Jacobi rotations (assemble the fast rotations).
1553 CALL SSCAL( MVL, WORK( p ), V( 1, p ), 1 )
1557 TEMP1 = ONE / SNRM2( MVL, V( 1, p ), 1 )
1558 CALL SSCAL( MVL, TEMP1, V( 1, p ), 1 )
1563 * Undo scaling, if necessary (and possible).
1564 IF( ( ( SKL.GT.ONE ) .AND. ( SVA( 1 ).LT.( BIG / SKL ) ) )
1565 $ .OR. ( ( SKL.LT.ONE ) .AND. ( SVA( MAX( N2, 1 ) ) .GT.
1566 $ ( SFMIN / SKL ) ) ) ) THEN
1568 SVA( P ) = SKL*SVA( P )
1574 * The singular values of A are SKL*SVA(1:N). If SKL.NE.ONE
1575 * then some of the singular values may overflow or underflow and
1576 * the spectrum is given in this factored representation.
1578 WORK( 2 ) = FLOAT( N4 )
1579 * N4 is the number of computed nonzero singular values of A.
1581 WORK( 3 ) = FLOAT( N2 )
1582 * N2 is the number of singular values of A greater than SFMIN.
1583 * If N2<N, SVA(N2:N) contains ZEROS and/or denormalized numbers
1584 * that may carry some information.
1586 WORK( 4 ) = FLOAT( i )
1587 * i is the index of the last sweep before declaring convergence.
1590 * MXAAPQ is the largest absolute value of scaled pivots in the
1594 * MXSINJ is the largest absolute value of the sines of Jacobi angles