diff src/utils.cc @ 4478:7afd4bf05aa8

[project @ 2003-07-30 19:15:31 by jwe]
author jwe
date Wed, 30 Jul 2003 19:15:31 +0000
parents d7d9ca19960a
children cfbaee1f562f
line wrap: on
line diff
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -229,27 +229,7 @@
 int
 empty_arg (const char *name, int nr, int nc)
 {
-  int is_empty = 0;
-
-  if (nr == 0 || nc == 0)
-    {
-      int flag = Vpropagate_empty_matrices;
-
-      if (flag < 0)
-	{
-	  gripe_empty_arg (name, 0);
-	  is_empty = 1;
-	}
-      else if (flag == 0)
-	{
-	  gripe_empty_arg (name, 1);
-	  is_empty = -1;
-	}
-      else
-	is_empty = 1;
-    }
-
-  return is_empty;
+  return (nr == 0 || nc == 0);
 }
 
 // See if the given file is in the path.
@@ -828,6 +808,22 @@
     check_dimensions (nr, nc, warn_for); // May set error_state.
 }
 
+Matrix
+identity_matrix (int nr, int nc)
+{
+  Matrix m (nr, nc, 0.0);
+
+  if (nr > 0 && nc > 0)
+    {
+      int n = std::min (nr, nc);
+
+      for (int i = 0; i < n; i++)
+	m (i, i) = 1.0;
+    }
+
+  return m;
+}
+
 extern int
 octave_format (std::ostream& os, const char *fmt, ...)
 {