00001 /* slarra.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Subroutine */ int slarra_(integer *n, real *d__, real *e, real *e2, real * 00017 spltol, real *tnrm, integer *nsplit, integer *isplit, integer *info) 00018 { 00019 /* System generated locals */ 00020 integer i__1; 00021 real r__1, r__2; 00022 00023 /* Builtin functions */ 00024 double sqrt(doublereal); 00025 00026 /* Local variables */ 00027 integer i__; 00028 real tmp1, eabs; 00029 00030 00031 /* -- LAPACK auxiliary routine (version 3.2) -- */ 00032 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00033 /* November 2006 */ 00034 00035 /* .. Scalar Arguments .. */ 00036 /* .. */ 00037 /* .. Array Arguments .. */ 00038 /* .. */ 00039 00040 /* Purpose */ 00041 /* ======= */ 00042 00043 /* Compute the splitting points with threshold SPLTOL. */ 00044 /* SLARRA sets any "small" off-diagonal elements to zero. */ 00045 00046 /* Arguments */ 00047 /* ========= */ 00048 00049 /* N (input) INTEGER */ 00050 /* The order of the matrix. N > 0. */ 00051 00052 /* D (input) REAL array, dimension (N) */ 00053 /* On entry, the N diagonal elements of the tridiagonal */ 00054 /* matrix T. */ 00055 00056 /* E (input/output) REAL array, dimension (N) */ 00057 /* On entry, the first (N-1) entries contain the subdiagonal */ 00058 /* elements of the tridiagonal matrix T; E(N) need not be set. */ 00059 /* On exit, the entries E( ISPLIT( I ) ), 1 <= I <= NSPLIT, */ 00060 /* are set to zero, the other entries of E are untouched. */ 00061 00062 /* E2 (input/output) REAL array, dimension (N) */ 00063 /* On entry, the first (N-1) entries contain the SQUARES of the */ 00064 /* subdiagonal elements of the tridiagonal matrix T; */ 00065 /* E2(N) need not be set. */ 00066 /* On exit, the entries E2( ISPLIT( I ) ), */ 00067 /* 1 <= I <= NSPLIT, have been set to zero */ 00068 00069 /* SPLTOL (input) REAL */ 00070 /* The threshold for splitting. Two criteria can be used: */ 00071 /* SPLTOL<0 : criterion based on absolute off-diagonal value */ 00072 /* SPLTOL>0 : criterion that preserves relative accuracy */ 00073 00074 /* TNRM (input) REAL */ 00075 /* The norm of the matrix. */ 00076 00077 /* NSPLIT (output) INTEGER */ 00078 /* The number of blocks T splits into. 1 <= NSPLIT <= N. */ 00079 00080 /* ISPLIT (output) INTEGER array, dimension (N) */ 00081 /* The splitting points, at which T breaks up into blocks. */ 00082 /* The first block consists of rows/columns 1 to ISPLIT(1), */ 00083 /* the second of rows/columns ISPLIT(1)+1 through ISPLIT(2), */ 00084 /* etc., and the NSPLIT-th consists of rows/columns */ 00085 /* ISPLIT(NSPLIT-1)+1 through ISPLIT(NSPLIT)=N. */ 00086 00087 00088 /* INFO (output) INTEGER */ 00089 /* = 0: successful exit */ 00090 00091 /* Further Details */ 00092 /* =============== */ 00093 00094 /* Based on contributions by */ 00095 /* Beresford Parlett, University of California, Berkeley, USA */ 00096 /* Jim Demmel, University of California, Berkeley, USA */ 00097 /* Inderjit Dhillon, University of Texas, Austin, USA */ 00098 /* Osni Marques, LBNL/NERSC, USA */ 00099 /* Christof Voemel, University of California, Berkeley, USA */ 00100 00101 /* ===================================================================== */ 00102 00103 /* .. Parameters .. */ 00104 /* .. */ 00105 /* .. Local Scalars .. */ 00106 /* .. */ 00107 /* .. Intrinsic Functions .. */ 00108 /* .. */ 00109 /* .. Executable Statements .. */ 00110 00111 /* Parameter adjustments */ 00112 --isplit; 00113 --e2; 00114 --e; 00115 --d__; 00116 00117 /* Function Body */ 00118 *info = 0; 00119 /* Compute splitting points */ 00120 *nsplit = 1; 00121 if (*spltol < 0.f) { 00122 /* Criterion based on absolute off-diagonal value */ 00123 tmp1 = dabs(*spltol) * *tnrm; 00124 i__1 = *n - 1; 00125 for (i__ = 1; i__ <= i__1; ++i__) { 00126 eabs = (r__1 = e[i__], dabs(r__1)); 00127 if (eabs <= tmp1) { 00128 e[i__] = 0.f; 00129 e2[i__] = 0.f; 00130 isplit[*nsplit] = i__; 00131 ++(*nsplit); 00132 } 00133 /* L9: */ 00134 } 00135 } else { 00136 /* Criterion that guarantees relative accuracy */ 00137 i__1 = *n - 1; 00138 for (i__ = 1; i__ <= i__1; ++i__) { 00139 eabs = (r__1 = e[i__], dabs(r__1)); 00140 if (eabs <= *spltol * sqrt((r__1 = d__[i__], dabs(r__1))) * sqrt(( 00141 r__2 = d__[i__ + 1], dabs(r__2)))) { 00142 e[i__] = 0.f; 00143 e2[i__] = 0.f; 00144 isplit[*nsplit] = i__; 00145 ++(*nsplit); 00146 } 00147 /* L10: */ 00148 } 00149 } 00150 isplit[*nsplit] = *n; 00151 return 0; 00152 00153 /* End of SLARRA */ 00154 00155 } /* slarra_ */