diff src/ov-re-mat.cc @ 4645:bd2067547b40

[project @ 2003-11-23 08:07:52 by jwe]
author jwe
date Sun, 23 Nov 2003 08:07:53 +0000
parents ef3a14fb6847
children e95c86d48732
line wrap: on
line diff
--- a/src/ov-re-mat.cc
+++ b/src/ov-re-mat.cc
@@ -82,8 +82,7 @@
 {
   double retval = lo_ieee_nan_value ();
 
-  // XXX FIXME XXX -- maybe this should be a function, valid_as_scalar()
-  if (rows () > 0 && columns () > 0)
+  if (numel () > 0)
     {
       // XXX FIXME XXX -- is warn_fortran_indexing the right variable here?
       if (Vwarn_fortran_indexing)
@@ -135,6 +134,29 @@
   return ComplexMatrix (matrix.matrix_value ());
 }
 
+streamoff_array
+octave_matrix::streamoff_array_value (void) const
+{
+  streamoff_array retval (dims ());
+
+  int nel = numel ();
+
+  for (int i = 0; i < nel; i++)
+    {
+      double d = matrix(i);
+
+      if (D_NINT (d) == d)
+	retval(i) = std::streamoff (static_cast<long> (d));
+      else
+	{
+	  error ("conversion to streamoff_array value failed");
+	  break;
+	}
+    }
+
+  return retval;
+}
+
 octave_value
 octave_matrix::convert_to_str_internal (bool, bool) const
 {