diff liboctave/Matrix-ext.cc @ 227:1a48a1b91489

[project @ 1993-11-15 10:10:35 by jwe]
author jwe
date Mon, 15 Nov 1993 10:11:59 +0000
parents 2db13bf4f3e2
children 0e77ff277fdc
line wrap: on
line diff
--- a/liboctave/Matrix-ext.cc	Mon Nov 15 10:06:26 1993 +0000
+++ b/liboctave/Matrix-ext.cc	Mon Nov 15 10:11:59 1993 +0000
@@ -27,6 +27,7 @@
 
 #include "Matrix.h"
 #include "mx-inlines.cc"
+#include "lo-error.h"
 
 /*
  * AEPBALANCE operations
@@ -36,7 +37,10 @@
 AEPBALANCE::init (const Matrix& a, const char *balance_job)
 {
   if (a.nr != a.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler) ("AEPBALANCE requires square matrix");
+      return -1;
+    }
 
   int n = a.nc;
 
@@ -110,7 +114,11 @@
 GEPBALANCE::init (const Matrix& a, const Matrix& b, const char *balance_job)
 {
   if (a.nr != a.nc || a.nr != b.nr || b.nr != b.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler)
+	("GEPBALANCE requires square matrices of the same size");
+      return -1;
+    }
 
   int n = a.nc;
 
@@ -236,7 +244,10 @@
 CHOL::init (const Matrix& a)
 {
   if (a.nr != a.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler) ("CHOL requires square matrix");
+      return -1;
+    }
 
   char uplo = 'U';
 
@@ -266,7 +277,11 @@
 ComplexCHOL::init (const ComplexMatrix& a)
 {
    if (a.nr != a.nc)
-     FAIL;
+     {
+       (*current_liboctave_error_handler)
+	 ("ComplexCHOL requires square matrix");
+       return -1;
+     }
 
    char uplo = 'U';
 
@@ -299,7 +314,10 @@
 HESS::init (const Matrix& a)
 {
   if (a.nr != a.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler) ("HESS requires square matrix");
+      return -1;
+    }
 
   char jobbal = 'N';
   char side = 'R';
@@ -357,7 +375,11 @@
 ComplexHESS::init (const ComplexMatrix& a)
 {
    if (a.nr != a.nc)
-     FAIL;
+     {
+       (*current_liboctave_error_handler)
+	 ("ComplexHESS requires square matrix");
+       return -1;
+     }
 
    char job = 'N';
    char side = 'R';
@@ -429,7 +451,10 @@
 SCHUR::init (const Matrix& a, const char *ord)
 {
   if (a.nr != a.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler) ("SCHUR requires square matrix");
+      return -1;
+    }
 
   char jobvs = 'V';
   char sort;
@@ -516,7 +541,11 @@
 ComplexSCHUR::init (const ComplexMatrix& a, const char *ord)
 {
   if (a.nr != a.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler)
+	("ComplexSCHUR requires square matrix");
+      return -1;
+    }
 
   char jobvs = 'V';
   char sort;
@@ -688,7 +717,10 @@
 EIG::init (const Matrix& a)
 {
   if (a.nr != a.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler) ("EIG requires square matrix");
+      return -1;
+    }
 
   int n = a.nr;
 
@@ -725,7 +757,10 @@
       else
 	{
 	  if (j+1 >= n)
-	    FAIL;
+	    {
+	      (*current_liboctave_error_handler) ("EIG: internal error");
+	      return -1;
+	    }
 
 	  for (int i = 0; i < n; i++)
 	    {
@@ -753,7 +788,10 @@
 {
 
   if (a.nr != a.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler) ("EIG requires square matrix");
+      return -1;
+    }
 
   int n = a.nr;
 
@@ -795,7 +833,10 @@
 LU::LU (const Matrix& a)
 {
   if (a.nr == 0 || a.nc == 0 || a.nr != a.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler) ("LU requires square matrix");
+      return;
+    }
 
   int n = a.nr;
 
@@ -854,7 +895,10 @@
 ComplexLU::ComplexLU (const ComplexMatrix& a)
 {
   if (a.nr == 0 || a.nc == 0 || a.nr != a.nc)
-    FAIL;
+    {
+      (*current_liboctave_error_handler) ("ComplexLU requires square matrix");
+      return;
+    }
 
   int n = a.nr;
 
@@ -920,7 +964,10 @@
   int n = a.nc;
 
   if (m == 0 || n == 0)
-    FAIL;
+    {
+      (*current_liboctave_error_handler) ("QR must have non-empty matrix");
+      return;
+    }
 
   double *tmp_data;
   int min_mn = m < n ? m : n;
@@ -966,7 +1013,11 @@
   int n = a.nc;
 
   if (m == 0 || n == 0)
-    FAIL;
+    {
+      (*current_liboctave_error_handler)
+	("ComplexQR must have non-empty matrix");
+      return;
+    }
 
   Complex *tmp_data;
   int min_mn = m < n ? m : n;