| 1 | /* eispack/tred1.f -- translated by f2c (version 20050501). |
| 2 | You must link the resulting object file with libf2c: |
| 3 | on Microsoft Windows system, link with libf2c.lib; |
| 4 | on Linux or Unix systems, link with .../path/to/libf2c.a -lm |
| 5 | or, if you install libf2c.a in a standard place, with -lf2c -lm |
| 6 | -- in that order, at the end of the command line, as in |
| 7 | cc *.o -lf2c -lm |
| 8 | Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., |
| 9 | |
| 10 | http://www.netlib.org/f2c/libf2c.zip |
| 11 | */ |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | #include "v3p_netlib.h"cxx . . $ `<file>/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib.h`/ |
| 17 | |
| 18 | /*< subroutine tred1(nm,n,a,d,e,e2) >*/ |
| 19 | /* Subroutine */ int tred1_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:300:9`!(integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *nm, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *n, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *a, |
| 20 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *d__, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *e, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *e2) |
| 21 | { |
| 22 | /* System generated locals */ |
| 23 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! a_dim1, a_offset, i__1, i__2, i__3; |
| 24 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! d__1; |
| 25 | |
| 26 | /* Builtin functions */ |
| 27 | double sqrtcxx . . $ sqrt(447c67c6676f75c3).(doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`!), d_signcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:14:9`!(doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *); |
| 28 | |
| 29 | /* Local variables */ |
| 30 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! f, g, h__; |
| 31 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! i__, j, k, l, ii, jp1; |
| 32 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! scale; |
| 33 | |
| 34 | |
| 35 | /*< integer i,j,k,l,n,ii,nm,jp1 >*/ |
| 36 | /*< double precision a(nm,n),d(n),e(n),e2(n) >*/ |
| 37 | /*< double precision f,g,h,scale >*/ |
| 38 | |
| 39 | /* this subroutine is a translation of the algol procedure tred1, */ |
| 40 | /* num. math. 11, 181-195(1968) by martin, reinsch, and wilkinson. */ |
| 41 | /* handbook for auto. comp., vol.ii-linear algebra, 212-226(1971). */ |
| 42 | |
| 43 | /* this subroutine reduces a real symmetric matrix */ |
| 44 | /* to a symmetric tridiagonal matrix using */ |
| 45 | /* orthogonal similarity transformations. */ |
| 46 | |
| 47 | /* on input */ |
| 48 | |
| 49 | /* nm must be set to the row dimension of two-dimensional */ |
| 50 | /* array parameters as declared in the calling program */ |
| 51 | /* dimension statement. */ |
| 52 | |
| 53 | /* n is the order of the matrix. */ |
| 54 | |
| 55 | /* a contains the real symmetric input matrix. only the */ |
| 56 | /* lower triangle of the matrix need be supplied. */ |
| 57 | |
| 58 | /* on output */ |
| 59 | |
| 60 | /* a contains information about the orthogonal trans- */ |
| 61 | /* formations used in the reduction in its strict lower */ |
| 62 | /* triangle. the full upper triangle of a is unaltered. */ |
| 63 | |
| 64 | /* d contains the diagonal elements of the tridiagonal matrix. */ |
| 65 | |
| 66 | /* e contains the subdiagonal elements of the tridiagonal */ |
| 67 | /* matrix in its last n-1 positions. e(1) is set to zero. */ |
| 68 | |
| 69 | /* e2 contains the squares of the corresponding elements of e. */ |
| 70 | /* e2 may coincide with e if the squares are not needed. */ |
| 71 | |
| 72 | /* questions and comments should be directed to burton s. garbow, */ |
| 73 | /* mathematics and computer science div, argonne national laboratory */ |
| 74 | |
| 75 | /* this version dated august 1983. */ |
| 76 | |
| 77 | /* ------------------------------------------------------------------ */ |
| 78 | |
| 79 | /*< do 100 i = 1, n >*/ |
| 80 | /* Parameter adjustments */ |
| 81 | --e2; |
| 82 | --e; |
| 83 | --d__; |
| 84 | a_dim1 = *nm; |
| 85 | a_offset = 1 + a_dim1; |
| 86 | a -= a_offset; |
| 87 | |
| 88 | /* Function Body */ |
| 89 | i__1 = *n; |
| 90 | for (i__ = 1; i__ <= i__1; ++i__) { |
| 91 | /*< d(i) = a(n,i) >*/ |
| 92 | d__[i__] = a[*n + i__ * a_dim1]; |
| 93 | /*< a(n,i) = a(i,i) >*/ |
| 94 | a[*n + i__ * a_dim1] = a[i__ + i__ * a_dim1]; |
| 95 | /*< 100 continue >*/ |
| 96 | /* L100: */ |
| 97 | } |
| 98 | /* .......... for i=n step -1 until 1 do -- .......... */ |
| 99 | /*< do 300 ii = 1, n >*/ |
| 100 | i__1 = *n; |
| 101 | for (ii = 1; ii <= i__1; ++ii) { |
| 102 | /*< i = n + 1 - ii >*/ |
| 103 | i__ = *n + 1 - ii; |
| 104 | /*< l = i - 1 >*/ |
| 105 | l = i__ - 1; |
| 106 | /*< h = 0.0d0 >*/ |
| 107 | h__ = 0.; |
| 108 | /*< scale = 0.0d0 >*/ |
| 109 | scale = 0.; |
| 110 | /*< if (l .lt. 1) go to 130 >*/ |
| 111 | if (l < 1) { |
| 112 | goto L130; |
| 113 | } |
| 114 | /* .......... scale row (algol tol then not needed) .......... */ |
| 115 | /*< do 120 k = 1, l >*/ |
| 116 | i__2 = l; |
| 117 | for (k = 1; k <= i__2; ++k) { |
| 118 | /*< 120 scale = scale + dabs(d(k)) >*/ |
| 119 | /* L120: */ |
| 120 | scale += (d__1 = d__[k], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__1)); |
| 121 | } |
| 122 | |
| 123 | /*< if (scale .ne. 0.0d0) go to 140 >*/ |
| 124 | if (scale != 0.) { |
| 125 | goto L140; |
| 126 | } |
| 127 | |
| 128 | /*< do 125 j = 1, l >*/ |
| 129 | i__2 = l; |
| 130 | for (j = 1; j <= i__2; ++j) { |
| 131 | /*< d(j) = a(l,j) >*/ |
| 132 | d__[j] = a[l + j * a_dim1]; |
| 133 | /*< a(l,j) = a(i,j) >*/ |
| 134 | a[l + j * a_dim1] = a[i__ + j * a_dim1]; |
| 135 | /*< a(i,j) = 0.0d0 >*/ |
| 136 | a[i__ + j * a_dim1] = 0.; |
| 137 | /*< 125 continue >*/ |
| 138 | /* L125: */ |
| 139 | } |
| 140 | |
| 141 | /*< 130 e(i) = 0.0d0 >*/ |
| 142 | L130: |
| 143 | e[i__] = 0.; |
| 144 | /*< e2(i) = 0.0d0 >*/ |
| 145 | e2[i__] = 0.; |
| 146 | /*< go to 300 >*/ |
| 147 | goto L300; |
| 148 | |
| 149 | /*< 140 do 150 k = 1, l >*/ |
| 150 | L140: |
| 151 | i__2 = l; |
| 152 | for (k = 1; k <= i__2; ++k) { |
| 153 | /*< d(k) = d(k) / scale >*/ |
| 154 | d__[k] /= scale; |
| 155 | /*< h = h + d(k) * d(k) >*/ |
| 156 | h__ += d__[k] * d__[k]; |
| 157 | /*< 150 continue >*/ |
| 158 | /* L150: */ |
| 159 | } |
| 160 | |
| 161 | /*< e2(i) = scale * scale * h >*/ |
| 162 | e2[i__] = scale * scale * h__; |
| 163 | /*< f = d(l) >*/ |
| 164 | f = d__[l]; |
| 165 | /*< g = -dsign(dsqrt(h),f) >*/ |
| 166 | d__1 = sqrtcxx . . $ sqrt(447c67c6676f75c3).(h__); |
| 167 | g = -d_signcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:14:9`!(&d__1, &f); |
| 168 | /*< e(i) = scale * g >*/ |
| 169 | e[i__] = scale * g; |
| 170 | /*< h = h - f * g >*/ |
| 171 | h__ -= f * g; |
| 172 | /*< d(l) = f - g >*/ |
| 173 | d__[l] = f - g; |
| 174 | /*< if (l .eq. 1) go to 285 >*/ |
| 175 | if (l == 1) { |
| 176 | goto L285; |
| 177 | } |
| 178 | /* .......... form a*u .......... */ |
| 179 | /*< do 170 j = 1, l >*/ |
| 180 | i__2 = l; |
| 181 | for (j = 1; j <= i__2; ++j) { |
| 182 | /*< 170 e(j) = 0.0d0 >*/ |
| 183 | /* L170: */ |
| 184 | e[j] = 0.; |
| 185 | } |
| 186 | |
| 187 | /*< do 240 j = 1, l >*/ |
| 188 | i__2 = l; |
| 189 | for (j = 1; j <= i__2; ++j) { |
| 190 | /*< f = d(j) >*/ |
| 191 | f = d__[j]; |
| 192 | /*< g = e(j) + a(j,j) * f >*/ |
| 193 | g = e[j] + a[j + j * a_dim1] * f; |
| 194 | /*< jp1 = j + 1 >*/ |
| 195 | jp1 = j + 1; |
| 196 | /*< if (l .lt. jp1) go to 220 >*/ |
| 197 | if (l < jp1) { |
| 198 | goto L220; |
| 199 | } |
| 200 | |
| 201 | /*< do 200 k = jp1, l >*/ |
| 202 | i__3 = l; |
| 203 | for (k = jp1; k <= i__3; ++k) { |
| 204 | /*< g = g + a(k,j) * d(k) >*/ |
| 205 | g += a[k + j * a_dim1] * d__[k]; |
| 206 | /*< e(k) = e(k) + a(k,j) * f >*/ |
| 207 | e[k] += a[k + j * a_dim1] * f; |
| 208 | /*< 200 continue >*/ |
| 209 | /* L200: */ |
| 210 | } |
| 211 | |
| 212 | /*< 220 e(j) = g >*/ |
| 213 | L220: |
| 214 | e[j] = g; |
| 215 | /*< 240 continue >*/ |
| 216 | /* L240: */ |
| 217 | } |
| 218 | /* .......... form p .......... */ |
| 219 | /*< f = 0.0d0 >*/ |
| 220 | f = 0.; |
| 221 | |
| 222 | /*< do 245 j = 1, l >*/ |
| 223 | i__2 = l; |
| 224 | for (j = 1; j <= i__2; ++j) { |
| 225 | /*< e(j) = e(j) / h >*/ |
| 226 | e[j] /= h__; |
| 227 | /*< f = f + e(j) * d(j) >*/ |
| 228 | f += e[j] * d__[j]; |
| 229 | /*< 245 continue >*/ |
| 230 | /* L245: */ |
| 231 | } |
| 232 | |
| 233 | /*< h = f / (h + h) >*/ |
| 234 | h__ = f / (h__ + h__); |
| 235 | /* .......... form q .......... */ |
| 236 | /*< do 250 j = 1, l >*/ |
| 237 | i__2 = l; |
| 238 | for (j = 1; j <= i__2; ++j) { |
| 239 | /*< 250 e(j) = e(j) - h * d(j) >*/ |
| 240 | /* L250: */ |
| 241 | e[j] -= h__ * d__[j]; |
| 242 | } |
| 243 | /* .......... form reduced a .......... */ |
| 244 | /*< do 280 j = 1, l >*/ |
| 245 | i__2 = l; |
| 246 | for (j = 1; j <= i__2; ++j) { |
| 247 | /*< f = d(j) >*/ |
| 248 | f = d__[j]; |
| 249 | /*< g = e(j) >*/ |
| 250 | g = e[j]; |
| 251 | |
| 252 | /*< do 260 k = j, l >*/ |
| 253 | i__3 = l; |
| 254 | for (k = j; k <= i__3; ++k) { |
| 255 | /*< 260 a(k,j) = a(k,j) - f * e(k) - g * d(k) >*/ |
| 256 | /* L260: */ |
| 257 | a[k + j * a_dim1] = a[k + j * a_dim1] - f * e[k] - g * d__[k]; |
| 258 | } |
| 259 | |
| 260 | /*< 280 continue >*/ |
| 261 | /* L280: */ |
| 262 | } |
| 263 | |
| 264 | /*< 285 do 290 j = 1, l >*/ |
| 265 | L285: |
| 266 | i__2 = l; |
| 267 | for (j = 1; j <= i__2; ++j) { |
| 268 | /*< f = d(j) >*/ |
| 269 | f = d__[j]; |
| 270 | /*< d(j) = a(l,j) >*/ |
| 271 | d__[j] = a[l + j * a_dim1]; |
| 272 | /*< a(l,j) = a(i,j) >*/ |
| 273 | a[l + j * a_dim1] = a[i__ + j * a_dim1]; |
| 274 | /*< a(i,j) = f * scale >*/ |
| 275 | a[i__ + j * a_dim1] = f * scale; |
| 276 | /*< 290 continue >*/ |
| 277 | /* L290: */ |
| 278 | } |
| 279 | |
| 280 | /*< 300 continue >*/ |
| 281 | L300: |
| 282 | ; |
| 283 | } |
| 284 | |
| 285 | /*< return >*/ |
| 286 | return 0; |
| 287 | /*< end >*/ |
| 288 | } /* tred1_ */ |
| 289 | |
| 290 | #ifdef __cplusplus |
| 291 | } |
| 292 | #endif |