nlmdl Part 2 of 6

Ron Gallant arg at ccvr1.ncsu.edu
Sun Dec 23 09:58:11 AEST 1990


#! /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 2 (of 6)."
# Contents:  ch5eg1/detail.bak ch5eg1/ending.bak ch5eg1/model.cc
#   ch6eg1/ending.bak ch6eg2/detail.bak ch6eg2/detail3l.bak realmat.h
# Wrapped by arg at sparc on Sat Dec 22 15:25:08 1990
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'\" \(5337 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     *                         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 5337 -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/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.9245814449905394e+00          -2.92458144  theta(1)
X  -1.2867460503316253e+00          -1.28674605  theta(2)
X   8.1856990242820626e-01           0.81856990  theta(3)
X   3.6115785153458313e-01           0.36115785  theta(4)
X  -1.5375885797279583e+00          -1.53758858  theta(5)
X  -1.0489590987941970e+00          -1.04895910  theta(6)
X   3.0086700127238110e-02           0.03008670  theta(7)
X  -4.6742011861360061e-01          -0.46742012  theta(8)
X   1.6492462994452800e-01           0.16492463  var(1,1)
X   9.2005729030115752e-02           0.09200573  var(2,1)
X   9.2005729030115752e-02           0.09200573  var(1,2)
X   8.9642642313468718e-02           0.08964264  var(2,2)
X   7.6048540286061672e-02           0.07604854  V(1,1)
X  -3.9441553483350732e-02          -0.03944155  V(2,1)
X  -8.1363244739170795e-03          -0.00813632  V(3,1)
X   2.2551454090316983e-03           0.00225515  V(4,1)
X   1.5161071017607188e-02           0.01516107  V(5,1)
X  -8.6386975580666527e-04          -0.00086387  V(6,1)
X  -2.9360670407352968e-03          -0.00293607  V(7,1)
X  -2.1820501843315037e-03          -0.00218205  V(8,1)
X  -3.9441553483350732e-02          -0.03944155  V(1,2)
X   5.0609776496864281e-02           0.05060978  V(2,2)
X   2.1939598638565584e-03           0.00219396  V(3,2)
X   7.1346738525713041e-04           0.00071347  V(4,2)
X  -2.4452170177131976e-03          -0.00244522  V(5,2)
X   1.2263248674600605e-02           0.01226325  V(6,2)
X   3.2176432740476935e-03           0.00321764  V(7,2)
X   1.7266330310185170e-03           0.00172663  V(8,2)
X  -8.1363244739170795e-03          -0.00813632  V(1,3)
X   2.1939598638565584e-03           0.00219396  V(2,3)
X   6.4415535876466042e-03           0.00644155  V(3,3)
X   7.8138029353526470e-04           0.00078138  V(4,3)
X  -6.0353186660806737e-03          -0.00603532  V(5,3)
X  -2.3859940716428598e-03          -0.00238599  V(6,3)
X  -7.5345196798700168e-04          -0.00075345  V(7,3)
X   8.0829924725463100e-04           0.00080830  V(8,3)
X   2.2551454090316983e-03           0.00225515  V(1,4)
X   7.1346738525713041e-04           0.00071347  V(2,4)
X   7.8138029353526470e-04           0.00078138  V(3,4)
X   9.0343960170753094e-04           0.00090344  V(4,4)
X  -4.8087021234569739e-04          -0.00048087  V(5,4)
X   1.0129070263378132e-03           0.00101291  V(6,4)
X  -7.9073549000040579e-04          -0.00079074  V(7,4)
X   2.7549163930955017e-04           0.00027549  V(8,4)
X   1.5161071017607188e-02           0.01516107  V(1,5)
X  -2.4452170177131976e-03          -0.00244522  V(2,5)
X  -6.0353186660806737e-03          -0.00603532  V(3,5)
X  -4.8087021234569739e-04          -0.00048087  V(4,5)
X   8.3213669168315310e-03           0.00832137  V(5,5)
X   2.0084691758629905e-03           0.00200847  V(6,5)
X   1.1068054905986301e-03           0.00110681  V(7,5)
X  -1.1537431859081695e-03          -0.00115374  V(8,5)
X  -8.6386975580666527e-04          -0.00086387  V(1,6)
X   1.2263248674600605e-02           0.01226325  V(2,6)
X  -2.3859940716428598e-03          -0.00238599  V(3,6)
X   1.0129070263378132e-03           0.00101291  V(4,6)
X   2.0084691758629905e-03           0.00200847  V(5,6)
X   6.8944369137878920e-03           0.00689444  V(6,6)
X   1.5596012423481543e-04           0.00015596  V(7,6)
X   4.9917336716968821e-04           0.00049917  V(8,6)
X  -2.9360670407352968e-03          -0.00293607  V(1,7)
X   3.2176432740476935e-03           0.00321764  V(2,7)
X  -7.5345196798700168e-04          -0.00075345  V(3,7)
X  -7.9073549000040579e-04          -0.00079074  V(4,7)
X   1.1068054905986301e-03           0.00110681  V(5,7)
X   1.5596012423481543e-04           0.00015596  V(6,7)
X   1.2861607365503146e-03           0.00128616  V(7,7)
X  -2.4275726696645420e-04          -0.00024276  V(8,7)
X  -2.1820501843315037e-03          -0.00218205  V(1,8)
X   1.7266330310185170e-03           0.00172663  V(2,8)
X   8.0829924725463100e-04           0.00080830  V(3,8)
X   2.7549163930955017e-04           0.00027549  V(4,8)
X  -1.1537431859081695e-03          -0.00115374  V(5,8)
X   4.9917336716968821e-04           0.00049917  V(6,8)
X  -2.4275726696645420e-04          -0.00024276  V(7,8)
X   3.6531993871197693e-04           0.00036532  V(8,8)
X   9.3314343702778457e-12           0.00000000  D(1)
X  -1.2485675041084458e-11          -0.00000000  D(2)
X  -2.0676873765543460e-12          -0.00000000  D(3)
X  -8.4392941637436807e-13          -0.00000000  D(4)
X   2.0601238938236186e-12           0.00000000  D(5)
X  -3.1850308776643680e-12          -0.00000000  D(6)
X  -2.0794232789221131e-13          -0.00000000  D(7)
X  -1.1490558838804978e-12          -0.00000000  D(8)
X   4.4685695288311541e+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 'ch5eg1/model.cc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ch5eg1/model.cc'\"
else
echo shar: Extracting \"'ch5eg1/model.cc'\" \(8301 characters\)
sed "s/^X//" >'ch5eg1/model.cc' <<'END_OF_FILE'
X#include "model.h"
X
Xmodel::model() { }
X
Xmodel::~model() { }
X
X
Xrealmat model::e(INTEGER t)
X{
X  realmat err(2,1);
X
X  REAL peak, inter, base;
X  REAL t1, t2, t3, t4, t5, t6, t7, t8;
X  REAL r1, r2, r3;
X  REAL x1, x2, x3;
X  REAL y1, y2, y3;
X
X  t1 = s.theta[1];
X  t2 = s.theta[2];
X  t3 = s.theta[3];
X  t4 = s.theta[4];
X  t5 = s.theta[5];
X  t6 = s.theta[6];
X  t7 = s.theta[7];
X  t8 = s.theta[8];
X  
X  y1 = data.elem(1,t);
X  y2 = data.elem(2,t);
X  y3 = data.elem(3,t);
X
X  r1 = data.elem(4,t);
X  r2 = data.elem(5,t);
X  r3 = data.elem(6,t);
X
X  x1 = r1 - y3;
X  x2 = r2 - y3;
X  x3 = r3 - y3;
X
X  peak  = t1 + t2*x1 + t3*x2 + t4*x3;  
X  inter = t5 + t3*x1 + t6*x2 + t7*x3;
X  base  = -1 + t4*x1 + t7*x2 + t8*x3;
X
X  err[1] = y1 - log(peak/base);
X  err[2] = y2 - log(inter/base);
X
X  return err;
X}
X
Xrealmat model::dele(INTEGER t) 
X{
X  realmat delerr(2,8);
X
X  REAL peak, inter, base;
X  REAL t1, t2, t3, t4, t5, t6, t7, t8;
X  REAL r1, r2, r3;
X  REAL x1, x2, x3;
X  REAL y1, y2, y3;
X
X  t1 = s.theta[1];
X  t2 = s.theta[2];
X  t3 = s.theta[3];
X  t4 = s.theta[4];
X  t5 = s.theta[5];
X  t6 = s.theta[6];
X  t7 = s.theta[7];
X  t8 = s.theta[8];
X
X  y1 = data.elem(1,t);
X  y2 = data.elem(2,t);
X  y3 = data.elem(3,t);
X
X  r1 = data.elem(4,t);
X  r2 = data.elem(5,t);
X  r3 = data.elem(6,t);
X
X  x1 = r1 - y3;
X  x2 = r2 - y3;
X  x3 = r3 - y3;
X
X  peak  = t1 + t2*x1 + t3*x2 + t4*x3;  
X  inter = t5 + t3*x1 + t6*x2 + t7*x3;
X  base  = -1 + t4*x1 + t7*x2 + t8*x3;
X
X//err[1] = y1 - log(peak/base);
X//err[2] = y2 - log(inter/base);
X
X
X  delerr.elem(1,1) = -    (1.0/peak);  
X  delerr.elem(1,2) = - (1.0/peak)*x1;  
X  delerr.elem(1,3) = - (1.0/peak)*x2;
X  delerr.elem(1,4) = - (1.0/peak)*x3   + (1.0/base)*x1;  
X  delerr.elem(1,5) =               0;
X  delerr.elem(1,6) =               0;  
X  delerr.elem(1,7) =                     (1.0/base)*x2;
X  delerr.elem(1,8) =                     (1.0/base)*x3;
X
X  delerr.elem(2,1) =                0;  
X  delerr.elem(2,2) =                0;  
X  delerr.elem(2,3) = - (1.0/inter)*x1;
X  delerr.elem(2,4) =                     (1.0/base)*x1;  
X  delerr.elem(2,5) = -    (1.0/inter);
X  delerr.elem(2,6) = - (1.0/inter)*x2;  
X  delerr.elem(2,7) = - (1.0/inter)*x3  + (1.0/base)*x2;
X  delerr.elem(2,8) =                     (1.0/base)*x3;
X
X  return delerr;
X
X}
X
X
Xint model::initialize()
X{
X  if (s.p != 8 || s.M != 2) {cerr << "Error, model::initialize.\n"; exit(1);}
X
X#ifdef GNU_GPP_COMPILER
X
X#ifdef USE_ATT_STYLE_IO_WITH_GNU
X
X  filebuf electa_buf;
X  if( electa_buf.open("electa.dat", input) == 0 ){
X    cerr << "Error, model::model, Cannot open electa.dat\n";
X    exit(1);
X  }
X  istream electa(&electa_buf);
X
X
X  filebuf electc1_buf;
X  if( electc1_buf.open("electc1.dat", input) == 0 ){
X    cerr << "Error, model::model, Cannot open electc1.dat\n";
X    exit(1);
X  }
X  istream electc1(&electc1_buf);
X
X  filebuf electc2_buf;
X  if( electc2_buf.open("electc2.dat", input) == 0 ){
X    cerr << "Error, model::model, Cannot open electc2.dat\n";
X    exit(1);
X  }
X  istream electc2(&electc2_buf);
X
X#endif
X
X#ifdef USE_GNU_STYLE_IO_WITH_GNU
X
X  istream electa("electa.dat",io_readonly,a_useonly);
X  if (!electa) {
X    cerr << "Error, model::model, Cannot open electa.dat\n";
X    exit(1);
X  }
X
X  istream electc1("electc1.dat",io_readonly,a_useonly);
X  if (!electc1) {
X    cerr << "Error, model::model, Cannot open electc1.dat\n";
X    exit(1);
X  }
X
X  istream electc2("electc2.dat",io_readonly,a_useonly);
X  if (!electc2) {
X    cerr << "Error, model::model, Cannot open electc2.dat\n";
X    exit(1);
X  }
X
X#endif
X
X#endif
X
X#ifdef TURBO_CPP_COMPILER
X
X  ifstream electa("electa.dat");
X  if (!electa) {
X    cerr << "Error, model::model, Cannot open electa.dat\n";
X    exit(1);
X  }
X
X  ifstream electc1("electc1.dat");
X  if (!electc1) {
X    cerr << "Error, model::model, Cannot open electc1.dat\n";
X    exit(1);
X  }
X
X  ifstream electc2("electc2.dat");
X  if (!electc2) {
X    cerr << "Error, model::model, Cannot open electc2.dat\n";
X    exit(1);
X  }
X#endif
X
X  double t1, treat, base, inter, peak, expend;
X  double t2, famsize, income, sqfeet, heatlos, range, wash, dry, cac, wac;
X  double t3, single, duplex, mobile, hwh, frez, ref;
X
X  data.resize(20,224);
X
X  int missing;
X
X  s.n = 224;
X
X  for (INTEGER t=1; t<=224; t++) {
X
X    missing = 0;
X
X    electa >>  t1;
X    electa >>  treat;
X    electa >>  base;
X    electa >>  inter;
X    electa >>  peak;
X    electa >>  expend;
X
X    electc1 >> t2;
X    electc1 >> famsize; if(famsize == -9999.) missing = 1;  //used for d8 d10
X    electc1 >> income;  if(income == -9999.) missing = 1;   //used for d0
X    electc1 >> sqfeet;  if(sqfeet == -9999.) missing = 1;   //used for d3
X    electc1 >> heatlos; if(heatlos == -9999.) missing = 1;  //used for d6
X    electc1 >> range;   if(range == -9999.) missing = 1;    //used for d13
X    electc1 >> wash;    if(wash == -9999.) missing = 1;     //used for d9
X    electc1 >> dry;     if(dry == -9999.) missing = 1;      //used for d10
X    electc1 >> cac;     if(cac == -9999.) missing = 1;      //used for d6
X    electc1 >> wac;     if(wac == -9999.) missing = 1;      //used for d7
X
X    electc2 >> t3;
X    electc2 >> single; // if(single == -9999.) missing = 1; //not used
X    electc2 >> duplex;  if(duplex == -9999.) missing = 1;   //used for d4
X    electc2 >> mobile;  if(mobile == -9999.) missing = 1;   //used for d5
X    electc2 >> hwh;     if(hwh == -9999.) missing = 1;      //used for d8 d9
X    electc2 >> frez;    if(frez == -9999.) missing = 1;     //used for d12
X    electc2 >> ref;     if(ref == -9999.) missing = 1;      //used for d11
X   
X    if (t1 != t2 || t1 != t3) {
X       cerr << "Error, model::initialize, t, t1, t2, t3 = " 
X            << t << "  " << t1 << "  " << t2 << "  " << t3 << ".\n"; 
X       exit(1);
X     }
X
X    double p1, p2, p3;
X
X    p1 = p2 = p3 = 0;
X
X    if (treat == 1) {  p1=3.90; p2=2.86; p3=1.06; }
X    if (treat == 2) {  p1=3.90; p2=2.86; p3=1.78; }
X    if (treat == 3) {  p1=3.90; p2=3.90; p3=1.06; }
X    if (treat == 4) {  p1=3.90; p2=3.90; p3=1.78; }
X    if (treat == 5) {  p1=5.06; p2=3.34; p3=1.37; }
X    if (treat == 6) {  p1=6.56; p2=2.86; p3=1.06; }
X    if (treat == 7) {  p1=6.56; p2=2.86; p3=1.78; }
X    if (treat == 8) {  p1=6.56; p2=3.90; p3=1.06; }
X    if (treat == 9) {  p1=6.56; p2=3.90; p3=1.78; }
X
X
X    double y1  = log(peak/base);
X    double y2  = log(inter/base);
X    double y3  = log(expend);
X
X    double r1  = log(p1);
X    double r2  = log(p2);
X    double r3  = log(p3);
X
X    double d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13;
X
X    if (missing) {
X      cout << "Missing observation at t = " << t << ".\n";
X      d0= d1= d2= d3= d4= d5= d6= d7= d8= d9= d10= d11= d12= d13= -9999.;
X    }
X    else {
X      d0  = 1;
X      d1  = log(10*p1+6*p2+8*p3);
X      d2  = log(income);
X      d3  = log(sqfeet);
X      d4  = duplex;
X      d5  = mobile;
X      d6  = cac*log(heatlos);
X      d7  = 0; if (wac>0) d7=log(wac);
X      d8  = 0; if (hwh>0) d8=log(famsize+1);
X      d9  = 0; if (hwh>0 && wash>0) d9=1;
X      d10 = 0; if (dry>0) d10=log(famsize+1);
X      d11 = 0; if (ref>0) d11=log(ref);
X      d12 = 0; if (frez>0) d12=log(frez);
X      d13 = range;
X    }
X
X    if (strcmp(s.method,"SUR") == 0  || !missing ) {
X      data.elem(1,t)  = (REAL)y1;
X      data.elem(2,t)  = (REAL)y2;
X      data.elem(3,t)  = (REAL)y3;
X      data.elem(4,t)  = (REAL)r1;
X      data.elem(5,t)  = (REAL)r2;
X      data.elem(6,t)  = (REAL)r3;
X      data.elem(7,t)  = (REAL)d0;
X      data.elem(8,t)  = (REAL)d1;
X      data.elem(9,t)  = (REAL)d2;
X      data.elem(10,t) = (REAL)d3;
X      data.elem(11,t) = (REAL)d4;
X      data.elem(12,t) = (REAL)d5;
X      data.elem(13,t) = (REAL)d6;
X      data.elem(14,t) = (REAL)d7;
X      data.elem(15,t) = (REAL)d8;
X      data.elem(16,t) = (REAL)d9;
X      data.elem(17,t) = (REAL)d10;
X      data.elem(18,t) = (REAL)d11;
X      data.elem(19,t) = (REAL)d12;
X      data.elem(20,t) = (REAL)d13;
X    }
X    else {
X      s.n--;
X    }
X  }
X
X  s.starting="tmp.dat";
X   s.to(s.starting);
X
X//  if (strcmp(s.detail,"full") == 0) cout << starbox("/data//_") << data;
X                
X  return 1;
X}
X
Xrealmat model::Z(INTEGER t)
X{
X  INTEGER i;
X
X  realmat z(s.K,1);
X
X  if (s.K < 4 || s.K > 17) {cerr << "Error, model::Z.\n"; exit(1);}
X    
X  
X  for (i = 1; i<=3;   i++)    z[i] = data.elem(i+3,t); 
X  for (i = 4; i<=s.K; i++)    z[i] = data.elem(i+3,t); 
X
X  return z;
X}
X
Xint model::terminate() { return 0; }
END_OF_FILE
if test 8301 -ne `wc -c <'ch5eg1/model.cc'`; then
    echo shar: \"'ch5eg1/model.cc'\" unpacked with wrong size!
