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