You are here

code review for linear constraint specification

There are some odd lines of code that I would like to see better inline comments explaining what is going on. In npsol.c around lines 330 I see "// For memory allocation purposes, nlinwid > 0" and then again for nlnwid. I don't understand why nlinwid and nlnwid are assigned to 1 for non-positive values of nclin and ncnln. Also, a little further down on line 373, there's the line: for(; k < n+nclin; k++). Is this the correct thing to do if nclin is negative?

Reporter: 
Created: 
Wed, 09/23/2009 - 15:18
Updated: 
Wed, 10/07/2009 - 17:09

Comments

In r839, I clarified the inline documentation a little, and enforced the (theoretically true anyway) constraint that nclin and ncnln are non-negative.

nlnwid and nlinwid are place-holders that indicate the number of rows in arrays A and J, which are working space for NPSOL, as well as the upper and lower boundary sets. They're specified to be at least 1, because the objects whose sizes they help to specify are required to be non-zero. (See the NPSOL manual under the section on subroutine npsol.)

Line 373 begins a loop to specify bounds for linear constraints. If nclin is non-positive (that is, there are no linear constraints), the loop content is skipped. This is intentional.

Automatically closed -- issue fixed for 2 weeks with no activity.