Mercurial > hg > octave-terminal
changeset 157:94aa0774c417
[project @ 1993-10-13 20:45:04 by jwe]
(qpsol): Check to ensure that the bounds on linear constraints are
vectors.
author | jwe |
---|---|
date | Wed, 13 Oct 1993 20:45:04 +0000 |
parents | 8dc079be9dc5 |
children | 76926a2d39a6 |
files | src/qpsol.cc |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/qpsol.cc +++ b/src/qpsol.cc @@ -72,14 +72,14 @@ ColumnVector x = args[1].to_vector (); if (x.capacity () == 0) { - message ("qpsol", "expecting vector as first argument"); + error ("qpsol: expecting vector as first argument"); return retval; } Matrix H = args[2].to_matrix (); if (H.rows () != H.columns () || H.rows () != x.capacity ()) { - message ("qpsol", "H must be a square matrix consistent with the\ + error ("qpsol: H must be a square matrix consistent with the\ size of x"); return retval; } @@ -87,7 +87,7 @@ ColumnVector c = args[3].to_vector (); if (c.capacity () != x.capacity ()) { - message ("qpsol", "c must be a vector the same size as x"); + error ("qpsol: c must be a vector the same size as x"); return retval; } @@ -101,7 +101,7 @@ int ub_len = ub.capacity (); if (lb_len != ub_len || lb_len != x.capacity ()) { - message ("qpsol", "lower and upper bounds and decision variable\n\ + error ("qpsol: lower and upper bounds and decision variable\n\ vector must all have the same number of elements"); return retval; } @@ -142,6 +142,12 @@ Matrix A = args[nargin-2].to_matrix (); ColumnVector llb = args[nargin-3].to_vector (); + if (llb.capacity () == 0 || lub.capacity () == 0) + { + error ("qpsol: bounds for linear constraints must be vectors"); + return retval; + } + if (! linear_constraints_ok (x, llb, A, lub, "qpsol", 1)) return retval;