fi
# end of 'ch5eg1/model.cc'
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.1627163465976280e+00          -2.16271635  theta(1)
X  -1.9719333385540063e+00          -1.97193334  theta(2)
X   7.2133896425246880e-01           0.72133896  theta(3)
X   3.3946743442262073e-01           0.33946743  theta(4)
X  -1.4205927265454195e+00          -1.42059273  theta(5)
X  -1.1310765240151173e+00          -1.13107652  theta(6)
X   2.8650535801919872e-02           0.02865054  theta(7)
X  -4.9669858671832290e-01          -0.49669859  theta(8)
X   1.7471080012601045e-01           0.17471080  var(1,1)
X   9.7416409013539040e-02           0.09741641  var(2,1)
X   9.7416409013539040e-02           0.09741641  var(1,2)
X   9.3835143890742337e-02           0.09383514  var(2,2)
X   3.9207278825954106e-01           0.39207279  V(1,1)
X  -4.6895087597028740e-01          -0.46895088  V(2,1)
X  -8.5411613500522870e-02          -0.08541161  V(3,1)
X  -1.9928186434099552e-02          -0.01992819  V(4,1)
X   8.5186086103806249e-02           0.08518609  V(5,1)
X  -9.4749539822049977e-02          -0.09474954  V(6,1)
X  -1.5976962406085118e-02          -0.01597696  V(7,1)
X  -2.6195340381881684e-02          -0.02619534  V(8,1)
X  -4.6895087597028740e-01          -0.46895088  V(1,2)
X   6.4848746277629477e-01           0.64848746  V(2,2)
X   1.0730087015326220e-01           0.10730087  V(3,2)
X   3.2223256416946261e-02           0.03222326  V(4,2)
X  -9.5307061453311206e-02          -0.09530706  V(5,2)
X   1.4515150729126394e-01           0.14515151  V(6,2)
X   2.1823922108669281e-02           0.02182392  V(7,2)
X   3.5310785315526366e-02           0.03531079  V(8,2)
X  -8.5411613500522870e-02          -0.08541161  V(1,3)
X   1.0730087015326220e-01           0.10730087  V(2,3)
X   2.6526143978408870e-02           0.02652614  V(3,3)
X   6.4841093413020414e-03           0.00648411  V(4,3)
X  -2.4149369252105864e-02          -0.02414937  V(5,3)
X   2.0665954715565073e-02           0.02066595  V(6,3)
X   2.3014157391522340e-03           0.00230142  V(7,3)
X   6.8516462305834242e-03           0.00685165  V(8,3)
X  -1.9928186434099552e-02          -0.01992819  V(1,4)
X   3.2223256416946261e-02           0.03222326  V(2,4)
X   6.4841093413020414e-03           0.00648411  V(3,4)
X   2.7482583229696041e-03           0.00274826  V(4,4)
X  -5.4896042141287871e-03          -0.00548960  V(5,4)
X   8.2126039991065151e-03           0.00821260  V(6,4)
X   4.6789323069801341e-05           0.00004679  V(7,4)
X   2.1260150724464084e-03           0.00212602  V(8,4)
X   8.5186086103806249e-02           0.08518609  V(1,5)
X  -9.5307061453311206e-02          -0.09530706  V(2,5)
X  -2.4149369252105864e-02          -0.02414937  V(3,5)
X  -5.4896042141287871e-03          -0.00548960  V(4,5)
X   2.5451085554286469e-02           0.02545109  V(5,5)
X  -1.8513595612848092e-02          -0.01851360  V(6,5)
X  -1.4375957890917096e-03          -0.00143760  V(7,5)
X  -6.5842366056490546e-03          -0.00658424  V(8,5)
X  -9.4749539822049977e-02          -0.09474954  V(1,6)
X   1.4515150729126394e-01           0.14515151  V(2,6)
X   2.0665954715565073e-02           0.02066595  V(3,6)
X   8.2126039991065151e-03           0.00821260  V(4,6)
X  -1.8513595612848092e-02          -0.01851360  V(5,6)
X   3.7590575527953057e-02           0.03759058  V(6,6)
X   4.3233488655844959e-03           0.00432335  V(7,6)
X   8.1702192296114542e-03           0.00817022  V(8,6)
X  -1.5976962406085118e-02          -0.01597696  V(1,7)
X   2.1823922108669281e-02           0.02182392  V(2,7)
X   2.3014157391522340e-03           0.00230142  V(3,7)
X   4.6789323069801341e-05           0.00004679  V(4,7)
X  -1.4375957890917096e-03          -0.00143760  V(5,7)
X   4.3233488655844959e-03           0.00432335  V(6,7)
X   2.1280285080019076e-03           0.00212803  V(7,7)
X   7.7962377166959098e-04           0.00077962  V(8,7)
X  -2.6195340381881684e-02          -0.02619534  V(1,8)
X   3.5310785315526366e-02           0.03531079  V(2,8)
X   6.8516462305834242e-03           0.00685165  V(3,8)
X   2.1260150724464084e-03           0.00212602  V(4,8)
X  -6.5842366056490546e-03          -0.00658424  V(5,8)
X   8.1702192296114542e-03           0.00817022  V(6,8)
X   7.7962377166959098e-04           0.00077962  V(7,8)
X   2.3635970633391831e-03           0.00236360  V(8,8)
X   3.7457531470233918e-07           0.00000037  D(1)
X  -5.4805306223851239e-07          -0.00000055  D(2)
X  -1.0306669177750563e-07          -0.00000010  D(3)
X  -3.2099108320353118e-08          -0.00000003  D(4)
X   9.1517328320860961e-08           0.00000009  D(5)
X  -1.3245443682856365e-07          -0.00000013  D(6)
X  -1.8457669873125952e-08          -0.00000002  D(7)
X  -3.7681085847915174e-08          -0.00000004  D(8)
X   3.7302539631324159e+01          37.30253963  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/detail.bak' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ch6eg2/detail.bak'\"
else
echo shar: Extracting \"'ch6eg2/detail.bak'\" \(6964 characters\)
sed "s/^X//" >'ch6eg2/detail.bak' <<'END_OF_FILE'
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     homoskedastic      Code homoskedastic or heteroskedastic.
X     0                  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.0582168346665826e-01           0.40582168  var(1,1)
X   4.0643410965960231e-01           0.40643411  var(2,1)
X   3.9873658267692480e-01           0.39873658  var(3,1)
X   4.0643410965960231e-01           0.40643411  var(1,2)
X   4.0705487414860658e-01           0.40705487  var(2,2)
X   3.9936326231932223e-01           0.39936326  var(3,2)
X   3.9873658267692480e-01           0.39873658  var(1,3)
X   3.9936326231932223e-01           0.39936326  var(2,3)
X   3.9272327136336027e-01           0.39272327  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.2467135787066870e+00           1.24671358  obj
X  -1.8474288819635265e-01          -0.18474289  D(1)
X  -6.7258036762946278e-04          -0.00067258  D(2)
XStep length = 1 
X
Xtheta_loop 1
X  -1.0335946266295388e+00          -1.03359463  theta(1)
X   9.9825655410124869e-01           0.99825655  theta(2)
X   1.0569217932960528e+00           1.05692179  obj
X   7.2887425999781236e-05           0.00007289  D(1)
X  -8.3045884673608490e-07          -0.00000083  D(2)
XStep length = 1 
X
Xtheta_loop 2
X  -1.0335217392035390e+00          -1.03352174  theta(1)
X   9.9825572364240200e-01           0.99825572  theta(2)
X   1.0569217148505041e+00           1.05692171  obj
X  -9.1931859179544446e-08          -0.00000009  D(1)
X   1.8525999753608607e-10           0.00000000  D(2)
XTolerence check passed.
X
X
X     **********************************************************************
X     *                                                                    *
X     *                               theta                                *
X     *                                                                    *
X     **********************************************************************
X 
X 
X                                           Col  1
X 
X                               Row  1    -1.03352
X                               Row  2    0.998256
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.405822    0.406434    0.398737
X                   Row  2    0.406434    0.407055    0.399363
X                   Row  3    0.398737    0.399363    0.392723
X
X
X
X     **********************************************************************
X     *                                                                    *
X     *                                 V                                  *
X     *                             (rank = 2)                             *
X     *                                                                    *
X     **********************************************************************
X 
X 
X                                     Col  1      Col  2
X 
X                         Row  1     3.58009 -0.00721268
X                         Row  2 -0.00721268   2.060e-05
X
END_OF_FILE
if test 6964 -ne `wc -c <'ch6eg2/detail.bak'`; then
    echo shar: \"'ch6eg2/detail.bak'\" unpacked with wrong size!
