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 real c_b57 = 0.f;
518 static real c_b58 = 1.f;
520 /* > \brief <b> SGGEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE mat
523 /* =========== DOCUMENTATION =========== */
525 /* Online html documentation available at */
526 /* http://www.netlib.org/lapack/explore-html/ */
529 /* > Download SGGEVX + dependencies */
530 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sggevx.
533 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sggevx.
536 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sggevx.
544 /* SUBROUTINE SGGEVX( BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, B, LDB, */
545 /* ALPHAR, ALPHAI, BETA, VL, LDVL, VR, LDVR, ILO, */
546 /* IHI, LSCALE, RSCALE, ABNRM, BBNRM, RCONDE, */
547 /* RCONDV, WORK, LWORK, IWORK, BWORK, INFO ) */
549 /* CHARACTER BALANC, JOBVL, JOBVR, SENSE */
550 /* INTEGER IHI, ILO, INFO, LDA, LDB, LDVL, LDVR, LWORK, N */
551 /* REAL ABNRM, BBNRM */
552 /* LOGICAL BWORK( * ) */
553 /* INTEGER IWORK( * ) */
554 /* REAL A( LDA, * ), ALPHAI( * ), ALPHAR( * ), */
555 /* $ B( LDB, * ), BETA( * ), LSCALE( * ), */
556 /* $ RCONDE( * ), RCONDV( * ), RSCALE( * ), */
557 /* $ VL( LDVL, * ), VR( LDVR, * ), WORK( * ) */
560 /* > \par Purpose: */
565 /* > SGGEVX computes for a pair of N-by-N real nonsymmetric matrices (A,B) */
566 /* > the generalized eigenvalues, and optionally, the left and/or right */
567 /* > generalized eigenvectors. */
569 /* > Optionally also, it computes a balancing transformation to improve */
570 /* > the conditioning of the eigenvalues and eigenvectors (ILO, IHI, */
571 /* > LSCALE, RSCALE, ABNRM, and BBNRM), reciprocal condition numbers for */
572 /* > the eigenvalues (RCONDE), and reciprocal condition numbers for the */
573 /* > right eigenvectors (RCONDV). */
575 /* > A generalized eigenvalue for a pair of matrices (A,B) is a scalar */
576 /* > lambda or a ratio alpha/beta = lambda, such that A - lambda*B is */
577 /* > singular. It is usually represented as the pair (alpha,beta), as */
578 /* > there is a reasonable interpretation for beta=0, and even for both */
581 /* > The right eigenvector v(j) corresponding to the eigenvalue lambda(j) */
582 /* > of (A,B) satisfies */
584 /* > A * v(j) = lambda(j) * B * v(j) . */
586 /* > The left eigenvector u(j) corresponding to the eigenvalue lambda(j) */
587 /* > of (A,B) satisfies */
589 /* > u(j)**H * A = lambda(j) * u(j)**H * B. */
591 /* > where u(j)**H is the conjugate-transpose of u(j). */
598 /* > \param[in] BALANC */
600 /* > BALANC is CHARACTER*1 */
601 /* > Specifies the balance option to be performed. */
602 /* > = 'N': do not diagonally scale or permute; */
603 /* > = 'P': permute only; */
604 /* > = 'S': scale only; */
605 /* > = 'B': both permute and scale. */
606 /* > Computed reciprocal condition numbers will be for the */
607 /* > matrices after permuting and/or balancing. Permuting does */
608 /* > not change condition numbers (in exact arithmetic), but */
609 /* > balancing does. */
612 /* > \param[in] JOBVL */
614 /* > JOBVL is CHARACTER*1 */
615 /* > = 'N': do not compute the left generalized eigenvectors; */
616 /* > = 'V': compute the left generalized eigenvectors. */
619 /* > \param[in] JOBVR */
621 /* > JOBVR is CHARACTER*1 */
622 /* > = 'N': do not compute the right generalized eigenvectors; */
623 /* > = 'V': compute the right generalized eigenvectors. */
626 /* > \param[in] SENSE */
628 /* > SENSE is CHARACTER*1 */
629 /* > Determines which reciprocal condition numbers are computed. */
630 /* > = 'N': none are computed; */
631 /* > = 'E': computed for eigenvalues only; */
632 /* > = 'V': computed for eigenvectors only; */
633 /* > = 'B': computed for eigenvalues and eigenvectors. */
639 /* > The order of the matrices A, B, VL, and VR. N >= 0. */
642 /* > \param[in,out] A */
644 /* > A is REAL array, dimension (LDA, N) */
645 /* > On entry, the matrix A in the pair (A,B). */
646 /* > On exit, A has been overwritten. If JOBVL='V' or JOBVR='V' */
647 /* > or both, then A contains the first part of the real Schur */
648 /* > form of the "balanced" versions of the input A and B. */
651 /* > \param[in] LDA */
653 /* > LDA is INTEGER */
654 /* > The leading dimension of A. LDA >= f2cmax(1,N). */
657 /* > \param[in,out] B */
659 /* > B is REAL array, dimension (LDB, N) */
660 /* > On entry, the matrix B in the pair (A,B). */
661 /* > On exit, B has been overwritten. If JOBVL='V' or JOBVR='V' */
662 /* > or both, then B contains the second part of the real Schur */
663 /* > form of the "balanced" versions of the input A and B. */
666 /* > \param[in] LDB */
668 /* > LDB is INTEGER */
669 /* > The leading dimension of B. LDB >= f2cmax(1,N). */
672 /* > \param[out] ALPHAR */
674 /* > ALPHAR is REAL array, dimension (N) */
677 /* > \param[out] ALPHAI */
679 /* > ALPHAI is REAL array, dimension (N) */
682 /* > \param[out] BETA */
684 /* > BETA is REAL array, dimension (N) */
685 /* > On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will */
686 /* > be the generalized eigenvalues. If ALPHAI(j) is zero, then */
687 /* > the j-th eigenvalue is real; if positive, then the j-th and */
688 /* > (j+1)-st eigenvalues are a complex conjugate pair, with */
689 /* > ALPHAI(j+1) negative. */
691 /* > Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j) */
692 /* > may easily over- or underflow, and BETA(j) may even be zero. */
693 /* > Thus, the user should avoid naively computing the ratio */
694 /* > ALPHA/BETA. However, ALPHAR and ALPHAI will be always less */
695 /* > than and usually comparable with norm(A) in magnitude, and */
696 /* > BETA always less than and usually comparable with norm(B). */
699 /* > \param[out] VL */
701 /* > VL is REAL array, dimension (LDVL,N) */
702 /* > If JOBVL = 'V', the left eigenvectors u(j) are stored one */
703 /* > after another in the columns of VL, in the same order as */
704 /* > their eigenvalues. If the j-th eigenvalue is real, then */
705 /* > u(j) = VL(:,j), the j-th column of VL. If the j-th and */
706 /* > (j+1)-th eigenvalues form a complex conjugate pair, then */
707 /* > u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1). */
708 /* > Each eigenvector will be scaled so the largest component have */
709 /* > abs(real part) + abs(imag. part) = 1. */
710 /* > Not referenced if JOBVL = 'N'. */
713 /* > \param[in] LDVL */
715 /* > LDVL is INTEGER */
716 /* > The leading dimension of the matrix VL. LDVL >= 1, and */
717 /* > if JOBVL = 'V', LDVL >= N. */
720 /* > \param[out] VR */
722 /* > VR is REAL array, dimension (LDVR,N) */
723 /* > If JOBVR = 'V', the right eigenvectors v(j) are stored one */
724 /* > after another in the columns of VR, in the same order as */
725 /* > their eigenvalues. If the j-th eigenvalue is real, then */
726 /* > v(j) = VR(:,j), the j-th column of VR. If the j-th and */
727 /* > (j+1)-th eigenvalues form a complex conjugate pair, then */
728 /* > v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1). */
729 /* > Each eigenvector will be scaled so the largest component have */
730 /* > abs(real part) + abs(imag. part) = 1. */
731 /* > Not referenced if JOBVR = 'N'. */
734 /* > \param[in] LDVR */
736 /* > LDVR is INTEGER */
737 /* > The leading dimension of the matrix VR. LDVR >= 1, and */
738 /* > if JOBVR = 'V', LDVR >= N. */
741 /* > \param[out] ILO */
743 /* > ILO is INTEGER */
746 /* > \param[out] IHI */
748 /* > IHI is INTEGER */
749 /* > ILO and IHI are integer values such that on exit */
750 /* > A(i,j) = 0 and B(i,j) = 0 if i > j and */
751 /* > j = 1,...,ILO-1 or i = IHI+1,...,N. */
752 /* > If BALANC = 'N' or 'S', ILO = 1 and IHI = N. */
755 /* > \param[out] LSCALE */
757 /* > LSCALE is REAL array, dimension (N) */
758 /* > Details of the permutations and scaling factors applied */
759 /* > to the left side of A and B. If PL(j) is the index of the */
760 /* > row interchanged with row j, and DL(j) is the scaling */
761 /* > factor applied to row j, then */
762 /* > LSCALE(j) = PL(j) for j = 1,...,ILO-1 */
763 /* > = DL(j) for j = ILO,...,IHI */
764 /* > = PL(j) for j = IHI+1,...,N. */
765 /* > The order in which the interchanges are made is N to IHI+1, */
766 /* > then 1 to ILO-1. */
769 /* > \param[out] RSCALE */
771 /* > RSCALE is REAL array, dimension (N) */
772 /* > Details of the permutations and scaling factors applied */
773 /* > to the right side of A and B. If PR(j) is the index of the */
774 /* > column interchanged with column j, and DR(j) is the scaling */
775 /* > factor applied to column j, then */
776 /* > RSCALE(j) = PR(j) for j = 1,...,ILO-1 */
777 /* > = DR(j) for j = ILO,...,IHI */
778 /* > = PR(j) for j = IHI+1,...,N */
779 /* > The order in which the interchanges are made is N to IHI+1, */
780 /* > then 1 to ILO-1. */
783 /* > \param[out] ABNRM */
785 /* > ABNRM is REAL */
786 /* > The one-norm of the balanced matrix A. */
789 /* > \param[out] BBNRM */
791 /* > BBNRM is REAL */
792 /* > The one-norm of the balanced matrix B. */
795 /* > \param[out] RCONDE */
797 /* > RCONDE is REAL array, dimension (N) */
798 /* > If SENSE = 'E' or 'B', the reciprocal condition numbers of */
799 /* > the eigenvalues, stored in consecutive elements of the array. */
800 /* > For a complex conjugate pair of eigenvalues two consecutive */
801 /* > elements of RCONDE are set to the same value. Thus RCONDE(j), */
802 /* > RCONDV(j), and the j-th columns of VL and VR all correspond */
803 /* > to the j-th eigenpair. */
804 /* > If SENSE = 'N' or 'V', RCONDE is not referenced. */
807 /* > \param[out] RCONDV */
809 /* > RCONDV is REAL array, dimension (N) */
810 /* > If SENSE = 'V' or 'B', the estimated reciprocal condition */
811 /* > numbers of the eigenvectors, stored in consecutive elements */
812 /* > of the array. For a complex eigenvector two consecutive */
813 /* > elements of RCONDV are set to the same value. If the */
814 /* > eigenvalues cannot be reordered to compute RCONDV(j), */
815 /* > RCONDV(j) is set to 0; this can only occur when the true */
816 /* > value would be very small anyway. */
817 /* > If SENSE = 'N' or 'E', RCONDV is not referenced. */
820 /* > \param[out] WORK */
822 /* > WORK is REAL array, dimension (MAX(1,LWORK)) */
823 /* > On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */
826 /* > \param[in] LWORK */
828 /* > LWORK is INTEGER */
829 /* > The dimension of the array WORK. LWORK >= f2cmax(1,2*N). */
830 /* > If BALANC = 'S' or 'B', or JOBVL = 'V', or JOBVR = 'V', */
831 /* > LWORK >= f2cmax(1,6*N). */
832 /* > If SENSE = 'E', LWORK >= f2cmax(1,10*N). */
833 /* > If SENSE = 'V' or 'B', LWORK >= 2*N*N+8*N+16. */
835 /* > If LWORK = -1, then a workspace query is assumed; the routine */
836 /* > only calculates the optimal size of the WORK array, returns */
837 /* > this value as the first entry of the WORK array, and no error */
838 /* > message related to LWORK is issued by XERBLA. */
841 /* > \param[out] IWORK */
843 /* > IWORK is INTEGER array, dimension (N+6) */
844 /* > If SENSE = 'E', IWORK is not referenced. */
847 /* > \param[out] BWORK */
849 /* > BWORK is LOGICAL array, dimension (N) */
850 /* > If SENSE = 'N', BWORK is not referenced. */
853 /* > \param[out] INFO */
855 /* > INFO is INTEGER */
856 /* > = 0: successful exit */
857 /* > < 0: if INFO = -i, the i-th argument had an illegal value. */
859 /* > The QZ iteration failed. No eigenvectors have been */
860 /* > calculated, but ALPHAR(j), ALPHAI(j), and BETA(j) */
861 /* > should be correct for j=INFO+1,...,N. */
862 /* > > N: =N+1: other than QZ iteration failed in SHGEQZ. */
863 /* > =N+2: error return from STGEVC. */
869 /* > \author Univ. of Tennessee */
870 /* > \author Univ. of California Berkeley */
871 /* > \author Univ. of Colorado Denver */
872 /* > \author NAG Ltd. */
874 /* > \date April 2012 */
876 /* > \ingroup realGEeigen */
878 /* > \par Further Details: */
879 /* ===================== */
883 /* > Balancing a matrix pair (A,B) includes, first, permuting rows and */
884 /* > columns to isolate eigenvalues, second, applying diagonal similarity */
885 /* > transformation to the rows and columns to make the rows and columns */
886 /* > as close in norm as possible. The computed reciprocal condition */
887 /* > numbers correspond to the balanced matrix. Permuting rows and columns */
888 /* > will not change the condition numbers (in exact arithmetic) but */
889 /* > diagonal scaling will. For further explanation of balancing, see */
890 /* > section 4.11.1.2 of LAPACK Users' Guide. */
892 /* > An approximate error bound on the chordal distance between the i-th */
893 /* > computed generalized eigenvalue w and the corresponding exact */
894 /* > eigenvalue lambda is */
896 /* > chord(w, lambda) <= EPS * norm(ABNRM, BBNRM) / RCONDE(I) */
898 /* > An approximate error bound for the angle between the i-th computed */
899 /* > eigenvector VL(i) or VR(i) is given by */
901 /* > EPS * norm(ABNRM, BBNRM) / DIF(i). */
903 /* > For further explanation of the reciprocal condition numbers RCONDE */
904 /* > and RCONDV, see section 4.11 of LAPACK User's Guide. */
907 /* ===================================================================== */
908 /* Subroutine */ int sggevx_(char *balanc, char *jobvl, char *jobvr, char *
909 sense, integer *n, real *a, integer *lda, real *b, integer *ldb, real
910 *alphar, real *alphai, real *beta, real *vl, integer *ldvl, real *vr,
911 integer *ldvr, integer *ilo, integer *ihi, real *lscale, real *rscale,
912 real *abnrm, real *bbnrm, real *rconde, real *rcondv, real *work,
913 integer *lwork, integer *iwork, logical *bwork, integer *info)
915 /* System generated locals */
916 integer a_dim1, a_offset, b_dim1, b_offset, vl_dim1, vl_offset, vr_dim1,
917 vr_offset, i__1, i__2;
918 real r__1, r__2, r__3, r__4;
920 /* Local variables */
926 integer iwrk, iwrk1, i__, j, m;
927 extern logical lsame_(char *, char *);
931 extern /* Subroutine */ int slabad_(real *, real *);
933 extern /* Subroutine */ int sggbak_(char *, char *, integer *, integer *,
934 integer *, real *, real *, integer *, real *, integer *, integer *
935 ), sggbal_(char *, integer *, real *, integer *,
936 real *, integer *, integer *, integer *, real *, real *, real *,
938 logical ilascl, ilbscl;
939 extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen), sgghrd_(
940 char *, char *, integer *, integer *, integer *, real *, integer *
941 , real *, integer *, real *, integer *, real *, integer *,
946 extern /* Subroutine */ int slascl_(char *, integer *, integer *, real *,
947 real *, integer *, integer *, real *, integer *, integer *);
948 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
949 integer *, integer *, ftnlen, ftnlen);
950 extern real slamch_(char *);
952 extern real slange_(char *, integer *, integer *, real *, integer *, real
954 extern /* Subroutine */ int sgeqrf_(integer *, integer *, real *, integer
955 *, real *, real *, integer *, integer *);
957 extern /* Subroutine */ int slacpy_(char *, integer *, integer *, real *,
958 integer *, real *, integer *);
960 extern /* Subroutine */ int slaset_(char *, integer *, integer *, real *,
961 real *, real *, integer *);
965 extern /* Subroutine */ int shgeqz_(char *, char *, char *, integer *,
966 integer *, integer *, real *, integer *, real *, integer *, real *
967 , real *, real *, real *, integer *, real *, integer *, real *,
968 integer *, integer *), stgevc_(char *,
969 char *, logical *, integer *, real *, integer *, real *, integer *
970 , real *, integer *, real *, integer *, integer *, integer *,
971 real *, integer *), stgsna_(char *, char *,
972 logical *, integer *, real *, integer *, real *, integer *, real *
973 , integer *, real *, integer *, real *, real *, integer *,
974 integer *, real *, integer *, integer *, integer *);
975 integer minwrk, maxwrk;
978 extern /* Subroutine */ int sorgqr_(integer *, integer *, integer *, real
979 *, integer *, real *, real *, integer *, integer *);
980 logical lquery, wantsv;
981 extern /* Subroutine */ int sormqr_(char *, char *, integer *, integer *,
982 integer *, real *, integer *, real *, real *, integer *, real *,
983 integer *, integer *);
988 /* -- LAPACK driver routine (version 3.7.0) -- */
989 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
990 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
994 /* ===================================================================== */
997 /* Decode the input arguments */
999 /* Parameter adjustments */
1001 a_offset = 1 + a_dim1 * 1;
1004 b_offset = 1 + b_dim1 * 1;
1010 vl_offset = 1 + vl_dim1 * 1;
1013 vr_offset = 1 + vr_dim1 * 1;
1024 if (lsame_(jobvl, "N")) {
1027 } else if (lsame_(jobvl, "V")) {
1035 if (lsame_(jobvr, "N")) {
1038 } else if (lsame_(jobvr, "V")) {
1047 noscl = lsame_(balanc, "N") || lsame_(balanc, "P");
1048 wantsn = lsame_(sense, "N");
1049 wantse = lsame_(sense, "E");
1050 wantsv = lsame_(sense, "V");
1051 wantsb = lsame_(sense, "B");
1053 /* Test the input arguments */
1056 lquery = *lwork == -1;
1057 if (! (noscl || lsame_(balanc, "S") || lsame_(
1060 } else if (ijobvl <= 0) {
1062 } else if (ijobvr <= 0) {
1064 } else if (! (wantsn || wantse || wantsb || wantsv)) {
1066 } else if (*n < 0) {
1068 } else if (*lda < f2cmax(1,*n)) {
1070 } else if (*ldb < f2cmax(1,*n)) {
1072 } else if (*ldvl < 1 || ilvl && *ldvl < *n) {
1074 } else if (*ldvr < 1 || ilvr && *ldvr < *n) {
1078 /* Compute workspace */
1079 /* (Note: Comments in the code beginning "Workspace:" describe the */
1080 /* minimal amount of workspace needed at that point in the code, */
1081 /* as well as the preferred amount for good performance. */
1082 /* NB refers to the optimal block size for the immediately */
1083 /* following subroutine, as returned by ILAENV. The workspace is */
1084 /* computed assuming ILO = 1 and IHI = N, the worst case.) */
1091 if (noscl && ! ilv) {
1098 } else if (wantsv || wantsb) {
1099 minwrk = (*n << 1) * (*n + 4) + 16;
1103 i__1 = maxwrk, i__2 = *n + *n * ilaenv_(&c__1, "SGEQRF", " ", n, &
1104 c__1, n, &c__0, (ftnlen)6, (ftnlen)1);
1105 maxwrk = f2cmax(i__1,i__2);
1107 i__1 = maxwrk, i__2 = *n + *n * ilaenv_(&c__1, "SORMQR", " ", n, &
1108 c__1, n, &c__0, (ftnlen)6, (ftnlen)1);
1109 maxwrk = f2cmax(i__1,i__2);
1112 i__1 = maxwrk, i__2 = *n + *n * ilaenv_(&c__1, "SORGQR",
1113 " ", n, &c__1, n, &c__0, (ftnlen)6, (ftnlen)1);
1114 maxwrk = f2cmax(i__1,i__2);
1117 work[1] = (real) maxwrk;
1119 if (*lwork < minwrk && ! lquery) {
1126 xerbla_("SGGEVX", &i__1, (ftnlen)6);
1128 } else if (lquery) {
1132 /* Quick return if possible */
1139 /* Get machine constants */
1142 smlnum = slamch_("S");
1143 bignum = 1.f / smlnum;
1144 slabad_(&smlnum, &bignum);
1145 smlnum = sqrt(smlnum) / eps;
1146 bignum = 1.f / smlnum;
1148 /* Scale A if f2cmax element outside range [SMLNUM,BIGNUM] */
1150 anrm = slange_("M", n, n, &a[a_offset], lda, &work[1]);
1152 if (anrm > 0.f && anrm < smlnum) {
1155 } else if (anrm > bignum) {
1160 slascl_("G", &c__0, &c__0, &anrm, &anrmto, n, n, &a[a_offset], lda, &
1164 /* Scale B if f2cmax element outside range [SMLNUM,BIGNUM] */
1166 bnrm = slange_("M", n, n, &b[b_offset], ldb, &work[1]);
1168 if (bnrm > 0.f && bnrm < smlnum) {
1171 } else if (bnrm > bignum) {
1176 slascl_("G", &c__0, &c__0, &bnrm, &bnrmto, n, n, &b[b_offset], ldb, &
1180 /* Permute and/or balance the matrix pair (A,B) */
1181 /* (Workspace: need 6*N if BALANC = 'S' or 'B', 1 otherwise) */
1183 sggbal_(balanc, n, &a[a_offset], lda, &b[b_offset], ldb, ilo, ihi, &
1184 lscale[1], &rscale[1], &work[1], &ierr);
1186 /* Compute ABNRM and BBNRM */
1188 *abnrm = slange_("1", n, n, &a[a_offset], lda, &work[1]);
1191 slascl_("G", &c__0, &c__0, &anrmto, &anrm, &c__1, &c__1, &work[1], &
1196 *bbnrm = slange_("1", n, n, &b[b_offset], ldb, &work[1]);
1199 slascl_("G", &c__0, &c__0, &bnrmto, &bnrm, &c__1, &c__1, &work[1], &
1204 /* Reduce B to triangular form (QR decomposition of B) */
1205 /* (Workspace: need N, prefer N*NB ) */
1207 irows = *ihi + 1 - *ilo;
1208 if (ilv || ! wantsn) {
1209 icols = *n + 1 - *ilo;
1214 iwrk = itau + irows;
1215 i__1 = *lwork + 1 - iwrk;
1216 sgeqrf_(&irows, &icols, &b[*ilo + *ilo * b_dim1], ldb, &work[itau], &work[
1217 iwrk], &i__1, &ierr);
1219 /* Apply the orthogonal transformation to A */
1220 /* (Workspace: need N, prefer N*NB) */
1222 i__1 = *lwork + 1 - iwrk;
1223 sormqr_("L", "T", &irows, &icols, &irows, &b[*ilo + *ilo * b_dim1], ldb, &
1224 work[itau], &a[*ilo + *ilo * a_dim1], lda, &work[iwrk], &i__1, &
1227 /* Initialize VL and/or VR */
1228 /* (Workspace: need N, prefer N*NB) */
1231 slaset_("Full", n, n, &c_b57, &c_b58, &vl[vl_offset], ldvl)
1236 slacpy_("L", &i__1, &i__2, &b[*ilo + 1 + *ilo * b_dim1], ldb, &vl[
1237 *ilo + 1 + *ilo * vl_dim1], ldvl);
1239 i__1 = *lwork + 1 - iwrk;
1240 sorgqr_(&irows, &irows, &irows, &vl[*ilo + *ilo * vl_dim1], ldvl, &
1241 work[itau], &work[iwrk], &i__1, &ierr);
1245 slaset_("Full", n, n, &c_b57, &c_b58, &vr[vr_offset], ldvr)
1249 /* Reduce to generalized Hessenberg form */
1250 /* (Workspace: none needed) */
1252 if (ilv || ! wantsn) {
1254 /* Eigenvectors requested -- work on whole matrix. */
1256 sgghrd_(jobvl, jobvr, n, ilo, ihi, &a[a_offset], lda, &b[b_offset],
1257 ldb, &vl[vl_offset], ldvl, &vr[vr_offset], ldvr, &ierr);
1259 sgghrd_("N", "N", &irows, &c__1, &irows, &a[*ilo + *ilo * a_dim1],
1260 lda, &b[*ilo + *ilo * b_dim1], ldb, &vl[vl_offset], ldvl, &vr[
1261 vr_offset], ldvr, &ierr);
1264 /* Perform QZ algorithm (Compute eigenvalues, and optionally, the */
1265 /* Schur forms and Schur vectors) */
1266 /* (Workspace: need N) */
1268 if (ilv || ! wantsn) {
1269 *(unsigned char *)chtemp = 'S';
1271 *(unsigned char *)chtemp = 'E';
1274 shgeqz_(chtemp, jobvl, jobvr, n, ilo, ihi, &a[a_offset], lda, &b[b_offset]
1275 , ldb, &alphar[1], &alphai[1], &beta[1], &vl[vl_offset], ldvl, &
1276 vr[vr_offset], ldvr, &work[1], lwork, &ierr);
1278 if (ierr > 0 && ierr <= *n) {
1280 } else if (ierr > *n && ierr <= *n << 1) {
1288 /* Compute Eigenvectors and estimate condition numbers if desired */
1289 /* (Workspace: STGEVC: need 6*N */
1290 /* STGSNA: need 2*N*(N+2)+16 if SENSE = 'V' or 'B', */
1291 /* need N otherwise ) */
1293 if (ilv || ! wantsn) {
1297 *(unsigned char *)chtemp = 'B';
1299 *(unsigned char *)chtemp = 'L';
1302 *(unsigned char *)chtemp = 'R';
1305 stgevc_(chtemp, "B", ldumma, n, &a[a_offset], lda, &b[b_offset],
1306 ldb, &vl[vl_offset], ldvl, &vr[vr_offset], ldvr, n, &in, &
1316 /* compute eigenvectors (STGEVC) and estimate condition */
1317 /* numbers (STGSNA). Note that the definition of the condition */
1318 /* number is not invariant under transformation (u,v) to */
1319 /* (Q*u, Z*v), where (u,v) are eigenvectors of the generalized */
1320 /* Schur form (S,T), Q and Z are orthogonal matrices. In order */
1321 /* to avoid using extra 2*N*N workspace, we have to recalculate */
1322 /* eigenvectors and estimate one condition numbers at a time. */
1326 for (i__ = 1; i__ <= i__1; ++i__) {
1334 if (a[i__ + 1 + i__ * a_dim1] != 0.f) {
1341 for (j = 1; j <= i__2; ++j) {
1347 } else if (mm == 2) {
1349 bwork[i__ + 1] = TRUE_;
1353 iwrk1 = iwrk + mm * *n;
1355 /* Compute a pair of left and right eigenvectors. */
1356 /* (compute workspace: need up to 4*N + 6*N) */
1358 if (wantse || wantsb) {
1359 stgevc_("B", "S", &bwork[1], n, &a[a_offset], lda, &b[
1360 b_offset], ldb, &work[1], n, &work[iwrk], n, &mm,
1361 &m, &work[iwrk1], &ierr);
1368 i__2 = *lwork - iwrk1 + 1;
1369 stgsna_(sense, "S", &bwork[1], n, &a[a_offset], lda, &b[
1370 b_offset], ldb, &work[1], n, &work[iwrk], n, &rconde[
1371 i__], &rcondv[i__], &mm, &m, &work[iwrk1], &i__2, &
1380 /* Undo balancing on VL and VR and normalization */
1381 /* (Workspace: none needed) */
1384 sggbak_(balanc, "L", n, ilo, ihi, &lscale[1], &rscale[1], n, &vl[
1385 vl_offset], ldvl, &ierr);
1388 for (jc = 1; jc <= i__1; ++jc) {
1389 if (alphai[jc] < 0.f) {
1393 if (alphai[jc] == 0.f) {
1395 for (jr = 1; jr <= i__2; ++jr) {
1397 r__2 = temp, r__3 = (r__1 = vl[jr + jc * vl_dim1], abs(
1399 temp = f2cmax(r__2,r__3);
1404 for (jr = 1; jr <= i__2; ++jr) {
1406 r__3 = temp, r__4 = (r__1 = vl[jr + jc * vl_dim1], abs(
1407 r__1)) + (r__2 = vl[jr + (jc + 1) * vl_dim1], abs(
1409 temp = f2cmax(r__3,r__4);
1413 if (temp < smlnum) {
1417 if (alphai[jc] == 0.f) {
1419 for (jr = 1; jr <= i__2; ++jr) {
1420 vl[jr + jc * vl_dim1] *= temp;
1425 for (jr = 1; jr <= i__2; ++jr) {
1426 vl[jr + jc * vl_dim1] *= temp;
1427 vl[jr + (jc + 1) * vl_dim1] *= temp;
1436 sggbak_(balanc, "R", n, ilo, ihi, &lscale[1], &rscale[1], n, &vr[
1437 vr_offset], ldvr, &ierr);
1439 for (jc = 1; jc <= i__1; ++jc) {
1440 if (alphai[jc] < 0.f) {
1444 if (alphai[jc] == 0.f) {
1446 for (jr = 1; jr <= i__2; ++jr) {
1448 r__2 = temp, r__3 = (r__1 = vr[jr + jc * vr_dim1], abs(
1450 temp = f2cmax(r__2,r__3);
1455 for (jr = 1; jr <= i__2; ++jr) {
1457 r__3 = temp, r__4 = (r__1 = vr[jr + jc * vr_dim1], abs(
1458 r__1)) + (r__2 = vr[jr + (jc + 1) * vr_dim1], abs(
1460 temp = f2cmax(r__3,r__4);
1464 if (temp < smlnum) {
1468 if (alphai[jc] == 0.f) {
1470 for (jr = 1; jr <= i__2; ++jr) {
1471 vr[jr + jc * vr_dim1] *= temp;
1476 for (jr = 1; jr <= i__2; ++jr) {
1477 vr[jr + jc * vr_dim1] *= temp;
1478 vr[jr + (jc + 1) * vr_dim1] *= temp;
1487 /* Undo scaling if necessary */
1492 slascl_("G", &c__0, &c__0, &anrmto, &anrm, n, &c__1, &alphar[1], n, &
1494 slascl_("G", &c__0, &c__0, &anrmto, &anrm, n, &c__1, &alphai[1], n, &
1499 slascl_("G", &c__0, &c__0, &bnrmto, &bnrm, n, &c__1, &beta[1], n, &
1503 work[1] = (real) maxwrk;