home *** CD-ROM | disk | FTP | other *** search
- From decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery Sat Aug 5 22:21:06 PDT 1989
- Article 1019 of comp.sources.misc:
- Path: decwrl!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!allbery
- From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
- Newsgroups: comp.sources.misc
- Subject: v07i118: minit linear programming package, Patch 1
- Message-ID: <62671@uunet.UU.NET>
- Date: 6 Aug 89 02:19:45 GMT
- Sender: allbery@uunet.UU.NET
- Reply-To: badri@ee.rochester.edu (Badri Lokanathan )
- Lines: 113
- Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 7, Issue 118
- Submitted-by: badri@ee.rochester.edu (Badri Lokanathan )
- Archive-name: minit.p1
-
- A few bugs were reported in the distribution version of minit.
- On checking my archives, I found that the version used in my application
- had these fixes, but not the standalone version that I had archived
- separately. My apologies, the bug report follows.
- ----------------------------------------------------------------------------
- Date: Fri, 4 Aug 89 22:43:03 EDT
- From: elsie!ado@ncifcrf.gov (Arthur David Olson)
- Message-Id: <8908050243.AA18767@elsie>
- To: badri@ee.rochester.edu
- Subject: minit
- Status: ORS
-
- Thanks for contributing the linear programming code to comp.sources.misc--
- it came along the very day I realized that a particular problem of mine
- was amenable to linear programming!
-
- In using the code I discovered a few problems; differences are attached.
- Three problems:
- 1. When reallocating the "e" array because of an increase in
- "MS", the code failed to remember the old size of the array
- so it would know where to begin when allocating new elements.
- 2. When reallocating the "e" array because of an increase in
- ""S", the code would set
- *tmp = realloc(tmp, ...
- rather than (correctly) setting
- *tmp = realloc(*tmp, ...
- 3. In code that was supposed to zero out the "x" and "w"
- result arrays, a typo resulted in zeroing out the "x"
- array twice.
-
- --ado
-
- *** 1.1/minit.c Fri Aug 4 22:36:30 1989
- --- 1/minit.c Fri Aug 4 22:36:31 1989
- ***************
- *** 155,162 ****
- --- 155,163 ----
-
- if(M + 1 > MS)
- {
- /* Need to reallocate space. */
- + i = MS;
- MS = M + 1;
- if(!(jmax = (int *) realloc((char *)jmax,
- (unsigned)(MS*sizeof(int)))))
- return(0);
- ***************
- *** 176,184 ****
- if(!(e=(float **) realloc((char *) e,
- (unsigned)(MS*sizeof(float *)))))
- return(0);
-
- ! for(tmp = e + m, i = 0; i < MS; i++)
- if(!(*(tmp++)=(float *)
- malloc((unsigned)(LS*sizeof(float)))))
- return(0);
- }
- --- 177,185 ----
- if(!(e=(float **) realloc((char *) e,
- (unsigned)(MS*sizeof(float *)))))
- return(0);
-
- ! for(tmp = e + i; i < MS; i++)
- if(!(*(tmp++)=(float *)
- malloc((unsigned)(LS*sizeof(float)))))
- return(0);
- }
- ***************
- *** 198,206 ****
- (unsigned)(LS*sizeof(float)))))
- return(0);
-
- for(tmp = e, i = 0; i < MS; tmp++, i++)
- ! if(!(*tmp=(float *) realloc((char *) tmp,
- (unsigned)(LS*sizeof(float)))))
- return(0);
- }
-
- --- 199,207 ----
- (unsigned)(LS*sizeof(float)))))
- return(0);
-
- for(tmp = e, i = 0; i < MS; tmp++, i++)
- ! if(!(*tmp=(float *) realloc((char *) *tmp,
- (unsigned)(LS*sizeof(float)))))
- return(0);
- }
-
- ***************
- *** 384,392 ****
- for(i = 0; i < n; i++)
- x[i] = 0.0;
-
- for(j = 0; j < m; j++)
- ! x[j] = 0.0;
-
- for(i = 1; i < m + 1; i++)
- {
- if(chk[i] >= n)
- --- 385,393 ----
- for(i = 0; i < n; i++)
- x[i] = 0.0;
-
- for(j = 0; j < m; j++)
- ! w[j] = 0.0;
-
- for(i = 1; i < m + 1; i++)
- {
- if(chk[i] >= n)
-
-
-