home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2401 / status.cc
C/C++ Source or Header  |  1990-12-28  |  17KB  |  645 lines

  1. /* ----------------------------------------------------------------------------
  2.  
  3. nlmdl: status.cc
  4.  
  5. nlmdl is a C++ implementation of the statistical methods in A. Ronald 
  6. Gallant, "Nonlinear Statistical Models," New York: John Wiley and Sons, 
  7. 1987, ISBN 0-471-80260-3, using a matrix class realmat that is distributed 
  8. with it.  The header files nlmdl.h and realmat.h describe the use of the 
  9. program and matrix class, respectively.  
  10.  
  11. Copyright (C) 1990.
  12.  
  13. A. Ronald Gallant
  14. P.O. Box 5513 
  15. Raleigh NC 27650-5513 
  16. USA   
  17.  
  18. Permission to use, copy, modify, and distribute this software and its 
  19. documentation for any purpose and without fee is hereby granted, provided 
  20. that the above copyright notice appear in all copies and that both that 
  21. copyright notice and this permission notice appear in supporting 
  22. documentation.  
  23.  
  24. This software is provided "as is" without any expressed or implied warranty.
  25.  
  26. ---------------------------------------------------------------------------- */
  27. /* status is a class used by nlmdl */
  28.  
  29. #include "status.h"
  30.  
  31. status::status()
  32. {
  33.   switches[0]='\0';
  34.   method[0]='\0';
  35.   n=0;
  36.   M=0;
  37.   K=0;
  38.   p=0;
  39.   itheta=0;
  40.   ivar=0;
  41.   vartype[0]='\0';
  42.   MA=0;
  43.   weights[0]='\0';
  44.   tol=0;
  45.   eps=0;
  46.   detail[0]='\0';
  47.   rank=0;
  48.   df[0]='\0';
  49.   obj=0;
  50.   starting=STARTING_FILENAME;
  51.   ending=ENDING_FILENAME;
  52. }
  53.  
  54. status::~status() { }
  55.  
  56.  
  57. int status::from(char* filename)
  58. {
  59.  
  60. #ifdef GNU_GPP_COMPILER
  61.  
  62. #ifdef USE_ATT_STYLE_IO_WITH_GNU
  63.   filebuf ib;
  64.   if( ib.open(filename, input) == 0 ){
  65.     cerr << "Error, status::from, Cannot open " << filename << "\n";
  66.     exit(1);
  67.   }
  68.   istream ifrom(&ib);
  69. #endif
  70.  
  71. #ifdef USE_GNU_STYLE_IO_WITH_GNU
  72.   istream ifrom(filename,io_readonly,a_useonly);
  73.   if ( !ifrom ) {
  74.     cerr << "Error, status::from, Cannot open " << filename << "\n";
  75.     exit(1);
  76.   } 
  77. #endif
  78.  
  79. #endif 
  80.  
  81. #ifdef TURBO_CPP_COMPILER
  82.   ifstream ifrom(filename);
  83.   if ( !ifrom ) {
  84.     cerr << "Error, status::from, Cannot open " << filename << "\n";
  85.     exit(1);
  86.   } 
  87. #endif 
  88.  
  89.   char     junk[MAX_STATUS_LINE];
  90.   char     newline;
  91.   INTEGER  i,len;
  92.   double   x = 0;
  93.   
  94.   if (!ifrom.get(switches,MAX_STATUS_LINE,'\n')) {
  95.     cerr << "Error, status::from, Bad data (switches) in " << filename << "\n";
  96.     exit(1);
  97.   }
  98.  
  99.   if (!(ifrom>>method)) return 0;
  100.   if ( strcmp(method,"SUR") != 0 
  101.       && strcmp(method,"TSLS") != 0 
  102.       && strcmp(method,"GMM") != 0 ) {
  103.     cerr << "Error, status::from, Bad data (method) in " << filename << "\n";
  104.     exit(1);
  105.   }
  106.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  107.  
  108.   if (!(ifrom>>n)) return 0;
  109.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  110.  
  111.   if (!(ifrom>>M)) return 0;
  112.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  113.  
  114.   if (!(ifrom>>K)) return 0;
  115.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  116.  
  117.   if (!(ifrom>>p)) return 0;
  118.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  119.  
  120.   if (!(ifrom>>itheta)) return 0;
  121.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  122.  
  123.   if (!(ifrom>>ivar)) return 0;
  124.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  125.  
  126.   if (!(ifrom>>vartype)) return 0;
  127.   if ( strcmp(vartype,"homoskedastic") != 0 
  128.        && strcmp(vartype,"heteroskedastic") != 0 ) {
  129.     cerr << "Error, status::from, Bad data (vartype) in " << filename << "\n";
  130.     exit(1);
  131.   }
  132.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  133.  
  134.   if (!(ifrom>>MA)) return 0;
  135.   if ( MA<0 || MA>=n ) {
  136.     cerr << "Error, status::from, Bad data (MA) in " << filename << "\n";
  137.     exit(1);
  138.   }
  139.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  140.  
  141.   if (!(ifrom>>weights)) return 0;
  142.   if ( strcmp(weights,"none") != 0 && strcmp(weights,"Parzen") != 0 ) {
  143.     cerr << "Error, status::from, Bad data (weights) in " << filename << "\n";
  144.     exit(1);
  145.   }
  146.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  147.  
  148.   if (!(ifrom>>x)) 
  149.     return 0;  
  150.   else 
  151.     tol = (REAL)x;
  152.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  153.  
  154.   if (!(ifrom>>x)) 
  155.     return 0;
  156.   else
  157.     eps = (REAL)x;
  158.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  159.  
  160.   if (!(ifrom>>detail)) return 0;
  161.   if ( strcmp(detail,"none") != 0 
  162.        && strcmp(detail,"minimal") != 0 
  163.        && strcmp(detail,"full") != 0 ) {
  164.     cerr << "Error, status::from, Bad data (detail) in " << filename << "\n";
  165.     exit(1);
  166.   }
  167.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  168.  
  169.   if (!ifrom.get(newline)) return 0;
  170.  
  171.   for (i=1; i<=5; i++) {
  172.     if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  173.     if (!ifrom.get(newline)) return 0;
  174.   }
  175.  
  176. #ifdef GNU_GPP_COMPILER
  177.   if (!(ifrom>>x)) return 0;
  178.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) {
  179.     cerr << "Error, status::from, Bad data (theta) in " << filename << "\n";
  180.     exit(1);
  181.   }
  182. #endif 
  183.  
  184. #ifdef TURBO_CPP_COMPILER     
  185.   float y;    //This nonsense is because Turbo can't read a null line into 
  186.   x=0;        //a float.  Precision is lost.  I should find a better way.
  187.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  188.   if (sscanf(junk, "%e", &x) <= 0) return 0;
  189.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) {
  190.     cerr << "Error, status::from, Bad data (theta) in " << filename << "\n";
  191.     exit(1);
  192.   }
  193.   x = (double)y;
  194. #endif 
  195.  
  196.   theta.resize(p,(INTEGER)1,0);
  197.   theta[1] = (REAL)x;
  198.   
  199.   if (p==1) return 0;
  200.   for (i=2; i<=p; i++) {
  201.     if(!(ifrom>>x)) {
  202.       cerr << "Error, status::from, Bad data (theta) in " << filename << "\n";
  203.       exit(1);
  204.     }
  205.     else {
  206.      theta[i] = (REAL)x;
  207.     }
  208.     if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) {
  209.       cerr << "Error, status::from, Bad data (theta) in " << filename << "\n";
  210.       exit(1);
  211.     }
  212.   }
  213.  
  214.   if (!ifrom.get(newline)) return 0;
  215.  
  216. #ifdef GNU_GPP_COMPILER
  217.   if (!(ifrom>>x)) return 0;
  218.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) {
  219.     cerr << "Error, status::from, Bad data (var) in " << filename << "\n";
  220.     exit(1);
  221.   }
  222. #endif 
  223.  
  224. #ifdef TURBO_CPP_COMPILER
  225.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) return 0;
  226.   if (sscanf(junk, "%e", &x) <= 0) return 0;
  227.   if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) {
  228.     cerr << "Error, status::from, Bad data (var) in " << filename << "\n";
  229.     exit(1);
  230.   }
  231.   x = (double)y;
  232. #endif 
  233.   
  234.   if ( strcmp(method,"SUR") == 0 || strcmp(method,"TSLS") == 0) {
  235.     var.resize(M,M);
  236.     var[1] = (REAL)x;
  237.     if (M==1) return 0;
  238.     for (i=2; i<=M*M; i++) {
  239.       if(!(ifrom>>x)) {
  240.         cerr << "Error, status::from, Bad data (var) in " << filename << "\n";
  241.         exit(1);
  242.       }
  243.       else {
  244.         var[i] = (REAL)x;
  245.       }
  246.       if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) {
  247.         cerr << "Error, status::from, Bad data (var) in " << filename << "\n";
  248.         exit(1);
  249.       }
  250.     }
  251.   }
  252.   else if ( strcmp(method,"GMM") == 0 ) {
  253.     len = M*K;
  254.     var.resize(len,len);
  255.     var[1] = (REAL)x;
  256.     if (len==1) return 0;
  257.     for (i=2; i<=len*len; i++) {
  258.       if(!(ifrom>>x)) {
  259.         cerr << "Error, status::from, Bad data (var) in " << filename << "\n";
  260.         exit(1);
  261.       }
  262.       else {
  263.         var[i] = (REAL)x;
  264.       }
  265.       if (!ifrom.get(junk,MAX_STATUS_LINE,'\n')) {
  266.         cerr << "Error, status::from, Bad data (var) in " << filename << "\n";
  267.         exit(1);
  268.       }
  269.     }
  270.   }
  271.   else {
  272.     cerr << "Error, status::from, Bad data (var) in " << filename << "\n";
  273.     exit(1);
  274.   }
  275.  
  276.   ifrom.close();
  277.   return 0;
  278.  
  279. }
  280.  
  281. int status::to(char* filename)
  282. {
  283.  
  284. #ifdef GNU_GPP_COMPILER
  285.  
  286. #ifdef USE_ATT_STYLE_IO_WITH_GNU
  287.   filebuf ob;
  288.   if( ob.open(filename, output) == 0 ) {
  289.     cerr << "Error, status::to, Cannot open " << filename << "\n";
  290.     exit(1);
  291.   }
  292.   ostream oto(&ob);
  293. #endif
  294.  
  295. #ifdef USE_GNU_STYLE_IO_WITH_GNU
  296.   ostream oto(filename,io_writeonly,a_create);
  297.   if ( !oto ) {
  298.     cerr << "Error, status::to, Cannot open " << filename << "\n";
  299.     exit(1);
  300.   } 
  301. #endif
  302.  
  303. #endif 
  304.  
  305. #ifdef TURBO_CPP_COMPILER
  306.   ofstream oto(filename);
  307.   if ( !oto ) {
  308.     cerr << "Error, status::to, Cannot open " << filename << "\n";
  309.     exit(1);
  310.   } 
  311. #endif 
  312.  
  313.   INTEGER i,j,len;
  314.   char    temp[MAX_STATUS_LINE];
  315.  
  316.   if (strlen(switches) == 0) {
  317.     if (!(oto << "\tThis line is passed to class model as a string.\n")) {
  318.       cerr << "Error, status::to, Error writing to " << filename << "\n";
  319.       exit(1);
  320.     }
  321.   }
  322.   else {
  323.     if (!(oto << switches << "\n")) {
  324.       cerr << "Error, status::to, Error writing to " << filename << "\n";
  325.       exit(1);
  326.     }
  327.   }
  328.  
  329.   sprintf(temp,"%-19s", method);
  330.   if (!(oto<<temp<< "What estimation method?  Code SUR, TSLS, or GMM.\n")) {
  331.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  332.     exit(1);
  333.   }
  334.  
  335.   sprintf(temp,"%-19d", n);
  336.   if (!(oto<<temp<< "Number of observations, t = 1, ..., n.\n")) {
  337.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  338.     exit(1);
  339.   }
  340.  
  341.   sprintf(temp,"%-19d",M);
  342.   if (!(oto<<temp<<"Number of equations, i.e. dimension of e.\n")) {
  343.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  344.     exit(1);
  345.   }
  346.  
  347.   sprintf(temp,"%-19d",K);
  348.   if (!(oto<<temp<<"Number of instruments, i.e. dimension of Z.\n")) {
  349.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  350.     exit(1);
  351.   }
  352.  
  353.   sprintf(temp,"%-19d",p);
  354.   if (!(oto<<temp<< "Number of parameters, i.e. dimension of theta.\n")){
  355.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  356.     exit(1);
  357.   }
  358.  
  359.   sprintf(temp,"%-19d",itheta);
  360.   if (!(oto<<temp<< "Upper limit on Gauss-Newton iterations.\n")) {
  361.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  362.     exit(1);
  363.   }
  364.  
  365.   sprintf(temp,"%-19d",ivar);
  366.   if (!(oto<<temp<< "Number var iterates, ivar=0 means none.\n")) {
  367.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  368.     exit(1);
  369.   }
  370.  
  371.   sprintf(temp,"%-19s",vartype);
  372.   if (!(oto<<temp<< "Code homoskedastic or heteroskedastic.\n")) {
  373.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  374.     exit(1);
  375.   }
  376.   sprintf(temp,"%-19d",MA);
  377.   if (!(oto<<temp<< "Number of moving average terms MA for var estimate.\n")) {
  378.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  379.     exit(1);
  380.   }
  381.  
  382.   sprintf(temp,"%-19s",weights);
  383.   if (!(oto<<temp<<"Code none or Parzen, none when MA>0 is unwise.\n")) {
  384.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  385.     exit(1);
  386.   }
  387.  
  388.   sprintf(temp,"%-19.6e",tol);
  389.   if (!(oto<<temp<< "Convergence tolerance, tol=1.0e-8 is reasonable.\n")) {
  390.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  391.     exit(1);
  392.   }
  393.  
  394.   sprintf(temp,"%-19.6e",eps);
  395.   if (!(oto<<temp<< "Inversion tolerance, eps=1.0e-13 is reasonable\n")) {
  396.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  397.     exit(1);                   
  398.   }
  399.  
  400.   sprintf(temp,"%-19s",detail);
  401.   if (!(oto<<temp<<"How much output?  Code none, minimal, or full.\n")) {
  402.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  403.     exit(1);
  404.   }
  405.  
  406.   sprintf(temp,"%-19d",rank);
  407.   if (!(oto<<temp<< "Computed rank of V.\n")) {
  408.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  409.     exit(1);
  410.   }
  411.  
  412.   sprintf(temp,"%-19s",df);
  413.   if (!(oto<<temp<< "Divisor of var, corrected or uncorrected.\n")) {
  414.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  415.     exit(1);
  416.   }
  417.  
  418.   for (i=3; i<=5; i++) {
  419.     if (!(oto << "                   Blank line.\n")) {
  420.       cerr << "Error, status::to, Error writing to " << filename << "\n";
  421.       exit(1);
  422.     }
  423.   }
  424.  
  425.   if ( rows(theta) <= 0 || cols(theta) <= 0 ){
  426.     cerr << "Error, status::to, theta is not initialized.\n";
  427.     exit(1);
  428.   }
  429.  
  430.   for (i=1; i<=p; i++) {
  431.     sprintf(temp,"%25.16e % 20.8f ",theta[i],theta[i]);
  432.     if(!(oto<<temp<< " theta(" << i << ")\n")) {
  433.       cerr << "Error, status::to, Error writing to " << filename << "\n";
  434.       exit(1);
  435.     }
  436.   }
  437.  
  438.   if ( rows(var) <= 0 || cols(var) <= 0 ){
  439.     cerr << "Warning, status::to, var is not initialized, " << filename
  440.          << " incomplete.\n";
  441.     return 0;
  442.   }
  443.  
  444.   if ( strcmp(method,"SUR") == 0 || strcmp(method,"TSLS") == 0) {
  445.     for (j=1; j<=M; j++) { 
  446.     for (i=1; i<=M; i++) { 
  447.       sprintf(temp,"%25.16e % 20.8f ",var.check2(i,j),var.elem(i,j));
  448.       if(!(oto<<temp<< " var(" << i << "," << j << ")\n")) {
  449.         cerr << "Error, status::to, Error writing to " << filename << "\n";
  450.         exit(1);
  451.       }
  452.     }
  453.     }  
  454.   }
  455.   else {
  456.     len = M*K;
  457.     for (j=1; j<=len; j++) {
  458.     for (i=1; i<=len; i++) {
  459.       sprintf(temp,"%25.16e % 20.8f ",var.check2(i,j),var.elem(i,j));
  460.       if(!(oto<<temp<< " var(" << i << "," << j << ")\n")) {
  461.         cerr << "Error, status::to, Error writing to " << filename << "\n";
  462.         exit(1);
  463.       }
  464.     }
  465.     }
  466.   }
  467.  
  468.   if ( rows(V) <= 0 || cols(V) <= 0 ){
  469.     cerr << "Warning, status::to, V is not initialized, file incomplete.\n";
  470.     return 0;
  471.   }
  472.  
  473.   for (j=1; j<=p; j++) {
  474.   for (i=1; i<=p; i++) {
  475.     sprintf(temp,"%25.16e % 20.8f ",V.check2(i,j),V.elem(i,j));
  476.     if(!(oto<<temp<< " V(" << i << "," << j << ")\n" )) {
  477.       cerr << "Error, status::to, Error writing to " << filename << "\n";
  478.       exit(1);
  479.     }
  480.   }
  481.   }
  482.  
  483.  
  484.   if ( rows(D) <= 0 || cols(D) <= 0 ){
  485.     cerr << "Error, status::to, D is not initialized.\n";
  486.     exit(1);
  487.   }
  488.  
  489.   for (i=1; i<=p; i++) {
  490.     sprintf(temp,"%25.16e % 20.8f ",D[i],D[i]);
  491.     if(!(oto<<temp<< " D(" << i << ")\n")) {
  492.       cerr << "Error, status::to, Error writing to " << filename << "\n";
  493.       exit(1);
  494.     }
  495.   }
  496.  
  497.  
  498.   sprintf(temp,"%25.16e % 20.8f ",obj,obj);
  499.   if (!(oto<<temp<< " obj\n")) {
  500.     cerr << "Error, status::to, Error writing to " << filename << "\n";
  501.     exit(1);
  502.   }
  503.  
  504.   oto.close();
  505.   return 0;
  506.  
  507. }
  508.  
  509. int status::display(display_mode mode)
  510. {
  511.  
  512.   INTEGER i,j,len;
  513.   char    temp[MAX_STATUS_LINE];
  514.   char*   pad = "     ";
  515.  
  516.  
  517.   switch (mode) {
  518.  
  519.   case START_UP:
  520.  
  521.     cout << starbox("/Parameter settings//_") << "\n";
  522.  
  523.     cout<<pad<< switches << "\n";
  524.  
  525.     sprintf(temp,"%-19s", method);
  526.     cout<<pad<<temp<< "What estimation method?  Code SUR, TSLS, or GMM.\n";
  527.  
  528.     sprintf(temp,"%-19d", n);
  529.     cout<<pad<<temp<< "Number of observations, t = 1, ..., n.\n";
  530.  
  531.     sprintf(temp,"%-19d",M);
  532.     cout<<pad<<temp<< "Number of equations, i.e. dimension of e.\n";
  533.  
  534.     sprintf(temp,"%-19d",K);
  535.     cout<<pad<<temp<<"Number of instruments, i.e. dimension of Z.\n";
  536.  
  537.     sprintf(temp,"%-19d",p);
  538.     cout<<pad<<temp<<"Number of parameters, i.e. dimension of theta.\n";
  539.  
  540.     sprintf(temp,"%-19d",itheta);
  541.     cout<<pad<<temp<< "Upper limit on Gauss-Newton iterations.\n";
  542.  
  543.     sprintf(temp,"%-19d",ivar);
  544.     cout<<pad<<temp<< "Number var iterates, ivar=0 means none.\n";
  545.  
  546.     sprintf(temp,"%-19s",vartype);
  547.     cout<<pad<<temp<< "Code homoskedastic or heteroskedastic.\n";
  548.  
  549.     sprintf(temp,"%-19d",MA);
  550.     cout<<pad<<temp<< "Number of moving average terms MA for var estimate.\n";
  551.  
  552.     sprintf(temp,"%-19s",weights);
  553.     cout<<pad<<temp<< "Code none or Parzen, none when MA>0 is unwise.\n";
  554.  
  555.     sprintf(temp,"%-19.6e",tol);
  556.     cout<<pad<<temp<< "Convergence tolerance, tol=1.0e-8 is reasonable.\n";
  557.  
  558.     sprintf(temp,"%-19.6e",eps);
  559.     cout<<pad<<temp<< "Inversion tolerance, eps=1.0e-13 is reasonable\n";
  560.  
  561.     sprintf(temp,"%-19s",detail);
  562.     cout<<pad<<temp<< "How much output?  Code none, minimal, or full.\n";
  563.  
  564.     break;
  565.  
  566.   case VAR_ITERATE:
  567.  
  568.     if ( rows(var) > 0 && cols(var) > 0 ){
  569.       if ( strcmp(method,"SUR") == 0 || strcmp(method,"TSLS") == 0){
  570.         for (j=1; j<=M; j++){ 
  571.         for (i=1; i<=M; i++){ 
  572.           sprintf(temp,"%25.16e % 20.8f ",var.check2(i,j),var.elem(i,j));
  573.           cout<<temp<< " var(" << i << "," << j << ")\n";
  574.         }
  575.         }  
  576.       }
  577.       else{
  578.         len = M*K;
  579.         for (j=1; j<=len; j++){
  580.         for (i=1; i<=len; i++){
  581.           sprintf(temp,"%25.16e % 20.8f ",var.check2(i,j),var.elem(i,j));
  582.           cout<<temp<< " var(" << i << "," << j << ")\n";
  583.         }
  584.         }
  585.       }
  586.     }
  587.     else{
  588.       cout << "Error, status::display, var is not initialized.\n";
  589.     }
  590.  
  591.     break;
  592.  
  593.    case THETA_ITERATE:
  594.  
  595.     if ( rows(theta) > 0 && cols(theta) > 0 ){
  596.       for (i=1; i<=p; i++){
  597.         sprintf(temp,"%25.16e % 20.8f ",theta[i],theta[i]);
  598.         cout<<temp<< " theta(" << i << ")\n";
  599.       }
  600.     }
  601.     else{
  602.       cout << "Error, status::display, theta is not initialized.\n";
  603.     }
  604.  
  605.     sprintf(temp,"%25.16e % 20.8f ",obj,obj);
  606.     cout<<temp<< " obj\n";
  607.  
  608.     if (strcmp(detail,"full")!=0) break;
  609.  
  610.     if ( rows(D) > 0 && cols(D) > 0 ){
  611.       for (i=1; i<=p; i++){
  612.         sprintf(temp,"%25.16e % 20.8f ",D[i],D[i]);
  613.         cout<<temp<< " D(" << i << ")\n";
  614.       }
  615.     }
  616.     else{
  617.       cout << "Error, status::display, D is not initialized.\n";
  618.     }
  619.  
  620.     break;
  621.  
  622.   case TERMINATION:
  623.   
  624.     cout << starbox("/theta//_") << theta << "\n";
  625.  
  626.     if (strcmp(df,"corrected") == 0)
  627.       cout << starbox("/var/(corrected for degrees of freedom)//_");
  628.     else
  629.       cout << starbox("/var/(no degrees of freedom corrections)//_"); 
  630.  
  631.     cout << var << "\n";
  632.  
  633.     sprintf(temp,"/V/(rank = %d)//_",rank);
  634.     cout << starbox(temp) << V << "\n";
  635.  
  636.     break;
  637.  
  638.   }
  639.  
  640.   cout.flush();
  641.  
  642.   return 0;
  643.  
  644. }
  645.