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;
517 /* > \brief \b DLANSF returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the ele
518 ment of largest absolute value of a symmetric matrix in RFP format. */
520 /* =========== DOCUMENTATION =========== */
522 /* Online html documentation available at */
523 /* http://www.netlib.org/lapack/explore-html/ */
526 /* > Download DLANSF + dependencies */
527 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlansf.
530 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlansf.
533 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlansf.
541 /* DOUBLE PRECISION FUNCTION DLANSF( NORM, TRANSR, UPLO, N, A, WORK ) */
543 /* CHARACTER NORM, TRANSR, UPLO */
545 /* DOUBLE PRECISION A( 0: * ), WORK( 0: * ) */
548 /* > \par Purpose: */
553 /* > DLANSF returns the value of the one norm, or the Frobenius norm, or */
554 /* > the infinity norm, or the element of largest absolute value of a */
555 /* > real symmetric matrix A in RFP format. */
558 /* > \return DLANSF */
561 /* > DLANSF = ( f2cmax(abs(A(i,j))), NORM = 'M' or 'm' */
563 /* > ( norm1(A), NORM = '1', 'O' or 'o' */
565 /* > ( normI(A), NORM = 'I' or 'i' */
567 /* > ( normF(A), NORM = 'F', 'f', 'E' or 'e' */
569 /* > where norm1 denotes the one norm of a matrix (maximum column sum), */
570 /* > normI denotes the infinity norm of a matrix (maximum row sum) and */
571 /* > normF denotes the Frobenius norm of a matrix (square root of sum of */
572 /* > squares). Note that f2cmax(abs(A(i,j))) is not a matrix norm. */
578 /* > \param[in] NORM */
580 /* > NORM is CHARACTER*1 */
581 /* > Specifies the value to be returned in DLANSF as described */
585 /* > \param[in] TRANSR */
587 /* > TRANSR is CHARACTER*1 */
588 /* > Specifies whether the RFP format of A is normal or */
589 /* > transposed format. */
590 /* > = 'N': RFP format is Normal; */
591 /* > = 'T': RFP format is Transpose. */
594 /* > \param[in] UPLO */
596 /* > UPLO is CHARACTER*1 */
597 /* > On entry, UPLO specifies whether the RFP matrix A came from */
598 /* > an upper or lower triangular matrix as follows: */
599 /* > = 'U': RFP A came from an upper triangular matrix; */
600 /* > = 'L': RFP A came from a lower triangular matrix. */
606 /* > The order of the matrix A. N >= 0. When N = 0, DLANSF is */
612 /* > A is DOUBLE PRECISION array, dimension ( N*(N+1)/2 ); */
613 /* > On entry, the upper (if UPLO = 'U') or lower (if UPLO = 'L') */
614 /* > part of the symmetric matrix A stored in RFP format. See the */
615 /* > "Notes" below for more details. */
616 /* > Unchanged on exit. */
619 /* > \param[out] WORK */
621 /* > WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)), */
622 /* > where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise, */
623 /* > WORK is not referenced. */
629 /* > \author Univ. of Tennessee */
630 /* > \author Univ. of California Berkeley */
631 /* > \author Univ. of Colorado Denver */
632 /* > \author NAG Ltd. */
634 /* > \date December 2016 */
636 /* > \ingroup doubleOTHERcomputational */
638 /* > \par Further Details: */
639 /* ===================== */
643 /* > We first consider Rectangular Full Packed (RFP) Format when N is */
644 /* > even. We give an example where N = 6. */
646 /* > AP is Upper AP is Lower */
648 /* > 00 01 02 03 04 05 00 */
649 /* > 11 12 13 14 15 10 11 */
650 /* > 22 23 24 25 20 21 22 */
651 /* > 33 34 35 30 31 32 33 */
652 /* > 44 45 40 41 42 43 44 */
653 /* > 55 50 51 52 53 54 55 */
656 /* > Let TRANSR = 'N'. RFP holds AP as follows: */
657 /* > For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last */
658 /* > three columns of AP upper. The lower triangle A(4:6,0:2) consists of */
659 /* > the transpose of the first three columns of AP upper. */
660 /* > For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first */
661 /* > three columns of AP lower. The upper triangle A(0:2,0:2) consists of */
662 /* > the transpose of the last three columns of AP lower. */
663 /* > This covers the case N even and TRANSR = 'N'. */
667 /* > 03 04 05 33 43 53 */
668 /* > 13 14 15 00 44 54 */
669 /* > 23 24 25 10 11 55 */
670 /* > 33 34 35 20 21 22 */
671 /* > 00 44 45 30 31 32 */
672 /* > 01 11 55 40 41 42 */
673 /* > 02 12 22 50 51 52 */
675 /* > Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */
676 /* > transpose of RFP A above. One therefore gets: */
681 /* > 03 13 23 33 00 01 02 33 00 10 20 30 40 50 */
682 /* > 04 14 24 34 44 11 12 43 44 11 21 31 41 51 */
683 /* > 05 15 25 35 45 55 22 53 54 55 22 32 42 52 */
686 /* > We then consider Rectangular Full Packed (RFP) Format when N is */
687 /* > odd. We give an example where N = 5. */
689 /* > AP is Upper AP is Lower */
691 /* > 00 01 02 03 04 00 */
692 /* > 11 12 13 14 10 11 */
693 /* > 22 23 24 20 21 22 */
694 /* > 33 34 30 31 32 33 */
695 /* > 44 40 41 42 43 44 */
698 /* > Let TRANSR = 'N'. RFP holds AP as follows: */
699 /* > For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last */
700 /* > three columns of AP upper. The lower triangle A(3:4,0:1) consists of */
701 /* > the transpose of the first two columns of AP upper. */
702 /* > For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first */
703 /* > three columns of AP lower. The upper triangle A(0:1,1:2) consists of */
704 /* > the transpose of the last two columns of AP lower. */
705 /* > This covers the case N odd and TRANSR = 'N'. */
709 /* > 02 03 04 00 33 43 */
710 /* > 12 13 14 10 11 44 */
711 /* > 22 23 24 20 21 22 */
712 /* > 00 33 34 30 31 32 */
713 /* > 01 11 44 40 41 42 */
715 /* > Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */
716 /* > transpose of RFP A above. One therefore gets: */
720 /* > 02 12 22 00 01 00 10 20 30 40 50 */
721 /* > 03 13 23 33 11 33 11 21 31 41 51 */
722 /* > 04 14 24 34 44 43 44 22 32 42 52 */
725 /* ===================================================================== */
726 doublereal dlansf_(char *norm, char *transr, char *uplo, integer *n,
727 doublereal *a, doublereal *work)
729 /* System generated locals */
731 doublereal ret_val, d__1;
733 /* Local variables */
735 integer i__, j, k, l;
737 extern logical lsame_(char *, char *);
741 extern logical disnan_(doublereal *);
742 extern /* Subroutine */ int dlassq_(integer *, doublereal *, integer *,
743 doublereal *, doublereal *);
744 integer lda, ifm, noe, ilu;
747 /* -- LAPACK computational routine (version 3.7.0) -- */
748 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
749 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
753 /* ===================================================================== */
759 } else if (*n == 1) {
764 /* set noe = 1 if n is odd. if n is even set noe=0 */
771 /* set ifm = 0 when form='T or 't' and 1 otherwise */
774 if (lsame_(transr, "T")) {
778 /* set ilu = 0 when uplo='U or 'u' and 1 otherwise */
781 if (lsame_(uplo, "U")) {
785 /* set lda = (n+1)/2 when ifm = 0 */
786 /* set lda = n when ifm = 1 and noe = 1 */
787 /* set lda = n+1 when ifm = 1 and noe = 0 */
801 if (lsame_(norm, "M")) {
803 /* Find f2cmax(abs(A(i,j))). */
812 for (j = 0; j <= i__1; ++j) {
814 for (i__ = 0; i__ <= i__2; ++i__) {
815 temp = (d__1 = a[i__ + j * lda], abs(d__1));
816 if (value < temp || disnan_(&temp)) {
822 /* xpose case; A is k by n */
824 for (j = 0; j <= i__1; ++j) {
826 for (i__ = 0; i__ <= i__2; ++i__) {
827 temp = (d__1 = a[i__ + j * lda], abs(d__1));
828 if (value < temp || disnan_(&temp)) {
839 for (j = 0; j <= i__1; ++j) {
841 for (i__ = 0; i__ <= i__2; ++i__) {
842 temp = (d__1 = a[i__ + j * lda], abs(d__1));
843 if (value < temp || disnan_(&temp)) {
849 /* xpose case; A is k by n+1 */
851 for (j = 0; j <= i__1; ++j) {
853 for (i__ = 0; i__ <= i__2; ++i__) {
854 temp = (d__1 = a[i__ + j * lda], abs(d__1));
855 if (value < temp || disnan_(&temp)) {
862 } else if (lsame_(norm, "I") || lsame_(norm, "O") || *(unsigned char *)norm == '1') {
864 /* Find normI(A) ( = norm1(A), since A is symmetric). */
872 for (i__ = 0; i__ <= i__1; ++i__) {
876 for (j = 0; j <= i__1; ++j) {
879 for (i__ = 0; i__ <= i__2; ++i__) {
880 aa = (d__1 = a[i__ + j * lda], abs(d__1));
885 aa = (d__1 = a[i__ + j * lda], abs(d__1));
887 work[j + k] = s + aa;
892 aa = (d__1 = a[i__ + j * lda], abs(d__1));
897 for (l = j + 1; l <= i__2; ++l) {
899 aa = (d__1 = a[i__ + j * lda], abs(d__1));
909 for (i__ = 1; i__ <= i__1; ++i__) {
911 if (value < temp || disnan_(&temp)) {
918 /* k=(n+1)/2 for n odd and ilu=1 */
920 for (i__ = k; i__ <= i__1; ++i__) {
923 for (j = k - 1; j >= 0; --j) {
926 for (i__ = 0; i__ <= i__1; ++i__) {
927 aa = (d__1 = a[i__ + j * lda], abs(d__1));
933 aa = (d__1 = a[i__ + j * lda], abs(d__1));
940 aa = (d__1 = a[i__ + j * lda], abs(d__1));
945 for (l = j + 1; l <= i__1; ++l) {
947 aa = (d__1 = a[i__ + j * lda], abs(d__1));
956 for (i__ = 1; i__ <= i__1; ++i__) {
958 if (value < temp || disnan_(&temp)) {
967 for (i__ = 0; i__ <= i__1; ++i__) {
971 for (j = 0; j <= i__1; ++j) {
974 for (i__ = 0; i__ <= i__2; ++i__) {
975 aa = (d__1 = a[i__ + j * lda], abs(d__1));
980 aa = (d__1 = a[i__ + j * lda], abs(d__1));
982 work[j + k] = s + aa;
984 aa = (d__1 = a[i__ + j * lda], abs(d__1));
989 for (l = j + 1; l <= i__2; ++l) {
991 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1000 for (i__ = 1; i__ <= i__1; ++i__) {
1002 if (value < temp || disnan_(&temp)) {
1009 for (i__ = k; i__ <= i__1; ++i__) {
1012 for (j = k - 1; j >= 0; --j) {
1015 for (i__ = 0; i__ <= i__1; ++i__) {
1016 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1019 work[i__ + k] += aa;
1021 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1027 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1032 for (l = j + 1; l <= i__1; ++l) {
1034 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1043 for (i__ = 1; i__ <= i__1; ++i__) {
1045 if (value < temp || disnan_(&temp)) {
1060 /* k is the row size and lda */
1062 for (i__ = n1; i__ <= i__1; ++i__) {
1066 for (j = 0; j <= i__1; ++j) {
1069 for (i__ = 0; i__ <= i__2; ++i__) {
1070 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1072 work[i__ + n1] += aa;
1077 /* j=n1=k-1 is special */
1078 s = (d__1 = a[j * lda], abs(d__1));
1081 for (i__ = 1; i__ <= i__1; ++i__) {
1082 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1084 work[i__ + n1] += aa;
1089 for (j = k; j <= i__1; ++j) {
1092 for (i__ = 0; i__ <= i__2; ++i__) {
1093 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1099 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1104 s = (d__1 = a[i__ + j * lda], abs(d__1));
1107 for (l = j + 1; l <= i__2; ++l) {
1109 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1118 for (i__ = 1; i__ <= i__1; ++i__) {
1120 if (value < temp || disnan_(&temp)) {
1127 /* k=(n+1)/2 for n odd and ilu=1 */
1129 for (i__ = k; i__ <= i__1; ++i__) {
1133 for (j = 0; j <= i__1; ++j) {
1137 for (i__ = 0; i__ <= i__2; ++i__) {
1138 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1143 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1144 /* i=j so process of A(j,j) */
1147 /* is initialised here */
1149 /* i=j process A(j+k,j+k) */
1150 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1153 for (l = k + j + 1; l <= i__2; ++l) {
1155 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1162 /* j=k-1 is special :process col A(k-1,0:k-1) */
1165 for (i__ = 0; i__ <= i__1; ++i__) {
1166 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1172 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1176 /* done with col j=k+1 */
1178 for (j = k; j <= i__1; ++j) {
1179 /* process col j of A = A(j,0:k-1) */
1182 for (i__ = 0; i__ <= i__2; ++i__) {
1183 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1192 for (i__ = 1; i__ <= i__1; ++i__) {
1194 if (value < temp || disnan_(&temp)) {
1203 for (i__ = k; i__ <= i__1; ++i__) {
1207 for (j = 0; j <= i__1; ++j) {
1210 for (i__ = 0; i__ <= i__2; ++i__) {
1211 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1213 work[i__ + k] += aa;
1219 aa = (d__1 = a[j * lda], abs(d__1));
1223 for (i__ = 1; i__ <= i__1; ++i__) {
1224 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1226 work[i__ + k] += aa;
1231 for (j = k + 1; j <= i__1; ++j) {
1234 for (i__ = 0; i__ <= i__2; ++i__) {
1235 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1241 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1242 /* A(j-k-1,j-k-1) */
1244 work[j - k - 1] += s;
1246 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1250 for (l = j + 1; l <= i__2; ++l) {
1252 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1262 for (i__ = 0; i__ <= i__1; ++i__) {
1263 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1269 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1275 for (i__ = 1; i__ <= i__1; ++i__) {
1277 if (value < temp || disnan_(&temp)) {
1284 for (i__ = k; i__ <= i__1; ++i__) {
1287 /* j=0 is special :process col A(k:n-1,k) */
1291 for (i__ = 1; i__ <= i__1; ++i__) {
1292 aa = (d__1 = a[i__], abs(d__1));
1294 work[i__ + k] += aa;
1299 for (j = 1; j <= i__1; ++j) {
1303 for (i__ = 0; i__ <= i__2; ++i__) {
1304 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1309 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1310 /* i=j-1 so process of A(j-1,j-1) */
1313 /* is initialised here */
1315 /* i=j process A(j+k,j+k) */
1316 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1319 for (l = k + j + 1; l <= i__2; ++l) {
1321 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1328 /* j=k is special :process col A(k,0:k-1) */
1331 for (i__ = 0; i__ <= i__1; ++i__) {
1332 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1338 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1342 /* done with col j=k+1 */
1344 for (j = k + 1; j <= i__1; ++j) {
1345 /* process col j-1 of A = A(j-1,0:k-1) */
1348 for (i__ = 0; i__ <= i__2; ++i__) {
1349 aa = (d__1 = a[i__ + j * lda], abs(d__1));
1358 for (i__ = 1; i__ <= i__1; ++i__) {
1360 if (value < temp || disnan_(&temp)) {
1367 } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
1369 /* Find normF(A). */
1381 for (j = 0; j <= i__1; ++j) {
1383 dlassq_(&i__2, &a[k + j + 1 + j * lda], &c__1, &scale,
1388 for (j = 0; j <= i__1; ++j) {
1390 dlassq_(&i__2, &a[j * lda], &c__1, &scale, &s);
1391 /* trap U at A(0,0) */
1394 /* double s for the off diagonal elements */
1397 dlassq_(&i__1, &a[k], &i__2, &scale, &s);
1398 /* tri L at A(k,0) */
1400 dlassq_(&k, &a[k - 1], &i__1, &scale, &s);
1401 /* tri U at A(k-1,0) */
1403 /* ilu=1 & A is lower */
1405 for (j = 0; j <= i__1; ++j) {
1407 dlassq_(&i__2, &a[j + 1 + j * lda], &c__1, &scale, &s)
1409 /* trap L at A(0,0) */
1412 for (j = 0; j <= i__1; ++j) {
1413 dlassq_(&j, &a[(j + 1) * lda], &c__1, &scale, &s);
1417 /* double s for the off diagonal elements */
1419 dlassq_(&k, a, &i__1, &scale, &s);
1420 /* tri L at A(0,0) */
1423 dlassq_(&i__1, &a[lda], &i__2, &scale, &s);
1424 /* tri U at A(0,1) */
1431 for (j = 1; j <= i__1; ++j) {
1432 dlassq_(&j, &a[(k + j) * lda], &c__1, &scale, &s);
1436 for (j = 0; j <= i__1; ++j) {
1437 dlassq_(&k, &a[j * lda], &c__1, &scale, &s);
1438 /* k by k-1 rect. at A(0,0) */
1441 for (j = 0; j <= i__1; ++j) {
1443 dlassq_(&i__2, &a[j + 1 + (j + k - 1) * lda], &c__1, &
1448 /* double s for the off diagonal elements */
1451 dlassq_(&i__1, &a[k * lda], &i__2, &scale, &s);
1452 /* tri U at A(0,k) */
1454 dlassq_(&k, &a[(k - 1) * lda], &i__1, &scale, &s);
1455 /* tri L at A(0,k-1) */
1459 for (j = 1; j <= i__1; ++j) {
1460 dlassq_(&j, &a[j * lda], &c__1, &scale, &s);
1464 for (j = k; j <= i__1; ++j) {
1465 dlassq_(&k, &a[j * lda], &c__1, &scale, &s);
1466 /* k by k-1 rect. at A(0,k) */
1469 for (j = 0; j <= i__1; ++j) {
1471 dlassq_(&i__2, &a[j + 2 + j * lda], &c__1, &scale, &s)
1476 /* double s for the off diagonal elements */
1478 dlassq_(&k, a, &i__1, &scale, &s);
1479 /* tri U at A(0,0) */
1482 dlassq_(&i__1, &a[1], &i__2, &scale, &s);
1483 /* tri L at A(1,0) */
1493 for (j = 0; j <= i__1; ++j) {
1495 dlassq_(&i__2, &a[k + j + 2 + j * lda], &c__1, &scale,
1500 for (j = 0; j <= i__1; ++j) {
1502 dlassq_(&i__2, &a[j * lda], &c__1, &scale, &s);
1503 /* trap U at A(0,0) */
1506 /* double s for the off diagonal elements */
1508 dlassq_(&k, &a[k + 1], &i__1, &scale, &s);
1509 /* tri L at A(k+1,0) */
1511 dlassq_(&k, &a[k], &i__1, &scale, &s);
1512 /* tri U at A(k,0) */
1514 /* ilu=1 & A is lower */
1516 for (j = 0; j <= i__1; ++j) {
1518 dlassq_(&i__2, &a[j + 2 + j * lda], &c__1, &scale, &s)
1520 /* trap L at A(1,0) */
1523 for (j = 1; j <= i__1; ++j) {
1524 dlassq_(&j, &a[j * lda], &c__1, &scale, &s);
1528 /* double s for the off diagonal elements */
1530 dlassq_(&k, &a[1], &i__1, &scale, &s);
1531 /* tri L at A(1,0) */
1533 dlassq_(&k, a, &i__1, &scale, &s);
1534 /* tri U at A(0,0) */
1541 for (j = 1; j <= i__1; ++j) {
1542 dlassq_(&j, &a[(k + 1 + j) * lda], &c__1, &scale, &s);
1546 for (j = 0; j <= i__1; ++j) {
1547 dlassq_(&k, &a[j * lda], &c__1, &scale, &s);
1548 /* k by k rect. at A(0,0) */
1551 for (j = 0; j <= i__1; ++j) {
1553 dlassq_(&i__2, &a[j + 1 + (j + k) * lda], &c__1, &
1558 /* double s for the off diagonal elements */
1560 dlassq_(&k, &a[(k + 1) * lda], &i__1, &scale, &s);
1561 /* tri U at A(0,k+1) */
1563 dlassq_(&k, &a[k * lda], &i__1, &scale, &s);
1564 /* tri L at A(0,k) */
1568 for (j = 1; j <= i__1; ++j) {
1569 dlassq_(&j, &a[(j + 1) * lda], &c__1, &scale, &s);
1573 for (j = k + 1; j <= i__1; ++j) {
1574 dlassq_(&k, &a[j * lda], &c__1, &scale, &s);
1575 /* k by k rect. at A(0,k+1) */
1578 for (j = 0; j <= i__1; ++j) {
1580 dlassq_(&i__2, &a[j + 1 + j * lda], &c__1, &scale, &s)
1585 /* double s for the off diagonal elements */
1587 dlassq_(&k, &a[lda], &i__1, &scale, &s);
1588 /* tri L at A(0,1) */
1590 dlassq_(&k, a, &i__1, &scale, &s);
1591 /* tri U at A(0,0) */
1595 value = scale * sqrt(s);