home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume07 / minit.p1 < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  3.6 KB

  1. From decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery Sat Aug  5 22:21:06 PDT 1989
  2. Article 1019 of comp.sources.misc:
  3. Path: decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v07i118: minit linear programming package, Patch 1
  7. Message-ID: <62671@uunet.UU.NET>
  8. Date: 6 Aug 89 02:19:45 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: badri@ee.rochester.edu (Badri Lokanathan )
  11. Lines: 113
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 7, Issue 118
  15. Submitted-by: badri@ee.rochester.edu (Badri Lokanathan )
  16. Archive-name: minit.p1
  17.  
  18. A few bugs were reported in the distribution version of minit.
  19. On checking my archives, I found that the version used in my application
  20. had these fixes, but not the standalone version that I had archived
  21. separately. My apologies, the bug report follows.
  22. ----------------------------------------------------------------------------
  23. Date: Fri, 4 Aug 89 22:43:03 EDT
  24. From: elsie!ado@ncifcrf.gov (Arthur David Olson)
  25. Message-Id: <8908050243.AA18767@elsie>
  26. To: badri@ee.rochester.edu
  27. Subject: minit
  28. Status: ORS
  29.  
  30. Thanks for contributing the linear programming code to comp.sources.misc--
  31. it came along the very day I realized that a particular problem of mine
  32. was amenable to linear programming!
  33.  
  34. In using the code I discovered a few problems; differences are attached.
  35. Three problems:
  36.     1.  When reallocating the "e" array because of an increase in
  37.         "MS", the code failed to remember the old size of the array
  38.         so it would know where to begin when allocating new elements.
  39.     2.  When reallocating the "e" array because of an increase in
  40.         ""S", the code would set
  41.         *tmp = realloc(tmp, ... 
  42.         rather than (correctly) setting
  43.         *tmp = realloc(*tmp, ...
  44.     3.  In code that was supposed to zero out the "x" and "w"
  45.         result arrays, a typo resulted in zeroing out the "x"
  46.         array twice.
  47.  
  48.                 --ado
  49.  
  50. *** 1.1/minit.c    Fri Aug  4 22:36:30 1989
  51. --- 1/minit.c    Fri Aug  4 22:36:31 1989
  52. ***************
  53. *** 155,162 ****
  54. --- 155,163 ----
  55.   
  56.       if(M + 1 > MS)
  57.       {
  58.           /* Need to reallocate space. */
  59. +         i = MS;
  60.           MS = M + 1;
  61.           if(!(jmax = (int *) realloc((char *)jmax,
  62.                   (unsigned)(MS*sizeof(int)))))
  63.               return(0);
  64. ***************
  65. *** 176,184 ****
  66.           if(!(e=(float **) realloc((char *) e,
  67.                   (unsigned)(MS*sizeof(float *)))))
  68.               return(0);
  69.   
  70. !         for(tmp = e + m, i = 0; i < MS; i++)
  71.               if(!(*(tmp++)=(float *)
  72.                       malloc((unsigned)(LS*sizeof(float)))))
  73.                   return(0);
  74.       }
  75. --- 177,185 ----
  76.           if(!(e=(float **) realloc((char *) e,
  77.                   (unsigned)(MS*sizeof(float *)))))
  78.               return(0);
  79.   
  80. !         for(tmp = e + i; i < MS; i++)
  81.               if(!(*(tmp++)=(float *)
  82.                       malloc((unsigned)(LS*sizeof(float)))))
  83.                   return(0);
  84.       }
  85. ***************
  86. *** 198,206 ****
  87.                   (unsigned)(LS*sizeof(float)))))
  88.               return(0);
  89.   
  90.           for(tmp = e, i = 0; i < MS; tmp++, i++)
  91. !             if(!(*tmp=(float *) realloc((char *) tmp,
  92.                       (unsigned)(LS*sizeof(float)))))
  93.                   return(0);
  94.       }
  95.   
  96. --- 199,207 ----
  97.                   (unsigned)(LS*sizeof(float)))))
  98.               return(0);
  99.   
  100.           for(tmp = e, i = 0; i < MS; tmp++, i++)
  101. !             if(!(*tmp=(float *) realloc((char *) *tmp,
  102.                       (unsigned)(LS*sizeof(float)))))
  103.                   return(0);
  104.       }
  105.   
  106. ***************
  107. *** 384,392 ****
  108.       for(i = 0; i < n; i++)
  109.           x[i] = 0.0;
  110.   
  111.       for(j = 0; j < m; j++)
  112. !         x[j] = 0.0;
  113.   
  114.       for(i = 1; i < m + 1; i++)
  115.       {
  116.           if(chk[i] >= n)
  117. --- 385,393 ----
  118.       for(i = 0; i < n; i++)
  119.           x[i] = 0.0;
  120.   
  121.       for(j = 0; j < m; j++)
  122. !         w[j] = 0.0;
  123.   
  124.       for(i = 1; i < m + 1; i++)
  125.       {
  126.           if(chk[i] >= n)
  127.  
  128.  
  129.