changeset 215:cf3f13026ff6

[project @ 1993-11-13 08:41:22 by jwe]
author jwe
date Sat, 13 Nov 1993 08:41:22 +0000
parents 1468a5e6a466
children e83d64b26659
files src/npsol.cc
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/npsol.cc
+++ b/src/npsol.cc
@@ -316,11 +316,17 @@
 	  Matrix c = args[nargin-2].to_matrix ();
 	  ColumnVector llb = args[nargin-3].to_vector ();
 
-	  LinConst linear_constraints (llb, c, lub);
+	  if (llb.capacity () == 0 || lub.capacity () == 0)
+	    {
+	      error ("npsol: bounds for linear constraints must be vectors");
+	      return retval;
+	    }
 
 	  if (! linear_constraints_ok (x, llb, c, lub, "npsol", 1))
 	    return retval;
 
+	  LinConst linear_constraints (llb, c, lub);
+
 	  if (nargin == 6)
 	    {
 	      // 7. npsol (x, phi, llb, c, lub)
@@ -397,6 +403,12 @@
 	      Matrix c = args[nargin-5].to_matrix ();
 	      ColumnVector llb = args[nargin-6].to_vector ();
 
+	      if (llb.capacity () == 0 || lub.capacity () == 0)
+		{
+		  error ("npsol: bounds for linear constraints must be vectors");
+		  return retval;
+		}
+
 	      if (! linear_constraints_ok (x, llb, c, lub, "npsol", 1))
 		return retval;