14 typedef long long BLASLONG;
15 typedef unsigned long long BLASULONG;
17 typedef long BLASLONG;
18 typedef unsigned long BLASULONG;
22 typedef BLASLONG blasint;
24 #define blasabs(x) llabs(x)
26 #define blasabs(x) labs(x)
30 #define blasabs(x) abs(x)
33 typedef blasint integer;
35 typedef unsigned int uinteger;
36 typedef char *address;
37 typedef short int shortint;
39 typedef double doublereal;
40 typedef struct { real r, i; } complex;
41 typedef struct { doublereal r, i; } doublecomplex;
43 static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
44 static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
45 static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
46 static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
48 static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
49 static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
50 static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
51 static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
53 #define pCf(z) (*_pCf(z))
54 #define pCd(z) (*_pCd(z))
56 typedef short int shortlogical;
57 typedef char logical1;
58 typedef char integer1;
63 /* Extern is for use with -E */
74 /*external read, write*/
83 /*internal read, write*/
113 /*rewind, backspace, endfile*/
125 ftnint *inex; /*parameters in standard's order*/
151 union Multitype { /* for multiple entry points */
162 typedef union Multitype Multitype;
164 struct Vardesc { /* for Namelist */
170 typedef struct Vardesc Vardesc;
177 typedef struct Namelist Namelist;
179 #define abs(x) ((x) >= 0 ? (x) : -(x))
180 #define dabs(x) (fabs(x))
181 #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
182 #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
183 #define dmin(a,b) (f2cmin(a,b))
184 #define dmax(a,b) (f2cmax(a,b))
185 #define bit_test(a,b) ((a) >> (b) & 1)
186 #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
187 #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
189 #define abort_() { sig_die("Fortran abort routine called", 1); }
190 #define c_abs(z) (cabsf(Cf(z)))
191 #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
193 #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
194 #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
196 #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
197 #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
199 #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
200 #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
201 #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
202 //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
203 #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
204 #define d_abs(x) (fabs(*(x)))
205 #define d_acos(x) (acos(*(x)))
206 #define d_asin(x) (asin(*(x)))
207 #define d_atan(x) (atan(*(x)))
208 #define d_atn2(x, y) (atan2(*(x),*(y)))
209 #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
210 #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
211 #define d_cos(x) (cos(*(x)))
212 #define d_cosh(x) (cosh(*(x)))
213 #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
214 #define d_exp(x) (exp(*(x)))
215 #define d_imag(z) (cimag(Cd(z)))
216 #define r_imag(z) (cimagf(Cf(z)))
217 #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
218 #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
219 #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
220 #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
221 #define d_log(x) (log(*(x)))
222 #define d_mod(x, y) (fmod(*(x), *(y)))
223 #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
224 #define d_nint(x) u_nint(*(x))
225 #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
226 #define d_sign(a,b) u_sign(*(a),*(b))
227 #define r_sign(a,b) u_sign(*(a),*(b))
228 #define d_sin(x) (sin(*(x)))
229 #define d_sinh(x) (sinh(*(x)))
230 #define d_sqrt(x) (sqrt(*(x)))
231 #define d_tan(x) (tan(*(x)))
232 #define d_tanh(x) (tanh(*(x)))
233 #define i_abs(x) abs(*(x))
234 #define i_dnnt(x) ((integer)u_nint(*(x)))
235 #define i_len(s, n) (n)
236 #define i_nint(x) ((integer)u_nint(*(x)))
237 #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
238 #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
239 #define pow_si(B,E) spow_ui(*(B),*(E))
240 #define pow_ri(B,E) spow_ui(*(B),*(E))
241 #define pow_di(B,E) dpow_ui(*(B),*(E))
242 #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
243 #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
244 #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
245 #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
246 #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
247 #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
248 #define sig_die(s, kill) { exit(1); }
249 #define s_stop(s, n) {exit(0);}
250 static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
251 #define z_abs(z) (cabs(Cd(z)))
252 #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
253 #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
254 #define myexit_() break;
255 #define mycycle() continue;
256 #define myceiling(w) {ceil(w)}
257 #define myhuge(w) {HUGE_VAL}
258 //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
259 #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
261 /* procedure parameter types for -A and -C++ */
263 #define F2C_proc_par_types 1
265 typedef logical (*L_fp)(...);
267 typedef logical (*L_fp)();
270 static float spow_ui(float x, integer n) {
271 float pow=1.0; unsigned long int u;
273 if(n < 0) n = -n, x = 1/x;
282 static double dpow_ui(double x, integer n) {
283 double pow=1.0; unsigned long int u;
285 if(n < 0) n = -n, x = 1/x;
295 static _Fcomplex cpow_ui(complex x, integer n) {
296 complex pow={1.0,0.0}; unsigned long int u;
298 if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
300 if(u & 01) pow.r *= x.r, pow.i *= x.i;
301 if(u >>= 1) x.r *= x.r, x.i *= x.i;
305 _Fcomplex p={pow.r, pow.i};
309 static _Complex float cpow_ui(_Complex float x, integer n) {
310 _Complex float pow=1.0; unsigned long int u;
312 if(n < 0) n = -n, x = 1/x;
323 static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
324 _Dcomplex pow={1.0,0.0}; unsigned long int u;
326 if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
328 if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
329 if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
333 _Dcomplex p = {pow._Val[0], pow._Val[1]};
337 static _Complex double zpow_ui(_Complex double x, integer n) {
338 _Complex double pow=1.0; unsigned long int u;
340 if(n < 0) n = -n, x = 1/x;
350 static integer pow_ii(integer x, integer n) {
351 integer pow; unsigned long int u;
353 if (n == 0 || x == 1) pow = 1;
354 else if (x != -1) pow = x == 0 ? 1/x : 0;
357 if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
367 static integer dmaxloc_(double *w, integer s, integer e, integer *n)
369 double m; integer i, mi;
370 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
371 if (w[i-1]>m) mi=i ,m=w[i-1];
374 static integer smaxloc_(float *w, integer s, integer e, integer *n)
376 float m; integer i, mi;
377 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
378 if (w[i-1]>m) mi=i ,m=w[i-1];
381 static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
382 integer n = *n_, incx = *incx_, incy = *incy_, i;
384 _Fcomplex zdotc = {0.0, 0.0};
385 if (incx == 1 && incy == 1) {
386 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
387 zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
388 zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
391 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
392 zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
393 zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
399 _Complex float zdotc = 0.0;
400 if (incx == 1 && incy == 1) {
401 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
402 zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
405 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
406 zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
412 static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
413 integer n = *n_, incx = *incx_, incy = *incy_, i;
415 _Dcomplex zdotc = {0.0, 0.0};
416 if (incx == 1 && incy == 1) {
417 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
418 zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
419 zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
422 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
423 zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
424 zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
430 _Complex double zdotc = 0.0;
431 if (incx == 1 && incy == 1) {
432 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
433 zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
436 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
437 zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
443 static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
444 integer n = *n_, incx = *incx_, incy = *incy_, i;
446 _Fcomplex zdotc = {0.0, 0.0};
447 if (incx == 1 && incy == 1) {
448 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
449 zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
450 zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
453 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
454 zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
455 zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
461 _Complex float zdotc = 0.0;
462 if (incx == 1 && incy == 1) {
463 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
464 zdotc += Cf(&x[i]) * Cf(&y[i]);
467 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
468 zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
474 static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
475 integer n = *n_, incx = *incx_, incy = *incy_, i;
477 _Dcomplex zdotc = {0.0, 0.0};
478 if (incx == 1 && incy == 1) {
479 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
480 zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
481 zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
484 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
485 zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
486 zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
492 _Complex double zdotc = 0.0;
493 if (incx == 1 && incy == 1) {
494 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
495 zdotc += Cd(&x[i]) * Cd(&y[i]);
498 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
499 zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
505 /* -- translated by f2c (version 20000121).
506 You must link the resulting object file with the libraries:
507 -lf2c -lm (in that order)
513 /* Table of constant values */
515 static integer c__1 = 1;
516 static integer c__0 = 0;
517 static doublereal c_b27 = 1.;
519 /* > \brief <b> ZGSVJ0 pre-processor for the routine zgesvj. </b> */
521 /* =========== DOCUMENTATION =========== */
523 /* Online html documentation available at */
524 /* http://www.netlib.org/lapack/explore-html/ */
527 /* > Download ZGSVJ0 + dependencies */
528 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgsvj0.
531 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgsvj0.
534 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgsvj0.
542 /* SUBROUTINE ZGSVJ0( JOBV, M, N, A, LDA, D, SVA, MV, V, LDV, EPS, */
543 /* SFMIN, TOL, NSWEEP, WORK, LWORK, INFO ) */
545 /* INTEGER INFO, LDA, LDV, LWORK, M, MV, N, NSWEEP */
546 /* DOUBLE PRECISION EPS, SFMIN, TOL */
547 /* CHARACTER*1 JOBV */
548 /* COMPLEX*16 A( LDA, * ), D( N ), V( LDV, * ), WORK( LWORK ) */
549 /* DOUBLE PRECISION SVA( N ) */
552 /* > \par Purpose: */
557 /* > ZGSVJ0 is called from ZGESVJ as a pre-processor and that is its main */
558 /* > purpose. It applies Jacobi rotations in the same way as ZGESVJ does, but */
559 /* > it does not check convergence (stopping criterion). Few tuning */
560 /* > parameters (marked by [TP]) are available for the implementer. */
566 /* > \param[in] JOBV */
568 /* > JOBV is CHARACTER*1 */
569 /* > Specifies whether the output from this procedure is used */
570 /* > to compute the matrix V: */
571 /* > = 'V': the product of the Jacobi rotations is accumulated */
572 /* > by postmulyiplying the N-by-N array V. */
573 /* > (See the description of V.) */
574 /* > = 'A': the product of the Jacobi rotations is accumulated */
575 /* > by postmulyiplying the MV-by-N array V. */
576 /* > (See the descriptions of MV and V.) */
577 /* > = 'N': the Jacobi rotations are not accumulated. */
583 /* > The number of rows of the input matrix A. M >= 0. */
589 /* > The number of columns of the input matrix A. */
593 /* > \param[in,out] A */
595 /* > A is COMPLEX*16 array, dimension (LDA,N) */
596 /* > On entry, M-by-N matrix A, such that A*diag(D) represents */
597 /* > the input matrix. */
599 /* > A_onexit * diag(D_onexit) represents the input matrix A*diag(D) */
600 /* > post-multiplied by a sequence of Jacobi rotations, where the */
601 /* > rotation threshold and the total number of sweeps are given in */
602 /* > TOL and NSWEEP, respectively. */
603 /* > (See the descriptions of D, TOL and NSWEEP.) */
606 /* > \param[in] LDA */
608 /* > LDA is INTEGER */
609 /* > The leading dimension of the array A. LDA >= f2cmax(1,M). */
612 /* > \param[in,out] D */
614 /* > D is COMPLEX*16 array, dimension (N) */
615 /* > The array D accumulates the scaling factors from the complex scaled */
616 /* > Jacobi rotations. */
617 /* > On entry, A*diag(D) represents the input matrix. */
618 /* > On exit, A_onexit*diag(D_onexit) represents the input matrix */
619 /* > post-multiplied by a sequence of Jacobi rotations, where the */
620 /* > rotation threshold and the total number of sweeps are given in */
621 /* > TOL and NSWEEP, respectively. */
622 /* > (See the descriptions of A, TOL and NSWEEP.) */
625 /* > \param[in,out] SVA */
627 /* > SVA is DOUBLE PRECISION array, dimension (N) */
628 /* > On entry, SVA contains the Euclidean norms of the columns of */
629 /* > the matrix A*diag(D). */
630 /* > On exit, SVA contains the Euclidean norms of the columns of */
631 /* > the matrix A_onexit*diag(D_onexit). */
634 /* > \param[in] MV */
636 /* > MV is INTEGER */
637 /* > If JOBV = 'A', then MV rows of V are post-multipled by a */
638 /* > sequence of Jacobi rotations. */
639 /* > If JOBV = 'N', then MV is not referenced. */
642 /* > \param[in,out] V */
644 /* > V is COMPLEX*16 array, dimension (LDV,N) */
645 /* > If JOBV = 'V' then N rows of V are post-multipled by a */
646 /* > sequence of Jacobi rotations. */
647 /* > If JOBV = 'A' then MV rows of V are post-multipled by a */
648 /* > sequence of Jacobi rotations. */
649 /* > If JOBV = 'N', then V is not referenced. */
652 /* > \param[in] LDV */
654 /* > LDV is INTEGER */
655 /* > The leading dimension of the array V, LDV >= 1. */
656 /* > If JOBV = 'V', LDV >= N. */
657 /* > If JOBV = 'A', LDV >= MV. */
660 /* > \param[in] EPS */
662 /* > EPS is DOUBLE PRECISION */
663 /* > EPS = DLAMCH('Epsilon') */
666 /* > \param[in] SFMIN */
668 /* > SFMIN is DOUBLE PRECISION */
669 /* > SFMIN = DLAMCH('Safe Minimum') */
672 /* > \param[in] TOL */
674 /* > TOL is DOUBLE PRECISION */
675 /* > TOL is the threshold for Jacobi rotations. For a pair */
676 /* > A(:,p), A(:,q) of pivot columns, the Jacobi rotation is */
677 /* > applied only if ABS(COS(angle(A(:,p),A(:,q)))) > TOL. */
680 /* > \param[in] NSWEEP */
682 /* > NSWEEP is INTEGER */
683 /* > NSWEEP is the number of sweeps of Jacobi rotations to be */
687 /* > \param[out] WORK */
689 /* > WORK is COMPLEX*16 array, dimension (LWORK) */
692 /* > \param[in] LWORK */
694 /* > LWORK is INTEGER */
695 /* > LWORK is the dimension of WORK. LWORK >= M. */
698 /* > \param[out] INFO */
700 /* > INFO is INTEGER */
701 /* > = 0: successful exit. */
702 /* > < 0: if INFO = -i, then the i-th argument had an illegal value */
708 /* > \author Univ. of Tennessee */
709 /* > \author Univ. of California Berkeley */
710 /* > \author Univ. of Colorado Denver */
711 /* > \author NAG Ltd. */
713 /* > \date June 2016 */
715 /* > \ingroup complex16OTHERcomputational */
717 /* > \par Further Details: */
718 /* ===================== */
720 /* > ZGSVJ0 is used just to enable ZGESVJ to call a simplified version of */
721 /* > itself to work on a submatrix of the original matrix. */
726 /* > Zlatko Drmac (Zagreb, Croatia) */
728 /* > \par Bugs, Examples and Comments: */
729 /* ============================ */
731 /* > Please report all bugs and send interesting test examples and comments to */
732 /* > drmac@math.hr. Thank you. */
734 /* ===================================================================== */
735 /* Subroutine */ int zgsvj0_(char *jobv, integer *m, integer *n,
736 doublecomplex *a, integer *lda, doublecomplex *d__, doublereal *sva,
737 integer *mv, doublecomplex *v, integer *ldv, doublereal *eps,
738 doublereal *sfmin, doublereal *tol, integer *nsweep, doublecomplex *
739 work, integer *lwork, integer *info)
741 /* System generated locals */
742 integer a_dim1, a_offset, v_dim1, v_offset, i__1, i__2, i__3, i__4, i__5,
744 doublereal d__1, d__2;
745 doublecomplex z__1, z__2, z__3;
747 /* Local variables */
755 extern /* Subroutine */ int zrot_(integer *, doublecomplex *, integer *,
756 doublecomplex *, integer *, doublereal *, doublecomplex *);
757 doublereal aapp0, aapq1, temp1;
759 doublereal t, apoaq, aqoap;
760 extern logical lsame_(char *, char *);
761 doublereal theta, small;
762 logical applv, rsvec;
763 extern /* Double Complex */ VOID zdotc_(doublecomplex *, integer *,
764 doublecomplex *, integer *, doublecomplex *, integer *);
766 extern /* Subroutine */ int zcopy_(integer *, doublecomplex *, integer *,
767 doublecomplex *, integer *), zswap_(integer *, doublecomplex *,
768 integer *, doublecomplex *, integer *), zaxpy_(integer *,
769 doublecomplex *, doublecomplex *, integer *, doublecomplex *,
771 doublereal rootsfmin;
772 extern doublereal dznrm2_(integer *, doublecomplex *, integer *);
774 extern integer idamax_(integer *, doublereal *, integer *);
775 extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
776 integer ijblsk, swband, blskip;
778 extern /* Subroutine */ int zlascl_(char *, integer *, integer *,
779 doublereal *, doublereal *, integer *, integer *, doublecomplex *,
780 integer *, integer *);
781 doublereal thsign, mxsinj;
783 extern /* Subroutine */ int zlassq_(integer *, doublecomplex *, integer *,
784 doublereal *, doublereal *);
785 integer emptsw, notrot, iswrot, jbc;
787 integer kbl, lkahead, igl, ibr, jgl, nbl, mvl;
788 doublereal rootbig, rooteps;
793 /* -- LAPACK computational routine (version 3.8.0) -- */
794 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
795 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
799 /* ===================================================================== */
804 /* Test the input parameters. */
806 /* Parameter adjustments */
810 a_offset = 1 + a_dim1 * 1;
813 v_offset = 1 + v_dim1 * 1;
818 applv = lsame_(jobv, "A");
819 rsvec = lsame_(jobv, "V");
820 if (! (rsvec || applv || lsame_(jobv, "N"))) {
824 } else if (*n < 0 || *n > *m) {
826 } else if (*lda < *m) {
828 } else if ((rsvec || applv) && *mv < 0) {
830 } else if (rsvec && *ldv < *n || applv && *ldv < *mv) {
832 } else if (*tol <= *eps) {
834 } else if (*nsweep < 0) {
836 } else if (*lwork < *m) {
845 xerbla_("ZGSVJ0", &i__1, (ftnlen)6);
854 rsvec = rsvec || applv;
855 rooteps = sqrt(*eps);
856 rootsfmin = sqrt(*sfmin);
857 small = *sfmin / *eps;
859 rootbig = 1. / rootsfmin;
860 bigtheta = 1. / rooteps;
861 roottol = sqrt(*tol);
864 emptsw = *n * (*n - 1) / 2;
869 /* [TP] SWBAND is a tuning parameter [TP]. It is meaningful and effective */
870 /* if ZGESVJ is used as a computational routine in the preconditioned */
871 /* Jacobi SVD algorithm ZGEJSV. For sweeps i=1:SWBAND the procedure */
872 /* works on pivots inside a band-like region around the diagonal. */
873 /* The boundaries are determined dynamically, based on the number of */
874 /* pivots above a threshold. */
877 /* [TP] KBL is a tuning parameter that defines the tile size in the */
878 /* tiling of the p-q loops of pivot pairs. In general, an optimal */
879 /* value of KBL depends on the matrix dimensions and on the */
880 /* parameters of the computer's memory. */
883 if (nbl * kbl != *n) {
887 /* Computing 2nd power */
889 blskip = i__1 * i__1;
890 /* [TP] BLKSKIP is a tuning parameter that depends on SWBAND and KBL. */
892 rowskip = f2cmin(5,kbl);
893 /* [TP] ROWSKIP is a tuning parameter. */
896 /* [TP] LKAHEAD is a tuning parameter. */
898 /* Quasi block transformations, using the lower (upper) triangular */
899 /* structure of the input matrix. The quasi-block-cycling usually */
900 /* invokes cubic convergence. Big part of this cycle is done inside */
901 /* canonical subspaces of dimensions less than M. */
906 for (i__ = 1; i__ <= i__1; ++i__) {
916 /* Each sweep is unrolled using KBL-by-KBL tiles over the pivot pairs */
917 /* 1 <= p < q <= N. This is the first step toward a blocked implementation */
918 /* of the rotations. New implementation, based on block transformations, */
919 /* is under development. */
922 for (ibr = 1; ibr <= i__2; ++ibr) {
924 igl = (ibr - 1) * kbl + 1;
927 i__4 = lkahead, i__5 = nbl - ibr;
928 i__3 = f2cmin(i__4,i__5);
929 for (ir1 = 0; ir1 <= i__3; ++ir1) {
934 i__5 = igl + kbl - 1, i__6 = *n - 1;
935 i__4 = f2cmin(i__5,i__6);
936 for (p = igl; p <= i__4; ++p) {
940 q = idamax_(&i__5, &sva[p], &c__1) + p - 1;
942 zswap_(m, &a[p * a_dim1 + 1], &c__1, &a[q * a_dim1 +
945 zswap_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q *
952 aapq.r = d__[i__5].r, aapq.i = d__[i__5].i;
955 d__[i__5].r = d__[i__6].r, d__[i__5].i = d__[i__6].i;
957 d__[i__5].r = aapq.r, d__[i__5].i = aapq.i;
962 /* Column norms are periodically updated by explicit */
963 /* norm computation. */
965 /* Unfortunately, some BLAS implementations compute SNCRM2(M,A(1,p),1) */
966 /* as SQRT(S=ZDOTC(M,A(1,p),1,A(1,p),1)), which may cause the result to */
967 /* overflow for ||A(:,p)||_2 > SQRT(overflow_threshold), and to */
968 /* underflow for ||A(:,p)||_2 < SQRT(underflow_threshold). */
969 /* Hence, DZNRM2 cannot be trusted, not even in the case when */
970 /* the true norm is far from the under(over)flow boundaries. */
971 /* If properly implemented DZNRM2 is available, the IF-THEN-ELSE-END IF */
972 /* below should be replaced with "AAPP = DZNRM2( M, A(1,p), 1 )". */
974 if (sva[p] < rootbig && sva[p] > rootsfmin) {
975 sva[p] = dznrm2_(m, &a[p * a_dim1 + 1], &c__1);
979 zlassq_(m, &a[p * a_dim1 + 1], &c__1, &temp1, &
981 sva[p] = temp1 * sqrt(aapp);
993 i__6 = igl + kbl - 1;
994 i__5 = f2cmin(i__6,*n);
995 for (q = p + 1; q <= i__5; ++q) {
1003 rotok = small * aapp <= aaqq;
1004 if (aapp < big / aaqq) {
1005 zdotc_(&z__3, m, &a[p * a_dim1 + 1], &
1006 c__1, &a[q * a_dim1 + 1], &
1008 z__2.r = z__3.r / aaqq, z__2.i =
1010 z__1.r = z__2.r / aapp, z__1.i =
1012 aapq.r = z__1.r, aapq.i = z__1.i;
1014 zcopy_(m, &a[p * a_dim1 + 1], &c__1, &
1016 zlascl_("G", &c__0, &c__0, &aapp, &
1017 c_b27, m, &c__1, &work[1],
1019 zdotc_(&z__2, m, &work[1], &c__1, &a[
1020 q * a_dim1 + 1], &c__1);
1021 z__1.r = z__2.r / aaqq, z__1.i =
1023 aapq.r = z__1.r, aapq.i = z__1.i;
1026 rotok = aapp <= aaqq / small;
1027 if (aapp > small / aaqq) {
1028 zdotc_(&z__3, m, &a[p * a_dim1 + 1], &
1029 c__1, &a[q * a_dim1 + 1], &
1031 z__2.r = z__3.r / aapp, z__2.i =
1033 z__1.r = z__2.r / aaqq, z__1.i =
1035 aapq.r = z__1.r, aapq.i = z__1.i;
1037 zcopy_(m, &a[q * a_dim1 + 1], &c__1, &
1039 zlascl_("G", &c__0, &c__0, &aaqq, &
1040 c_b27, m, &c__1, &work[1],
1042 zdotc_(&z__2, m, &a[p * a_dim1 + 1], &
1043 c__1, &work[1], &c__1);
1044 z__1.r = z__2.r / aapp, z__1.i =
1046 aapq.r = z__1.r, aapq.i = z__1.i;
1050 /* AAPQ = AAPQ * CONJG( CWORK(p) ) * CWORK(q) */
1051 aapq1 = -z_abs(&aapq);
1053 d__1 = mxaapq, d__2 = -aapq1;
1054 mxaapq = f2cmax(d__1,d__2);
1056 /* TO rotate or NOT to rotate, THAT is the question ... */
1058 if (abs(aapq1) > *tol) {
1059 d__1 = z_abs(&aapq);
1060 z__1.r = aapq.r / d__1, z__1.i = aapq.i /
1062 ompq.r = z__1.r, ompq.i = z__1.i;
1064 /* [RTD] ROTATED = ROTATED + ONE */
1074 aqoap = aaqq / aapp;
1075 apoaq = aapp / aaqq;
1076 theta = (d__1 = aqoap - apoaq, abs(
1077 d__1)) * -.5 / aapq1;
1079 if (abs(theta) > bigtheta) {
1083 d_cnjg(&z__2, &ompq);
1084 z__1.r = t * z__2.r, z__1.i = t *
1086 zrot_(m, &a[p * a_dim1 + 1], &
1087 c__1, &a[q * a_dim1 + 1],
1090 d_cnjg(&z__2, &ompq);
1091 z__1.r = t * z__2.r, z__1.i = t * z__2.i;
1092 zrot_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q *
1093 v_dim1 + 1], &c__1, &cs, &z__1);
1096 d__1 = 0., d__2 = t * apoaq *
1098 sva[q] = aaqq * sqrt((f2cmax(d__1,
1101 d__1 = 0., d__2 = 1. - t * aqoap *
1103 aapp *= sqrt((f2cmax(d__1,d__2)));
1105 d__1 = mxsinj, d__2 = abs(t);
1106 mxsinj = f2cmax(d__1,d__2);
1111 thsign = -d_sign(&c_b27, &aapq1);
1112 t = 1. / (theta + thsign * sqrt(
1113 theta * theta + 1.));
1114 cs = sqrt(1. / (t * t + 1.));
1118 d__1 = mxsinj, d__2 = abs(sn);
1119 mxsinj = f2cmax(d__1,d__2);
1121 d__1 = 0., d__2 = t * apoaq *
1123 sva[q] = aaqq * sqrt((f2cmax(d__1,
1126 d__1 = 0., d__2 = 1. - t * aqoap *
1128 aapp *= sqrt((f2cmax(d__1,d__2)));
1130 d_cnjg(&z__2, &ompq);
1131 z__1.r = sn * z__2.r, z__1.i = sn
1133 zrot_(m, &a[p * a_dim1 + 1], &
1134 c__1, &a[q * a_dim1 + 1],
1137 d_cnjg(&z__2, &ompq);
1138 z__1.r = sn * z__2.r, z__1.i = sn * z__2.i;
1139 zrot_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q *
1140 v_dim1 + 1], &c__1, &cs, &z__1);
1145 z__2.r = -d__[i__7].r, z__2.i = -d__[
1147 z__1.r = z__2.r * ompq.r - z__2.i *
1148 ompq.i, z__1.i = z__2.r *
1149 ompq.i + z__2.i * ompq.r;
1150 d__[i__6].r = z__1.r, d__[i__6].i =
1154 zcopy_(m, &a[p * a_dim1 + 1], &c__1, &
1156 zlascl_("G", &c__0, &c__0, &aapp, &
1157 c_b27, m, &c__1, &work[1],
1159 zlascl_("G", &c__0, &c__0, &aaqq, &
1160 c_b27, m, &c__1, &a[q *
1161 a_dim1 + 1], lda, &ierr);
1162 z__1.r = -aapq.r, z__1.i = -aapq.i;
1163 zaxpy_(m, &z__1, &work[1], &c__1, &a[
1164 q * a_dim1 + 1], &c__1);
1165 zlascl_("G", &c__0, &c__0, &c_b27, &
1166 aaqq, m, &c__1, &a[q * a_dim1
1169 d__1 = 0., d__2 = 1. - aapq1 * aapq1;
1170 sva[q] = aaqq * sqrt((f2cmax(d__1,d__2)))
1172 mxsinj = f2cmax(mxsinj,*sfmin);
1174 /* END IF ROTOK THEN ... ELSE */
1176 /* In the case of cancellation in updating SVA(q), SVA(p) */
1177 /* recompute SVA(q), SVA(p). */
1179 /* Computing 2nd power */
1180 d__1 = sva[q] / aaqq;
1181 if (d__1 * d__1 <= rooteps) {
1182 if (aaqq < rootbig && aaqq >
1184 sva[q] = dznrm2_(m, &a[q * a_dim1
1189 zlassq_(m, &a[q * a_dim1 + 1], &
1191 sva[q] = t * sqrt(aaqq);
1194 if (aapp / aapp0 <= rooteps) {
1195 if (aapp < rootbig && aapp >
1197 aapp = dznrm2_(m, &a[p * a_dim1 +
1202 zlassq_(m, &a[p * a_dim1 + 1], &
1204 aapp = t * sqrt(aapp);
1210 /* A(:,p) and A(:,q) already numerically orthogonal */
1214 /* [RTD] SKIPPED = SKIPPED + 1 */
1218 /* A(:,q) is zero column */
1225 if (i__ <= swband && pskipped > rowskip) {
1238 /* bailed out of q-loop */
1244 if (ir1 == 0 && aapp == 0.) {
1246 i__5 = igl + kbl - 1;
1247 notrot = notrot + f2cmin(i__5,*n) - p;
1253 /* end of the p-loop */
1254 /* end of doing the block ( ibr, ibr ) */
1257 /* end of ir1-loop */
1259 /* ... go to the off diagonal blocks */
1261 igl = (ibr - 1) * kbl + 1;
1264 for (jbc = ibr + 1; jbc <= i__3; ++jbc) {
1266 jgl = (jbc - 1) * kbl + 1;
1268 /* doing the block at ( ibr, jbc ) */
1272 i__5 = igl + kbl - 1;
1273 i__4 = f2cmin(i__5,*n);
1274 for (p = igl; p <= i__4; ++p) {
1282 i__6 = jgl + kbl - 1;
1283 i__5 = f2cmin(i__6,*n);
1284 for (q = jgl; q <= i__5; ++q) {
1291 /* Safe Gram matrix computation */
1295 rotok = small * aapp <= aaqq;
1297 rotok = small * aaqq <= aapp;
1299 if (aapp < big / aaqq) {
1300 zdotc_(&z__3, m, &a[p * a_dim1 + 1], &
1301 c__1, &a[q * a_dim1 + 1], &
1303 z__2.r = z__3.r / aaqq, z__2.i =
1305 z__1.r = z__2.r / aapp, z__1.i =
1307 aapq.r = z__1.r, aapq.i = z__1.i;
1309 zcopy_(m, &a[p * a_dim1 + 1], &c__1, &
1311 zlascl_("G", &c__0, &c__0, &aapp, &
1312 c_b27, m, &c__1, &work[1],
1314 zdotc_(&z__2, m, &work[1], &c__1, &a[
1315 q * a_dim1 + 1], &c__1);
1316 z__1.r = z__2.r / aaqq, z__1.i =
1318 aapq.r = z__1.r, aapq.i = z__1.i;
1322 rotok = aapp <= aaqq / small;
1324 rotok = aaqq <= aapp / small;
1326 if (aapp > small / aaqq) {
1327 zdotc_(&z__3, m, &a[p * a_dim1 + 1], &
1328 c__1, &a[q * a_dim1 + 1], &
1330 d__1 = f2cmax(aaqq,aapp);
1331 z__2.r = z__3.r / d__1, z__2.i =
1333 d__2 = f2cmin(aaqq,aapp);
1334 z__1.r = z__2.r / d__2, z__1.i =
1336 aapq.r = z__1.r, aapq.i = z__1.i;
1338 zcopy_(m, &a[q * a_dim1 + 1], &c__1, &
1340 zlascl_("G", &c__0, &c__0, &aaqq, &
1341 c_b27, m, &c__1, &work[1],
1343 zdotc_(&z__2, m, &a[p * a_dim1 + 1], &
1344 c__1, &work[1], &c__1);
1345 z__1.r = z__2.r / aapp, z__1.i =
1347 aapq.r = z__1.r, aapq.i = z__1.i;
1351 /* AAPQ = AAPQ * CONJG(CWORK(p))*CWORK(q) */
1352 aapq1 = -z_abs(&aapq);
1354 d__1 = mxaapq, d__2 = -aapq1;
1355 mxaapq = f2cmax(d__1,d__2);
1357 /* TO rotate or NOT to rotate, THAT is the question ... */
1359 if (abs(aapq1) > *tol) {
1360 d__1 = z_abs(&aapq);
1361 z__1.r = aapq.r / d__1, z__1.i = aapq.i /
1363 ompq.r = z__1.r, ompq.i = z__1.i;
1365 /* [RTD] ROTATED = ROTATED + 1 */
1371 aqoap = aaqq / aapp;
1372 apoaq = aapp / aaqq;
1373 theta = (d__1 = aqoap - apoaq, abs(
1374 d__1)) * -.5 / aapq1;
1379 if (abs(theta) > bigtheta) {
1382 d_cnjg(&z__2, &ompq);
1383 z__1.r = t * z__2.r, z__1.i = t *
1385 zrot_(m, &a[p * a_dim1 + 1], &
1386 c__1, &a[q * a_dim1 + 1],
1389 d_cnjg(&z__2, &ompq);
1390 z__1.r = t * z__2.r, z__1.i = t * z__2.i;
1391 zrot_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q *
1392 v_dim1 + 1], &c__1, &cs, &z__1);
1395 d__1 = 0., d__2 = t * apoaq *
1397 sva[q] = aaqq * sqrt((f2cmax(d__1,
1400 d__1 = 0., d__2 = 1. - t * aqoap *
1402 aapp *= sqrt((f2cmax(d__1,d__2)));
1404 d__1 = mxsinj, d__2 = abs(t);
1405 mxsinj = f2cmax(d__1,d__2);
1409 thsign = -d_sign(&c_b27, &aapq1);
1413 t = 1. / (theta + thsign * sqrt(
1414 theta * theta + 1.));
1415 cs = sqrt(1. / (t * t + 1.));
1418 d__1 = mxsinj, d__2 = abs(sn);
1419 mxsinj = f2cmax(d__1,d__2);
1421 d__1 = 0., d__2 = t * apoaq *
1423 sva[q] = aaqq * sqrt((f2cmax(d__1,
1426 d__1 = 0., d__2 = 1. - t * aqoap *
1428 aapp *= sqrt((f2cmax(d__1,d__2)));
1430 d_cnjg(&z__2, &ompq);
1431 z__1.r = sn * z__2.r, z__1.i = sn
1433 zrot_(m, &a[p * a_dim1 + 1], &
1434 c__1, &a[q * a_dim1 + 1],
1437 d_cnjg(&z__2, &ompq);
1438 z__1.r = sn * z__2.r, z__1.i = sn * z__2.i;
1439 zrot_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q *
1440 v_dim1 + 1], &c__1, &cs, &z__1);
1445 z__2.r = -d__[i__7].r, z__2.i = -d__[
1447 z__1.r = z__2.r * ompq.r - z__2.i *
1448 ompq.i, z__1.i = z__2.r *
1449 ompq.i + z__2.i * ompq.r;
1450 d__[i__6].r = z__1.r, d__[i__6].i =
1455 zcopy_(m, &a[p * a_dim1 + 1], &
1456 c__1, &work[1], &c__1);
1457 zlascl_("G", &c__0, &c__0, &aapp,
1458 &c_b27, m, &c__1, &work[1]
1460 zlascl_("G", &c__0, &c__0, &aaqq,
1461 &c_b27, m, &c__1, &a[q *
1462 a_dim1 + 1], lda, &ierr);
1463 z__1.r = -aapq.r, z__1.i =
1465 zaxpy_(m, &z__1, &work[1], &c__1,
1466 &a[q * a_dim1 + 1], &c__1)
1468 zlascl_("G", &c__0, &c__0, &c_b27,
1469 &aaqq, m, &c__1, &a[q *
1470 a_dim1 + 1], lda, &ierr);
1472 d__1 = 0., d__2 = 1. - aapq1 *
1474 sva[q] = aaqq * sqrt((f2cmax(d__1,
1476 mxsinj = f2cmax(mxsinj,*sfmin);
1478 zcopy_(m, &a[q * a_dim1 + 1], &
1479 c__1, &work[1], &c__1);
1480 zlascl_("G", &c__0, &c__0, &aaqq,
1481 &c_b27, m, &c__1, &work[1]
1483 zlascl_("G", &c__0, &c__0, &aapp,
1484 &c_b27, m, &c__1, &a[p *
1485 a_dim1 + 1], lda, &ierr);
1486 d_cnjg(&z__2, &aapq);
1487 z__1.r = -z__2.r, z__1.i =
1489 zaxpy_(m, &z__1, &work[1], &c__1,
1490 &a[p * a_dim1 + 1], &c__1)
1492 zlascl_("G", &c__0, &c__0, &c_b27,
1493 &aapp, m, &c__1, &a[p *
1494 a_dim1 + 1], lda, &ierr);
1496 d__1 = 0., d__2 = 1. - aapq1 *
1498 sva[p] = aapp * sqrt((f2cmax(d__1,
1500 mxsinj = f2cmax(mxsinj,*sfmin);
1503 /* END IF ROTOK THEN ... ELSE */
1505 /* In the case of cancellation in updating SVA(q), SVA(p) */
1506 /* Computing 2nd power */
1507 d__1 = sva[q] / aaqq;
1508 if (d__1 * d__1 <= rooteps) {
1509 if (aaqq < rootbig && aaqq >
1511 sva[q] = dznrm2_(m, &a[q * a_dim1
1516 zlassq_(m, &a[q * a_dim1 + 1], &
1518 sva[q] = t * sqrt(aaqq);
1521 /* Computing 2nd power */
1522 d__1 = aapp / aapp0;
1523 if (d__1 * d__1 <= rooteps) {
1524 if (aapp < rootbig && aapp >
1526 aapp = dznrm2_(m, &a[p * a_dim1 +
1531 zlassq_(m, &a[p * a_dim1 + 1], &
1533 aapp = t * sqrt(aapp);
1537 /* end of OK rotation */
1540 /* [RTD] SKIPPED = SKIPPED + 1 */
1550 if (i__ <= swband && ijblsk >= blskip) {
1555 if (i__ <= swband && pskipped > rowskip) {
1563 /* end of the q-loop */
1572 i__5 = jgl + kbl - 1;
1573 notrot = notrot + f2cmin(i__5,*n) - jgl + 1;
1583 /* end of the p-loop */
1586 /* end of the jbc-loop */
1588 /* 2011 bailed out of the jbc-loop */
1590 i__4 = igl + kbl - 1;
1591 i__3 = f2cmin(i__4,*n);
1592 for (p = igl; p <= i__3; ++p) {
1593 sva[p] = (d__1 = sva[p], abs(d__1));
1599 /* 2000 :: end of the ibr-loop */
1601 if (sva[*n] < rootbig && sva[*n] > rootsfmin) {
1602 sva[*n] = dznrm2_(m, &a[*n * a_dim1 + 1], &c__1);
1606 zlassq_(m, &a[*n * a_dim1 + 1], &c__1, &t, &aapp);
1607 sva[*n] = t * sqrt(aapp);
1610 /* Additional steering devices */
1612 if (i__ < swband && (mxaapq <= roottol || iswrot <= *n)) {
1616 if (i__ > swband + 1 && mxaapq < sqrt((doublereal) (*n)) * *tol && (
1617 doublereal) (*n) * mxaapq * mxsinj < *tol) {
1621 if (notrot >= emptsw) {
1627 /* end i=1:NSWEEP loop */
1629 /* #:( Reaching this point means that the procedure has not converged. */
1630 *info = *nsweep - 1;
1634 /* #:) Reaching this point means numerical convergence after the i-th */
1638 /* #:) INFO = 0 confirms successful iterations. */
1641 /* Sort the vector SVA() of column norms. */
1643 for (p = 1; p <= i__1; ++p) {
1645 q = idamax_(&i__2, &sva[p], &c__1) + p - 1;
1651 aapq.r = d__[i__2].r, aapq.i = d__[i__2].i;
1654 d__[i__2].r = d__[i__3].r, d__[i__2].i = d__[i__3].i;
1656 d__[i__2].r = aapq.r, d__[i__2].i = aapq.i;
1657 zswap_(m, &a[p * a_dim1 + 1], &c__1, &a[q * a_dim1 + 1], &c__1);
1659 zswap_(&mvl, &v[p * v_dim1 + 1], &c__1, &v[q * v_dim1 + 1], &