cureos / csnumerics

Portable numerical algorithms in C#
GNU Lesser General Public License v3.0
32 stars 11 forks source link

Fix IndexOutOfRange when lincoa selects last function evaluation as kopt #3

Closed monkeypushbutton closed 9 years ago

monkeypushbutton commented 9 years ago

Line 498 of Lincoa - kopt is the one based index of the most optimal function evaluation after PRELIM calculations. This line however assumes it to be a zero based index, leading to a potential out of range exception. Test case added which exhibits the exceptional behavior.

anders9ustafsson commented 9 years ago

Well spotted, @monkeypushbutton ! Many thanks for solving this issue and offering a PR, this is very much appreciated!

Best regards, Anders @ Cureos

monkeypushbutton commented 9 years ago

You're welcome - thanks for maintaining the library.