00001 /* dlarra.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 dlarra_(integer *n, doublereal *d__, doublereal *e, 00017 doublereal *e2, doublereal *spltol, doublereal *tnrm, integer *nsplit, 00018 integer *isplit, integer *info) 00019 { 00020 /* System generated locals */ 00021 integer i__1; 00022 doublereal d__1, d__2; 00023 00024 /* Builtin functions */ 00025 double sqrt(doublereal); 00026 00027 /* Local variables */ 00028 integer i__; 00029 doublereal tmp1, eabs; 00030 00031 00032 /* -- LAPACK auxiliary routine (version 3.2) -- */ 00033 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00034 /* November 2006 */ 00035 00036 /* .. Scalar Arguments .. */ 00037 /* .. */ 00038 /* .. Array Arguments .. */ 00039 /* .. */ 00040 00041 /* Purpose */ 00042 /* ======= */ 00043 00044 /* Compute the splitting points with threshold SPLTOL. */ 00045 /* DLARRA sets any "small" off-diagonal elements to zero. */ 00046 00047 /* Arguments */ 00048 /* ========= */ 00049 00050 /* N (input) INTEGER */ 00051 /* The order of the matrix. N > 0. */ 00052 00053 /* D (input) DOUBLE PRECISION array, dimension (N) */ 00054 /* On entry, the N diagonal elements of the tridiagonal */ 00055 /* matrix T. */ 00056 00057 /* E (input/output) DOUBLE PRECISION array, dimension (N) */ 00058 /* On entry, the first (N-1) entries contain the subdiagonal */ 00059 /* elements of the tridiagonal matrix T; E(N) need not be set. */ 00060 /* On exit, the entries E( ISPLIT( I ) ), 1 <= I <= NSPLIT, */ 00061 /* are set to zero, the other entries of E are untouched. */ 00062 00063 /* E2 (input/output) DOUBLE PRECISION array, dimension (N) */ 00064 /* On entry, the first (N-1) entries contain the SQUARES of the */ 00065 /* subdiagonal elements of the tridiagonal matrix T; */ 00066 /* E2(N) need not be set. */ 00067 /* On exit, the entries E2( ISPLIT( I ) ), */ 00068 /* 1 <= I <= NSPLIT, have been set to zero */ 00069 00070 /* SPLTOL (input) DOUBLE PRECISION */ 00071 /* The threshold for splitting. Two criteria can be used: */ 00072 /* SPLTOL<0 : criterion based on absolute off-diagonal value */ 00073 /* SPLTOL>0 : criterion that preserves relative accuracy */ 00074 00075 /* TNRM (input) DOUBLE PRECISION */ 00076 /* The norm of the matrix. */ 00077 00078 /* NSPLIT (output) INTEGER */ 00079 /* The number of blocks T splits into. 1 <= NSPLIT <= N. */ 00080 00081 /* ISPLIT (output) INTEGER array, dimension (N) */ 00082 /* The splitting points, at which T breaks up into blocks. */ 00083 /* The first block consists of rows/columns 1 to ISPLIT(1), */ 00084 /* the second of rows/columns ISPLIT(1)+1 through ISPLIT(2), */ 00085 /* etc., and the NSPLIT-th consists of rows/columns */ 00086 /* ISPLIT(NSPLIT-1)+1 through ISPLIT(NSPLIT)=N. */ 00087 00088 00089 /* INFO (output) INTEGER */ 00090 /* = 0: successful exit */ 00091 00092 /* Further Details */ 00093 /* =============== */ 00094 00095 /* Based on contributions by */ 00096 /* Beresford Parlett, University of California, Berkeley, USA */ 00097 /* Jim Demmel, University of California, Berkeley, USA */ 00098 /* Inderjit Dhillon, University of Texas, Austin, USA */ 00099 /* Osni Marques, LBNL/NERSC, USA */ 00100 /* Christof Voemel, University of California, Berkeley, USA */ 00101 00102 /* ===================================================================== */ 00103 00104 /* .. Parameters .. */ 00105 /* .. */ 00106 /* .. Local Scalars .. */ 00107 /* .. */ 00108 /* .. Intrinsic Functions .. */ 00109 /* .. */ 00110 /* .. Executable Statements .. */ 00111 00112 /* Parameter adjustments */ 00113 --isplit; 00114 --e2; 00115 --e; 00116 --d__; 00117 00118 /* Function Body */ 00119 *info = 0; 00120 /* Compute splitting points */ 00121 *nsplit = 1; 00122 if (*spltol < 0.) { 00123 /* Criterion based on absolute off-diagonal value */ 00124 tmp1 = abs(*spltol) * *tnrm; 00125 i__1 = *n - 1; 00126 for (i__ = 1; i__ <= i__1; ++i__) { 00127 eabs = (d__1 = e[i__], abs(d__1)); 00128 if (eabs <= tmp1) { 00129 e[i__] = 0.; 00130 e2[i__] = 0.; 00131 isplit[*nsplit] = i__; 00132 ++(*nsplit); 00133 } 00134 /* L9: */ 00135 } 00136 } else { 00137 /* Criterion that guarantees relative accuracy */ 00138 i__1 = *n - 1; 00139 for (i__ = 1; i__ <= i__1; ++i__) { 00140 eabs = (d__1 = e[i__], abs(d__1)); 00141 if (eabs <= *spltol * sqrt((d__1 = d__[i__], abs(d__1))) * sqrt(( 00142 d__2 = d__[i__ + 1], abs(d__2)))) { 00143 e[i__] = 0.; 00144 e2[i__] = 0.; 00145 isplit[*nsplit] = i__; 00146 ++(*nsplit); 00147 } 00148 /* L10: */ 00149 } 00150 } 00151 isplit[*nsplit] = *n; 00152 return 0; 00153 00154 /* End of DLARRA */ 00155 00156 } /* dlarra_ */