Mercurial > octave-nkf
diff src/DLD-FUNCTIONS/__qp__.cc @ 11682:b7a30502f0c9 release-3-0-x
handle possible error from EIG
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 11 Mar 2008 10:49:33 -0400 |
parents | a2000c2b5e7d |
children | 72830070a17b |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/__qp__.cc Mon Mar 10 23:18:47 2008 -0400 +++ b/src/DLD-FUNCTIONS/__qp__.cc Tue Mar 11 10:49:33 2008 -0400 @@ -137,6 +137,13 @@ // Computing the ??? EIG eigH (H); + + if (error_state) + { + error ("qp: failed to compute eigenvalues of H"); + return -1; + } + ColumnVector eigenvalH = real (eigH.eigenvalues ()); Matrix eigenvecH = real (eigH.eigenvectors ()); double minReal = eigenvalH.min (); @@ -272,6 +279,13 @@ // Searching for the most negative curvature. EIG eigrH (rH); + + if (error_state) + { + error ("qp: failed to compute eigenvalues of rH"); + return -1; + } + ColumnVector eigenvalrH = real (eigrH.eigenvalues ()); Matrix eigenvecrH = real (eigrH.eigenvectors ()); double mRrH = eigenvalrH.min (); @@ -494,10 +508,15 @@ int info = qp (H, q, Aeq, beq, Ain, bin, maxit, x, lambda, iter); - retval(3) = iter; - retval(2) = info; - retval(1) = lambda; - retval(0) = x; + if (! error_state) + { + retval(3) = iter; + retval(2) = info; + retval(1) = lambda; + retval(0) = x; + } + else + error ("qp: internal error"); } else error ("__qp__: invalid arguments");