fi
# end of 'ch6eg2/detail.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'\" \(6661 characters\)
sed "s/^X//" >'ch6eg2/detail3l.bak' <<'END_OF_FILE'
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 6661 -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 'realmat.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'realmat.h'\"
else
echo shar: Extracting \"'realmat.h'\" \(7957 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 defined.  T(X) transposes X.  X.check1(i) 
Xand X.check2(i,j) access the elements of vex(X) and X respectively with range 
Xchecking.  invpsd(X) or invpsd(X,eps) returns a g-inverse of a positive semi-
Xdefinite, symmetric matrix X with minimal error checking; eps is the tolerance 
Xused in rank determination and defaults to 1.e-13.  rows(X) returns X.rows and 
Xcols(X) returns X.cols.
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  INTEGER       rows;
X  INTEGER       cols;
X  INTEGER       len;
X  REAL          *x;
X                realmat(INTEGER r, INTEGER c, REAL* a);
Xvoid            realmat_constructor(INTEGER r, INTEGER c, REAL fill_value);
Xvoid            resize_constructor(INTEGER r, INTEGER c, REAL fill_value);
X
Xpublic:
X                realmat();
X
X                realmat(INTEGER r, INTEGER c);
X                realmat(INTEGER r, INTEGER c, REAL fill_value);
X                realmat(INTEGER r, INTEGER c, int fill_value);
X
X                realmat(int r, int c);
X                realmat(int r, int c, REAL fill_value);
X                realmat(int r, int c, int fill_value);
X
X                realmat(INTEGER r, int c);
X                realmat(INTEGER r, int c, REAL fill_value);
X                realmat(INTEGER r, int c, int fill_value);
X
X                realmat(int r, INTEGER c);
X                realmat(int r, INTEGER c, REAL fill_value);
X                realmat(int r, INTEGER c, int 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);
Xvoid            resize(INTEGER r, INTEGER c, int fill_value);
X
Xvoid            resize(int r, int c);
Xvoid            resize(int r, int c, REAL fill_value);
Xvoid            resize(int r, int c, int fill_value);
X
Xvoid            resize(INTEGER r, int c);
Xvoid            resize(INTEGER r, int c, REAL fill_value);
Xvoid            resize(INTEGER r, int c, int fill_value);
X
Xvoid            resize(int r, INTEGER c);
Xvoid            resize(int r, INTEGER c, REAL fill_value);
Xvoid            resize(int r, INTEGER c, int fill_value);
X
Xrealmat&        operator=(realmat& a);
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 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
Xinline REAL& realmat::operator[](INTEGER i)
X{
X  return x[i-1];
X}
X
Xinline REAL& realmat::elem(INTEGER i, INTEGER j)
X{
X  return x[i + rows*j - rows - 1];  //  return x[rows*(j-1)+i-1]
X}
X
Xinline INTEGER rows(realmat& a)
X{
X  return a.rows;
X}
X
Xinline INTEGER cols(realmat& a)
X{
X  return a.cols;
X}
X
Xinline realmat::realmat()
X{ rows=0; cols=0; len=0; x=0;}
X
Xinline realmat::realmat(INTEGER r, INTEGER c)
X  {realmat_constructor(r, c, (REAL) 0);}
X
Xinline realmat::realmat(INTEGER r, INTEGER c, REAL fill_value)
X  {realmat_constructor(r, c, fill_value);}
X
Xinline realmat::realmat(INTEGER r, INTEGER c, int fill_value)
X  {realmat_constructor(r, c, (REAL) fill_value);}
X
Xinline realmat::realmat(int r, int c)
X  {realmat_constructor((INTEGER) r, (INTEGER) c, (REAL) 0);}
X
Xinline realmat::realmat(int r, int c, REAL fill_value)
X  {realmat_constructor((INTEGER) r, (INTEGER) c, fill_value);}
X
Xinline realmat::realmat(int r, int c, int fill_value)
X  {realmat_constructor((INTEGER) r, (INTEGER) c, (REAL) fill_value);}
X
Xinline realmat::realmat(INTEGER r, int c)
X  {realmat_constructor(r, (INTEGER) c, (REAL) 0);}
X
Xinline realmat::realmat(INTEGER r, int c, REAL fill_value)
X  {realmat_constructor(r, (INTEGER) c, fill_value);}
X
Xinline realmat::realmat(INTEGER r, int c, int fill_value)
X  {realmat_constructor(r, (INTEGER) c, (REAL) fill_value);}
X
Xinline realmat::realmat(int r, INTEGER c)
X  {realmat_constructor((INTEGER) r, c, (REAL) 0);}
X
Xinline realmat::realmat(int r, INTEGER c, REAL fill_value)
X  {realmat_constructor((INTEGER) r, c, fill_value);}
X
Xinline realmat::realmat(int r, INTEGER c, int fill_value)
X  {realmat_constructor((INTEGER) r, c, (REAL) fill_value);}
X
Xinline realmat::~realmat()
X{delete x;} 
X
Xinline void realmat::resize(INTEGER r, INTEGER c)
X  {resize_constructor(r, c, (REAL) 0);}
X
Xinline void realmat::resize(INTEGER r, INTEGER c, REAL fill_value)
X  {resize_constructor(r, c, fill_value);}
X
Xinline void realmat::resize(INTEGER r, INTEGER c, int fill_value)
X  {resize_constructor(r, c, (REAL) fill_value);}
X
Xinline void realmat::resize(int r, int c)
X  {resize_constructor((INTEGER) r, (INTEGER) c, (REAL) 0);}
X
Xinline void realmat::resize(int r, int c, REAL fill_value)
X  {resize_constructor((INTEGER) r, (INTEGER) c, fill_value);}
X
Xinline void realmat::resize(int r, int c, int fill_value)
X  {resize_constructor((INTEGER) r, (INTEGER) c, (REAL) fill_value);}
X
Xinline void realmat::resize(INTEGER r, int c)
X  {resize_constructor(r, (INTEGER) c, (REAL) 0);}
X
Xinline void realmat::resize(INTEGER r, int c, REAL fill_value)
X  {resize_constructor(r, (INTEGER) c, fill_value);}
X
Xinline void realmat::resize(INTEGER r, int c, int fill_value)
X  {resize_constructor(r, (INTEGER) c, (REAL) fill_value);}
X
Xinline void realmat::resize(int r, INTEGER c)
X  {resize_constructor((INTEGER) r, c, (REAL) 0);}
X
Xinline void realmat::resize(int r, INTEGER c, REAL fill_value)
X  {resize_constructor((INTEGER) r, c, fill_value);}
X
Xinline void realmat::resize(int r, INTEGER c, int fill_value)
X  {resize_constructor((INTEGER) r, c, (REAL) fill_value);}
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 7957 -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



More information about the Alt.sources mailing list