arg@ccvr1.ncsu.edu (Ron Gallant) (12/23/90)
#! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 3 (of 6)." # Contents: ch1eg1/detail.bak ch6eg2/hansen.dat nlopr.cc realmat.cc # Wrapped by arg@sparc on Sat Dec 22 15:25:09 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'ch1eg1/detail.bak' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ch1eg1/detail.bak'\" else echo shar: Extracting \"'ch1eg1/detail.bak'\" \(11585 characters\) sed "s/^X//" >'ch1eg1/detail.bak' <<'END_OF_FILE' X X X ********************************************************************** X * * X * data * X * * X ********************************************************************** X X X Col 1 Col 2 Col 3 Col 4 Col 5 X X Row 1 1.00000 0.986100 1.00000 1.00000 6.28000 X Row 2 2.00000 1.03848 0.0 1.00000 9.86000 X Row 3 3.00000 0.954820 1.00000 1.00000 9.11000 X Row 4 4.00000 1.04184 0.0 1.00000 8.43000 X Row 5 5.00000 1.02324 1.00000 1.00000 8.11000 X Row 6 6.00000 0.904750 0.0 1.00000 1.82000 X Row 7 7.00000 0.962630 1.00000 1.00000 6.58000 X Row 8 8.00000 1.05026 0.0 1.00000 5.02000 X Row 9 9.00000 0.988610 1.00000 1.00000 6.52000 X Row 10 10.0000 1.03437 0.0 1.00000 3.75000 X Row 11 11.0000 0.989820 1.00000 1.00000 9.86000 X Row 12 12.0000 1.01214 0.0 1.00000 7.31000 X Row 13 13.0000 0.667680 1.00000 1.00000 0.470000 X Row 14 14.0000 0.551070 0.0 1.00000 0.0700000 X Row 15 15.0000 0.968220 1.00000 1.00000 4.07000 X Row 16 16.0000 0.988230 0.0 1.00000 4.61000 X Row 17 17.0000 0.597590 1.00000 1.00000 0.170000 X Row 18 18.0000 0.994180 0.0 1.00000 6.99000 X Row 19 19.0000 1.01962 1.00000 1.00000 4.39000 X Row 20 20.0000 0.691630 0.0 1.00000 0.390000 X Row 21 21.0000 1.04255 1.00000 1.00000 4.73000 X Row 22 22.0000 1.04343 0.0 1.00000 9.42000 X Row 23 23.0000 0.975260 1.00000 1.00000 8.90000 X Row 24 24.0000 1.04969 0.0 1.00000 3.02000 X Row 25 25.0000 0.802190 1.00000 1.00000 0.770000 X Row 26 26.0000 1.01046 0.0 1.00000 3.31000 X Row 27 27.0000 0.951960 1.00000 1.00000 4.51000 X Row 28 28.0000 0.976580 0.0 1.00000 2.65000 X Row 29 29.0000 0.508110 1.00000 1.00000 0.0800000 X Row 30 30.0000 0.918400 0.0 1.00000 6.11000 X X X ********************************************************************** X * * X * Parameter settings * X * * X ********************************************************************** X X Gallant, "Nonlinear Statistical Models," Chapter 1, Figure 5, p. 35-36. X SUR What estimation method? Code SUR, TSLS, or GMM. X 30 Number of observations, t = 1, ..., n. X 1 Number of equations, i.e. dimension of e. X 0 Number of instruments, i.e. dimension of Z. X 4 Number of parameters, i.e. dimension of theta. X 50 Upper limit on Gauss-Newton iterations. X 1 Number var iterates, ivar=0 means none. X homoskedastic Code homoskedastic or heteroskedastic. X 0 Number of moving average terms MA for var estimate. X none Code none or Parzen, none when MA>0 is unwise. X 1.000000e-13 Convergence tolerance, tol=1.0e-8 is reasonable. X 1.000000e-10 Inversion tolerance, eps=1.0e-13 is reasonable X full How much output? Code none, minimal, or full. X X X ********************************************************************** X * * X * Starting theta * X * * X ********************************************************************** X X X Col 1 X X Row 1 -0.0486600 X Row 2 1.03884 X Row 3 -0.737920 X Row 4 -0.513620 X Xvar_loop 0 X 1.0000000000000000e+00 1.00000000 var(1,1) X Xtheta_loop 0 X -4.8660000000000002e-02 -0.04866000 theta(1) X 1.0388400000000000e+00 1.03884000 theta(2) X -7.3792000000000002e-01 -0.73792000 theta(3) X -5.1361999999999997e-01 -0.51362000 theta(4) X 5.0775308202588146e-02 0.05077531 obj X 2.4331006069174543e-02 0.02433101 D(1) X -2.8980780513591580e-02 -0.02898078 D(2) X -2.7779093350995165e-01 -0.27779093 D(3) X 2.2218376750406332e-02 0.02221838 D(4) XStep length = 1 X Xtheta_loop 1 X -2.4328993930825459e-02 -0.02432899 theta(1) X 1.0098592194864084e+00 1.00985922 theta(2) X -1.0157109335099517e+00 -1.01571093 theta(3) X -4.9140162324959363e-01 -0.49140162 theta(4) X 3.2351520567053427e-02 0.03235152 obj X -1.4057031119702702e-03 -0.00140570 D(1) X 5.4557838716931487e-03 0.00545578 D(2) X -1.0039354203311036e-01 -0.10039354 D(3) X -1.3173231905220829e-02 -0.01317323 D(4) XStep length = 1 X Xtheta_loop 2 X -2.5734697042795730e-02 -0.02573470 theta(1) X 1.0153150033581015e+00 1.01531500 theta(2) X -1.1161044755430620e+00 -1.11610448 theta(3) X -5.0457485515481448e-01 -0.50457486 theta(4) X 3.0497613121941033e-02 0.03049761 obj X -1.5509486383662779e-04 -0.00015509 D(1) X 3.6499057445712069e-04 0.00036499 D(2) X 4.2218191744343219e-04 0.00042218 D(3) X -3.2672143437975117e-04 -0.00032672 D(4) XStep length = 1 X Xtheta_loop 3 X -2.5889791906632358e-02 -0.02588979 theta(1) X 1.0156799939325587e+00 1.01567999 theta(2) X -1.1156822936256185e+00 -1.11568229 theta(3) X -5.0490157658919421e-01 -0.50490158 theta(4) X 3.0495537203056537e-02 0.03049554 obj X 9.7321692293949851e-08 0.00000010 D(1) X -3.3659920289733601e-07 -0.00000034 D(2) X -1.5374080636796911e-05 -0.00001537 D(3) X -1.3314150623113408e-06 -0.00000133 D(4) XStep length = 1 X Xtheta_loop 4 X -2.5889694584940063e-02 -0.02588969 theta(1) X 1.0156796573333557e+00 1.01567966 theta(2) X -1.1156976677062553e+00 -1.11569767 theta(3) X -5.0490290800425652e-01 -0.50490291 theta(4) X 3.0495537193052542e-02 0.03049554 obj X -3.6229294260247439e-09 -0.00000000 D(1) X 1.2413365101829759e-08 0.00000001 D(2) X 5.4662401885543252e-07 0.00000055 D(3) X 4.8150321542521305e-08 0.00000005 D(4) XStep length = 1 X Xtheta_loop 5 X -2.5889698207869488e-02 -0.02588970 theta(1) X 1.0156796697467207e+00 1.01567967 theta(2) X -1.1156971210822364e+00 -1.11569712 theta(3) X -5.0490285985393502e-01 -0.50490286 theta(4) X 3.0495537193039934e-02 0.03049554 obj X 1.2871068769735452e-10 0.00000000 D(1) X -4.4115387457665704e-10 -0.00000000 D(2) X -1.9437985890799474e-08 -0.00000002 D(3) X -1.7124136454193738e-09 -0.00000000 D(4) XStep length = 1 X Xtheta_loop 6 X -2.5889698079158800e-02 -0.02588970 theta(1) X 1.0156796693055670e+00 1.01567967 theta(2) X -1.1156971405202223e+00 -1.11569714 theta(3) X -5.0490286156634867e-01 -0.50490286 theta(4) X 3.0495537193039886e-02 0.03049554 obj X -4.5771437765728809e-12 -0.00000000 D(1) X 1.5687617718772477e-11 0.00000000 D(2) X 6.9121248119946195e-10 0.00000000 D(3) X 6.0893027878551739e-11 0.00000000 D(4) XStep length = .9 X Xtheta_loop 7 X -2.5889698083278231e-02 -0.02588970 theta(1) X 1.0156796693196859e+00 1.01567967 theta(2) X -1.1156971398981310e+00 -1.11569714 theta(3) X -5.0490286151154495e-01 -0.50490286 theta(4) X 3.0495537193039865e-02 0.03049554 obj X -3.1123169737974754e-13 -0.00000000 D(1) X 1.0666118487966118e-12 0.00000000 D(2) X 4.6999452916535867e-11 0.00000000 D(3) X 4.1405133028926090e-12 0.00000000 D(4) XA line search did not improve this estimate. X Xvar_loop 1 X 1.1729052766553795e-03 0.00117291 var(1,1) X Xtheta_loop 0 X -2.5889698083278231e-02 -0.02588970 theta(1) X 1.0156796693196859e+00 1.01567967 theta(2) X -1.1156971398981310e+00 -1.11569714 theta(3) X -5.0490286151154495e-01 -0.50490286 theta(4) X 2.5999999999999996e+01 26.00000000 obj X -3.1122653130181253e-13 -0.00000000 D(1) X 1.0666063107489048e-12 0.00000000 D(2) X 4.6999396801498302e-11 0.00000000 D(3) X 4.1405085967972343e-12 0.00000000 D(4) XA line search did not improve this estimate. X X X ********************************************************************** X * * X * theta * X * * X ********************************************************************** X X X Col 1 X X Row 1 -0.0258897 X Row 2 1.01568 X Row 3 -1.11570 X Row 4 -0.504903 X X X X ********************************************************************** X * * X * var * X * (corrected for degrees of freedom) * X * * X ********************************************************************** X X X Col 1 X X Row 1 0.00117291 X X X X ********************************************************************** X * * X * V * X * (rank = 4) * X * * X ********************************************************************** X X X Col 1 Col 2 Col 3 Col 4 X X Row 1 0.00015936 -7.872e-05 -0.00017711 -4.409e-05 X Row 2 -7.872e-05 9.876e-05 0.00060702 -1.851e-06 X Row 3 -0.00017711 0.00060702 0.0267460 0.00235621 X Row 4 -4.409e-05 -1.851e-06 0.00235621 0.00065829 X END_OF_FILE if test 11585 -ne `wc -c <'ch1eg1/detail.bak'`; then echo shar: \"'ch1eg1/detail.bak'\" unpacked with wrong size! fi # end of 'ch1eg1/detail.bak' fi if test -f 'ch6eg2/hansen.dat' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ch6eg2/hansen.dat'\" else echo shar: Extracting \"'ch6eg2/hansen.dat'\" \(11280 characters\) sed "s/^X//" >'ch6eg2/hansen.dat' <<'END_OF_FILE' X 381.9 176.6850 0.0093695102 0.6818539 X 383.7 176.9050 0.0093310997 0.6823039 X 388.3 177.1460 0.0049904501 0.6814319 X 385.5 177.3650 0.0383739690 0.6830091 X 389.7 177.5910 0.0204769890 0.6846292 X 390.0 177.8300 0.0007165600 0.6876923 X 389.2 178.1010 0.0371922290 0.6893628 X 390.7 178.3760 -0.0113433900 0.6910673 X 393.6 178.6570 -0.0472779090 0.6930894 X 394.2 178.9210 0.0164727200 0.6945713 X 394.1 179.1530 0.0194594210 0.6950013 X 396.5 179.3860 0.0296911900 0.6958386 X 396.8 179.5970 -0.0664901060 0.6960685 X 395.4 179.7880 0.0114439700 0.6967628 X 399.1 180.0070 -0.0114419700 0.6983212 X 404.2 180.2220 -0.0163223000 0.7013855 X 399.8 180.4440 0.0328373610 0.7016008 X 401.3 180.6710 0.0231378990 0.7024670 X 402.0 180.9450 -0.0210754290 0.7034826 X 400.4 181.2380 0.0296860300 0.7047952 X 400.2 181.5280 -0.0568203400 0.7061469 X 402.9 181.7960 -0.0045937700 0.7078680 X 403.8 182.0420 0.0472565590 0.7100049 X 401.6 182.2870 0.0478186380 0.7109064 X 404.0 182.5200 0.0654135870 0.7106436 X 405.7 182.7420 0.0364446900 0.7108701 X 409.4 182.9920 0.0318523910 0.7105520 X 410.1 183.2170 0.0058811302 0.7100707 X 412.1 183.4520 0.0251120610 0.7100218 X 412.4 183.6910 -0.0296279510 0.7109602 X 410.4 183.9580 0.0303546690 0.7127193 X 411.5 184.2430 0.0251584590 0.7132442 X 413.7 184.5240 -0.0189705600 0.7138023 X 415.9 184.7830 0.0265103900 0.7136331 X 419.0 185.0160 0.0470347110 0.7136038 X 420.5 185.2420 0.0006585300 0.7143876 X 420.8 185.4520 -0.0358958100 0.7155418 X 420.6 185.6500 0.0197925490 0.7177841 X 423.4 185.8740 -0.0055647301 0.7191781 X 424.8 186.0870 -0.0615112410 0.7203390 X 427.0 186.3140 -0.0834698080 0.7206089 X 425.2 186.5380 -0.0809235570 0.7208373 X 427.0 186.7900 0.0659098630 0.7203747 X 428.5 187.0580 0.0226466300 0.7218203 X 431.8 187.3230 -0.0487761200 0.7264938 X 431.0 187.5740 0.0039394898 0.7262181 X 433.6 187.7960 0.1114552000 0.7269373 X 434.1 188.0130 0.0139081300 0.7270214 X 434.7 188.2130 0.0508059190 0.7292386 X 433.7 188.3870 -0.0226500000 0.7299977 X 436.2 188.5800 0.0347222910 0.7297111 X 437.0 188.7900 0.0479895880 0.7295194 X 436.9 189.0180 0.0206833590 0.7308308 X 440.2 189.2420 -0.0178168900 0.7319400 X 442.1 189.4960 -0.0018435300 0.7335444 X 445.6 189.7610 0.0536292610 0.7349641 X 443.8 190.0280 -0.0126571200 0.7347905 X 444.2 190.2650 0.0286585090 0.7361549 X 445.8 190.4720 -0.0047020698 0.7375505 X 449.5 190.6680 0.0221940800 0.7385984 X 450.1 190.8580 0.0256042290 0.7398356 X 453.7 191.0470 0.0181333610 0.7399162 X 456.6 191.2450 0.0173465290 0.7402540 X 456.7 191.4470 0.0051271599 0.7407488 X 462.1 191.6660 0.0166149310 0.7405324 X 463.8 191.8890 0.0158939310 0.7416990 X 466.0 192.1310 0.0202899800 0.7429185 X 468.5 192.3760 -0.0109651800 0.7432231 X 468.0 192.6310 0.0315313120 0.7448718 X 470.0 192.8470 0.0100951200 0.7457447 X 468.0 193.0390 0.0013465700 0.7465812 X 474.4 193.2230 0.0034312201 0.7476813 X 474.5 193.3930 0.0377800500 0.7481560 X 477.4 193.5400 0.0066147698 0.7488479 X 474.5 193.7090 -0.0107356600 0.7506849 X 479.6 193.8880 0.0345496910 0.7525021 X 481.2 194.0870 -0.0047443998 0.7554032 X 479.5 194.3030 -0.0505878400 0.7593326 X 484.3 194.5280 0.0169978100 0.7602726 X 485.3 194.7610 0.0299301090 0.7601484 X 488.7 194.9970 0.0323472920 0.7605893 X 497.2 195.1950 0.0293272190 0.7626710 X 497.1 195.3720 0.0008636100 0.7648361 X 499.0 195.5390 0.0121703600 0.7671343 X 500.1 195.6880 0.0100357400 0.7696461 X 501.5 195.8310 -0.0102875900 0.7730808 X 502.9 195.9990 -0.0215729900 0.7757009 X 505.8 196.1780 0.0233628400 0.7785686 X 504.8 196.3720 -0.0509349700 0.7793185 X 507.5 196.5600 -0.0109703900 0.7812808 X 510.9 196.7620 -0.0118703500 0.7827363 X 508.3 196.9840 -0.0748946070 0.7867401 X 510.2 197.2070 -0.0066132201 0.7894943 X 509.8 197.3980 0.0464050400 0.7910945 X 512.1 197.5720 0.0138342800 0.7922281 X 513.5 197.7360 0.0047225100 0.7933788 X 516.0 197.8920 0.0838221310 0.7941861 X 517.7 198.0370 0.0098125497 0.7948619 X 519.0 198.2060 0.0433843100 0.7959538 X 521.1 198.3630 0.0420965220 0.7965842 X 521.0 198.5370 -0.0415207000 0.7988484 X 523.1 198.7120 0.0232013710 0.8015676 X 522.1 198.9110 0.0482556600 0.8038690 X 525.5 199.1130 -0.0056581302 0.8058991 X 528.2 199.3110 0.0336121990 0.8076486 X 524.9 199.4980 -0.0276739710 0.8094875 X 527.9 199.6570 0.0078005102 0.8124645 X 531.9 199.8080 0.0307225010 0.8155668 X 533.0 199.9200 -0.0389530290 0.8200750 X 533.9 200.0560 -0.0311505910 0.8231879 X 539.8 200.2080 0.0068653398 0.8262319 X 540.0 200.3610 0.0898963210 0.8285185 X 541.2 200.5360 0.0230161700 0.8318551 X 547.8 200.7060 0.0118528200 0.8335159 X 550.9 200.8980 -0.0211507900 0.8359049 X 552.4 201.0950 0.0163246690 0.8388849 X 551.0 201.2900 0.0422958400 0.8421053 X 552.1 201.4660 0.0111537600 0.8462235 X 556.7 201.6210 0.0562853110 0.8492905 X 554.1 201.7600 -0.0372401590 0.8521928 X 557.0 201.8810 -0.0072337599 0.8560144 X 561.2 202.0230 -0.0502119700 0.8578047 X 560.6 202.1610 0.0314719300 0.8619336 X 561.9 202.3310 0.0213753300 0.8667023 X 566.5 202.5070 0.0029275999 0.8704325 X 563.9 202.6770 -0.0623450020 0.8751552 X 565.9 202.8770 -0.0630705430 0.8784238 X 569.4 203.0900 0.0504970810 0.8816298 X 568.2 203.3020 -0.0220447110 0.8856037 X 573.1 203.5000 0.0547974710 0.8888501 X 572.5 203.6750 -0.0314589110 0.8939738 X 572.4 203.8490 -0.0180749090 0.8981481 X 577.2 204.0080 -0.0763489600 0.9019404 X 578.1 204.1560 0.0597185420 0.9058986 X 577.7 204.3350 -0.0023485899 0.9077376 X 577.1 204.5050 -0.0995834470 0.9123202 X 580.3 204.6920 -0.0611347710 0.9155609 X 582.0 204.8780 -0.0502832790 0.9176976 X 582.8 205.0860 0.0746088620 0.9208991 X 584.7 205.2940 0.0502020900 0.9235505 X 588.5 205.5070 0.0426676610 0.9276126 X 587.3 205.7070 -0.0160981810 0.9324025 X 587.6 205.8840 0.0521828200 0.9361811 X 592.6 206.0760 0.0617985200 0.9399258 X 592.2 206.2420 0.0492740680 0.9414049 X 594.5 206.3930 0.0149685600 0.9434819 X 592.4 206.5670 0.0441647210 0.9469953 X 596.1 206.7260 0.0341992900 0.9506794 X 596.3 206.8910 -0.0365711710 0.9548885 X 598.5 207.0530 0.0043891501 0.9597327 X 597.3 207.2370 -0.0398038400 0.9630002 X 599.1 207.4330 0.0409017500 0.9679519 X 601.1 207.6270 -0.0056930701 0.9698885 X 601.7 207.8000 -0.0395274310 0.9729101 X 604.9 207.9490 -0.0000956400 0.9752025 X 608.8 208.0880 0.0907427070 0.9797963 X 607.9 208.1960 0.0241155400 0.9825629 X 610.3 208.3100 0.0308808110 0.9875471 X 618.9 208.4470 0.0091922097 0.9891743 X 620.6 208.5690 0.0066767102 0.9911376 X 622.3 208.7120 0.0176741590 0.9942150 X 623.7 208.8460 -0.0221355410 0.9961520 X 627.6 208.9880 -0.0018799200 0.9996813 X 629.7 209.1530 0.0382015890 1.0031760 X 631.7 209.3170 -0.0064313002 1.0079150 X 638.2 209.4570 0.0099495398 1.0117520 X 639.8 209.5840 0.0497901590 1.0151610 X 640.7 209.7110 0.0116306100 1.0190420 X 643.4 209.8090 -0.0253177100 1.0247120 X 645.3 209.9050 -0.0398146990 1.0309930 X 643.3 210.0340 -0.0054550399 1.0399500 X 642.1 210.1540 -0.0464594700 1.0478120 X 643.2 210.2860 -0.0183557910 1.0541040 X 646.0 210.4100 -0.0088413004 1.0603720 X 651.9 210.5560 0.0521348010 1.0632000 X 643.4 210.7150 -0.0302029100 1.0792660 X 651.3 210.8630 0.0522540810 1.0815290 X 649.5 210.9840 -0.0018884100 1.0896070 X 651.3 211.0970 -0.1165516000 1.0993400 X 647.7 211.2070 0.0153318600 1.1093100 X 648.4 211.3110 -0.0013036400 1.1215300 X 646.2 211.4110 0.0038444500 1.1363350 X 645.9 211.5220 -0.0243075400 1.1489390 X 648.6 211.6370 -0.0433935780 1.1558740 X 649.3 211.7720 -0.0352610800 1.1667950 X 650.3 211.9010 -0.0193944290 1.1737660 X 653.5 212.0510 -0.0730255170 1.1802600 X 654.5 212.2160 -0.0852853730 1.1926660 X 652.7 212.3830 -0.1098341000 1.2043820 X 654.5 212.5180 0.1671594000 1.2122230 X 651.2 212.6370 -0.0397416390 1.2205160 X 650.3 212.7480 -0.0234328400 1.2278950 X 653.7 212.8440 0.1358016000 1.2337460 X 657.4 212.9390 0.0607054380 1.2376030 X 659.4 213.0560 0.0293416310 1.2406730 X 659.7 213.1870 0.0470072290 1.2457180 X 670.4 213.3930 0.0546782990 1.2502980 X 669.7 213.5590 0.0517648310 1.2593700 X 668.3 213.7410 -0.0637501480 1.2721830 X 670.1 213.9000 -0.0203062710 1.2786150 X 670.2 214.0550 -0.0366309580 1.2821550 X 670.8 214.2000 0.0609995690 1.2904000 X 674.1 214.3210 0.0314961600 1.2966920 X 677.4 214.4460 -0.0105694800 1.3039560 X 684.3 214.5610 0.1251743000 1.3081980 X 682.9 214.6550 0.0012425600 1.3069260 X 687.1 214.7620 0.0300192200 1.3092710 X 690.6 214.8810 -0.0108725300 1.3132060 X 688.7 215.0180 -0.0088088503 1.3206040 X 695.0 215.1520 0.0472505990 1.3256120 X 696.8 215.3110 -0.0073758499 1.3307980 X 699.6 215.4780 0.0005799900 1.3381930 X 702.5 215.6420 0.0261333100 1.3449110 X 705.6 215.7920 -0.0214380810 1.3520410 X 709.7 215.9240 0.0046152598 1.3587430 X 715.8 216.0570 0.0585772800 1.3657450 X 717.6 216.1860 -0.0398427810 1.3720740 X 719.3 216.3000 -0.0162227190 1.3831500 X 716.5 216.4360 -0.0106509200 1.3884160 X 719.1 216.5650 0.0038957901 1.3953550 X 722.6 216.7120 -0.0126387400 1.4014670 X 721.5 216.8630 0.0509454310 1.4105340 X 728.3 217.0300 -0.0156951400 1.4159000 X 727.0 217.2070 -0.0140849800 1.4244840 X 729.1 217.3740 0.0006794800 1.4295710 X 735.7 217.5230 -0.0394544790 1.4350960 X 739.4 217.6550 0.0419719890 1.4442790 X 740.1 217.7850 0.0052549900 1.4508850 X 738.0 217.8810 -0.0568409600 1.4581300 X 744.8 217.9870 -0.0121089800 1.4663000 X 750.5 218.1310 0.0318689010 1.4743500 X 750.4 218.2610 0.0833722430 1.4862740 X 750.3 218.4040 0.0186665390 1.5033990 X 753.1 218.5480 -0.0129163500 1.5146730 X 755.6 218.7200 0.0564879100 1.5199840 X 761.1 218.9090 0.0372171590 1.5284460 X 765.4 219.0780 -0.0063229799 1.5412860 X 765.2 219.2360 -0.1017461000 1.5541030 X 768.0 219.3840 0.0313147900 1.5640620 X 774.1 219.5300 0.0166718100 1.5694350 END_OF_FILE if test 11280 -ne `wc -c <'ch6eg2/hansen.dat'`; then echo shar: \"'ch6eg2/hansen.dat'\" unpacked with wrong size! fi # end of 'ch6eg2/hansen.dat' fi if test -f 'nlopr.cc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'nlopr.cc'\" else echo shar: Extracting \"'nlopr.cc'\" \(9210 characters\) sed "s/^X//" >'nlopr.cc' <<'END_OF_FILE' X/* --------------------------------------------------------------------------- X Xnlmdl: nlopr.cc X Xnlmdl is a C++ implementation of the statistical methods in A. Ronald XGallant, "Nonlinear Statistical Models," New York: John Wiley and Sons, X1987, ISBN 0-471-80260-3, using a matrix class realmat that is distributed Xwith it. The header files nlmdl.h and realmat.h describe the use of the Xprogram and matrix class, respectively. X XCopyright (C) 1990. X XA. Ronald Gallant XP.O. Box 5513 XRaleigh NC 27650-5513 XUSA X XPermission to use, copy, modify, and distribute this software and its Xdocumentation for any purpose and without fee is hereby granted, provided Xthat the above copyright notice appear in all copies and that both that Xcopyright notice and this permission notice appear in supporting Xdocumentation. X XThis software is provided "as is" without any expressed or implied warranty. X X------------------------------------------------------------------------------ X XThis is the collection of operators used by nlmdl. They act on s, of class Xstatus, using m, of class model; s must have been filled in and the function Xinitialize(), of class model, must have been called before using any of these Xoperators. X X--------------------------------------------------------------------------- */ X Xint line_search(char* msg) X{ X REAL norm_D, norm_theta; X REAL step_length; X REAL save_obj = s.obj; X realmat save_theta = s.theta; X realmat ss(1,1); X X ss = T(s.D) * s.D; X norm_D = sqrt(ss[1]); X X ss = T(s.theta) * s.theta; X norm_theta = sqrt(ss[1]); X X if ( norm_D < s.tol*(norm_theta + s.eps) ) { X strcpy(msg,"Tolerence check passed.\n"); X return 1; X } X X for (step_length=1; step_length >= 0.5; step_length -= 0.1) { X X s.theta = save_theta + step_length * s.D; X X (*opr_obj)(); X X if (s.obj < save_obj) { X sprintf(msg,"Step length = %g \n",step_length); X return 0 ; X } X } X X for (step_length=0.5; step_length > 1.0e-13; step_length *= 0.5) { X X s.theta = save_theta + step_length * s.D; X X (*opr_obj)(); X X if (s.obj < save_obj) { X sprintf(msg,"Step length = %g \n",step_length); X return 0; X } X } X X strcpy(msg,"A line search did not improve this estimate.\n"); X s.obj = save_obj; X s.theta = save_theta; X return 1; X} X X Xvoid SUR_obj() X{ X INTEGER t; X realmat sse(1,1,(REAL)0 ); X realmat varinv = invpsd(s.var,s.eps); X X for (t=1; t<=s.n; t++) X sse = sse + T(m.e(t)) * varinv * m.e(t); X X s.obj = sse[1]; X} X X Xvoid SUR_mgn() X{ X INTEGER t; X realmat sse; X realmat varinv = invpsd(s.var,s.eps); X X sse.resize(1,1,(REAL)0 ); X s.V.resize(s.p, s.p, (REAL)0 ); X s.D.resize(s.p, 1, (REAL)0 ); X X for(t=1; t<=s.n; t++) { X sse = sse + T(m.e(t)) * varinv * m.e(t); X s.V = s.V + T(m.dele(t)) * varinv * m.dele(t); X s.D = s.D + T(m.dele(t)) * varinv * m.e(t); X } X X s.obj = sse[1]; X s.V = invpsd(s.V,s.eps); X s.D = - s.V * s.D; X} X X Xvoid SUR_var(int var_loop) X{ X INTEGER i,j,t; X REAL fn; X X if (rows(s.var)==0 || cols(s.var)==0) { X s.var.resize(s.M,s.M,(REAL)0 ); X for (i=1; i<=s.M; i++) s.var.elem(i,i)=1.0; X } X X if (var_loop == 0) return; X X for (i=1; i<=s.M; i++) X for (j=1; j<=s.M; j++) X s.var.elem(i,j) = (REAL)0 ; X X for (t=1; t<=s.n; t++) X s.var = s.var + m.e(t) * T(m.e(t)); X X if (s.M == 1 && s.n > s.p) { X fn = s.n - s.p; X strcpy(s.df,"corrected"); X } X else { X fn = s.n; X strcpy(s.df,"uncorrected"); X } X X for (i=1; i<=s.M; i++) X for (j=1; j<=s.M; j++) X s.var.elem(i,j) = s.var.elem(i,j)/fn; X} X X Xvoid SUR_V() X{ X INTEGER t; X INTEGER tau; X INTEGER i; X REAL x,weight; X realmat varinv = invpsd(s.var,s.eps); X X if (strcmp(s.vartype,"heteroskedastic") == 0 || s.MA > 0) { X X realmat I(s.p,s.p,(REAL)0 ); X realmat I_tau; X X for (tau=0; tau<=s.MA; tau++) { X X I_tau.resize(s.p,s.p,(REAL)0 ); X X for (t=tau+1; t<=s.n; t++) X I_tau = I_tau X + T(m.dele(t)) * varinv * m.e(t) X * T(m.e(t-tau)) * varinv * m.dele(t-tau); X X if (strcmp(s.weights,"Parzen") == 0 && tau > 0) { X x = tau/(REAL)s.MA; X X if ( x < 0.5 ) X weight = 1.0 - 6.0*pow(x,2) + 6.0*pow(x,3); X else X weight = 2.0*pow((1.0 - x),3); X } X else { X weight = 1.0; X } X X I = I + weight*I_tau; X X if (tau > 0) X I = I + weight*T(I_tau); X } X X s.V = s.V * I * s.V; X } X X s.rank = 0; X for (i=1; i<=s.p; i++) X if (s.V.elem(i,i) > (REAL)0 ) s.rank++; X X return; X} X X Xrealmat qZ; X Xvoid opr_qZ(INTEGER t) X X{ X INTEGER alpha, i, ii; X X realmat q_tmp(s.M,1); X realmat Z_tmp(s.K,1); X X qZ.resize(s.M*s.K,1); X X q_tmp = m.e(t); X Z_tmp = m.Z(t); X X for (alpha=1; alpha<=s.M; alpha++) { X for (i=1; i<=s.K; i++) { X X ii = s.K*(alpha-1) + i; X X qZ[ii] = q_tmp[alpha] * Z_tmp[i]; X } X } X} X X Xrealmat QZ; X Xvoid opr_QZ(INTEGER t) X{ X INTEGER alpha, i, ii, k; X X realmat Q_tmp(s.M,s.p); X realmat Z_tmp(s.K,1); X X QZ.resize(s.M*s.K,s.p); X X Q_tmp = m.dele(t); X Z_tmp = m.Z(t); X X for (k=1; k<=s.p; k++) { X for (alpha=1; alpha<=s.M; alpha++) { X for (i=1; i<=s.K; i++) { X X ii = s.K*(alpha-1) + i; X X QZ.elem(ii,k) = Q_tmp.elem(alpha,k) * Z_tmp[i]; X } X } X } X} X X Xrealmat qZ_mts; X Xvoid opr_qZ_mts() X{ X X INTEGER t; X X qZ_mts.resize(s.M*s.K, 1, (REAL)0 ); X X for (t=1; t<=s.n; t++) { X X opr_qZ(t); X X qZ_mts = qZ_mts + qZ; X X } X} X X Xrealmat QZ_mts; X Xvoid opr_QZ_mts() X{ X INTEGER t; X X QZ_mts.resize(s.M*s.K, s.p, (REAL)0 ); X X for (t=1; t<=s.n; t++) { X X opr_QZ(t); X X QZ_mts = QZ_mts + QZ; X X } X} X X Xrealmat ZZ; X Xvoid opr_ZZ() X{ X INTEGER t; X X ZZ.resize(s.K, s.K, (REAL)0 ); X X for (t=1; t<=s.n; t++) X ZZ = ZZ + m.Z(t) * T(m.Z(t)); X} X X Xvoid TSLS_obj() X{ X X INTEGER alpha, i, ii; X INTEGER beta, j, jj; X X realmat varinv = invpsd(s.var,s.eps); X X opr_qZ_mts(); X opr_ZZ(); X X realmat ZZinv = invpsd(ZZ,s.eps); X s.obj = (REAL)0 ; X X for (alpha=1; alpha<=s.M; alpha++) { X for (i=1; i<=s.K; i++) { X for (beta=1; beta<=s.M; beta++) { X for (j=1; j<=s.K; j++) { X X ii = s.K*(alpha-1) + i; X jj = s.K*(beta-1) + j; X X s.obj += qZ_mts[ii] * qZ_mts[jj] X * varinv.elem(alpha,beta) * ZZinv.elem(i,j); X } X } X } X } X} X X Xvoid TSLS_mgn() X{ X INTEGER alpha, i, ii; X INTEGER beta, j, jj; X INTEGER k,l; X X realmat varinv = invpsd(s.var,s.eps); X X opr_qZ_mts(); X opr_QZ_mts(); X opr_ZZ(); X X realmat ZZinv = invpsd(ZZ,s.eps); X X s.obj = (REAL)0 ; X s.V.resize(s.p, s.p, (REAL)0 ); X s.D.resize(s.p, 1, (REAL)0 ); X X for (alpha=1; alpha<=s.M; alpha++) { X for (i=1; i<=s.K; i++) { X for (beta=1; beta<=s.M; beta++) { X for (j=1; j<=s.K; j++) { X X ii = s.K*(alpha-1) + i; X jj = s.K*(beta-1) + j; X X s.obj += qZ_mts[ii] * qZ_mts[jj] X * varinv.elem(alpha,beta) * ZZinv.elem(i,j); X X for (k=1; k<=s.p; k++) { X X s.D[k] += QZ_mts.elem(ii,k) * qZ_mts[jj] X * varinv.elem(alpha,beta) * ZZinv.elem(i,j); X X for (l=1; l<=s.p; l++) { X X s.V.elem(k,l) += QZ_mts.elem(ii,k) * QZ_mts.elem(jj,l) X * varinv.elem(alpha,beta) * ZZinv.elem(i,j); X X } X } X } X } X } X } X X s.V = invpsd(s.V,s.eps); X X s.D = - s.V * s.D; X X} X X Xvoid TSLS_V() X{ X INTEGER i; X X s.rank = 0; X for (i=1; i<=s.p; i++) X if (s.V.elem(i,i) > (REAL)0 ) s.rank++; X X return; X}; X X Xvoid GMM_obj() X{ X X realmat sse(1,1); X realmat varinv = invpsd(s.var,s.eps); X X opr_qZ_mts(); X X sse = T(qZ_mts) * varinv * qZ_mts ; X X s.obj = sse[1]; X} X X Xvoid GMM_mgn() { X X realmat sse(1,1); X realmat varinv = invpsd(s.var,s.eps); X X opr_qZ_mts(); X opr_QZ_mts(); X X sse = T(qZ_mts) * varinv * qZ_mts ; X X s.obj = sse[1]; X X s.D = T(QZ_mts) * varinv * qZ_mts ; X X s.V = T(QZ_mts) * varinv * QZ_mts ; X X s.V = invpsd(s.V,s.eps); X X s.D = - s.V * s.D; X X} X X Xvoid GMM_var(int var_loop) X{ X INTEGER l = s.M * s.K; X INTEGER t; X INTEGER tau; X INTEGER alpha, i, j, ii, jj; X REAL x,weight; X X strcpy(s.df,"uncorrected"); X X if (rows(s.var)==0 || cols(s.var)==0) { X X s.var.resize(l,l,(REAL)0 ); X X opr_ZZ(); X X for (alpha=1; alpha<=s.M; alpha++) { X for (i=1; i<=s.K; i++) { X for (j=1; j<=s.K; j++) { X X ii = s.K*(alpha-1) + i; X jj = s.K*(alpha-1) + j; X X s.var.elem(ii,jj) = ZZ.elem(i,j); X X } X } X } X } X if (var_loop == 0) return; X X realmat I(l,l); X realmat I_tau(l,l); X realmat qZ_lag(l,1); X X for (tau=0; tau<=s.MA; tau++) { X X for (i=1; i<=l; i++) X for (j=1; j<=l; j++) X I_tau.elem(i,j)=(REAL)0 ; X X for (t=tau+1; t<=s.n; t++) { X X opr_qZ(t-tau); X qZ_lag = qZ; X opr_qZ(t); X X I_tau = I_tau + qZ * T(qZ_lag); X } X X if (strcmp(s.weights,"Parzen") == 0 && tau > 0) { X x = tau/(REAL)s.MA; X if ( x < 0.5 ) X weight = 1.0 - 6.0*pow(x,2) + 6.0*pow(x,3); X else X weight = 2.0*pow((1.0 - x),3); X X } X else { X weight = 1.0; X } X X I = I + weight*I_tau; X if (tau > 0) { X I = I + weight*T(I_tau); X } X } X X s.var = I; X X return; X} X X Xvoid GMM_V() X{ X INTEGER i; X X s.rank = 0; X for (i=1; i<=s.p; i++) X if (s.V.elem(i,i) > (REAL)0 ) s.rank++; X X return; X} END_OF_FILE if test 9210 -ne `wc -c <'nlopr.cc'`; then echo shar: \"'nlopr.cc'\" unpacked with wrong size! fi # end of 'nlopr.cc' fi if test -f 'realmat.cc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'realmat.cc'\" else echo shar: Extracting \"'realmat.cc'\" \(9898 characters\) sed "s/^X//" >'realmat.cc' <<'END_OF_FILE' X/* ---------------------------------------------------------------------------- X Xrealmat: realmat.cc X Xrealmat is a C++ matrix class. The header file realmat.h describes its use. X XCopyright (C) 1990. X XA. Ronald Gallant XP.O. Box 5513 XRaleigh NC 27650-5513 XUSA X XPermission to use, copy, modify, and distribute this software and its Xdocumentation for any purpose and without fee is hereby granted, provided Xthat the above copyright notice appear in all copies and that both that Xcopyright notice and this permission notice appear in supporting Xdocumentation. X XThis software is provided "as is" without any expressed or implied warranty. X X---------------------------------------------------------------------------- */ X#include "realmat.h" X Xrealmat::realmat(INTEGER r, INTEGER c, REAL* a) X{ X if (r<=0) error("Error, realmat::realmat, Number of rows not positive"); X if (c<=0) error("Error, realmat::realmat, Number of columns not positive"); X rows=r; X cols=c; X len=r*c; X x = a; X} X X Xvoid realmat::realmat_constructor(INTEGER r, INTEGER c, REAL fill_value) X{ X if (r<=0) error("Error, realmat::realmat, Number of rows not positive"); X if (c<=0) error("Error, realmat::realmat, Number of columns not positive"); X rows=r; X cols=c; X len=r*c; X x = new REAL[len]; X if (x == 0) error("Error, realmat::realmat, Operator new failed"); X REAL* top = &(x[len-1]); X REAL* t = x; X while (t <= top) *t++ = fill_value; X} X Xrealmat::realmat(realmat& a) X{ X rows=a.rows; X cols=a.cols; X if(rows<=0) X error("Error, realmat::realmat, Number of rows not positive"); X if(cols<=0) X error("Error, realmat::realmat, Number of columns not positive"); X len=a.rows*a.cols; X x = new REAL[len]; X if (x == 0) error("Error, realmat::realmat, Operator new failed"); X REAL* top = &(x[len-1]); X REAL* t = x; X REAL* u = a.x; X while (t <= top) *t++ = *u++; X} X Xvoid realmat::resize_constructor(INTEGER r, INTEGER c, REAL fill_value) X{ X if (r<=0) error("Error, realmat::resize, Number of rows not positive"); X if (c<=0) error("Error, realmat::resize, Number of columns not positive"); X delete x; X rows=r; X cols=c; X len=r*c; X x = new REAL[len]; X if (x == 0) error("Error, realmat::resize, Operator new failed"); X REAL* top = &(x[len-1]); X REAL* t = x; X while (t <= top) *t++ = fill_value; X} X Xrealmat& realmat::operator=(realmat& a) X{ X if (this != &a) { X delete x; X rows=a.rows; X cols=a.cols; X len=a.len; X x = new REAL[len]; X if (x == 0) error("Error, realmat::operator=, Operator new failed"); X REAL* top = &(x[len-1]); X REAL* t = x; X REAL* u = a.x; X while (t <= top) *t++ = *u++; X } X return *this; X} X XREAL& realmat::check1(INTEGER i) X{ X if ((1<=i) && (i<=len)) X return x[i-1]; X else X error("Error, realmat::check1, Index out of range"); X exit(1); //This keeps the compiler from complaining; X} X XREAL& realmat::check2(INTEGER i, INTEGER j) X{ X if ((1<=i) && (1<=j) && (i<=rows) && (j<=cols)) X return x[i + rows*j - rows - 1]; // return x[rows*(j-1)+i-1] X else X error("Error, realmat::check2, Index out of range"); X exit(1); //This keeps the compiler from complaining; X} X Xrealmat T(realmat& a) X{ X INTEGER newrows = a.cols; X INTEGER newcols = a.rows; X INTEGER newlen = newrows*newcols; X REAL* newx = new REAL[newlen]; X if (newx == 0) a.error("Error, realmat, T, Operator new failed"); X INTEGER i,j; X for (j = 0; j < a.cols; j++) X for (i = 0; i < a.rows; i++) X newx[j + newrows*i] = a.x[i + a.rows*j]; X realmat d(newrows,newcols,newx); X return d; X} X Xrealmat operator+(realmat& a, realmat& b) X{ X if ((a.cols == b.cols) && (a.rows == b.rows)) { X REAL* newx = new REAL[a.len]; X if (newx == 0) a.error("Error, realmat, operator+, Operator new failed"); X REAL* top = &(newx[a.len-1]); X REAL* t = newx; X REAL* u = a.x; X REAL* v = b.x; X while (t <= top) *t++ = *u++ + *v++; X realmat d(a.rows,a.cols,newx); X return d; X } X else X a.error("Error, realmat, operator+, Matrices not conformable."); X exit(1); //This keeps the compiler from complaining; X} X Xrealmat operator+(realmat& a) X{ X REAL* newx = new REAL[a.len]; X if (newx == 0) a.error("Error, realmat, operator+, Operator new failed"); X REAL* top = &(newx[a.len-1]); X REAL* t = newx; X REAL* u = a.x; X while (t <= top) *t++ = *u++; X realmat d(a.rows,a.cols,newx); X return d; X} X Xrealmat operator-(realmat& a, realmat& b) X{ X if ((a.cols == b.cols) && (a.rows == b.rows)) { X REAL* newx = new REAL[a.len]; X if (newx == 0) a.error("Error, realmat, operator-, Operator new failed"); X REAL* top = &(newx[a.len-1]); X REAL* t = newx; X REAL* u = a.x; X REAL* v = b.x; X while (t <= top) *t++ = *u++ - *v++; X realmat d(a.rows,a.cols,newx); X return d; X } X else X a.error("Error, realmat, operator-, Matrices not conformable."); X exit(1); //This keeps the compiler from complaining; X} X Xrealmat operator-(realmat& a) X{ X REAL* newx = new REAL[a.len]; X if (newx == 0) a.error("Error, realmat, operator-, Operator new failed"); X REAL* top = &(newx[a.len-1]); X REAL* t = newx; X REAL* u = a.x; X while (t <= top) *t++ = - *u++; X realmat d(a.rows,a.cols,newx); X return d; X} X Xrealmat operator*(realmat& a, realmat& b) X{ X if (a.cols == b.rows) { X INTEGER newlen = a.rows*b.cols; X REAL* newx = new REAL[newlen]; X if (newx == 0) a.error("Error, realmat, operator*, Operator new failed"); X REAL zero = 0.0; X REAL* top = &(newx[newlen-1]); X REAL* t = newx; X while (t <= top) *t++ = zero; X INTEGER i,j,k; X for (j = 0; j < b.cols; j++) X for (k = 0; k < a.cols; k++) X for (i = 0; i < a.rows; i++) X newx[i+a.rows*j] += a.x[i+a.rows*k] * b.x[k+b.rows*j]; X realmat d(a.rows,b.cols,newx); X return d; X } X else { X a.error("Error, realmat, operator*, Matrices not conformable."); X exit(1); //this keeps compiler from complaining X } X} X Xrealmat operator*(REAL& a, realmat& b) X{ X REAL* newx = new REAL[b.len]; X if (newx == 0) b.error("Error, realmat, operator*, Operator new failed"); X REAL* top = &(newx[b.len-1]); X REAL* t = newx; X REAL* u = b.x; X while (t <= top) *t++ = a * *u++; X realmat d(b.rows,b.cols,newx); X return d; X} X Xrealmat operator*(INTEGER& a, realmat& b) X{ X REAL* newx = new REAL[b.len]; X if (newx == 0) b.error("Error, realmat, operator*, Operator new failed"); X REAL f = a; X REAL* top = &(newx[b.len-1]); X REAL* t = newx; X REAL* u = b.x; X while (t <= top) *t++ = f * *u++; X realmat d(b.rows,b.cols,newx); X return d; X} X Xvoid default_realmat_error_handler(const char* msg) X{ X cerr << msg << "\n"; X exit(1); X} X XONE_ARG_ERROR_HANDLER_T realmat_error_handler = default_realmat_error_handler; X XONE_ARG_ERROR_HANDLER_T set_realmat_error_handler(ONE_ARG_ERROR_HANDLER_T f) X{ X ONE_ARG_ERROR_HANDLER_T old = realmat_error_handler; X realmat_error_handler = f; X return old; X} X Xvoid realmat::error(const char* msg) X{ X (*realmat_error_handler)(msg); X} X Xostream& operator<<(ostream& stream, realmat& a) X{ X char line[256], eol[2] = {'\n','\0'}, bl[3] = {' ','\n','\0'}; X char *next,*save,*fcode; X REAL f,af; X INTEGER i,j,linesize,maxcol,pad,start,stop,r,c; X X r=rows(a); X c=cols(a); X X ((LINESIZE<72)||(LINESIZE>133)) ? (linesize=133) : (linesize=LINESIZE); X maxcol = (linesize - 8)/12; X if (c < maxcol) maxcol = c; X pad = (linesize - 8 - 12*maxcol)/2 + 1; X memset(line,' ',pad); X save = line + pad; X X start=1; X do { X stop = start - 1 + maxcol; X if (stop > c) stop = c; X X stream << bl; X stream << bl; X X next = save; X memset(next,' ',6); X next = next + 6; X X for (j = start; j <= stop; j++) { X if (j < 1000) {sprintf(next," Col%3i",j); next = next+12;} X else if (j <32760) {sprintf(next," C%5i" ,j); next = next+12;} X else {sprintf(next," TooBig" ); next = next+12;} X } X X memcpy(next,eol,2); X X stream << line; X stream << bl; X X for (i = 1; i <= r; i++) { X next = save; X if (i < 1000) {sprintf(next,"Row%3i",i); next = next+6;} X else if (i <32760) {sprintf(next,"R%5i" ,i); next = next+6;} X else {sprintf(next,"TooBig" ); next = next+6;} X for (j = start; j <= stop; j++) { X fcode = "%12.3e"; X f = a.elem(i,j); X af = f; if (f < 0.E0) af = -f ; X if (af < 1.E+8 ) fcode = "%12.0f"; X if (af < 1.E+5 ) fcode = "%12.1f"; X if (af < 1.E+4 ) fcode = "%12.2f"; X if (af < 1.E+3 ) fcode = "%12.3f"; X if (af < 1.E+2 ) fcode = "%12.4f"; X if (af < 1.E+1 ) fcode = "%12.5f"; X if (af < 1.E+0 ) fcode = "%12.6f"; X if (af < 1.E-1 ) fcode = "%12.7f"; X if (af < 1.E-2 ) fcode = "%12.8f"; X if (af < 1.E-4 ) fcode = "%12.3e"; X if (af < 1.E-30) fcode = "%12.1f"; X sprintf(next,fcode,f); next = next+12; X } X memcpy(next,eol,2); X stream << line; X } X start = stop + 1; X } while (stop < c); X X return stream; X} X Xrealmat invpsd(realmat& a, REAL eps) X{ X if (a.cols != a.rows) X a.error("Error, realmat, invpsd, Matrix not square."); X INTEGER i; X for (i=0; i<a.rows; i++) X if (a.x[i+a.rows*i] < 0) X a.error("Error, realmat, invpsd, Matrix not positive semi-definite."); X X INTEGER newrows = a.cols; X INTEGER newcols = a.rows; X INTEGER newlen = newrows*newcols; X REAL* newx = new REAL[newlen]; X if (newx == 0) a.error("Error, realmat, invpsd, Operator new failed"); X X REAL* top = &(newx[a.len-1]); X REAL* t = newx; X REAL* u = a.x; X while (t <= top) *t++ = *u++; X X REAL* s = new REAL[newrows]; X if (s == 0) a.error("Error, realmat, invpsd, Operator new failed"); X X dcond(newx,newrows,s,0); X INTEGER ier = dsweep(newx,newrows,eps); X dcond(newx,newrows,s,1); X X ier++; //This stops a compiler warning. X X delete s; X X realmat d(newrows,newcols,newx); X return d; X} END_OF_FILE if test 9898 -ne `wc -c <'realmat.cc'`; then echo shar: \"'realmat.cc'\" unpacked with wrong size! fi # end of 'realmat.cc' fi echo shar: End of archive 3 \(of 6\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 5 6 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 6 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0