changeset 8998:a48fba01e4ac

optimize isnan/isinf/isfinite mappers
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 19 Mar 2009 17:46:38 +0100
parents 187a9d9c2f04
children dc07bc4157b8
files ChangeLog aclocal.m4 configure.in liboctave/Array.h liboctave/CNDArray.cc liboctave/CNDArray.h liboctave/ChangeLog liboctave/dNDArray.cc liboctave/dNDArray.h liboctave/fCNDArray.cc liboctave/fCNDArray.h liboctave/fNDArray.cc liboctave/fNDArray.h liboctave/lo-mappers.cc liboctave/lo-mappers.h liboctave/mx-op-defs.h src/ChangeLog src/ov-cx-mat.cc src/ov-flt-cx-mat.cc src/ov-flt-re-mat.cc src/ov-re-mat.cc
diffstat 21 files changed, 322 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 19 08:54:56 2009 +0100
+++ b/ChangeLog	Thu Mar 19 17:46:38 2009 +0100
@@ -1,3 +1,8 @@
+2009-03-20  Jaroslav Hajek  <highegg@gmail.com>
+
+	* aclocal.m4 (OCTAVE_CMATH_FUNC): New macro.
+	* configure.in: Use it.
+
 2009-03-09  John W. Eaton  <jwe@octave.org>
 
 	* run-octave.in: Use doc-cache instead of DOC for doc cache file.
--- a/aclocal.m4	Thu Mar 19 08:54:56 2009 +0100
+++ b/aclocal.m4	Thu Mar 19 17:46:38 2009 +0100
@@ -1285,6 +1285,41 @@
    AC_SUBST([FT2_LIBS])])
 dnl end of freetype2.m4
 
+dnl Check whether a math mapper function is available in <cmath>.
+dnl Will define HAVE_CMATH_FUNC if there is a double variant and
+dnl HAVE_CMATH_FUNCF if there is a float variant.
+dnl Currently capable of checking for functions with single 
+dnl argument and returning bool/int/real.
+AC_DEFUN([OCTAVE_CMATH_FUNC],[
+AC_MSG_CHECKING([for std::$1 in <cmath>])
+AC_LANG_PUSH(C++)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <cmath>
+void take_func (bool (*func) (double x));
+void take_func (int (*func) (double x));
+void take_func (double (*func) (double x));
+]],
+[[
+take_func(std::$1);
+]])],
+[AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_CMATH_[]AS_TR_CPP($1),1,[Define if <cmath> provides $1])],
+[AC_MSG_RESULT([no])])
+AC_MSG_CHECKING([for std::$1 (float variant) in <cmath>])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <cmath>
+void take_func (bool (*func) (float x));
+void take_func (int (*func) (float x));
+void take_func (float (*func) (float x));
+]],
+[[
+take_func(std::$1);
+]])],
+[AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_CMATH_[]AS_TR_CPP($1)F,1,[Define if <cmath> provides float variant of $1])],
+[AC_MSG_RESULT([no])])
+])
+
 dnl Check whether fast signed integer arithmetics using bit tricks
 dnl can be used in oct-inttypes.h. Defines HAVE_FAST_INT_OPS if
 dnl the following conditions hold:
--- a/configure.in	Thu Mar 19 08:54:56 2009 +0100
+++ b/configure.in	Thu Mar 19 17:46:38 2009 +0100
@@ -1776,6 +1776,12 @@
      [Define if your system has a single-arg prototype for gettimeofday.])])
 fi
 
+dnl Maybe <cmath> defines the IEEE functions we need.
+
+OCTAVE_CMATH_FUNC(isnan)
+OCTAVE_CMATH_FUNC(isinf)
+OCTAVE_CMATH_FUNC(isfinite)
+
 dnl Would like to get rid of this cruft, and just have
 dnl
 dnl   AC_CHECK_FUNCS(finite isnan isinf)
--- a/liboctave/Array.h	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/Array.h	Thu Mar 19 17:46:38 2009 +0100
@@ -601,6 +601,26 @@
 
     return result;
   }
+
+  // This is non-breakable map, suitable for fast functions. Efficiency
+  // relies on compiler's ability to inline a function pointer. This seems
+  // to be OK with recent GCC.
+  template <class U>
+  Array<U>
+  fastmap (U (*fcn) (typename ref_param<T>::type)) const
+  {
+    octave_idx_type len = length ();
+
+    const T *m = data ();
+
+    Array<U> result (dims ());
+    U *p = result.fortran_vec ();
+
+    std::transform (m, m + len, p, fcn);
+
+    return result;
+  }
+
 };
 
 #endif
