changeset 589:02fba8dc2a92

Fix size check in newMatrix so as to check all rows/cols
author Chris Cannam
date Thu, 11 Sep 2014 11:00:58 +0100
parents 28871ec9e4a9
children 7c33308cebf8
files src/may/matrix.yeti
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/may/matrix.yeti	Thu Sep 11 08:18:45 2014 +0100
+++ b/src/may/matrix.yeti	Thu Sep 11 11:00:58 2014 +0100
@@ -214,8 +214,8 @@
     Rows rr: 
         if (length rr) != size.rows then
             failWith "Wrong number of rows in row-major newMatrix (\(length rr), size calls for \(size.rows))";
-        elif not empty? rr and vec.length (head rr) != size.columns then
-            failWith "Wrong number of columns in row-major newMatrix (\(vec.length (head rr)), size calls for \(size.columns))";
+        elif not (all do r: vec.length r == size.columns done rr) then
+            failWith "Wrong or inconsistent number of columns in rows in row-major newMatrix (\(map vec.length rr)), size calls for \(size.columns))";
         else
             {
                 size,
@@ -225,8 +225,8 @@
     Columns cc: 
         if (length cc) != size.columns then
             failWith "Wrong number of columns in column-major newMatrix (\(length cc), size calls for \(size.columns))";
-        elif not empty? cc and vec.length (head cc) != size.rows then
-            failWith "Wrong number of rows in column-major newMatrix (\(vec.length (head cc)), size calls for \(size.rows))";
+        elif not (all do c: vec.length c == size.rows done cc) then
+            failWith "Wrong or inconsistent number of rows in in columns in column-major newMatrix (\(map vec.length cc)), size calls for \(size.rows))";
         else
             {
                 size,