octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #61762] qp should check positive definiteness


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #61762] qp should check positive definiteness
Date: Wed, 5 Jan 2022 14:39:49 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0

Follow-up Comment #4, bug #61762 (project octave):

I was thinking of something like this, moving the check up where the other
checks are done on the matrix, but if this will cause problems we don't need
to do it.


diff -r 00ab5e929111 scripts/optimization/qp.m
--- a/scripts/optimization/qp.m Wed Jan 05 19:30:43 2022 +0100
+++ b/scripts/optimization/qp.m Wed Jan 05 14:36:42 2022 -0500
@@ -182,6 +182,13 @@
   ## Validate the quadratic penalty.
   if (! issquare (H))
     error ("qp: quadratic penalty matrix must be square");
+  elseif (isdefinite (H) != 1)  # not quadratic, return early
+    x = x0;
+    obj = nan;  # or something indicating problem instance is unbounded
below
+    INFO.info = 2;
+    INFO.solveiter = 0;
+    lambda = [];
+    return
   elseif (! ishermitian (H))
     ## warning ("qp: quadratic penalty matrix not hermitian");
     H = (H + H')/2;
@@ -348,10 +355,6 @@
 
   info = 0;
 
-  if (isdefinite (H) != 1)
-    info = 2;
-  endif
-
   if (info == 0 && (eq_infeasible || in_infeasible))
     ## The initial guess is not feasible.
     ## First, define an xbar that is feasible with respect to the



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61762>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]