changeset 7612:c1702f963a5e

error check for subspace.m
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 20 Mar 2008 09:36:50 -0400
parents 4f903c303c3c
children 4fc7c16ee564
files scripts/ChangeLog scripts/linear-algebra/subspace.m
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Mar 19 21:22:20 2008 -0400
+++ b/scripts/ChangeLog	Thu Mar 20 09:36:50 2008 -0400
@@ -1,3 +1,8 @@
+2008-03-20  Jaroslav Hajek  <highegg@localhost.localdomain>
+
+	* linear-algebra/subspace.m: Check number of arguments and number
+	of dimensions of arguments.
+
 2008-03-19  Jaroslav Hajek  <highegg@gmail.com>
 
 	* linear-algebra/subspace.m: New function.
--- a/scripts/linear-algebra/subspace.m	Wed Mar 19 21:22:20 2008 -0400
+++ b/scripts/linear-algebra/subspace.m	Thu Mar 20 09:36:50 2008 -0400
@@ -34,6 +34,12 @@
 
 function ang = subspace (a, b)
 
+  if (nargin != 2)
+    print_usage ();
+  elseif (ndims (a) != 2 || ndims (b) != 2)
+    error ("subspace: expecting A and B to be 2-dimensional arrays");
+  endif
+
   a = orth (a);
   b = orth (b);
   c = a'*b;