diff liboctave/CMatrix.cc @ 6924:be176b7e110a

[project @ 2007-09-25 19:08:19 by dbateman]
author dbateman
date Tue, 25 Sep 2007 19:08:20 +0000
parents 83619ae96c1d
children c05fbb1b7e1f
line wrap: on
line diff
--- a/liboctave/CMatrix.cc
+++ b/liboctave/CMatrix.cc
@@ -1691,9 +1691,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 = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0));
   else
     {
       volatile int typ = mattype.type ();
@@ -1798,9 +1800,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 = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0));
   else
     {
       volatile int typ = mattype.type ();
@@ -1905,9 +1909,12 @@
   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 in solution of linear equations");
+      ("matrix dimension mismatch solution of linear equations");
+  else if (nr == 0 || b.cols () == 0)
+    retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0));
   else
     {
       volatile int typ = mattype.type ();
@@ -2422,9 +2429,11 @@
   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 solution of linear equations");
+  else if (m== 0 || n == 0 || b.cols () == 0)
+    retval = ComplexMatrix (n, b.cols (), Complex (0.0, 0.0));
   else
     {
       ComplexMatrix atmp = *this;
@@ -2536,9 +2545,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 solution of least squares problem");
+      ("matrix dimension mismatch solution of linear equations");
+  else if (m == 0 || n == 0 || b.cols () == 0)
+    retval = ComplexColumnVector (n, Complex (0.0, 0.0));
   else
     {
       ComplexMatrix atmp = *this;