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 SLANSF */
519 /* =========== DOCUMENTATION =========== */
521 /* Online html documentation available at */
522 /* http://www.netlib.org/lapack/explore-html/ */
525 /* > Download SLANSF + dependencies */
526 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slansf.
529 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slansf.
532 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slansf.
540 /* REAL FUNCTION SLANSF( NORM, TRANSR, UPLO, N, A, WORK ) */
542 /* CHARACTER NORM, TRANSR, UPLO */
544 /* REAL A( 0: * ), WORK( 0: * ) */
547 /* > \par Purpose: */
552 /* > SLANSF returns the value of the one norm, or the Frobenius norm, or */
553 /* > the infinity norm, or the element of largest absolute value of a */
554 /* > real symmetric matrix A in RFP format. */
557 /* > \return SLANSF */
560 /* > SLANSF = ( f2cmax(abs(A(i,j))), NORM = 'M' or 'm' */
562 /* > ( norm1(A), NORM = '1', 'O' or 'o' */
564 /* > ( normI(A), NORM = 'I' or 'i' */
566 /* > ( normF(A), NORM = 'F', 'f', 'E' or 'e' */
568 /* > where norm1 denotes the one norm of a matrix (maximum column sum), */
569 /* > normI denotes the infinity norm of a matrix (maximum row sum) and */
570 /* > normF denotes the Frobenius norm of a matrix (square root of sum of */
571 /* > squares). Note that f2cmax(abs(A(i,j))) is not a matrix norm. */
577 /* > \param[in] NORM */
579 /* > NORM is CHARACTER*1 */
580 /* > Specifies the value to be returned in SLANSF as described */
584 /* > \param[in] TRANSR */
586 /* > TRANSR is CHARACTER*1 */
587 /* > Specifies whether the RFP format of A is normal or */
588 /* > transposed format. */
589 /* > = 'N': RFP format is Normal; */
590 /* > = 'T': RFP format is Transpose. */
593 /* > \param[in] UPLO */
595 /* > UPLO is CHARACTER*1 */
596 /* > On entry, UPLO specifies whether the RFP matrix A came from */
597 /* > an upper or lower triangular matrix as follows: */
598 /* > = 'U': RFP A came from an upper triangular matrix; */
599 /* > = 'L': RFP A came from a lower triangular matrix. */
605 /* > The order of the matrix A. N >= 0. When N = 0, SLANSF is */
611 /* > A is REAL array, dimension ( N*(N+1)/2 ); */
612 /* > On entry, the upper (if UPLO = 'U') or lower (if UPLO = 'L') */
613 /* > part of the symmetric matrix A stored in RFP format. See the */
614 /* > "Notes" below for more details. */
615 /* > Unchanged on exit. */
618 /* > \param[out] WORK */
620 /* > WORK is REAL array, dimension (MAX(1,LWORK)), */
621 /* > where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise, */
622 /* > WORK is not referenced. */
628 /* > \author Univ. of Tennessee */
629 /* > \author Univ. of California Berkeley */
630 /* > \author Univ. of Colorado Denver */
631 /* > \author NAG Ltd. */
633 /* > \date December 2016 */
635 /* > \ingroup realOTHERcomputational */
637 /* > \par Further Details: */
638 /* ===================== */
642 /* > We first consider Rectangular Full Packed (RFP) Format when N is */
643 /* > even. We give an example where N = 6. */
645 /* > AP is Upper AP is Lower */
647 /* > 00 01 02 03 04 05 00 */
648 /* > 11 12 13 14 15 10 11 */
649 /* > 22 23 24 25 20 21 22 */
650 /* > 33 34 35 30 31 32 33 */
651 /* > 44 45 40 41 42 43 44 */
652 /* > 55 50 51 52 53 54 55 */
655 /* > Let TRANSR = 'N'. RFP holds AP as follows: */
656 /* > For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last */
657 /* > three columns of AP upper. The lower triangle A(4:6,0:2) consists of */
658 /* > the transpose of the first three columns of AP upper. */
659 /* > For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first */
660 /* > three columns of AP lower. The upper triangle A(0:2,0:2) consists of */
661 /* > the transpose of the last three columns of AP lower. */
662 /* > This covers the case N even and TRANSR = 'N'. */
666 /* > 03 04 05 33 43 53 */
667 /* > 13 14 15 00 44 54 */
668 /* > 23 24 25 10 11 55 */
669 /* > 33 34 35 20 21 22 */
670 /* > 00 44 45 30 31 32 */
671 /* > 01 11 55 40 41 42 */
672 /* > 02 12 22 50 51 52 */
674 /* > Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */
675 /* > transpose of RFP A above. One therefore gets: */
680 /* > 03 13 23 33 00 01 02 33 00 10 20 30 40 50 */
681 /* > 04 14 24 34 44 11 12 43 44 11 21 31 41 51 */
682 /* > 05 15 25 35 45 55 22 53 54 55 22 32 42 52 */
685 /* > We then consider Rectangular Full Packed (RFP) Format when N is */
686 /* > odd. We give an example where N = 5. */
688 /* > AP is Upper AP is Lower */
690 /* > 00 01 02 03 04 00 */
691 /* > 11 12 13 14 10 11 */
692 /* > 22 23 24 20 21 22 */
693 /* > 33 34 30 31 32 33 */
694 /* > 44 40 41 42 43 44 */
697 /* > Let TRANSR = 'N'. RFP holds AP as follows: */
698 /* > For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last */
699 /* > three columns of AP upper. The lower triangle A(3:4,0:1) consists of */
700 /* > the transpose of the first two columns of AP upper. */
701 /* > For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first */
702 /* > three columns of AP lower. The upper triangle A(0:1,1:2) consists of */
703 /* > the transpose of the last two columns of AP lower. */
704 /* > This covers the case N odd and TRANSR = 'N'. */
708 /* > 02 03 04 00 33 43 */
709 /* > 12 13 14 10 11 44 */
710 /* > 22 23 24 20 21 22 */
711 /* > 00 33 34 30 31 32 */
712 /* > 01 11 44 40 41 42 */
714 /* > Now let TRANSR = 'T'. RFP A in both UPLO cases is just the */
715 /* > transpose of RFP A above. One therefore gets: */
719 /* > 02 12 22 00 01 00 10 20 30 40 50 */
720 /* > 03 13 23 33 11 33 11 21 31 41 51 */
721 /* > 04 14 24 34 44 43 44 22 32 42 52 */
724 /* ===================================================================== */
725 real slansf_(char *norm, char *transr, char *uplo, integer *n, real *a, real *
728 /* System generated locals */
732 /* Local variables */
734 integer i__, j, k, l;
736 extern logical lsame_(char *, char *);
740 extern logical sisnan_(real *);
741 extern /* Subroutine */ int slassq_(integer *, real *, integer *, real *,
743 integer lda, ifm, noe, ilu;
746 /* -- LAPACK computational routine (version 3.7.0) -- */
747 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
748 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
752 /* ===================================================================== */
758 } else if (*n == 1) {
763 /* set noe = 1 if n is odd. if n is even set noe=0 */
770 /* set ifm = 0 when form='T or 't' and 1 otherwise */
773 if (lsame_(transr, "T")) {
777 /* set ilu = 0 when uplo='U or 'u' and 1 otherwise */
780 if (lsame_(uplo, "U")) {
784 /* set lda = (n+1)/2 when ifm = 0 */
785 /* set lda = n when ifm = 1 and noe = 1 */
786 /* set lda = n+1 when ifm = 1 and noe = 0 */
800 if (lsame_(norm, "M")) {
802 /* Find f2cmax(abs(A(i,j))). */
811 for (j = 0; j <= i__1; ++j) {
813 for (i__ = 0; i__ <= i__2; ++i__) {
814 temp = (r__1 = a[i__ + j * lda], abs(r__1));
815 if (value < temp || sisnan_(&temp)) {
821 /* xpose case; A is k by n */
823 for (j = 0; j <= i__1; ++j) {
825 for (i__ = 0; i__ <= i__2; ++i__) {
826 temp = (r__1 = a[i__ + j * lda], abs(r__1));
827 if (value < temp || sisnan_(&temp)) {
838 for (j = 0; j <= i__1; ++j) {
840 for (i__ = 0; i__ <= i__2; ++i__) {
841 temp = (r__1 = a[i__ + j * lda], abs(r__1));
842 if (value < temp || sisnan_(&temp)) {
848 /* xpose case; A is k by n+1 */
850 for (j = 0; j <= i__1; ++j) {
852 for (i__ = 0; i__ <= i__2; ++i__) {
853 temp = (r__1 = a[i__ + j * lda], abs(r__1));
854 if (value < temp || sisnan_(&temp)) {
861 } else if (lsame_(norm, "I") || lsame_(norm, "O") || *(unsigned char *)norm == '1') {
863 /* Find normI(A) ( = norm1(A), since A is symmetric). */
871 for (i__ = 0; i__ <= i__1; ++i__) {
875 for (j = 0; j <= i__1; ++j) {
878 for (i__ = 0; i__ <= i__2; ++i__) {
879 aa = (r__1 = a[i__ + j * lda], abs(r__1));
884 aa = (r__1 = a[i__ + j * lda], abs(r__1));
886 work[j + k] = s + aa;
891 aa = (r__1 = a[i__ + j * lda], abs(r__1));
896 for (l = j + 1; l <= i__2; ++l) {
898 aa = (r__1 = a[i__ + j * lda], abs(r__1));
908 for (i__ = 1; i__ <= i__1; ++i__) {
910 if (value < temp || sisnan_(&temp)) {
917 /* k=(n+1)/2 for n odd and ilu=1 */
919 for (i__ = k; i__ <= i__1; ++i__) {
922 for (j = k - 1; j >= 0; --j) {
925 for (i__ = 0; i__ <= i__1; ++i__) {
926 aa = (r__1 = a[i__ + j * lda], abs(r__1));
932 aa = (r__1 = a[i__ + j * lda], abs(r__1));
939 aa = (r__1 = a[i__ + j * lda], abs(r__1));
944 for (l = j + 1; l <= i__1; ++l) {
946 aa = (r__1 = a[i__ + j * lda], abs(r__1));
955 for (i__ = 1; i__ <= i__1; ++i__) {
957 if (value < temp || sisnan_(&temp)) {
966 for (i__ = 0; i__ <= i__1; ++i__) {
970 for (j = 0; j <= i__1; ++j) {
973 for (i__ = 0; i__ <= i__2; ++i__) {
974 aa = (r__1 = a[i__ + j * lda], abs(r__1));
979 aa = (r__1 = a[i__ + j * lda], abs(r__1));
981 work[j + k] = s + aa;
983 aa = (r__1 = a[i__ + j * lda], abs(r__1));
988 for (l = j + 1; l <= i__2; ++l) {
990 aa = (r__1 = a[i__ + j * lda], abs(r__1));
999 for (i__ = 1; i__ <= i__1; ++i__) {
1001 if (value < temp || sisnan_(&temp)) {
1008 for (i__ = k; i__ <= i__1; ++i__) {
1011 for (j = k - 1; j >= 0; --j) {
1014 for (i__ = 0; i__ <= i__1; ++i__) {
1015 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1018 work[i__ + k] += aa;
1020 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1026 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1031 for (l = j + 1; l <= i__1; ++l) {
1033 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1042 for (i__ = 1; i__ <= i__1; ++i__) {
1044 if (value < temp || sisnan_(&temp)) {
1059 /* k is the row size and lda */
1061 for (i__ = n1; i__ <= i__1; ++i__) {
1065 for (j = 0; j <= i__1; ++j) {
1068 for (i__ = 0; i__ <= i__2; ++i__) {
1069 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1071 work[i__ + n1] += aa;
1076 /* j=n1=k-1 is special */
1077 s = (r__1 = a[j * lda], abs(r__1));
1080 for (i__ = 1; i__ <= i__1; ++i__) {
1081 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1083 work[i__ + n1] += aa;
1088 for (j = k; j <= i__1; ++j) {
1091 for (i__ = 0; i__ <= i__2; ++i__) {
1092 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1098 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1103 s = (r__1 = a[i__ + j * lda], abs(r__1));
1106 for (l = j + 1; l <= i__2; ++l) {
1108 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1117 for (i__ = 1; i__ <= i__1; ++i__) {
1119 if (value < temp || sisnan_(&temp)) {
1126 /* k=(n+1)/2 for n odd and ilu=1 */
1128 for (i__ = k; i__ <= i__1; ++i__) {
1132 for (j = 0; j <= i__1; ++j) {
1136 for (i__ = 0; i__ <= i__2; ++i__) {
1137 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1142 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1143 /* i=j so process of A(j,j) */
1146 /* is initialised here */
1148 /* i=j process A(j+k,j+k) */
1149 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1152 for (l = k + j + 1; l <= i__2; ++l) {
1154 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1161 /* j=k-1 is special :process col A(k-1,0:k-1) */
1164 for (i__ = 0; i__ <= i__1; ++i__) {
1165 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1171 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1175 /* done with col j=k+1 */
1177 for (j = k; j <= i__1; ++j) {
1178 /* process col j of A = A(j,0:k-1) */
1181 for (i__ = 0; i__ <= i__2; ++i__) {
1182 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1191 for (i__ = 1; i__ <= i__1; ++i__) {
1193 if (value < temp || sisnan_(&temp)) {
1202 for (i__ = k; i__ <= i__1; ++i__) {
1206 for (j = 0; j <= i__1; ++j) {
1209 for (i__ = 0; i__ <= i__2; ++i__) {
1210 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1212 work[i__ + k] += aa;
1218 aa = (r__1 = a[j * lda], abs(r__1));
1222 for (i__ = 1; i__ <= i__1; ++i__) {
1223 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1225 work[i__ + k] += aa;
1230 for (j = k + 1; j <= i__1; ++j) {
1233 for (i__ = 0; i__ <= i__2; ++i__) {
1234 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1240 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1241 /* A(j-k-1,j-k-1) */
1243 work[j - k - 1] += s;
1245 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1249 for (l = j + 1; l <= i__2; ++l) {
1251 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1261 for (i__ = 0; i__ <= i__1; ++i__) {
1262 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1268 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1274 for (i__ = 1; i__ <= i__1; ++i__) {
1276 if (value < temp || sisnan_(&temp)) {
1283 for (i__ = k; i__ <= i__1; ++i__) {
1286 /* j=0 is special :process col A(k:n-1,k) */
1290 for (i__ = 1; i__ <= i__1; ++i__) {
1291 aa = (r__1 = a[i__], abs(r__1));
1293 work[i__ + k] += aa;
1298 for (j = 1; j <= i__1; ++j) {
1302 for (i__ = 0; i__ <= i__2; ++i__) {
1303 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1308 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1309 /* i=j-1 so process of A(j-1,j-1) */
1312 /* is initialised here */
1314 /* i=j process A(j+k,j+k) */
1315 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1318 for (l = k + j + 1; l <= i__2; ++l) {
1320 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1327 /* j=k is special :process col A(k,0:k-1) */
1330 for (i__ = 0; i__ <= i__1; ++i__) {
1331 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1337 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1341 /* done with col j=k+1 */
1343 for (j = k + 1; j <= i__1; ++j) {
1344 /* process col j-1 of A = A(j-1,0:k-1) */
1347 for (i__ = 0; i__ <= i__2; ++i__) {
1348 aa = (r__1 = a[i__ + j * lda], abs(r__1));
1357 for (i__ = 1; i__ <= i__1; ++i__) {
1359 if (value < temp || sisnan_(&temp)) {
1366 } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
1368 /* Find normF(A). */
1380 for (j = 0; j <= i__1; ++j) {
1382 slassq_(&i__2, &a[k + j + 1 + j * lda], &c__1, &scale,
1387 for (j = 0; j <= i__1; ++j) {
1389 slassq_(&i__2, &a[j * lda], &c__1, &scale, &s);
1390 /* trap U at A(0,0) */
1393 /* double s for the off diagonal elements */
1396 slassq_(&i__1, &a[k], &i__2, &scale, &s);
1397 /* tri L at A(k,0) */
1399 slassq_(&k, &a[k - 1], &i__1, &scale, &s);
1400 /* tri U at A(k-1,0) */
1402 /* ilu=1 & A is lower */
1404 for (j = 0; j <= i__1; ++j) {
1406 slassq_(&i__2, &a[j + 1 + j * lda], &c__1, &scale, &s)
1408 /* trap L at A(0,0) */
1411 for (j = 0; j <= i__1; ++j) {
1412 slassq_(&j, &a[(j + 1) * lda], &c__1, &scale, &s);
1416 /* double s for the off diagonal elements */
1418 slassq_(&k, a, &i__1, &scale, &s);
1419 /* tri L at A(0,0) */
1422 slassq_(&i__1, &a[lda], &i__2, &scale, &s);
1423 /* tri U at A(0,1) */
1430 for (j = 1; j <= i__1; ++j) {
1431 slassq_(&j, &a[(k + j) * lda], &c__1, &scale, &s);
1435 for (j = 0; j <= i__1; ++j) {
1436 slassq_(&k, &a[j * lda], &c__1, &scale, &s);
1437 /* k by k-1 rect. at A(0,0) */
1440 for (j = 0; j <= i__1; ++j) {
1442 slassq_(&i__2, &a[j + 1 + (j + k - 1) * lda], &c__1, &
1447 /* double s for the off diagonal elements */
1450 slassq_(&i__1, &a[k * lda], &i__2, &scale, &s);
1451 /* tri U at A(0,k) */
1453 slassq_(&k, &a[(k - 1) * lda], &i__1, &scale, &s);
1454 /* tri L at A(0,k-1) */
1458 for (j = 1; j <= i__1; ++j) {
1459 slassq_(&j, &a[j * lda], &c__1, &scale, &s);
1463 for (j = k; j <= i__1; ++j) {
1464 slassq_(&k, &a[j * lda], &c__1, &scale, &s);
1465 /* k by k-1 rect. at A(0,k) */
1468 for (j = 0; j <= i__1; ++j) {
1470 slassq_(&i__2, &a[j + 2 + j * lda], &c__1, &scale, &s)
1475 /* double s for the off diagonal elements */
1477 slassq_(&k, a, &i__1, &scale, &s);
1478 /* tri U at A(0,0) */
1481 slassq_(&i__1, &a[1], &i__2, &scale, &s);
1482 /* tri L at A(1,0) */
1492 for (j = 0; j <= i__1; ++j) {
1494 slassq_(&i__2, &a[k + j + 2 + j * lda], &c__1, &scale,
1499 for (j = 0; j <= i__1; ++j) {
1501 slassq_(&i__2, &a[j * lda], &c__1, &scale, &s);
1502 /* trap U at A(0,0) */
1505 /* double s for the off diagonal elements */
1507 slassq_(&k, &a[k + 1], &i__1, &scale, &s);
1508 /* tri L at A(k+1,0) */
1510 slassq_(&k, &a[k], &i__1, &scale, &s);
1511 /* tri U at A(k,0) */
1513 /* ilu=1 & A is lower */
1515 for (j = 0; j <= i__1; ++j) {
1517 slassq_(&i__2, &a[j + 2 + j * lda], &c__1, &scale, &s)
1519 /* trap L at A(1,0) */
1522 for (j = 1; j <= i__1; ++j) {
1523 slassq_(&j, &a[j * lda], &c__1, &scale, &s);
1527 /* double s for the off diagonal elements */
1529 slassq_(&k, &a[1], &i__1, &scale, &s);
1530 /* tri L at A(1,0) */
1532 slassq_(&k, a, &i__1, &scale, &s);
1533 /* tri U at A(0,0) */
1540 for (j = 1; j <= i__1; ++j) {
1541 slassq_(&j, &a[(k + 1 + j) * lda], &c__1, &scale, &s);
1545 for (j = 0; j <= i__1; ++j) {
1546 slassq_(&k, &a[j * lda], &c__1, &scale, &s);
1547 /* k by k rect. at A(0,0) */
1550 for (j = 0; j <= i__1; ++j) {
1552 slassq_(&i__2, &a[j + 1 + (j + k) * lda], &c__1, &
1557 /* double s for the off diagonal elements */
1559 slassq_(&k, &a[(k + 1) * lda], &i__1, &scale, &s);
1560 /* tri U at A(0,k+1) */
1562 slassq_(&k, &a[k * lda], &i__1, &scale, &s);
1563 /* tri L at A(0,k) */
1567 for (j = 1; j <= i__1; ++j) {
1568 slassq_(&j, &a[(j + 1) * lda], &c__1, &scale, &s);
1572 for (j = k + 1; j <= i__1; ++j) {
1573 slassq_(&k, &a[j * lda], &c__1, &scale, &s);
1574 /* k by k rect. at A(0,k+1) */
1577 for (j = 0; j <= i__1; ++j) {
1579 slassq_(&i__2, &a[j + 1 + j * lda], &c__1, &scale, &s)
1584 /* double s for the off diagonal elements */
1586 slassq_(&k, &a[lda], &i__1, &scale, &s);
1587 /* tri L at A(0,1) */
1589 slassq_(&k, a, &i__1, &scale, &s);
1590 /* tri U at A(0,0) */
1594 value = scale * sqrt(s);