changeset 9872:72d6e0de76c7

fix qp, condest and krylov
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 26 Nov 2009 08:28:07 +0100
parents 87595d714005
children b7acf3cb5984
files scripts/ChangeLog scripts/linear-algebra/condest.m scripts/linear-algebra/krylov.m scripts/optimization/qp.m
diffstat 4 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Nov 26 07:22:02 2009 +0100
+++ b/scripts/ChangeLog	Thu Nov 26 08:28:07 2009 +0100
@@ -1,3 +1,9 @@
+2009-11-26  Jaroslav Hajek  <highegg@gmail.com>
+
+	* optimization/qp.m: Fix matrix tests.
+	* optimization/condest.m: Ditto.
+	* optimization/krylov.m: Ditto.
+
 2009-11-26  Jaroslav Hajek  <highegg@gmail.com>
 
 	* sparse/normest.m: Move to linear-algebra.
--- a/scripts/linear-algebra/condest.m	Thu Nov 26 07:22:02 2009 +0100
+++ b/scripts/linear-algebra/condest.m	Thu Nov 26 08:28:07 2009 +0100
@@ -117,10 +117,10 @@
 
   if (ismatrix (varargin{1}))
     A = varargin{1};
-    n = issquare (A);
-    if (! n)
+    if (! issquare (A))
       error ("condest: matrix must be square");
     endif
+    n = rows (A);
     have_A = true;
 
     if (nargin > 1)
--- a/scripts/linear-algebra/krylov.m	Thu Nov 26 07:22:02 2009 +0100
+++ b/scripts/linear-algebra/krylov.m	Thu Nov 26 08:28:07 2009 +0100
@@ -81,10 +81,10 @@
     eps1 = defeps;
   endif
 
-  na = issquare (A);
-  if (! na)
-    error ("A(%d x %d) must be square", rows (A), columns (A));
+  if (! issquare (A) || isempty (A))
+    error ("A(%d x %d) must be non-empty square matrix", rows (A), columns (A));
   endif
+  na = rows (A);
 
   [m, kb] = size (V);
   if (m != na)
--- a/scripts/optimization/qp.m	Thu Nov 26 07:22:02 2009 +0100
+++ b/scripts/optimization/qp.m	Thu Nov 26 08:28:07 2009 +0100
@@ -85,16 +85,13 @@
   if (nargin == 5 || nargin == 7 || nargin == 10)
 
     ## Checking the quadratic penalty
-    n = issquare (H);
-    if (n == 0)
+    if (! issquare (H))
       error ("qp: quadratic penalty matrix not square");
-    endif
-
-    n1 = issymmetric (H);
-    if (n1 == 0)
-      ## warning ("qp: quadratic penalty matrix not symmetric");
+    elseif (! ishermitian (H))
+      ## warning ("qp: quadratic penalty matrix not hermitian");
       H = (H + H')/2;
     endif
+    n = rows (H);
 
     ## Checking the initial guess (if empty it is resized to the
     ## right dimension and filled with 0)