3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DGESVJ + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgesvj.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgesvj.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgesvj.f">
21 * SUBROUTINE DGESVJ( 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 * DOUBLE PRECISION A( LDA, * ), SVA( N ), V( LDV, * ),
39 *> DGESVJ 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 *> DGESVJ 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=DSQRT(M), EPS=DLAMCH('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/DLAMCH('E') > M >= 0.
112 *> The number of columns of the input matrix A.
118 *> A is DOUBLE PRECISION 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 DLAMCH('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=DSQRT(M)*EPS (default); or TOL=CTOL*EPS (JOBU.EQ.'C'),
133 *> see the description of JOBU.
135 *> the procedure DGESVJ 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.
143 *> If JOBU .EQ. 'N' :
145 *> Note that the left singular vectors are 'for free' in the
146 *> one-sided Jacobi SVD algorithm. However, if only the
147 *> singular values are needed, the level of numerical
148 *> orthogonality of U is not an issue and iterations are
149 *> stopped when the columns of the iterated matrix are
150 *> numerically orthogonal up to approximately M*EPS. Thus,
151 *> on exit, A contains the columns of U scaled with the
152 *> corresponding singular values.
154 *> the procedure DGESVJ did not converge in the given number
155 *> of iterations (sweeps).
161 *> The leading dimension of the array A. LDA >= max(1,M).
166 *> SVA is DOUBLE PRECISION array, dimension (N)
169 *> depending on the value SCALE = WORK(1), we have:
170 *> If SCALE .EQ. ONE :
171 *> SVA(1:N) contains the computed singular values of A.
172 *> During the computation SVA contains the Euclidean column
173 *> norms of the iterated matrices in the array A.
174 *> If SCALE .NE. ONE :
175 *> The singular values of A are SCALE*SVA(1:N), and this
176 *> factored representation is due to the fact that some of the
177 *> singular values of A might underflow or overflow.
179 *> the procedure DGESVJ 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 DGESVJ
187 *> is applied to the first MV rows of V. See the description of JOBV.
192 *> V is DOUBLE PRECISION 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 DOUBLE PRECISION array, dimension (max(6,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=DLAMCH('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 values 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 DGESVJ 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 : DGESVJ 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 December 2016
265 *> \ingroup doubleGEcomputational
267 *> \par Further Details:
268 * =====================
272 *> The orthogonal N-by-N matrix V is obtained as a product of Jacobi plane
273 *> rotations. The rotations are implemented as fast scaled rotations of
274 *> Anda and Park [1]. In the case of underflow of the Jacobi angle, a
275 *> modified Jacobi transformation of Drmac [4] is used. Pivot strategy uses
276 *> column interchanges of de Rijk [2]. The relative accuracy of the computed
277 *> singular values and the accuracy of the computed singular vectors (in
278 *> angle metric) is as guaranteed by the theory of Demmel and Veselic [3].
279 *> The condition number that determines the accuracy in the full rank case
280 *> is essentially min_{D=diag} kappa(A*D), where kappa(.) is the
281 *> spectral condition number. The best performance of this Jacobi SVD
282 *> procedure is achieved if used in an accelerated version of Drmac and
283 *> Veselic [5,6], and it is the kernel routine in the SIGMA library [7].
284 *> Some tunning parameters (marked with [TP]) are available for the
286 *> The computational range for the nonzero singular values is the machine
287 *> number interval ( UNDERFLOW , OVERFLOW ). In extreme cases, even
288 *> denormalized singular values can be computed with the corresponding
289 *> gradual loss of accurate digits.
292 *> \par Contributors:
299 *> Zlatko Drmac (Zagreb, Croatia) and Kresimir Veselic (Hagen, Germany)
307 *> [1] A. A. Anda and H. Park: Fast plane rotations with dynamic scaling.
308 *> SIAM J. matrix Anal. Appl., Vol. 15 (1994), pp. 162-174.
309 *> [2] P. P. M. De Rijk: A one-sided Jacobi algorithm for computing the
310 *> singular value decomposition on a vector computer.
311 *> SIAM J. Sci. Stat. Comp., Vol. 10 (1998), pp. 359-371.
312 *> [3] J. Demmel and K. Veselic: Jacobi method is more accurate than QR.
313 *> [4] Z. Drmac: Implementation of Jacobi rotations for accurate singular
314 *> value computation in floating point arithmetic.
315 *> SIAM J. Sci. Comp., Vol. 18 (1997), pp. 1200-1222.
316 *> [5] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm I.
317 *> SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 1322-1342.
318 *> LAPACK Working note 169.
319 *> [6] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm II.
320 *> SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 1343-1362.
321 *> LAPACK Working note 170.
322 *> [7] Z. Drmac: SIGMA - mathematical software library for accurate SVD, PSV,
323 *> QSVD, (H,K)-SVD computations.
324 *> Department of Mathematics, University of Zagreb, 2008.
327 *> \par Bugs, examples and comments:
328 * =================================
331 *> ===========================
332 *> Please report all bugs and send interesting test examples and comments to
333 *> drmac@math.hr. Thank you.
336 * =====================================================================
337 SUBROUTINE DGESVJ( JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V,
338 $ LDV, WORK, LWORK, INFO )
340 * -- LAPACK computational routine (version 3.7.0) --
341 * -- LAPACK is a software package provided by Univ. of Tennessee, --
342 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
345 * .. Scalar Arguments ..
346 INTEGER INFO, LDA, LDV, LWORK, M, MV, N
347 CHARACTER*1 JOBA, JOBU, JOBV
349 * .. Array Arguments ..
350 DOUBLE PRECISION A( LDA, * ), SVA( N ), V( LDV, * ),
354 * =====================================================================
356 * .. Local Parameters ..
357 DOUBLE PRECISION ZERO, HALF, ONE
358 PARAMETER ( ZERO = 0.0D0, HALF = 0.5D0, ONE = 1.0D0)
360 PARAMETER ( NSWEEP = 30 )
362 * .. Local Scalars ..
363 DOUBLE PRECISION AAPP, AAPP0, AAPQ, AAQQ, APOAQ, AQOAP, BIG,
364 $ BIGTHETA, CS, CTOL, EPSLN, LARGE, MXAAPQ,
365 $ MXSINJ, ROOTBIG, ROOTEPS, ROOTSFMIN, ROOTTOL,
366 $ SKL, SFMIN, SMALL, SN, T, TEMP1, THETA,
368 INTEGER BLSKIP, EMPTSW, i, ibr, IERR, igl, IJBLSK, ir1,
369 $ ISWROT, jbc, jgl, KBL, LKAHEAD, MVL, N2, N34,
370 $ N4, NBL, NOTROT, p, PSKIPPED, q, ROWSKIP,
372 LOGICAL APPLV, GOSCALE, LOWER, LSVEC, NOSCALE, ROTOK,
373 $ RSVEC, UCTOL, UPPER
376 DOUBLE PRECISION FASTR( 5 )
378 * .. Intrinsic Functions ..
379 INTRINSIC DABS, MAX, MIN, DBLE, DSIGN, DSQRT
381 * .. External Functions ..
384 DOUBLE PRECISION DDOT, DNRM2
389 DOUBLE PRECISION DLAMCH
394 * .. External Subroutines ..
397 EXTERNAL DAXPY, DCOPY, DROTM, DSCAL, DSWAP
399 EXTERNAL DLASCL, DLASET, DLASSQ, XERBLA
401 EXTERNAL DGSVJ0, DGSVJ1
403 * .. Executable Statements ..
405 * Test the input arguments
407 LSVEC = LSAME( JOBU, 'U' )
408 UCTOL = LSAME( JOBU, 'C' )
409 RSVEC = LSAME( JOBV, 'V' )
410 APPLV = LSAME( JOBV, 'A' )
411 UPPER = LSAME( JOBA, 'U' )
412 LOWER = LSAME( JOBA, 'L' )
414 IF( .NOT.( UPPER .OR. LOWER .OR. LSAME( JOBA, 'G' ) ) ) THEN
416 ELSE IF( .NOT.( LSVEC .OR. UCTOL .OR. LSAME( JOBU, 'N' ) ) ) THEN
418 ELSE IF( .NOT.( RSVEC .OR. APPLV .OR. LSAME( JOBV, 'N' ) ) ) THEN
420 ELSE IF( M.LT.0 ) THEN
422 ELSE IF( ( N.LT.0 ) .OR. ( N.GT.M ) ) THEN
424 ELSE IF( LDA.LT.M ) THEN
426 ELSE IF( MV.LT.0 ) THEN
428 ELSE IF( ( RSVEC .AND. ( LDV.LT.N ) ) .OR.
429 $ ( APPLV .AND. ( LDV.LT.MV ) ) ) THEN
431 ELSE IF( UCTOL .AND. ( WORK( 1 ).LE.ONE ) ) THEN
433 ELSE IF( LWORK.LT.MAX( M+N, 6 ) ) THEN
441 CALL XERBLA( 'DGESVJ', -INFO )
445 * #:) Quick return for void matrix
447 IF( ( M.EQ.0 ) .OR. ( N.EQ.0 ) )RETURN
449 * Set numerical parameters
450 * The stopping criterion for Jacobi rotations is
452 * max_{i<>j}|A(:,i)^T * A(:,j)|/(||A(:,i)||*||A(:,j)||) < CTOL*EPS
454 * where EPS is the round-off and CTOL is defined as follows:
457 * ... user controlled
461 IF( LSVEC .OR. RSVEC .OR. APPLV ) THEN
462 CTOL = DSQRT( DBLE( M ) )
467 * ... and the machine dependent parameters are
468 *[!] (Make sure that DLAMCH() works properly on the target machine.)
470 EPSLN = DLAMCH( 'Epsilon' )
471 ROOTEPS = DSQRT( EPSLN )
472 SFMIN = DLAMCH( 'SafeMinimum' )
473 ROOTSFMIN = DSQRT( SFMIN )
474 SMALL = SFMIN / EPSLN
475 BIG = DLAMCH( 'Overflow' )
477 ROOTBIG = ONE / ROOTSFMIN
478 LARGE = BIG / DSQRT( DBLE( M*N ) )
479 BIGTHETA = ONE / ROOTEPS
482 ROOTTOL = DSQRT( TOL )
484 IF( DBLE( M )*EPSLN.GE.ONE ) THEN
486 CALL XERBLA( 'DGESVJ', -INFO )
490 * Initialize the right singular vector matrix.
494 CALL DLASET( 'A', MVL, N, ZERO, ONE, V, LDV )
495 ELSE IF( APPLV ) THEN
498 RSVEC = RSVEC .OR. APPLV
500 * Initialize SVA( 1:N ) = ( ||A e_i||_2, i = 1:N )
501 *(!) If necessary, scale A to protect the largest singular value
502 * from overflow. It is possible that saving the largest singular
503 * value destroys the information about the small ones.
504 * This initial scaling is almost minimal in the sense that the
505 * goal is to make sure that no column norm overflows, and that
506 * DSQRT(N)*max_i SVA(i) does not overflow. If INFinite entries
507 * in A are detected, the procedure returns with INFO=-6.
509 SKL= ONE / DSQRT( DBLE( M )*DBLE( N ) )
514 * the input matrix is M-by-N lower triangular (trapezoidal)
518 CALL DLASSQ( M-p+1, A( p, p ), 1, AAPP, AAQQ )
519 IF( AAPP.GT.BIG ) THEN
521 CALL XERBLA( 'DGESVJ', -INFO )
525 IF( ( AAPP.LT.( BIG / AAQQ ) ) .AND. NOSCALE ) THEN
529 SVA( p ) = AAPP*( AAQQ*SKL)
533 SVA( q ) = SVA( q )*SKL
538 ELSE IF( UPPER ) THEN
539 * the input matrix is M-by-N upper triangular (trapezoidal)
543 CALL DLASSQ( p, A( 1, p ), 1, AAPP, AAQQ )
544 IF( AAPP.GT.BIG ) THEN
546 CALL XERBLA( 'DGESVJ', -INFO )
550 IF( ( AAPP.LT.( BIG / AAQQ ) ) .AND. NOSCALE ) THEN
554 SVA( p ) = AAPP*( AAQQ*SKL)
558 SVA( q ) = SVA( q )*SKL
564 * the input matrix is M-by-N general dense
568 CALL DLASSQ( M, A( 1, p ), 1, AAPP, AAQQ )
569 IF( AAPP.GT.BIG ) THEN
571 CALL XERBLA( 'DGESVJ', -INFO )
575 IF( ( AAPP.LT.( BIG / AAQQ ) ) .AND. NOSCALE ) THEN
579 SVA( p ) = AAPP*( AAQQ*SKL)
583 SVA( q ) = SVA( q )*SKL
590 IF( NOSCALE )SKL= ONE
592 * Move the smaller part of the spectrum from the underflow threshold
593 *(!) Start by determining the position of the nonzero entries of the
594 * array SVA() relative to ( SFMIN, BIG ).
599 IF( SVA( p ).NE.ZERO )AAQQ = MIN( AAQQ, SVA( p ) )
600 AAPP = MAX( AAPP, SVA( p ) )
603 * #:) Quick return for zero matrix
605 IF( AAPP.EQ.ZERO ) THEN
606 IF( LSVEC )CALL DLASET( 'G', M, N, ZERO, ONE, A, LDA )
616 * #:) Quick return for one-column matrix
619 IF( LSVEC )CALL DLASCL( 'G', 0, 0, SVA( 1 ), SKL, M, 1,
620 $ A( 1, 1 ), LDA, IERR )
621 WORK( 1 ) = ONE / SKL
622 IF( SVA( 1 ).GE.SFMIN ) THEN
634 * Protect small singular values from underflow, and try to
635 * avoid underflows/overflows in computing Jacobi rotations.
637 SN = DSQRT( SFMIN / EPSLN )
638 TEMP1 = DSQRT( BIG / DBLE( N ) )
639 IF( ( AAPP.LE.SN ) .OR. ( AAQQ.GE.TEMP1 ) .OR.
640 $ ( ( SN.LE.AAQQ ) .AND. ( AAPP.LE.TEMP1 ) ) ) THEN
641 TEMP1 = MIN( BIG, TEMP1 / AAPP )
644 ELSE IF( ( AAQQ.LE.SN ) .AND. ( AAPP.LE.TEMP1 ) ) THEN
645 TEMP1 = MIN( SN / AAQQ, BIG / ( AAPP*DSQRT( DBLE( N ) ) ) )
648 ELSE IF( ( AAQQ.GE.SN ) .AND. ( AAPP.GE.TEMP1 ) ) THEN
649 TEMP1 = MAX( SN / AAQQ, TEMP1 / AAPP )
652 ELSE IF( ( AAQQ.LE.SN ) .AND. ( AAPP.GE.TEMP1 ) ) THEN
653 TEMP1 = MIN( SN / AAQQ, BIG / ( DSQRT( DBLE( N ) )*AAPP ) )
660 * Scale, if necessary
662 IF( TEMP1.NE.ONE ) THEN
663 CALL DLASCL( 'G', 0, 0, ONE, TEMP1, N, 1, SVA, N, IERR )
666 IF( SKL.NE.ONE ) THEN
667 CALL DLASCL( JOBA, 0, 0, ONE, SKL, M, N, A, LDA, IERR )
671 * Row-cyclic Jacobi SVD algorithm with column pivoting
673 EMPTSW = ( N*( N-1 ) ) / 2
677 * A is represented in factored form A = A * diag(WORK), where diag(WORK)
678 * is initialized to identity. WORK is updated during fast scaled
687 *[TP] SWBAND is a tuning parameter [TP]. It is meaningful and effective
688 * if DGESVJ is used as a computational routine in the preconditioned
689 * Jacobi SVD algorithm DGESVJ. For sweeps i=1:SWBAND the procedure
690 * works on pivots inside a band-like region around the diagonal.
691 * The boundaries are determined dynamically, based on the number of
692 * pivots above a threshold.
695 *[TP] KBL is a tuning parameter that defines the tile size in the
696 * tiling of the p-q loops of pivot pairs. In general, an optimal
697 * value of KBL depends on the matrix dimensions and on the
698 * parameters of the computer's memory.
701 IF( ( NBL*KBL ).NE.N )NBL = NBL + 1
704 *[TP] BLKSKIP is a tuning parameter that depends on SWBAND and KBL.
706 ROWSKIP = MIN( 5, KBL )
707 *[TP] ROWSKIP is a tuning parameter.
710 *[TP] LKAHEAD is a tuning parameter.
712 * Quasi block transformations, using the lower (upper) triangular
713 * structure of the input matrix. The quasi-block-cycling usually
714 * invokes cubic convergence. Big part of this cycle is done inside
715 * canonical subspaces of dimensions less than M.
717 IF( ( LOWER .OR. UPPER ) .AND. ( N.GT.MAX( 64, 4*KBL ) ) ) THEN
718 *[TP] The number of partition levels and the actual partition are
731 * This works very well on lower triangular matrices, in particular
732 * in the framework of the preconditioned Jacobi SVD (xGEJSV).
733 * The idea is simple:
734 * [+ 0 0 0] Note that Jacobi transformations of [0 0]
736 * [+ + x 0] actually work on [x 0] [x 0]
737 * [+ + x x] [x x]. [x x]
739 CALL DGSVJ0( JOBV, M-N34, N-N34, A( N34+1, N34+1 ), LDA,
740 $ WORK( N34+1 ), SVA( N34+1 ), MVL,
741 $ V( N34*q+1, N34+1 ), LDV, EPSLN, SFMIN, TOL,
742 $ 2, WORK( N+1 ), LWORK-N, IERR )
744 CALL DGSVJ0( JOBV, M-N2, N34-N2, A( N2+1, N2+1 ), LDA,
745 $ WORK( N2+1 ), SVA( N2+1 ), MVL,
746 $ V( N2*q+1, N2+1 ), LDV, EPSLN, SFMIN, TOL, 2,
747 $ WORK( N+1 ), LWORK-N, IERR )
749 CALL DGSVJ1( JOBV, M-N2, N-N2, N4, A( N2+1, N2+1 ), LDA,
750 $ WORK( N2+1 ), SVA( N2+1 ), MVL,
751 $ V( N2*q+1, N2+1 ), LDV, EPSLN, SFMIN, TOL, 1,
752 $ WORK( N+1 ), LWORK-N, IERR )
754 CALL DGSVJ0( JOBV, M-N4, N2-N4, A( N4+1, N4+1 ), LDA,
755 $ WORK( N4+1 ), SVA( N4+1 ), MVL,
756 $ V( N4*q+1, N4+1 ), LDV, EPSLN, SFMIN, TOL, 1,
757 $ WORK( N+1 ), LWORK-N, IERR )
759 CALL DGSVJ0( JOBV, M, N4, A, LDA, WORK, SVA, MVL, V, LDV,
760 $ EPSLN, SFMIN, TOL, 1, WORK( N+1 ), LWORK-N,
763 CALL DGSVJ1( JOBV, M, N2, N4, A, LDA, WORK, SVA, MVL, V,
764 $ LDV, EPSLN, SFMIN, TOL, 1, WORK( N+1 ),
768 ELSE IF( UPPER ) THEN
771 CALL DGSVJ0( JOBV, N4, N4, A, LDA, WORK, SVA, MVL, V, LDV,
772 $ EPSLN, SFMIN, TOL, 2, WORK( N+1 ), LWORK-N,
775 CALL DGSVJ0( JOBV, N2, N4, A( 1, N4+1 ), LDA, WORK( N4+1 ),
776 $ SVA( N4+1 ), MVL, V( N4*q+1, N4+1 ), LDV,
777 $ EPSLN, SFMIN, TOL, 1, WORK( N+1 ), LWORK-N,
780 CALL DGSVJ1( JOBV, N2, N2, N4, A, LDA, WORK, SVA, MVL, V,
781 $ LDV, EPSLN, SFMIN, TOL, 1, WORK( N+1 ),
784 CALL DGSVJ0( JOBV, N2+N4, N4, A( 1, N2+1 ), LDA,
785 $ WORK( N2+1 ), SVA( N2+1 ), MVL,
786 $ V( N2*q+1, N2+1 ), LDV, EPSLN, SFMIN, TOL, 1,
787 $ WORK( N+1 ), LWORK-N, IERR )
793 * .. Row-cyclic pivot strategy with de Rijk's pivoting ..
795 DO 1993 i = 1, NSWEEP
806 * Each sweep is unrolled using KBL-by-KBL tiles over the pivot pairs
807 * 1 <= p < q <= N. This is the first step toward a blocked implementation
808 * of the rotations. New implementation, based on block transformations,
809 * is under development.
813 igl = ( ibr-1 )*KBL + 1
815 DO 1002 ir1 = 0, MIN( LKAHEAD, NBL-ibr )
819 DO 2001 p = igl, MIN( igl+KBL-1, N-1 )
821 * .. de Rijk's pivoting
823 q = IDAMAX( N-p+1, SVA( p ), 1 ) + p - 1
825 CALL DSWAP( M, A( 1, p ), 1, A( 1, q ), 1 )
826 IF( RSVEC )CALL DSWAP( MVL, V( 1, p ), 1,
832 WORK( p ) = WORK( q )
838 * Column norms are periodically updated by explicit
841 * Unfortunately, some BLAS implementations compute DNRM2(M,A(1,p),1)
842 * as DSQRT(DDOT(M,A(1,p),1,A(1,p),1)), which may cause the result to
843 * overflow for ||A(:,p)||_2 > DSQRT(overflow_threshold), and to
844 * underflow for ||A(:,p)||_2 < DSQRT(underflow_threshold).
845 * Hence, DNRM2 cannot be trusted, not even in the case when
846 * the true norm is far from the under(over)flow boundaries.
847 * If properly implemented DNRM2 is available, the IF-THEN-ELSE
848 * below should read "AAPP = DNRM2( M, A(1,p), 1 ) * WORK(p)".
850 IF( ( SVA( p ).LT.ROOTBIG ) .AND.
851 $ ( SVA( p ).GT.ROOTSFMIN ) ) THEN
852 SVA( p ) = DNRM2( M, A( 1, p ), 1 )*WORK( p )
856 CALL DLASSQ( M, A( 1, p ), 1, TEMP1, AAPP )
857 SVA( p ) = TEMP1*DSQRT( AAPP )*WORK( p )
864 IF( AAPP.GT.ZERO ) THEN
868 DO 2002 q = p + 1, MIN( igl+KBL-1, N )
872 IF( AAQQ.GT.ZERO ) THEN
875 IF( AAQQ.GE.ONE ) THEN
876 ROTOK = ( SMALL*AAPP ).LE.AAQQ
877 IF( AAPP.LT.( BIG / AAQQ ) ) THEN
878 AAPQ = ( DDOT( M, A( 1, p ), 1, A( 1,
879 $ q ), 1 )*WORK( p )*WORK( q ) /
882 CALL DCOPY( M, A( 1, p ), 1,
884 CALL DLASCL( 'G', 0, 0, AAPP,
886 $ WORK( N+1 ), LDA, IERR )
887 AAPQ = DDOT( M, WORK( N+1 ), 1,
888 $ A( 1, q ), 1 )*WORK( q ) / AAQQ
891 ROTOK = AAPP.LE.( AAQQ / SMALL )
892 IF( AAPP.GT.( SMALL / AAQQ ) ) THEN
893 AAPQ = ( DDOT( M, A( 1, p ), 1, A( 1,
894 $ q ), 1 )*WORK( p )*WORK( q ) /
897 CALL DCOPY( M, A( 1, q ), 1,
899 CALL DLASCL( 'G', 0, 0, AAQQ,
901 $ WORK( N+1 ), LDA, IERR )
902 AAPQ = DDOT( M, WORK( N+1 ), 1,
903 $ A( 1, p ), 1 )*WORK( p ) / AAPP
907 MXAAPQ = MAX( MXAAPQ, DABS( AAPQ ) )
909 * TO rotate or NOT to rotate, THAT is the question ...
911 IF( DABS( AAPQ ).GT.TOL ) THEN
914 *[RTD] ROTATED = ROTATED + ONE
926 THETA = -HALF*DABS(AQOAP-APOAQ)/AAPQ
928 IF( DABS( THETA ).GT.BIGTHETA ) THEN
931 FASTR( 3 ) = T*WORK( p ) / WORK( q )
932 FASTR( 4 ) = -T*WORK( q ) /
934 CALL DROTM( M, A( 1, p ), 1,
935 $ A( 1, q ), 1, FASTR )
936 IF( RSVEC )CALL DROTM( MVL,
940 SVA( q ) = AAQQ*DSQRT( MAX( ZERO,
941 $ ONE+T*APOAQ*AAPQ ) )
942 AAPP = AAPP*DSQRT( MAX( ZERO,
943 $ ONE-T*AQOAP*AAPQ ) )
944 MXSINJ = MAX( MXSINJ, DABS( T ) )
948 * .. choose correct signum for THETA and rotate
950 THSIGN = -DSIGN( ONE, AAPQ )
951 T = ONE / ( THETA+THSIGN*
952 $ DSQRT( ONE+THETA*THETA ) )
953 CS = DSQRT( ONE / ( ONE+T*T ) )
956 MXSINJ = MAX( MXSINJ, DABS( SN ) )
957 SVA( q ) = AAQQ*DSQRT( MAX( ZERO,
958 $ ONE+T*APOAQ*AAPQ ) )
959 AAPP = AAPP*DSQRT( MAX( ZERO,
960 $ ONE-T*AQOAP*AAPQ ) )
962 APOAQ = WORK( p ) / WORK( q )
963 AQOAP = WORK( q ) / WORK( p )
964 IF( WORK( p ).GE.ONE ) THEN
965 IF( WORK( q ).GE.ONE ) THEN
967 FASTR( 4 ) = -T*AQOAP
968 WORK( p ) = WORK( p )*CS
969 WORK( q ) = WORK( q )*CS
970 CALL DROTM( M, A( 1, p ), 1,
973 IF( RSVEC )CALL DROTM( MVL,
974 $ V( 1, p ), 1, V( 1, q ),
977 CALL DAXPY( M, -T*AQOAP,
980 CALL DAXPY( M, CS*SN*APOAQ,
983 WORK( p ) = WORK( p )*CS
984 WORK( q ) = WORK( q ) / CS
986 CALL DAXPY( MVL, -T*AQOAP,
996 IF( WORK( q ).GE.ONE ) THEN
997 CALL DAXPY( M, T*APOAQ,
1000 CALL DAXPY( M, -CS*SN*AQOAP,
1003 WORK( p ) = WORK( p ) / CS
1004 WORK( q ) = WORK( q )*CS
1006 CALL DAXPY( MVL, T*APOAQ,
1015 IF( WORK( p ).GE.WORK( q ) )
1017 CALL DAXPY( M, -T*AQOAP,
1020 CALL DAXPY( M, CS*SN*APOAQ,
1023 WORK( p ) = WORK( p )*CS
1024 WORK( q ) = WORK( q ) / CS
1036 CALL DAXPY( M, T*APOAQ,
1043 WORK( p ) = WORK( p ) / CS
1044 WORK( q ) = WORK( q )*CS
1047 $ T*APOAQ, V( 1, p ),
1060 * .. have to use modified Gram-Schmidt like transformation
1061 CALL DCOPY( M, A( 1, p ), 1,
1063 CALL DLASCL( 'G', 0, 0, AAPP, ONE, M,
1064 $ 1, WORK( N+1 ), LDA,
1066 CALL DLASCL( 'G', 0, 0, AAQQ, ONE, M,
1067 $ 1, A( 1, q ), LDA, IERR )
1068 TEMP1 = -AAPQ*WORK( p ) / WORK( q )
1069 CALL DAXPY( M, TEMP1, WORK( N+1 ), 1,
1071 CALL DLASCL( 'G', 0, 0, ONE, AAQQ, M,
1072 $ 1, A( 1, q ), LDA, IERR )
1073 SVA( q ) = AAQQ*DSQRT( MAX( ZERO,
1075 MXSINJ = MAX( MXSINJ, SFMIN )
1077 * END IF ROTOK THEN ... ELSE
1079 * In the case of cancellation in updating SVA(q), SVA(p)
1080 * recompute SVA(q), SVA(p).
1082 IF( ( SVA( q ) / AAQQ )**2.LE.ROOTEPS )
1084 IF( ( AAQQ.LT.ROOTBIG ) .AND.
1085 $ ( AAQQ.GT.ROOTSFMIN ) ) THEN
1086 SVA( q ) = DNRM2( M, A( 1, q ), 1 )*
1091 CALL DLASSQ( M, A( 1, q ), 1, T,
1093 SVA( q ) = T*DSQRT( AAQQ )*WORK( q )
1096 IF( ( AAPP / AAPP0 ).LE.ROOTEPS ) THEN
1097 IF( ( AAPP.LT.ROOTBIG ) .AND.
1098 $ ( AAPP.GT.ROOTSFMIN ) ) THEN
1099 AAPP = DNRM2( M, A( 1, p ), 1 )*
1104 CALL DLASSQ( M, A( 1, p ), 1, T,
1106 AAPP = T*DSQRT( AAPP )*WORK( p )
1112 * A(:,p) and A(:,q) already numerically orthogonal
1113 IF( ir1.EQ.0 )NOTROT = NOTROT + 1
1114 *[RTD] SKIPPED = SKIPPED + 1
1115 PSKIPPED = PSKIPPED + 1
1118 * A(:,q) is zero column
1119 IF( ir1.EQ.0 )NOTROT = NOTROT + 1
1120 PSKIPPED = PSKIPPED + 1
1123 IF( ( i.LE.SWBAND ) .AND.
1124 $ ( PSKIPPED.GT.ROWSKIP ) ) THEN
1125 IF( ir1.EQ.0 )AAPP = -AAPP
1134 * bailed out of q-loop
1140 IF( ( ir1.EQ.0 ) .AND. ( AAPP.EQ.ZERO ) )
1141 $ NOTROT = NOTROT + MIN( igl+KBL-1, N ) - p
1146 * end of doing the block ( ibr, ibr )
1150 * ... go to the off diagonal blocks
1152 igl = ( ibr-1 )*KBL + 1
1154 DO 2010 jbc = ibr + 1, NBL
1156 jgl = ( jbc-1 )*KBL + 1
1158 * doing the block at ( ibr, jbc )
1161 DO 2100 p = igl, MIN( igl+KBL-1, N )
1164 IF( AAPP.GT.ZERO ) THEN
1168 DO 2200 q = jgl, MIN( jgl+KBL-1, N )
1171 IF( AAQQ.GT.ZERO ) THEN
1174 * .. M x 2 Jacobi SVD ..
1176 * Safe Gram matrix computation
1178 IF( AAQQ.GE.ONE ) THEN
1179 IF( AAPP.GE.AAQQ ) THEN
1180 ROTOK = ( SMALL*AAPP ).LE.AAQQ
1182 ROTOK = ( SMALL*AAQQ ).LE.AAPP
1184 IF( AAPP.LT.( BIG / AAQQ ) ) THEN
1185 AAPQ = ( DDOT( M, A( 1, p ), 1, A( 1,
1186 $ q ), 1 )*WORK( p )*WORK( q ) /
1189 CALL DCOPY( M, A( 1, p ), 1,
1191 CALL DLASCL( 'G', 0, 0, AAPP,
1193 $ WORK( N+1 ), LDA, IERR )
1194 AAPQ = DDOT( M, WORK( N+1 ), 1,
1195 $ A( 1, q ), 1 )*WORK( q ) / AAQQ
1198 IF( AAPP.GE.AAQQ ) THEN
1199 ROTOK = AAPP.LE.( AAQQ / SMALL )
1201 ROTOK = AAQQ.LE.( AAPP / SMALL )
1203 IF( AAPP.GT.( SMALL / AAQQ ) ) THEN
1204 AAPQ = ( DDOT( M, A( 1, p ), 1, A( 1,
1205 $ q ), 1 )*WORK( p )*WORK( q ) /
1208 CALL DCOPY( M, A( 1, q ), 1,
1210 CALL DLASCL( 'G', 0, 0, AAQQ,
1212 $ WORK( N+1 ), LDA, IERR )
1213 AAPQ = DDOT( M, WORK( N+1 ), 1,
1214 $ A( 1, p ), 1 )*WORK( p ) / AAPP
1218 MXAAPQ = MAX( MXAAPQ, DABS( AAPQ ) )
1220 * TO rotate or NOT to rotate, THAT is the question ...
1222 IF( DABS( AAPQ ).GT.TOL ) THEN
1224 *[RTD] ROTATED = ROTATED + 1
1232 THETA = -HALF*DABS(AQOAP-APOAQ)/AAPQ
1233 IF( AAQQ.GT.AAPP0 )THETA = -THETA
1235 IF( DABS( THETA ).GT.BIGTHETA ) THEN
1237 FASTR( 3 ) = T*WORK( p ) / WORK( q )
1238 FASTR( 4 ) = -T*WORK( q ) /
1240 CALL DROTM( M, A( 1, p ), 1,
1241 $ A( 1, q ), 1, FASTR )
1242 IF( RSVEC )CALL DROTM( MVL,
1246 SVA( q ) = AAQQ*DSQRT( MAX( ZERO,
1247 $ ONE+T*APOAQ*AAPQ ) )
1248 AAPP = AAPP*DSQRT( MAX( ZERO,
1249 $ ONE-T*AQOAP*AAPQ ) )
1250 MXSINJ = MAX( MXSINJ, DABS( T ) )
1253 * .. choose correct signum for THETA and rotate
1255 THSIGN = -DSIGN( ONE, AAPQ )
1256 IF( AAQQ.GT.AAPP0 )THSIGN = -THSIGN
1257 T = ONE / ( THETA+THSIGN*
1258 $ DSQRT( ONE+THETA*THETA ) )
1259 CS = DSQRT( ONE / ( ONE+T*T ) )
1261 MXSINJ = MAX( MXSINJ, DABS( SN ) )
1262 SVA( q ) = AAQQ*DSQRT( MAX( ZERO,
1263 $ ONE+T*APOAQ*AAPQ ) )
1264 AAPP = AAPP*DSQRT( MAX( ZERO,
1265 $ ONE-T*AQOAP*AAPQ ) )
1267 APOAQ = WORK( p ) / WORK( q )
1268 AQOAP = WORK( q ) / WORK( p )
1269 IF( WORK( p ).GE.ONE ) THEN
1271 IF( WORK( q ).GE.ONE ) THEN
1272 FASTR( 3 ) = T*APOAQ
1273 FASTR( 4 ) = -T*AQOAP
1274 WORK( p ) = WORK( p )*CS
1275 WORK( q ) = WORK( q )*CS
1276 CALL DROTM( M, A( 1, p ), 1,
1279 IF( RSVEC )CALL DROTM( MVL,
1280 $ V( 1, p ), 1, V( 1, q ),
1283 CALL DAXPY( M, -T*AQOAP,
1286 CALL DAXPY( M, CS*SN*APOAQ,
1290 CALL DAXPY( MVL, -T*AQOAP,
1298 WORK( p ) = WORK( p )*CS
1299 WORK( q ) = WORK( q ) / CS
1302 IF( WORK( q ).GE.ONE ) THEN
1303 CALL DAXPY( M, T*APOAQ,
1306 CALL DAXPY( M, -CS*SN*AQOAP,
1310 CALL DAXPY( MVL, T*APOAQ,
1318 WORK( p ) = WORK( p ) / CS
1319 WORK( q ) = WORK( q )*CS
1321 IF( WORK( p ).GE.WORK( q ) )
1323 CALL DAXPY( M, -T*AQOAP,
1326 CALL DAXPY( M, CS*SN*APOAQ,
1329 WORK( p ) = WORK( p )*CS
1330 WORK( q ) = WORK( q ) / CS
1342 CALL DAXPY( M, T*APOAQ,
1349 WORK( p ) = WORK( p ) / CS
1350 WORK( q ) = WORK( q )*CS
1353 $ T*APOAQ, V( 1, p ),
1366 IF( AAPP.GT.AAQQ ) THEN
1367 CALL DCOPY( M, A( 1, p ), 1,
1369 CALL DLASCL( 'G', 0, 0, AAPP, ONE,
1370 $ M, 1, WORK( N+1 ), LDA,
1372 CALL DLASCL( 'G', 0, 0, AAQQ, ONE,
1373 $ M, 1, A( 1, q ), LDA,
1375 TEMP1 = -AAPQ*WORK( p ) / WORK( q )
1376 CALL DAXPY( M, TEMP1, WORK( N+1 ),
1378 CALL DLASCL( 'G', 0, 0, ONE, AAQQ,
1379 $ M, 1, A( 1, q ), LDA,
1381 SVA( q ) = AAQQ*DSQRT( MAX( ZERO,
1383 MXSINJ = MAX( MXSINJ, SFMIN )
1385 CALL DCOPY( M, A( 1, q ), 1,
1387 CALL DLASCL( 'G', 0, 0, AAQQ, ONE,
1388 $ M, 1, WORK( N+1 ), LDA,
1390 CALL DLASCL( 'G', 0, 0, AAPP, ONE,
1391 $ M, 1, A( 1, p ), LDA,
1393 TEMP1 = -AAPQ*WORK( q ) / WORK( p )
1394 CALL DAXPY( M, TEMP1, WORK( N+1 ),
1396 CALL DLASCL( 'G', 0, 0, ONE, AAPP,
1397 $ M, 1, A( 1, p ), LDA,
1399 SVA( p ) = AAPP*DSQRT( MAX( ZERO,
1401 MXSINJ = MAX( MXSINJ, SFMIN )
1404 * END IF ROTOK THEN ... ELSE
1406 * In the case of cancellation in updating SVA(q)
1407 * .. recompute SVA(q)
1408 IF( ( SVA( q ) / AAQQ )**2.LE.ROOTEPS )
1410 IF( ( AAQQ.LT.ROOTBIG ) .AND.
1411 $ ( AAQQ.GT.ROOTSFMIN ) ) THEN
1412 SVA( q ) = DNRM2( M, A( 1, q ), 1 )*
1417 CALL DLASSQ( M, A( 1, q ), 1, T,
1419 SVA( q ) = T*DSQRT( AAQQ )*WORK( q )
1422 IF( ( AAPP / AAPP0 )**2.LE.ROOTEPS ) THEN
1423 IF( ( AAPP.LT.ROOTBIG ) .AND.
1424 $ ( AAPP.GT.ROOTSFMIN ) ) THEN
1425 AAPP = DNRM2( M, A( 1, p ), 1 )*
1430 CALL DLASSQ( M, A( 1, p ), 1, T,
1432 AAPP = T*DSQRT( AAPP )*WORK( p )
1436 * end of OK rotation
1439 *[RTD] SKIPPED = SKIPPED + 1
1440 PSKIPPED = PSKIPPED + 1
1445 PSKIPPED = PSKIPPED + 1
1449 IF( ( i.LE.SWBAND ) .AND. ( IJBLSK.GE.BLSKIP ) )
1455 IF( ( i.LE.SWBAND ) .AND.
1456 $ ( PSKIPPED.GT.ROWSKIP ) ) THEN
1470 IF( AAPP.EQ.ZERO )NOTROT = NOTROT +
1471 $ MIN( jgl+KBL-1, N ) - jgl + 1
1472 IF( AAPP.LT.ZERO )NOTROT = 0
1479 * end of the jbc-loop
1481 *2011 bailed out of the jbc-loop
1482 DO 2012 p = igl, MIN( igl+KBL-1, N )
1483 SVA( p ) = DABS( SVA( p ) )
1487 *2000 :: end of the ibr-loop
1490 IF( ( SVA( N ).LT.ROOTBIG ) .AND. ( SVA( N ).GT.ROOTSFMIN ) )
1492 SVA( N ) = DNRM2( M, A( 1, N ), 1 )*WORK( N )
1496 CALL DLASSQ( M, A( 1, N ), 1, T, AAPP )
1497 SVA( N ) = T*DSQRT( AAPP )*WORK( N )
1500 * Additional steering devices
1502 IF( ( i.LT.SWBAND ) .AND. ( ( MXAAPQ.LE.ROOTTOL ) .OR.
1503 $ ( ISWROT.LE.N ) ) )SWBAND = i
1505 IF( ( i.GT.SWBAND+1 ) .AND. ( MXAAPQ.LT.DSQRT( DBLE( N ) )*
1506 $ TOL ) .AND. ( DBLE( N )*MXAAPQ*MXSINJ.LT.TOL ) ) THEN
1510 IF( NOTROT.GE.EMPTSW )GO TO 1994
1513 * end i=1:NSWEEP loop
1515 * #:( Reaching this point means that the procedure has not converged.
1520 * #:) Reaching this point means numerical convergence after the i-th
1524 * #:) INFO = 0 confirms successful iterations.
1527 * Sort the singular values and find how many are above
1528 * the underflow threshold.
1532 DO 5991 p = 1, N - 1
1533 q = IDAMAX( N-p+1, SVA( p ), 1 ) + p - 1
1539 WORK( p ) = WORK( q )
1541 CALL DSWAP( M, A( 1, p ), 1, A( 1, q ), 1 )
1542 IF( RSVEC )CALL DSWAP( MVL, V( 1, p ), 1, V( 1, q ), 1 )
1544 IF( SVA( p ).NE.ZERO ) THEN
1546 IF( SVA( p )*SKL.GT.SFMIN )N2 = N2 + 1
1549 IF( SVA( N ).NE.ZERO ) THEN
1551 IF( SVA( N )*SKL.GT.SFMIN )N2 = N2 + 1
1554 * Normalize the left singular vectors.
1556 IF( LSVEC .OR. UCTOL ) THEN
1558 CALL DSCAL( M, WORK( p ) / SVA( p ), A( 1, p ), 1 )
1562 * Scale the product of Jacobi rotations (assemble the fast rotations).
1567 CALL DSCAL( MVL, WORK( p ), V( 1, p ), 1 )
1571 TEMP1 = ONE / DNRM2( MVL, V( 1, p ), 1 )
1572 CALL DSCAL( MVL, TEMP1, V( 1, p ), 1 )
1577 * Undo scaling, if necessary (and possible).
1578 IF( ( ( SKL.GT.ONE ) .AND. ( SVA( 1 ).LT.( BIG / SKL) ) )
1579 $ .OR. ( ( SKL.LT.ONE ) .AND. ( SVA( MAX( N2, 1 ) ) .GT.
1580 $ ( SFMIN / SKL) ) ) ) THEN
1582 SVA( P ) = SKL*SVA( P )
1588 * The singular values of A are SKL*SVA(1:N). If SKL.NE.ONE
1589 * then some of the singular values may overflow or underflow and
1590 * the spectrum is given in this factored representation.
1592 WORK( 2 ) = DBLE( N4 )
1593 * N4 is the number of computed nonzero singular values of A.
1595 WORK( 3 ) = DBLE( N2 )
1596 * N2 is the number of singular values of A greater than SFMIN.
1597 * If N2<N, SVA(N2:N) contains ZEROS and/or denormalized numbers
1598 * that may carry some information.
1600 WORK( 4 ) = DBLE( i )
1601 * i is the index of the last sweep before declaring convergence.
1604 * MXAAPQ is the largest absolute value of scaled pivots in the
1608 * MXSINJ is the largest absolute value of the sines of Jacobi angles