diff liboctave/dMatrix.cc @ 6924:be176b7e110a

[project @ 2007-09-25 19:08:19 by dbateman]
author dbateman
date Tue, 25 Sep 2007 19:08:20 +0000
parents 2f17d5556756
children c05fbb1b7e1f
line wrap: on
line diff
--- a/liboctave/dMatrix.cc	Tue Sep 25 16:57:13 2007 +0000
+++ b/liboctave/dMatrix.cc	Tue Sep 25 19:08:20 2007 +0000
@@ -1353,9 +1353,11 @@
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
 
-  if (nr == 0 || nc == 0 || nr != b.rows ())
+  if (nr != b.rows ())
     (*current_liboctave_error_handler)
       ("matrix dimension mismatch solution of linear equations");
+  else if (nr == 0 || nc == 0 || b.cols () == 0)
+    retval = Matrix (nc, b.cols (), 0.0);
   else
     {
       volatile int typ = mattype.type ();
@@ -1459,9 +1461,11 @@
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
 
-  if (nr == 0 || nc == 0 || nr != b.rows ())
+  if (nr != b.rows ())
     (*current_liboctave_error_handler)
       ("matrix dimension mismatch solution of linear equations");
+  else if (nr == 0 || nc == 0 || b.cols () == 0)
+    retval = Matrix (nc, b.cols (), 0.0);
   else
     {
       volatile int typ = mattype.type ();
@@ -1565,9 +1569,11 @@
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
 
-  if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ())
+  if (nr != nc || nr != b.rows ())
     (*current_liboctave_error_handler)
       ("matrix dimension mismatch solution of linear equations");
+  else if (nr == 0 || b.cols () == 0)
+    retval = Matrix (nc, b.cols (), 0.0);
   else
     {
       volatile int typ = mattype.type ();
@@ -2046,9 +2052,12 @@
   octave_idx_type m = rows ();
   octave_idx_type n = cols ();
 
-  if (m == 0 || n == 0 || m != b.rows ())
+
+  if (m != b.rows ())
     (*current_liboctave_error_handler)
-      ("matrix dimension mismatch in solution of least squares problem");
+      ("matrix dimension mismatch solution of linear equations");
+  else if (m == 0 || n == 0 || b.cols () == 0)
+    retval = Matrix (n, b.cols (), 0.0);
   else
     {
       Matrix atmp = *this;
@@ -2155,9 +2164,11 @@
   octave_idx_type m = rows ();
   octave_idx_type n = cols ();
 
-  if (m == 0 || n == 0 || m != b.length ())
+  if (m != b.length ())
     (*current_liboctave_error_handler)
-      ("matrix dimension mismatch in solution of least squares problem");
+      ("matrix dimension mismatch solution of linear equations");
+  else if (m == 0 || n == 0)
+    retval = ColumnVector (n, 0.0);
   else
     {
       Matrix atmp = *this;