home *** CD-ROM | disk | FTP | other *** search
- From: arg@ccvr1.cc.ncsu.edu (Ron Gallant)
- Newsgroups: comp.sources.misc
- Subject: v16i064: nlmdl - Estimate nonlinear statistical models, Part02/06
- Message-ID: <1991Jan12.050546.8628@sparky.IMD.Sterling.COM>
- Date: 12 Jan 91 05:05:46 GMT
- Approved: kent@sparky.imd.sterling.com
- X-Checksum-Snefru: 6f34cb32 6a1e6f5f 64181494 7c1cfcab
-
- Submitted-by: arg@ccvr1.cc.ncsu.edu (Ron Gallant)
- Posting-number: Volume 16, Issue 64
- Archive-name: nlmdl/part02
-
- # 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 2 (of 6)."
- # Contents: ch5eg1/detail.bak ch5eg1/end3l.bak ch5eg1/ending.bak
- # ch6eg1/ending.bak ch6eg2/detail3l.bak display.cc nlmdl.h realmat.h
- # Wrapped by arg@sparc on Fri Jan 11 20:14:53 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'ch5eg1/detail.bak' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ch5eg1/detail.bak'\"
- else
- echo shar: Extracting \"'ch5eg1/detail.bak'\" \(5719 characters\)
- sed "s/^X//" >'ch5eg1/detail.bak' <<'END_OF_FILE'
- XMissing observation at t = 142.
- XMissing observation at t = 170.
- XMissing observation at t = 172.
- XMissing observation at t = 193.
- XWarning, status::to, var is not initialized, tmp.dat incomplete.
- X
- X
- X **********************************************************************
- X * *
- X * nlmdl 2.0 *
- X * *
- X **********************************************************************
- X
- X
- X **********************************************************************
- X * *
- X * Parameter settings *
- X * *
- X **********************************************************************
- X
- X Gallant, "Nonlinear Statistical Models," Chapter 5, Figure 3, p. 324-326
- X SUR What estimation method? Code SUR, TSLS, or GMM.
- X 224 Number of observations, t = 1, ..., n.
- X 2 Number of equations, i.e. dimension of e.
- X 0 Number of instruments, i.e. dimension of Z.
- X 8 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 minimal 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 -2.90000
- X Row 2 -1.30000
- X Row 3 0.820000
- X Row 4 0.360000
- X Row 5 -1.50000
- X Row 6 -1.00000
- X Row 7 -0.0300000
- X Row 8 -0.470000
- X
- X
- X **********************************************************************
- X * *
- X * theta *
- X * *
- X **********************************************************************
- X
- X
- X Col 1
- X
- X Row 1 -2.92458
- X Row 2 -1.28675
- X Row 3 0.818570
- X Row 4 0.361158
- X Row 5 -1.53759
- X Row 6 -1.04896
- X Row 7 0.0300867
- X Row 8 -0.467420
- X
- X
- X
- X **********************************************************************
- X * *
- X * var *
- X * (no degrees of freedom corrections) *
- X * *
- X **********************************************************************
- X
- X
- X Col 1 Col 2
- X
- X Row 1 0.164925 0.0920057
- X Row 2 0.0920057 0.0896426
- X
- X
- X
- X **********************************************************************
- X * *
- X * V *
- X * (rank = 8) *
- X * *
- X **********************************************************************
- X
- X
- X Col 1 Col 2 Col 3 Col 4 Col 5 Col 6
- X
- X Row 1 0.0760485 -0.0394416 -0.00813632 0.00225515 0.0151611 -0.00086387
- X Row 2 -0.0394416 0.0506098 0.00219396 0.00071347 -0.00244522 0.0122632
- X Row 3 -0.00813632 0.00219396 0.00644155 0.00078138 -0.00603532 -0.00238599
- X Row 4 0.00225515 0.00071347 0.00078138 0.00090344 -0.00048087 0.00101291
- X Row 5 0.0151611 -0.00244522 -0.00603532 -0.00048087 0.00832137 0.00200847
- X Row 6 -0.00086387 0.0122632 -0.00238599 0.00101291 0.00200847 0.00689444
- X Row 7 -0.00293607 0.00321764 -0.00075345 -0.00079074 0.00110681 0.00015596
- X Row 8 -0.00218205 0.00172663 0.00080830 0.00027549 -0.00115374 0.00049917
- X
- X
- X Col 7 Col 8
- X
- X Row 1 -0.00293607 -0.00218205
- X Row 2 0.00321764 0.00172663
- X Row 3 -0.00075345 0.00080830
- X Row 4 -0.00079074 0.00027549
- X Row 5 0.00110681 -0.00115374
- X Row 6 0.00015596 0.00049917
- X Row 7 0.00128616 -0.00024276
- X Row 8 -0.00024276 0.00036532
- X
- END_OF_FILE
- if test 5719 -ne `wc -c <'ch5eg1/detail.bak'`; then
- echo shar: \"'ch5eg1/detail.bak'\" unpacked with wrong size!
- fi
- # end of 'ch5eg1/detail.bak'
- fi
- if test -f 'ch5eg1/end3l.bak' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ch5eg1/end3l.bak'\"
- else
- echo shar: Extracting \"'ch5eg1/end3l.bak'\" \(5775 characters\)
- sed "s/^X//" >'ch5eg1/end3l.bak' <<'END_OF_FILE'
- XGallant, "Nonlinear Statistical Models," Chapter 5, Figure 3, p. 324-326
- XSUR What estimation method? Code SUR, TSLS, or GMM.
- X224 Number of observations, t = 1, ..., n.
- X2 Number of equations, i.e. dimension of e.
- X0 Number of instruments, i.e. dimension of Z.
- X8 Number of parameters, i.e. dimension of theta.
- X50 Upper limit on Gauss-Newton iterations.
- X1 Number var iterates, ivar=0 means none.
- Xheteroskedastic Code homoskedastic or heteroskedastic.
- X3 Number of moving average terms MA for var estimate.
- XParzen Code none or Parzen, none when MA>0 is unwise.
- X1.000000e-13 Convergence tolerance, tol=1.0e-8 is reasonable.
- X1.000000e-10 Inversion tolerance, eps=1.0e-13 is reasonable
- Xfull How much output? Code none, minimal, or full.
- X8 Computed rank of V.
- Xuncorrected Divisor of var, corrected or uncorrected.
- X Blank line.
- X Blank line.
- X Blank line.
- X -2.9245814501616803e+00 -2.92458145 theta(1)
- X -1.2867460434063589e+00 -1.28674604 theta(2)
- X 8.1856990357452608e-01 0.81856990 theta(3)
- X 3.6115785200404138e-01 0.36115785 theta(4)
- X -1.5375885808695555e+00 -1.53758858 theta(5)
- X -1.0489590970263374e+00 -1.04895910 theta(6)
- X 3.0086700241162653e-02 0.03008670 theta(7)
- X -4.6742011797582117e-01 -0.46742012 theta(8)
- X 1.6492462994112111e-01 0.16492463 var(1,1)
- X 9.2005729031321579e-02 0.09200573 var(2,1)
- X 9.2005729031321579e-02 0.09200573 var(1,2)
- X 8.9642642316875812e-02 0.08964264 var(2,2)
- X 6.4151871786190293e-02 0.06415187 V(1,1)
- X -2.6808435093990508e-02 -0.02680844 V(2,1)
- X -1.0481302083617307e-02 -0.01048130 V(3,1)
- X 2.4179792658493493e-03 0.00241798 V(4,1)
- X 1.5271744257123141e-02 0.01527174 V(5,1)
- X 3.6217216495842341e-03 0.00362172 V(6,1)
- X -2.2745052058113957e-03 -0.00227451 V(7,1)
- X -2.2282353784641093e-03 -0.00222824 V(8,1)
- X -2.6808435093990942e-02 -0.02680844 V(1,2)
- X 3.9204445770723149e-02 0.03920445 V(2,2)
- X 3.5239211150354388e-03 0.00352392 V(3,2)
- X 1.9044116642894958e-03 0.00190441 V(4,2)
- X -2.5090660931227499e-03 -0.00250907 V(5,2)
- X 9.9860387081928022e-03 0.00998604 V(6,2)
- X 1.0763522857786497e-03 0.00107635 V(7,2)
- X 1.4608657346846976e-03 0.00146087 V(8,2)
- X -1.0481302083617045e-02 -0.01048130 V(1,3)
- X 3.5239211150353313e-03 0.00352392 V(2,3)
- X 5.9499339084749959e-03 0.00594993 V(3,3)
- X 3.8379282539160748e-04 0.00038379 V(4,3)
- X -5.5488697133901426e-03 -0.00554887 V(5,3)
- X -2.3181283618853221e-03 -0.00231813 V(6,3)
- X -3.0995472128008387e-04 -0.00030995 V(7,3)
- X 7.9619528555448433e-04 0.00079620 V(8,3)
- X 2.4179792658493345e-03 0.00241798 V(1,4)
- X 1.9044116642895203e-03 0.00190441 V(2,4)
- X 3.8379282539158981e-04 0.00038379 V(3,4)
- X 1.1185997609060533e-03 0.00111860 V(4,4)
- X -8.2948235409772357e-05 -0.00008295 V(5,4)
- X 1.8128096548391446e-03 0.00181281 V(6,4)
- X -8.6907934492451726e-04 -0.00086908 V(7,4)
- X 2.3704685064746336e-04 0.00023705 V(8,4)
- X 1.5271744257122990e-02 0.01527174 V(1,5)
- X -2.5090660931226623e-03 -0.00250907 V(2,5)
- X -5.5488697133901886e-03 -0.00554887 V(3,5)
- X -8.2948235409779458e-05 -0.00008295 V(4,5)
- X 7.2303542854823596e-03 0.00723035 V(5,5)
- X 2.4292056516279819e-03 0.00242921 V(6,5)
- X 6.6272949286796750e-04 0.00066273 V(7,5)
- X -1.0628753376875112e-03 -0.00106288 V(8,5)
- X 3.6217216495840446e-03 0.00362172 V(1,6)
- X 9.9860387081929288e-03 0.00998604 V(2,6)
- X -2.3181283618853659e-03 -0.00231813 V(3,6)
- X 1.8128096548391255e-03 0.00181281 V(4,6)
- X 2.4292056516280035e-03 0.00242921 V(5,6)
- X 6.9725212588786700e-03 0.00697252 V(6,6)
- X -8.0090995756335992e-04 -0.00080091 V(7,6)
- X 2.8957023926462434e-04 0.00028957 V(8,6)
- X -2.2745052058114465e-03 -0.00227451 V(1,7)
- X 1.0763522857786777e-03 0.00107635 V(2,7)
- X -3.0995472128007016e-04 -0.00030995 V(3,7)
- X -8.6907934492452008e-04 -0.00086908 V(4,7)
- X 6.6272949286796273e-04 0.00066273 V(5,7)
- X -8.0090995756337260e-04 -0.00080091 V(6,7)
- X 1.1126181202496821e-03 0.00111262 V(7,7)
- X -2.5799316642020757e-04 -0.00025799 V(8,7)
- X -2.2282353784641279e-03 -0.00222824 V(1,8)
- X 1.4608657346847011e-03 0.00146087 V(2,8)
- X 7.9619528555449908e-04 0.00079620 V(3,8)
- X 2.3704685064746418e-04 0.00023705 V(4,8)
- X -1.0628753376875236e-03 -0.00106288 V(5,8)
- X 2.8957023926462423e-04 0.00028957 V(6,8)
- X -2.5799316642020887e-04 -0.00025799 V(7,8)
- X 3.6558708385757817e-04 0.00036559 V(8,8)
- X 7.1212458944209244e-09 0.00000001 D(1)
- X -9.5291010557382897e-09 -0.00000001 D(2)
- X -1.5778368693623276e-09 -0.00000000 D(3)
- X -6.4433263552306315e-10 -0.00000000 D(4)
- X 1.5722264246975941e-09 0.00000000 D(5)
- X -2.4312439036197547e-09 -0.00000000 D(6)
- X -1.5845329475213192e-10 -0.00000000 D(7)
- X -8.7707819833213637e-10 -0.00000000 D(8)
- X 4.4685695288184939e+02 446.85695288 obj
- END_OF_FILE
- if test 5775 -ne `wc -c <'ch5eg1/end3l.bak'`; then
- echo shar: \"'ch5eg1/end3l.bak'\" unpacked with wrong size!
- fi
- # end of 'ch5eg1/end3l.bak'
- fi
- if test -f 'ch5eg1/ending.bak' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ch5eg1/ending.bak'\"
- else
- echo shar: Extracting \"'ch5eg1/ending.bak'\" \(5775 characters\)
- sed "s/^X//" >'ch5eg1/ending.bak' <<'END_OF_FILE'
- XGallant, "Nonlinear Statistical Models," Chapter 5, Figure 3, p. 324-326
- XSUR What estimation method? Code SUR, TSLS, or GMM.
- X224 Number of observations, t = 1, ..., n.
- X2 Number of equations, i.e. dimension of e.
- X0 Number of instruments, i.e. dimension of Z.
- X8 Number of parameters, i.e. dimension of theta.
- X50 Upper limit on Gauss-Newton iterations.
- X1 Number var iterates, ivar=0 means none.
- Xhomoskedastic Code homoskedastic or heteroskedastic.
- X0 Number of moving average terms MA for var estimate.
- Xnone Code none or Parzen, none when MA>0 is unwise.
- X1.000000e-13 Convergence tolerance, tol=1.0e-8 is reasonable.
- X1.000000e-10 Inversion tolerance, eps=1.0e-13 is reasonable
- Xminimal How much output? Code none, minimal, or full.
- X8 Computed rank of V.
- Xuncorrected Divisor of var, corrected or uncorrected.
- X Blank line.
- X Blank line.
- X Blank line.
- X -2.9245814501616803e+00 -2.92458145 theta(1)
- X -1.2867460434063589e+00 -1.28674604 theta(2)
- X 8.1856990357452608e-01 0.81856990 theta(3)
- X 3.6115785200404138e-01 0.36115785 theta(4)
- X -1.5375885808695555e+00 -1.53758858 theta(5)
- X -1.0489590970263374e+00 -1.04895910 theta(6)
- X 3.0086700241162653e-02 0.03008670 theta(7)
- X -4.6742011797582117e-01 -0.46742012 theta(8)
- X 1.6492462994112111e-01 0.16492463 var(1,1)
- X 9.2005729031321579e-02 0.09200573 var(2,1)
- X 9.2005729031321579e-02 0.09200573 var(1,2)
- X 8.9642642316875812e-02 0.08964264 var(2,2)
- X 7.6048540298630313e-02 0.07604854 V(1,1)
- X -3.9441553460601381e-02 -0.03944155 V(2,1)
- X -8.1363244658375945e-03 -0.00813632 V(3,1)
- X 2.2551454088996347e-03 0.00225515 V(4,1)
- X 1.5161071040894071e-02 0.01516107 V(5,1)
- X -8.6386978244942293e-04 -0.00086387 V(6,1)
- X -2.9360670383682128e-03 -0.00293607 V(7,1)
- X -2.1820501983515709e-03 -0.00218205 V(8,1)
- X -3.9441553460601381e-02 -0.03944155 V(1,2)
- X 5.0609776285336930e-02 0.05060978 V(2,2)
- X 2.1939598380520749e-03 0.00219396 V(3,2)
- X 7.1346736728890531e-04 0.00071347 V(4,2)
- X -2.4452170498858623e-03 -0.00244522 V(5,2)
- X 1.2263248643774908e-02 0.01226325 V(6,2)
- X 3.2176432662395357e-03 0.00321764 V(7,2)
- X 1.7266330377801262e-03 0.00172663 V(8,2)
- X -8.1363244658375945e-03 -0.00813632 V(1,3)
- X 2.1939598380520749e-03 0.00219396 V(2,3)
- X 6.4415535695106418e-03 0.00644155 V(3,3)
- X 7.8138028913347761e-04 0.00078138 V(4,3)
- X -6.0353186597764865e-03 -0.00603532 V(5,3)
- X -2.3859940684536310e-03 -0.00238599 V(6,3)
- X -7.5345196703219372e-04 -0.00075345 V(7,3)
- X 8.0829924747999706e-04 0.00080830 V(8,3)
- X 2.2551454088996347e-03 0.00225515 V(1,4)
- X 7.1346736728890531e-04 0.00071347 V(2,4)
- X 7.8138028913347761e-04 0.00078138 V(3,4)
- X 9.0343959846035443e-04 0.00090344 V(4,4)
- X -4.8087021200371650e-04 -0.00048087 V(5,4)
- X 1.0129070210761102e-03 0.00101291 V(6,4)
- X -7.9073548924408663e-04 -0.00079074 V(7,4)
- X 2.7549163836087631e-04 0.00027549 V(8,4)
- X 1.5161071040894071e-02 0.01516107 V(1,5)
- X -2.4452170498858623e-03 -0.00244522 V(2,5)
- X -6.0353186597764865e-03 -0.00603532 V(3,5)
- X -4.8087021200371650e-04 -0.00048087 V(4,5)
- X 8.3213669176229327e-03 0.00832137 V(5,5)
- X 2.0084691585193232e-03 0.00200847 V(6,5)
- X 1.1068054871987483e-03 0.00110681 V(7,5)
- X -1.1537431897854821e-03 -0.00115374 V(8,5)
- X -8.6386978244942293e-04 -0.00086387 V(1,6)
- X 1.2263248643774908e-02 0.01226325 V(2,6)
- X -2.3859940684536310e-03 -0.00238599 V(3,6)
- X 1.0129070210761102e-03 0.00101291 V(4,6)
- X 2.0084691585193232e-03 0.00200847 V(5,6)
- X 6.8944369024945473e-03 0.00689444 V(6,6)
- X 1.5596012364267730e-04 0.00015596 V(7,6)
- X 4.9917336963915457e-04 0.00049917 V(8,6)
- X -2.9360670383682128e-03 -0.00293607 V(1,7)
- X 3.2176432662395357e-03 0.00321764 V(2,7)
- X -7.5345196703219372e-04 -0.00075345 V(3,7)
- X -7.9073548924408663e-04 -0.00079074 V(4,7)
- X 1.1068054871987483e-03 0.00110681 V(5,7)
- X 1.5596012364267730e-04 0.00015596 V(6,7)
- X 1.2861607343363046e-03 0.00128616 V(7,7)
- X -2.4275726609718795e-04 -0.00024276 V(8,7)
- X -2.1820501983515709e-03 -0.00218205 V(1,8)
- X 1.7266330377801262e-03 0.00172663 V(2,8)
- X 8.0829924747999706e-04 0.00080830 V(3,8)
- X 2.7549163836087631e-04 0.00027549 V(4,8)
- X -1.1537431897854821e-03 -0.00115374 V(5,8)
- X 4.9917336963915457e-04 0.00049917 V(6,8)
- X -2.4275726609718795e-04 -0.00024276 V(7,8)
- X 3.6531994032499421e-04 0.00036532 V(8,8)
- X 7.1212458944209244e-09 0.00000001 D(1)
- X -9.5291010557382897e-09 -0.00000001 D(2)
- X -1.5778368693623276e-09 -0.00000000 D(3)
- X -6.4433263552306315e-10 -0.00000000 D(4)
- X 1.5722264246975941e-09 0.00000000 D(5)
- X -2.4312439036197547e-09 -0.00000000 D(6)
- X -1.5845329475213192e-10 -0.00000000 D(7)
- X -8.7707819833213637e-10 -0.00000000 D(8)
- X 4.4685695288184939e+02 446.85695288 obj
- END_OF_FILE
- if test 5775 -ne `wc -c <'ch5eg1/ending.bak'`; then
- echo shar: \"'ch5eg1/ending.bak'\" unpacked with wrong size!
- fi
- # end of 'ch5eg1/ending.bak'
- fi
- if test -f 'ch6eg1/ending.bak' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ch6eg1/ending.bak'\"
- else
- echo shar: Extracting \"'ch6eg1/ending.bak'\" \(5772 characters\)
- sed "s/^X//" >'ch6eg1/ending.bak' <<'END_OF_FILE'
- XGallant, "Nonlinear Statistical Models," Chapter 6, Figure 1, p. 436.
- XTSLS What estimation method? Code SUR, TSLS, or GMM.
- X220 Number of observations, t = 1, ..., n.
- X2 Number of equations, i.e. dimension of e.
- X17 Number of instruments, i.e. dimension of Z.
- X8 Number of parameters, i.e. dimension of theta.
- X20 Upper limit on Gauss-Newton iterations.
- X1 Number var iterates, ivar=0 means none.
- Xhomoskedastic Code homoskedastic or heteroskedastic.
- X0 Number of moving average terms MA for var estimate.
- Xnone Code none or Parzen, none when MA>0 is unwise.
- X1.000000e-08 Convergence tolerance, tol=1.0e-8 is reasonable.
- X1.000000e-10 Inversion tolerance, eps=1.0e-13 is reasonable
- Xfull How much output? Code none, minimal, or full.
- X8 Computed rank of V.
- Xuncorrected Divisor of var, corrected or uncorrected.
- X Blank line.
- X Blank line.
- X Blank line.
- X -2.1378778275860273e+00 -2.13787783 theta(1)
- X -1.9893911556433312e+00 -1.98939116 theta(2)
- X 7.0939153916745556e-01 0.70939154 theta(3)
- X 3.3663399323270310e-01 0.33663399 theta(4)
- X -1.4019968694481941e+00 -1.40199687 theta(5)
- X -1.1388969627624823e+00 -1.13889696 theta(6)
- X 2.9131488559477250e-02 0.02913149 theta(7)
- X -5.0050229673416280e-01 -0.50050230 theta(8)
- X 1.6847307354905444e-01 0.16847307 var(1,1)
- X 9.4991006557633997e-02 0.09499101 var(2,1)
- X 9.4991006557633997e-02 0.09499101 var(1,2)
- X 9.3711564655296287e-02 0.09371156 var(2,2)
- X 3.4123357521137065e-01 0.34123358 V(1,1)
- X -4.0515026192173231e-01 -0.40515026 V(2,1)
- X -7.4443670981270527e-02 -0.07444367 V(3,1)
- X -1.7075137202523048e-02 -0.01707514 V(4,1)
- X 7.3616408974018430e-02 0.07361641 V(5,1)
- X -8.0520944995638929e-02 -0.08052094 V(6,1)
- X -1.3988025621517654e-02 -0.01398803 V(7,1)
- X -2.2077927314748533e-02 -0.02207793 V(8,1)
- X -4.0515026192173231e-01 -0.40515026 V(1,2)
- X 5.6591782097119825e-01 0.56591782 V(2,2)
- X 9.3113487046268872e-02 0.09311349 V(3,2)
- X 2.8410019934882371e-02 0.02841002 V(4,2)
- X -8.0617530766411080e-02 -0.08061753 V(5,2)
- X 1.2644653136927941e-01 0.12644653 V(6,2)
- X 1.9325013502098160e-02 0.01932501 V(7,2)
- X 2.9896132263088925e-02 0.02989613 V(8,2)
- X -7.4443670981270527e-02 -0.07444367 V(1,3)
- X 9.3113487046268872e-02 0.09311349 V(2,3)
- X 2.4067454001684946e-02 0.02406745 V(3,3)
- X 5.7835699332500186e-03 0.00578357 V(4,3)
- X -2.1581815564116969e-02 -0.02158182 V(5,3)
- X 1.7403224408106693e-02 0.01740322 V(6,3)
- X 1.9150094956931823e-03 0.00191501 V(7,3)
- X 5.9076727860237991e-03 0.00590767 V(8,3)
- X -1.7075137202523048e-02 -0.01707514 V(1,4)
- X 2.8410019934882371e-02 0.02841002 V(2,4)
- X 5.7835699332500186e-03 0.00578357 V(3,4)
- X 2.5487432759845568e-03 0.00254874 V(4,4)
- X -4.7950486640943122e-03 -0.00479505 V(5,4)
- X 7.3439708547267122e-03 0.00734397 V(6,4)
- X -5.1094810414861448e-05 -0.00005109 V(7,4)
- X 1.8674253117946520e-03 0.00186743 V(8,4)
- X 7.3616408974018430e-02 0.07361641 V(1,5)
- X -8.0617530766411080e-02 -0.08061753 V(2,5)
- X -2.1581815564116969e-02 -0.02158182 V(3,5)
- X -4.7950486640943122e-03 -0.00479505 V(4,5)
- X 2.2762057613803403e-02 0.02276206 V(5,5)
- X -1.5195066143983841e-02 -0.01519507 V(6,5)
- X -9.9415605596577862e-04 -0.00099416 V(7,5)
- X -5.6251801394123823e-03 -0.00562518 V(8,5)
- X -8.0520944995638929e-02 -0.08052094 V(1,6)
- X 1.2644653136927941e-01 0.12644653 V(2,6)
- X 1.7403224408106693e-02 0.01740322 V(3,6)
- X 7.3439708547267122e-03 0.00734397 V(4,6)
- X -1.5195066143983841e-02 -0.01519507 V(5,6)
- X 3.3346276344180567e-02 0.03334628 V(6,6)
- X 3.7331467729901690e-03 0.00373315 V(7,6)
- X 6.9269333322694495e-03 0.00692693 V(8,6)
- X -1.3988025621517654e-02 -0.01398803 V(1,7)
- X 1.9325013502098160e-02 0.01932501 V(2,7)
- X 1.9150094956931823e-03 0.00191501 V(3,7)
- X -5.1094810414861448e-05 -0.00005109 V(4,7)
- X -9.9415605596577862e-04 -0.00099416 V(5,7)
- X 3.7331467729901690e-03 0.00373315 V(6,7)
- X 2.0417788436814010e-03 0.00204178 V(7,7)
- X 6.0905830809060847e-04 0.00060906 V(8,7)
- X -2.2077927314748533e-02 -0.02207793 V(1,8)
- X 2.9896132263088925e-02 0.02989613 V(2,8)
- X 5.9076727860237991e-03 0.00590767 V(3,8)
- X 1.8674253117946520e-03 0.00186743 V(4,8)
- X -5.6251801394123823e-03 -0.00562518 V(5,8)
- X 6.9269333322694495e-03 0.00692693 V(6,8)
- X 6.0905830809060847e-04 0.00060906 V(7,8)
- X 2.0036106220501352e-03 0.00200361 V(8,8)
- X 1.6787206308357473e-07 0.00000017 D(1)
- X -2.4625529712808257e-07 -0.00000025 D(2)
- X -4.6504414197150224e-08 -0.00000005 D(3)
- X -1.4610224422905096e-08 -0.00000001 D(4)
- X 4.0400010629413197e-08 0.00000004 D(5)
- X -5.8821932254927893e-08 -0.00000006 D(6)
- X -8.2632941559150507e-09 -0.00000001 D(7)
- X -1.6640001385280539e-08 -0.00000002 D(8)
- X 3.5611514196184793e+01 35.61151420 obj
- END_OF_FILE
- if test 5772 -ne `wc -c <'ch6eg1/ending.bak'`; then
- echo shar: \"'ch6eg1/ending.bak'\" unpacked with wrong size!
- fi
- # end of 'ch6eg1/ending.bak'
- fi
- if test -f 'ch6eg2/detail3l.bak' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ch6eg2/detail3l.bak'\"
- else
- echo shar: Extracting \"'ch6eg2/detail3l.bak'\" \(7043 characters\)
- sed "s/^X//" >'ch6eg2/detail3l.bak' <<'END_OF_FILE'
- X
- X
- X **********************************************************************
- X * *
- X * nlmdl 2.0 *
- X * *
- X **********************************************************************
- X
- X
- X **********************************************************************
- X * *
- X * Parameter settings *
- X * *
- X **********************************************************************
- X
- X Gallant, "Nonlinear Statistical Models," Chapter 6, Figure 2, p. 449-450.
- X GMM What estimation method? Code SUR, TSLS, or GMM.
- X 238 Number of observations, t = 1, ..., n.
- X 1 Number of equations, i.e. dimension of e.
- X 3 Number of instruments, i.e. dimension of Z.
- X 2 Number of parameters, i.e. dimension of theta.
- X 20 Upper limit on Gauss-Newton iterations.
- X 1 Number var iterates, ivar=0 means none.
- X heteroskedastic Code homoskedastic or heteroskedastic.
- X 3 Number of moving average terms MA for var estimate.
- X Parzen Code none or Parzen, none when MA>0 is unwise.
- X 1.000000e-05 Convergence tolerance, tol=1.0e-8 is reasonable.
- X 1.000000e-13 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.400000
- X Row 2 0.900000
- X
- Xvar_loop 0
- X 2.3800000000000000e+02 238.00000000 var(1,1)
- X 2.3848513503508150e+02 238.48513504 var(2,1)
- X 2.3866807009536583e+02 238.66807010 var(3,1)
- X 2.3848513503508150e+02 238.48513504 var(1,2)
- X 2.3897620940526255e+02 238.97620941 var(2,2)
- X 2.3916481122626234e+02 239.16481123 var(3,2)
- X 2.3866807009536583e+02 238.66807010 var(1,3)
- X 2.3916481122626234e+02 239.16481123 var(2,3)
- X 2.3975964092305995e+02 239.75964092 var(3,3)
- X
- Xtheta_loop 0
- X -4.0000000000000002e-01 -0.40000000 theta(1)
- X 9.0000000000000002e-01 0.90000000 theta(2)
- X 2.2977593855825589e+00 2.29775939 obj
- X -4.9910043429446205e-01 -0.49910043 D(1)
- X 9.8933364963875864e-02 0.09893336 D(2)
- XStep length = 1
- X
- Xtheta_loop 1
- X -8.9910043429446207e-01 -0.89910043 theta(1)
- X 9.9893336496387586e-01 0.99893336 theta(2)
- X 2.7751760221041621e-03 0.00277518 obj
- X 5.0366043831498272e-02 0.05036604 D(1)
- X -4.4414610501568677e-06 -0.00000444 D(2)
- XStep length = 1
- X
- Xtheta_loop 2
- X -8.4873439046296384e-01 -0.84873439 theta(1)
- X 9.9892892350282569e-01 0.99892892 theta(2)
- X 2.7717868638761308e-03 0.00277179 obj
- X -1.1734797022229638e-04 -0.00011735 D(1)
- X 2.1096605255709332e-07 0.00000021 D(2)
- XStep length = 1
- X
- Xtheta_loop 3
- X -8.4885173843318618e-01 -0.84885174 theta(1)
- X 9.9892913446887821e-01 0.99892913 theta(2)
- X 2.7717868580610532e-03 0.00277179 obj
- X 2.6798358348564710e-07 0.00000027 D(1)
- X -5.5350439549602871e-10 -0.00000000 D(2)
- XTolerence check passed.
- X
- Xvar_loop 1
- X 4.3978220854904504e-01 0.43978221 var(1,1)
- X 4.4050039895600307e-01 0.44050040 var(2,1)
- X 4.3420956263910121e-01 0.43420956 var(3,1)
- X 4.4050039895600307e-01 0.44050040 var(1,2)
- X 4.4122700259798669e-01 0.44122700 var(2,2)
- X 4.3493663977747488e-01 0.43493664 var(3,2)
- X 4.3420956263910121e-01 0.43420956 var(1,3)
- X 4.3493663977747488e-01 0.43493664 var(2,3)
- X 4.2967081964723475e-01 0.42967082 var(3,3)
- X
- Xtheta_loop 0
- X -8.4885173843318618e-01 -0.84885174 theta(1)
- X 9.9892913446887821e-01 0.99892913 theta(2)
- X 1.2014636301992196e+00 1.20146363 obj
- X -6.4020486065461402e-03 -0.00640205 D(1)
- X -8.8353145570584189e-04 -0.00088353 D(2)
- XStep length = 1
- X
- Xtheta_loop 1
- X -8.5525378703973232e-01 -0.85525379 theta(1)
- X 9.9804560301317236e-01 0.99804560 theta(2)
- X 1.0861341198092420e+00 1.08613412 obj
- X 2.6747016119385693e-06 0.00000267 D(1)
- X -1.7073275785211286e-08 -0.00000002 D(2)
- XTolerence check passed.
- X
- X
- X **********************************************************************
- X * *
- X * theta *
- X * *
- X **********************************************************************
- X
- X
- X Col 1
- X
- X Row 1 -0.855254
- X Row 2 0.998046
- X
- X
- X
- X **********************************************************************
- X * *
- X * var *
- X * (no degrees of freedom corrections) *
- X * *
- X **********************************************************************
- X
- X
- X Col 1 Col 2 Col 3
- X
- X Row 1 0.439782 0.440500 0.434210
- X Row 2 0.440500 0.441227 0.434937
- X Row 3 0.434210 0.434937 0.429671
- X
- X
- X
- X **********************************************************************
- X * *
- X * V *
- X * (rank = 2) *
- X * *
- X **********************************************************************
- X
- X
- X Col 1 Col 2
- X
- X Row 1 3.60663 -0.00715768
- X Row 2 -0.00715768 2.117e-05
- X
- END_OF_FILE
- if test 7043 -ne `wc -c <'ch6eg2/detail3l.bak'`; then
- echo shar: \"'ch6eg2/detail3l.bak'\" unpacked with wrong size!
- fi
- # end of 'ch6eg2/detail3l.bak'
- fi
- if test -f 'display.cc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'display.cc'\"
- else
- echo shar: Extracting \"'display.cc'\" \(4567 characters\)
- sed "s/^X//" >'display.cc' <<'END_OF_FILE'
- X/* ----------------------------------------------------------------------------
- X
- Xnlmdl: display.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/* display.cc is a piece of status.cc that was split */
- X/* out to reduce Turbo C++ memory requirements. */
- X
- X#include "status.h"
- X
- Xint status::display(display_mode mode)
- X{
- X
- X INTEGER i,j,len;
- X char temp[MAX_STATUS_LINE];
- X char* pad = " ";
- X
- X
- X switch (mode) {
- X
- X case START_UP:
- X
- X cout << starbox("/Parameter settings//_") << "\n";
- X
- X cout<<pad<< switches << "\n";
- X
- X sprintf(temp,"%-19s", method);
- X cout<<pad<<temp<< "What estimation method? Code SUR, TSLS, or GMM.\n";
- X
- X sprintf(temp,"%-19d", n);
- X cout<<pad<<temp<< "Number of observations, t = 1, ..., n.\n";
- X
- X sprintf(temp,"%-19d",M);
- X cout<<pad<<temp<< "Number of equations, i.e. dimension of e.\n";
- X
- X sprintf(temp,"%-19d",K);
- X cout<<pad<<temp<<"Number of instruments, i.e. dimension of Z.\n";
- X
- X sprintf(temp,"%-19d",p);
- X cout<<pad<<temp<<"Number of parameters, i.e. dimension of theta.\n";
- X
- X sprintf(temp,"%-19d",itheta);
- X cout<<pad<<temp<< "Upper limit on Gauss-Newton iterations.\n";
- X
- X sprintf(temp,"%-19d",ivar);
- X cout<<pad<<temp<< "Number var iterates, ivar=0 means none.\n";
- X
- X sprintf(temp,"%-19s",vartype);
- X cout<<pad<<temp<< "Code homoskedastic or heteroskedastic.\n";
- X
- X sprintf(temp,"%-19d",MA);
- X cout<<pad<<temp<< "Number of moving average terms MA for var estimate.\n";
- X
- X sprintf(temp,"%-19s",weights);
- X cout<<pad<<temp<< "Code none or Parzen, none when MA>0 is unwise.\n";
- X
- X sprintf(temp,"%-19.6e",tol);
- X cout<<pad<<temp<< "Convergence tolerance, tol=1.0e-8 is reasonable.\n";
- X
- X sprintf(temp,"%-19.6e",eps);
- X cout<<pad<<temp<< "Inversion tolerance, eps=1.0e-13 is reasonable\n";
- X
- X sprintf(temp,"%-19s",detail);
- X cout<<pad<<temp<< "How much output? Code none, minimal, or full.\n";
- X
- X break;
- X
- X case VAR_ITERATE:
- X
- X if ( rows(var) > 0 && cols(var) > 0 ){
- X if ( strcmp(method,"SUR") == 0 || strcmp(method,"TSLS") == 0){
- X for (j=1; j<=M; j++){
- X for (i=1; i<=M; i++){
- X sprintf(temp,"%25.16e % 20.8f ",var.check2(i,j),var.elem(i,j));
- X cout<<temp<< " var(" << i << "," << j << ")\n";
- X }
- X }
- X }
- X else{
- X len = M*K;
- X for (j=1; j<=len; j++){
- X for (i=1; i<=len; i++){
- X sprintf(temp,"%25.16e % 20.8f ",var.check2(i,j),var.elem(i,j));
- X cout<<temp<< " var(" << i << "," << j << ")\n";
- X }
- X }
- X }
- X }
- X else{
- X cout << "Error, status::display, var is not initialized.\n";
- X }
- X
- X break;
- X
- X case THETA_ITERATE:
- X
- X if ( rows(theta) > 0 && cols(theta) > 0 ){
- X for (i=1; i<=p; i++){
- X sprintf(temp,"%25.16e % 20.8f ",theta[i],theta[i]);
- X cout<<temp<< " theta(" << i << ")\n";
- X }
- X }
- X else{
- X cout << "Error, status::display, theta is not initialized.\n";
- X }
- X
- X sprintf(temp,"%25.16e % 20.8f ",obj,obj);
- X cout<<temp<< " obj\n";
- X
- X if (strcmp(detail,"full")!=0) break;
- X
- X if ( rows(D) > 0 && cols(D) > 0 ){
- X for (i=1; i<=p; i++){
- X sprintf(temp,"%25.16e % 20.8f ",D[i],D[i]);
- X cout<<temp<< " D(" << i << ")\n";
- X }
- X }
- X else{
- X cout << "Error, status::display, D is not initialized.\n";
- X }
- X
- X break;
- X
- X case TERMINATION:
- X
- X cout << starbox("/theta//_") << theta << "\n";
- X
- X if (strcmp(df,"corrected") == 0)
- X cout << starbox("/var/(corrected for degrees of freedom)//_");
- X else
- X cout << starbox("/var/(no degrees of freedom corrections)//_");
- X
- X cout << var << "\n";
- X
- X sprintf(temp,"/V/(rank = %d)//_",rank);
- X cout << starbox(temp) << V << "\n";
- X
- X break;
- X
- X }
- X
- X cout.flush();
- X
- X return 0;
- X
- X}
- END_OF_FILE
- if test 4567 -ne `wc -c <'display.cc'`; then
- echo shar: \"'display.cc'\" unpacked with wrong size!
- fi
- # end of 'display.cc'
- fi
- if test -f 'nlmdl.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'nlmdl.h'\"
- else
- echo shar: Extracting \"'nlmdl.h'\" \(5856 characters\)
- sed "s/^X//" >'nlmdl.h' <<'END_OF_FILE'
- X/* ---------------------------------------------------------------------------
- X
- Xnlmdl: nlmdl.h
- 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 header describes the program nlmdl.cc for estimating theta of the model
- Xe=q(t,theta). The user supples a file named starting.dat whose contents are
- Xdescribed by the template:
- X
- X switches This line is passed to class model as a string.
- X method What estimation method? Code SUR, TSLS, or GMM.
- X n Number of observations, t = 1, ..., n.
- X M Number of equations in the system, i.e. dimension of e.
- X K Number of instruments, i.e. dimension of Z, code K=0 with SUR.
- X p Number of parameters, i.e. dimension of theta.
- X itheta Upper limit on Gauss-Newton iterations.
- X ivar Number of var iterates, ivar=0 means none.
- X vartype Code homoskedastic or heteroskedastic.
- X MA Number of moving average terms for var estimate, code MA=0 if e iid.
- X weights Code none or Parzen, coding none when MA>0 is asking for trouble.
- X tol Convergence tolerance, tol=1.0e-8 is reasonable.
- X eps Inversion tolerance, eps=1.0e-13 is reasonable (if REAL is double).
- X detail How much output? Code none, minimal, or full.
- X Blank line.
- X Blank line.
- X Blank line.
- X Blank line.
- X Blank line.
- X theta(1) Starting values for theta. These must be supplied.
- X
- X to
- X
- X theta(p)
- X var(1) Starting values for variance estimate. These can be omitted.
- X Matrix is stored columnwise. If method = SUR or TSLS then then
- X to l=M and var corresponds to C(e,e'). If method = GMM then l=M*K
- X and var corresponds to the variance of sum on t of e Kronecker
- X var(l*l) product Z.
- X
- X
- XSee class status for more detail, especially status::from. The file
- Xstarting.dat is read twice. At the first reading it must contain at least
- Xthe first line, switches. Class model, described next, can supply entries
- Xfor the second reading.
- X
- XThe user also supplies the class model as files model.h and model.cc. The
- Xclass model is declared in model.h which should match the following template:
- X
- X #include "status.h"
- X external status s;
- X
- X class model
- X {
- X protected:
- X //...
- X
- X public:
- X model();
- X ~model();
- X realmat e_t; // e_t is s.M by 1
- X realmat dele_t; // dele_t is s.M by s.p
- X realmat Z_t; // Z_t is s.K by 1, null if s.K = 0;
- X int initialize();
- X int terminate();
- X void e(INTEGER t); // e fills in e_t
- X void dele(INTEGER t); // dele fills in dele_t = del e_t wrt theta
- X void Z(INTEGER t); // Z fills in Z_t
- X }
- X
- XFor SUR, code the function Z as follows:
- X
- X realmat model::Z(INTEGER t) { }
- X
- XIn writing the class model, the relevant facts regarding program flow in
- Xnlmdl.cc are as follows:
- X
- X 1. First, s is tentatively filled in by reading starting.dat using
- X
- X status s;
- X s.from(s.starting);
- X
- X The primary purpose of this read is to get the first line from
- X starting.dat so as to make it available to model as the string
- X s.switches. Nonetheless, everything in starting.dat is read and
- X put in s.
- X
- X 2. Next, initialize() of class model is called. The function initialize()
- X can read starting.dat, can read other data, etc. Since all of class
- X status's data is public, any of it can be filled in or changed by
- X initialize(). One could, for example, fill in all of class status's
- X data and write it using
- X
- X s.to(s.starting);
- X
- X One could also switch to a different starting status file using
- X
- X s.starting="filename";
- X
- X or a different ending status file using
- X
- X s.ending="filename";
- X
- X If initialize() returns 0, execution stops.
- X
- X 3. Then, class status's data is definitively filled in by the call
- X
- X s.from(s.starting);
- X
- X and m.e_t, m.dele_t, and m.Z_t are dimensioned as
- X
- X m.e_t.resize(s.M,1);
- X m.dele_t.resize(s.M,s.p);
- X if (s.K > 0) m.Z_t.resize(s.K,1);
- X
- X and estimation proceeds using these settings and dimensions.
- X
- X 4. Finally, terminate() of class model is called; terminate() can read data,
- X write data, etc. If terminate() returns 0 execution stops, otherwise
- X initialize() is called again and the cycle repeats (from Step 2). One
- X can use this feature to loop over a grid of starting values.
- X
- X
- XReference:
- X
- XGallant, A. Ronald (1987), "Nonlinear Statistical Models," New York: John
- XWiley and Sons. ISBN 0-471-80260-3.
- X
- X--------------------------------------------------------------------------- */
- X
- X
- X#ifndef __FILE_NLMDL_H_SEEN__
- X#pragma once
- X#define __FILE_NLMDL_H_SEEN__ 1
- X
- X#include "usual.h" //This header is also in status.h
- X#include "realmat.h" //This header is also in status.h
- X#include "tools.h" //This header is also in status.h
- X
- X#include "status.h"
- X#include "model.h"
- X
- X#define VERSION "2.0"
- X
- X#endif
- X
- END_OF_FILE
- if test 5856 -ne `wc -c <'nlmdl.h'`; then
- echo shar: \"'nlmdl.h'\" unpacked with wrong size!
- fi
- # end of 'nlmdl.h'
- fi
- if test -f 'realmat.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'realmat.h'\"
- else
- echo shar: Extracting \"'realmat.h'\" \(5870 characters\)
- sed "s/^X//" >'realmat.h' <<'END_OF_FILE'
- X/* ----------------------------------------------------------------------------
- X
- Xrealmat: realmat.h
- 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
- XThis header defines a matrix class. A matrix X with r rows, and c columns is
- Xconstructed using realmat X(r,c). X is stored columnwise with no wasted space
- Xwhich is to say that vec(X) is what is stored. Indexing of the elements starts
- Xwith 1, not zero. The protected members of realmat are rows, cols, len, and x.
- X
- XAs an illustration, suppose X is constructed using realmat X(r,c). Then
- XX.rows=r, X.cols=c, X.len=r*c, the pointer X.x points to the first element of
- Xvec(X), X[i] returns the i-th element of vec(X), i=1,...,X.len, X.elem(i,j)
- Xreturns the (i,j)-th element of X, i=1,...,X.rows, j=1,...,.X.cols. An element
- Xof X is of type REAL and X.rows, X.cols, and X.len are of type INTEGER. The
- Xtypedef of REAL and INTEGER is in usual.h. To allocate store at run time, use
- Xrealmat X; X.resize(r,c);.
- X
- XThe operators +, -, *, =, +=, -=, ++, --, ==, !=, <, <=, >, >= and << are
- Xdefined. T(X) transposes X. X.check1(i) and X.check2(i,j) access the elements
- Xof vec(X) and X respectively with range checking. invpsd(X) or invpsd(X,eps)
- Xreturns a g-inverse of a positive semi-definite, symmetric matrix X with
- Xminimal error checking; eps is the tolerance used in rank determination and
- Xdefaults to 1.e-13. rows(X) returns X.rows and cols(X) returns X.cols. The
- Xoperator ++ acts like ++X, not like X++; similarly for --. The operators ==,
- X<, <=, >, and >= evaluate to true if the matrices compared are the same size
- Xand the relation is true for each element; (A!=B) = !(A==B).
- X
- X-----------------------------------------------------------------------------*/
- X
- X#ifndef __FILE_REALMAT_H_SEEN__
- X#pragma once
- X#define __FILE_REALMAT_H_SEEN__ 1
- X
- X#include "usual.h"
- X#include "tools.h"
- X
- Xclass realmat
- X{
- Xprotected:
- X
- X INTEGER rows;
- X INTEGER cols;
- X INTEGER len;
- X REAL *x;
- X
- X realmat(INTEGER r, INTEGER c, REAL* a);
- X void resize(INTEGER r, INTEGER c, REAL* a); //expects this.x == 0
- X
- X
- Xpublic:
- X realmat();
- X
- X realmat(INTEGER r, INTEGER c);
- X realmat(INTEGER r, INTEGER c, REAL fill_value);
- X
- X realmat(realmat&);
- X
- X ~realmat();
- X
- Xvoid resize(INTEGER r, INTEGER c);
- Xvoid resize(INTEGER r, INTEGER c, REAL fill_value);
- X
- Xrealmat& operator=(realmat& a);
- Xrealmat& operator+=(realmat& a);
- Xrealmat& operator-=(realmat& a);
- Xrealmat& operator++();
- Xrealmat& operator--();
- X
- XREAL& operator[](INTEGER i);
- XREAL& elem(INTEGER i, INTEGER j);
- XREAL& check1(INTEGER i);
- XREAL& check2(INTEGER i, INTEGER j);
- X
- Xvoid error(const char* msg);
- X
- Xfriend int operator==(realmat& a, realmat& b);
- Xfriend int operator!=(realmat& a, realmat& b);
- X
- Xfriend int operator<(realmat& a, realmat& b);
- Xfriend int operator>(realmat& a, realmat& b);
- X
- Xfriend int operator<=(realmat& a, realmat& b);
- Xfriend int operator>=(realmat& a, realmat& b);
- X
- Xfriend INTEGER rows(realmat& a);
- Xfriend INTEGER cols(realmat& a);
- X
- Xfriend ostream& operator<<(ostream& stream, realmat& a);
- X
- Xfriend realmat operator+(realmat& a, realmat& b);
- Xfriend realmat operator+(realmat& a);
- X
- Xfriend realmat operator-(realmat& a, realmat& b);
- Xfriend realmat operator-(realmat& a);
- X
- Xfriend realmat operator*(realmat& a, realmat& b);
- Xfriend realmat operator*(REAL& a, realmat& b);
- Xfriend realmat operator*(INTEGER& a, realmat& b);
- X
- Xfriend realmat T(realmat& a);
- X
- Xfriend realmat invpsd(realmat& a, REAL eps = 1.0e-13); //a is psd, symmetric
- X
- X};
- X
- X
- X//protected:
- X
- Xinline realmat::realmat(INTEGER r, INTEGER c, REAL* a)
- X {rows=r; cols=c; len=r*c; x = a;}
- X
- Xinline void realmat::resize(INTEGER r, INTEGER c, REAL* a)
- X {rows=r; cols=c; len=r*c; x = a;} //Note: No delete, this.x == 0 expected.
- X
- X
- X//public:
- X
- Xinline int operator!=(realmat& a, realmat& b)
- X {return !(a == b);}
- X
- Xinline REAL& realmat::operator[](INTEGER i)
- X {return x[i-1];}
- X
- Xinline REAL& realmat::elem(INTEGER i, INTEGER j)
- X {return x[i + rows*j - rows - 1];} // returns x[rows*(j-1)+i-1]
- X
- Xinline INTEGER rows(realmat& a)
- X {return a.rows;}
- X
- Xinline INTEGER cols(realmat& a)
- X {return a.cols;}
- X
- Xinline realmat::~realmat()
- X {delete x;}
- X
- Xinline realmat::realmat()
- X {rows=0; cols=0; len=0; x = 0;}
- X
- Xinline realmat::realmat(INTEGER r, INTEGER c)
- 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}
- X
- Xinline void realmat::resize(INTEGER r, INTEGER c)
- 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}
- X
- Xextern void default_realmat_error_handler(const char* msg);
- Xextern ONE_ARG_ERROR_HANDLER_T realmat_error_handler;
- Xextern ONE_ARG_ERROR_HANDLER_T
- X set_realmat_error_handler(ONE_ARG_ERROR_HANDLER_T f);
- X
- X#endif
- END_OF_FILE
- if test 5870 -ne `wc -c <'realmat.h'`; then
- echo shar: \"'realmat.h'\" unpacked with wrong size!
- fi
- # end of 'realmat.h'
- fi
- echo shar: End of archive 2 \(of 6\).
- cp /dev/null ark2isdone
- 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
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-