--- a/liboctave/CNDArray.cc	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/CNDArray.cc	Thu Mar 19 17:46:38 2009 +0100
@@ -754,6 +754,24 @@
                   dims ());
 }
 
+boolNDArray
+ComplexNDArray::isnan (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xisnan));
+}
+
+boolNDArray
+ComplexNDArray::isinf (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xisinf));
+}
+
+boolNDArray
+ComplexNDArray::isfinite (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xfinite));
+}
+
 ComplexNDArray
 conj (const ComplexNDArray& a)
 {
--- a/liboctave/CNDArray.h	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/CNDArray.h	Thu Mar 19 17:46:38 2009 +0100
@@ -98,6 +98,9 @@
   ComplexNDArray& insert (const ComplexNDArray& a, const Array<octave_idx_type>& ra_idx);
   
   NDArray abs (void) const;
+  boolNDArray isnan (void) const;
+  boolNDArray isinf (void) const;
+  boolNDArray isfinite (void) const;
 
   friend ComplexNDArray conj (const ComplexNDArray& a);
 
--- a/liboctave/ChangeLog	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/ChangeLog	Thu Mar 19 17:46:38 2009 +0100
@@ -1,3 +1,21 @@
+2009-03-20  Jaroslav Hajek  <highegg@gmail.com>
+
+	* Array.h (Array<T>::fastmap): New method.
+	* dNDArray.cc (NDArray::isnan, NDArray::isinf, NDArray::isfinite):
+	New methods.
+	* dNDArray.h: Declare them.
+	* fNDArray.cc (FloatNDArray::isnan, FloatNDArray::isinf,
+	FloatNDArray::isfinite): New methods.
+	* fNDArray.h: Declare them.
+	* CNDArray.cc (ComplexNDArray::isnan, ComplexNDArray::isinf,
+	ComplexNDArray::isfinite): New methods.
+	* CNDArray.h: Declare them.
+	* fCNDArray.cc (FloatComplexNDArray::isnan, FloatComplexNDArray::isinf,
+	FloatComplexNDArray::isfinite): New methods.
+	* fCNDArray.h: Declare them.
+	* lo-mappers.h (xisnan, xisinf, xfinite): If possible, use definitions
+	from <cmath>.
+
 2009-03-18  Jaroslav Hajek <highegg@gmail.com>
 
 	* oct-norm.cc (get_eps): Remove that hack.
--- a/liboctave/dNDArray.cc	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/dNDArray.cc	Thu Mar 19 17:46:38 2009 +0100
@@ -874,6 +874,24 @@
                   dims ());
 }
 
+boolNDArray
+NDArray::isnan (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xisnan));
+}
+
+boolNDArray
+NDArray::isinf (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xisinf));
+}
+
+boolNDArray
+NDArray::isfinite (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xfinite));
+}
+
 Matrix
 NDArray::matrix_value (void) const
 {
--- a/liboctave/dNDArray.h	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/dNDArray.h	Thu Mar 19 17:46:38 2009 +0100
@@ -109,6 +109,9 @@
   NDArray& insert (const NDArray& a, const Array<octave_idx_type>& ra_idx);
 
   NDArray abs (void) const;
+  boolNDArray isnan (void) const;
+  boolNDArray isinf (void) const;
+  boolNDArray isfinite (void) const;
 
   ComplexNDArray fourier (int dim = 1) const;
   ComplexNDArray ifourier (int dim = 1) const;
--- a/liboctave/fCNDArray.cc	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/fCNDArray.cc	Thu Mar 19 17:46:38 2009 +0100
@@ -749,6 +749,24 @@
                        dims ());
 }
 
+boolNDArray
+FloatComplexNDArray::isnan (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xisnan));
+}
+
+boolNDArray
+FloatComplexNDArray::isinf (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xisinf));
+}
+
+boolNDArray
+FloatComplexNDArray::isfinite (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xfinite));
+}
+
 FloatComplexNDArray
 conj (const FloatComplexNDArray& a)
 {
--- a/liboctave/fCNDArray.h	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/fCNDArray.h	Thu Mar 19 17:46:38 2009 +0100
@@ -98,6 +98,9 @@
   FloatComplexNDArray& insert (const FloatComplexNDArray& a, const Array<octave_idx_type>& ra_idx);
   
   FloatNDArray abs (void) const;
+  boolNDArray isnan (void) const;
+  boolNDArray isinf (void) const;
+  boolNDArray isfinite (void) const;
 
   friend FloatComplexNDArray conj (const FloatComplexNDArray& a);
 
--- a/liboctave/fNDArray.cc	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/fNDArray.cc	Thu Mar 19 17:46:38 2009 +0100
@@ -829,6 +829,24 @@
                        dims ());
 }
 
+boolNDArray
+FloatNDArray::isnan (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xisnan));
+}
+
+boolNDArray
+FloatNDArray::isinf (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xisinf));
+}
+
+boolNDArray
+FloatNDArray::isfinite (void) const
+{
+  return ArrayN<bool> (fastmap<bool> (xfinite));
+}
+
 FloatMatrix
 FloatNDArray::matrix_value (void) const
 {
--- a/liboctave/fNDArray.h	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/fNDArray.h	Thu Mar 19 17:46:38 2009 +0100
@@ -106,6 +106,9 @@
   FloatNDArray& insert (const FloatNDArray& a, const Array<octave_idx_type>& ra_idx);
 
   FloatNDArray abs (void) const;
+  boolNDArray isnan (void) const;
+  boolNDArray isinf (void) const;
+  boolNDArray isfinite (void) const;
 
   FloatComplexNDArray fourier (int dim = 1) const;
   FloatComplexNDArray ifourier (int dim = 1) const;
--- a/liboctave/lo-mappers.cc	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/lo-mappers.cc	Thu Mar 19 17:46:38 2009 +0100
@@ -190,23 +190,29 @@
 
 // double -> bool mappers.
 
+#if ! defined(HAVE_CMATH_ISNAN)
 bool
 xisnan (double x)
 {
   return lo_ieee_isnan (x);
 }
+#endif
 
+#if ! defined(HAVE_CMATH_ISFINITE)
 bool
 xfinite (double x)
 {
   return lo_ieee_finite (x);
 }
+#endif
 
+#if ! defined(HAVE_CMATH_ISINF)
 bool
 xisinf (double x)
 {
   return lo_ieee_isinf (x);
 }
+#endif
 
 bool
 octave_is_NA (double x)
@@ -321,28 +327,6 @@
 // complex -> bool mappers.
 
 bool
-xisnan (const Complex& x)
-{
-  return (xisnan (real (x)) || xisnan (imag (x)));
-}
-
-bool
-xfinite (const Complex& x)
-{
-  double rx = real (x);
-  double ix = imag (x);
-
-  return (xfinite (rx) && ! xisnan (rx)
-	  && xfinite (ix) && ! xisnan (ix));
-}
-
-bool
-xisinf (const Complex& x)
-{
-  return (xisinf (real (x)) || xisinf (imag (x)));
-}
-
-bool
 octave_is_NA (const Complex& x)
 {
   return (octave_is_NA (real (x)) || octave_is_NA (imag (x)));
@@ -524,23 +508,29 @@
 
 // float -> bool mappers.
 
+#if ! defined(HAVE_CMATH_ISNANF)
 bool
 xisnan (float x)
 {
   return lo_ieee_isnan (x);
 }
+#endif
 
+#if ! defined(HAVE_CMATH_ISFINITEF)
 bool
 xfinite (float x)
 {
   return lo_ieee_finite (x);
 }
+#endif
 
+#if ! defined(HAVE_CMATH_ISINFF)
 bool
 xisinf (float x)
 {
   return lo_ieee_isinf (x);
 }
+#endif
 
 bool
 octave_is_NA (float x)
@@ -655,28 +645,6 @@
 // complex -> bool mappers.
 
 bool
-xisnan (const FloatComplex& x)
-{
-  return (xisnan (real (x)) || xisnan (imag (x)));
-}
-
-bool
-xfinite (const FloatComplex& x)
-{
-  float rx = real (x);
-  float ix = imag (x);
-
-  return (xfinite (rx) && ! xisnan (rx)
-	  && xfinite (ix) && ! xisnan (ix));
-}
-
-bool
-xisinf (const FloatComplex& x)
-{
-  return (xisinf (real (x)) || xisinf (imag (x)));
-}
-
-bool
 octave_is_NA (const FloatComplex& x)
 {
   return (octave_is_NA (real (x)) || octave_is_NA (imag (x)));
--- a/liboctave/lo-mappers.h	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/lo-mappers.h	Thu Mar 19 17:46:38 2009 +0100
@@ -25,6 +25,7 @@
 #define octave_liboctave_mappers_h 1
 
 #include "oct-cmplx.h"
+#include "lo-math.h"
 
 // Double Precision 
 extern OCTAVE_API double arg (double x);
@@ -46,9 +47,24 @@
 inline bool xisnan (bool) { return false; }
 inline bool xisnan (char) { return false; }
 
+#if defined (HAVE_CMATH_ISNAN)
+inline bool xisnan (double x)
+{ return std::isnan (x); }
+#else
 extern OCTAVE_API bool xisnan (double x);
+#endif
+#if defined (HAVE_CMATH_ISFINITE)
+inline bool xfinite (double x)
+{ return std::isfinite (x); }
+#else
 extern OCTAVE_API bool xfinite (double x);
+#endif
+#if defined (HAVE_CMATH_ISINF)
+inline bool xisinf (double x)
+{ return std::isinf (x); }
+#else
 extern OCTAVE_API bool xisinf (double x);
+#endif
 
 extern OCTAVE_API bool octave_is_NA (double x);
 extern OCTAVE_API bool octave_is_NaN_or_NA (double x) GCC_ATTR_DEPRECATED;
@@ -70,9 +86,15 @@
 extern OCTAVE_API Complex xroundb (const Complex& x);
 extern OCTAVE_API Complex signum (const Complex& x);
 
-extern OCTAVE_API bool xisnan (const Complex& x);
-extern OCTAVE_API bool xfinite (const Complex& x);
-extern OCTAVE_API bool xisinf (const Complex& x);
+inline bool
+xisnan (const Complex& x)
+{ return (xisnan (real (x)) || xisnan (imag (x))); }
+inline bool
+xfinite (const Complex& x)
+{ return (xfinite (real (x)) && xfinite (imag (x))); }
+inline bool
+xisinf (const Complex& x)
+{ return (xisinf (real (x)) || xisinf (imag (x))); }
 
 extern OCTAVE_API bool octave_is_NA (const Complex& x);
 extern OCTAVE_API bool octave_is_NaN_or_NA (const Complex& x);
@@ -96,9 +118,25 @@
 extern OCTAVE_API FloatComplex xlog2 (const FloatComplex& x, int& exp);
 extern OCTAVE_API float xexp2 (float x);
 
+#if defined (HAVE_CMATH_ISNANF)
+inline bool xisnan (float x)
+{ return std::isnan (x); }
+#else
 extern OCTAVE_API bool xisnan (float x);
+#endif
+#if defined (HAVE_CMATH_ISFINITEF)
+inline bool xfinite (float x)
+{ return std::isfinite (x); }
+#else
 extern OCTAVE_API bool xfinite (float x);
+#endif
+#if defined (HAVE_CMATH_ISINFF)
+inline bool xisinf (float x)
+{ return std::isinf (x); }
+#else
 extern OCTAVE_API bool xisinf (float x);
+#endif
+
 
 extern OCTAVE_API bool octave_is_NA (float x);
 extern OCTAVE_API bool octave_is_NaN_or_NA (float x) GCC_ATTR_DEPRECATED;
@@ -120,9 +158,15 @@
 extern OCTAVE_API FloatComplex xroundb (const FloatComplex& x);
 extern OCTAVE_API FloatComplex signum (const FloatComplex& x);
 
-extern OCTAVE_API bool xisnan (const FloatComplex& x);
-extern OCTAVE_API bool xfinite (const FloatComplex& x);
-extern OCTAVE_API bool xisinf (const FloatComplex& x);
+inline bool
+xisnan (const FloatComplex& x)
+{ return (xisnan (real (x)) || xisnan (imag (x))); }
+inline bool
+xfinite (const FloatComplex& x)
+{ return (xfinite (real (x)) && xfinite (imag (x))); }
+inline bool
+xisinf (const FloatComplex& x)
+{ return (xisinf (real (x)) || xisinf (imag (x))); }
 
 extern OCTAVE_API bool octave_is_NA (const FloatComplex& x);
 extern OCTAVE_API bool octave_is_NaN_or_NA (const FloatComplex& x);
--- a/liboctave/mx-op-defs.h	Thu Mar 19 08:54:56 2009 +0100
+++ b/liboctave/mx-op-defs.h	Thu Mar 19 17:46:38 2009 +0100
@@ -1120,6 +1120,13 @@
 #define MPM_BIN_OPS(R, M, PM) \
   MPM_MULTIPLY_OP(M, PM);
 
+#define NDND_MAPPER_BODY(R, NAME) \
+  R retval (dims ()); \
+  octave_idx_type n = numel (); \
+  for (octave_idx_type i = 0; i < n; i++) \
+    retval.xelem (i) = NAME (elem (i)); \
+  return retval;
+
 #endif
 
 
--- a/src/ChangeLog	Thu Mar 19 08:54:56 2009 +0100
+++ b/src/ChangeLog	Thu Mar 19 17:46:38 2009 +0100
@@ -1,3 +1,16 @@
+2009-03-20  Jaroslav Hajek  <highegg@gmail.com>
+
+	* ov-re-mat.cc (octave_matrix::isnan, octave_matrix::isinf,
+	octave_matrix::finite): Simplify.
+	* ov-flt-re-mat.cc (octave_float_matrix::isnan,
+	octave_float_matrix::isinf, octave_float_matrix::finite): Simplify.
+	* ov-cx-mat.cc (octave_complex_matrix::isnan,
+	octave_complex_matrix::isinf, octave_complex_matrix::finite):
+	Simplify.
+	* ov-flt-cx-mat.cc (octave_float_complex_matrix::isnan,
+	octave_float_complex_matrix::isinf,
+	octave_float_complex_matrix::finite): Simplify.
+
 2009-03-19  Benjamin Lindner  <lindnerb@users.sourceforge.net>
 
 	* ls-oct-ascii.cc (extract_keyword): Replace loop with call to
--- a/src/ov-cx-mat.cc	Thu Mar 19 08:54:56 2009 +0100
+++ b/src/ov-cx-mat.cc	Thu Mar 19 17:46:38 2009 +0100
@@ -856,6 +856,24 @@
   return ::imag (matrix);
 }
 
+octave_value
+octave_complex_matrix::isnan (void) const
+{
+  return matrix.isnan ();
+}
+
+octave_value
+octave_complex_matrix::isinf (void) const
+{
+  return matrix.isinf ();
+}
+
+octave_value
+octave_complex_matrix::finite (void) const
+{
+  return matrix.isfinite ();
+}
+
 DARRAY_MAPPER (erf, NDArray::dmapper, ::erf)
 DARRAY_MAPPER (erfc, NDArray::dmapper, ::erfc)
 DARRAY_MAPPER (gamma, NDArray::dmapper, xgamma)
@@ -888,10 +906,7 @@
 ARRAY_MAPPER (sqrt, ComplexNDArray::cmapper, std::sqrt)
 ARRAY_MAPPER (tan, ComplexNDArray::cmapper, std::tan)
 ARRAY_MAPPER (tanh, ComplexNDArray::cmapper, std::tanh)
-ARRAY_MAPPER (finite, ComplexNDArray::bmapper, xfinite)
-ARRAY_MAPPER (isinf, ComplexNDArray::bmapper, xisinf)
 ARRAY_MAPPER (isna, ComplexNDArray::bmapper, octave_is_NA)
-ARRAY_MAPPER (isnan, ComplexNDArray::bmapper, xisnan)
 
 /*
 ;;; Local Variables: ***
--- a/src/ov-flt-cx-mat.cc	Thu Mar 19 08:54:56 2009 +0100
+++ b/src/ov-flt-cx-mat.cc	Thu Mar 19 17:46:38 2009 +0100
@@ -823,6 +823,24 @@
   return ::imag (matrix);
 }
 
+octave_value
+octave_float_complex_matrix::isnan (void) const
+{
+  return matrix.isnan ();
+}
+
+octave_value
+octave_float_complex_matrix::isinf (void) const
+{
+  return matrix.isinf ();
+}
+
+octave_value
+octave_float_complex_matrix::finite (void) const
+{
+  return matrix.isfinite ();
+}
+
 DARRAY_MAPPER (erf, FloatNDArray::dmapper, ::erff)
 DARRAY_MAPPER (erfc, FloatNDArray::dmapper, ::erfcf)
 DARRAY_MAPPER (gamma, FloatNDArray::dmapper, xgamma)
@@ -855,10 +873,7 @@
 ARRAY_MAPPER (sqrt, FloatComplexNDArray::cmapper, std::sqrt)
 ARRAY_MAPPER (tan, FloatComplexNDArray::cmapper, std::tan)
 ARRAY_MAPPER (tanh, FloatComplexNDArray::cmapper, std::tanh)
-ARRAY_MAPPER (finite, FloatComplexNDArray::bmapper, xfinite)
-ARRAY_MAPPER (isinf, FloatComplexNDArray::bmapper, xisinf)
 ARRAY_MAPPER (isna, FloatComplexNDArray::bmapper, octave_is_NA)
-ARRAY_MAPPER (isnan, FloatComplexNDArray::bmapper, xisnan)
 
 /*
 ;;; Local Variables: ***
--- a/src/ov-flt-re-mat.cc	Thu Mar 19 08:54:56 2009 +0100
+++ b/src/ov-flt-re-mat.cc	Thu Mar 19 17:46:38 2009 +0100
@@ -766,6 +766,24 @@
   return FloatNDArray (matrix.dims (), 0.0);
 }
 
+octave_value
+octave_float_matrix::isnan (void) const
+{
+  return matrix.isnan ();
+}
+
+octave_value
+octave_float_matrix::isinf (void) const
+{
+  return matrix.isinf ();
+}
+
+octave_value
+octave_float_matrix::finite (void) const
+{
+  return matrix.isfinite ();
+}
+
 ARRAY_MAPPER (erf, FloatNDArray::dmapper, ::erff)
 ARRAY_MAPPER (erfc, FloatNDArray::dmapper, ::erfcf)
 ARRAY_MAPPER (gamma, FloatNDArray::dmapper, xgamma)
@@ -797,10 +815,7 @@
 CD_ARRAY_MAPPER (sqrt, ::sqrtf, std::sqrt, 0.0, octave_Float_Inf)
 ARRAY_MAPPER (tan, FloatNDArray::dmapper, ::tanf)
 ARRAY_MAPPER (tanh, FloatNDArray::dmapper, ::tanhf)
-ARRAY_MAPPER (finite, FloatNDArray::bmapper, xfinite)
-ARRAY_MAPPER (isinf, FloatNDArray::bmapper, xisinf)
 ARRAY_MAPPER (isna, FloatNDArray::bmapper, octave_is_NA)
-ARRAY_MAPPER (isnan, FloatNDArray::bmapper, xisnan)
 
 DEFUN (single, args, ,
   "-*- texinfo -*-\n\
--- a/src/ov-re-mat.cc	Thu Mar 19 08:54:56 2009 +0100
+++ b/src/ov-re-mat.cc	Thu Mar 19 17:46:38 2009 +0100
@@ -794,6 +794,24 @@
   return NDArray (matrix.dims (), 0.0);
 }
 
+octave_value
+octave_matrix::isnan (void) const
+{
+  return matrix.isnan ();
+}
+
+octave_value
+octave_matrix::isinf (void) const
+{
+  return matrix.isinf ();
+}
+
+octave_value
+octave_matrix::finite (void) const
+{
+  return matrix.isfinite ();
+}
+
 ARRAY_MAPPER (erf, NDArray::dmapper, ::erf)
 ARRAY_MAPPER (erfc, NDArray::dmapper, ::erfc)
 ARRAY_MAPPER (gamma, NDArray::dmapper, xgamma)
@@ -825,10 +843,7 @@
 CD_ARRAY_MAPPER (sqrt, ::sqrt, std::sqrt, 0.0, octave_Inf)
 ARRAY_MAPPER (tan, NDArray::dmapper, ::tan)
 ARRAY_MAPPER (tanh, NDArray::dmapper, ::tanh)
-ARRAY_MAPPER (finite, NDArray::bmapper, xfinite)
-ARRAY_MAPPER (isinf, NDArray::bmapper, xisinf)
 ARRAY_MAPPER (isna, NDArray::bmapper, octave_is_NA)
-ARRAY_MAPPER (isnan, NDArray::bmapper, xisnan)
 
 DEFUN (double, args, ,
   "-*- texinfo -*-\n\