octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

template instantations


From: John W. Eaton
Subject: template instantations
Date: Wed, 12 Nov 2008 22:44:45 -0500

I'd like to consider reworking the way we are managing template
instantiations.

Back when C++ compilers were first starting to handle templates, we
used to have to instantiate all templates manually.  So that's why
files like Array-{d,C,b,i,...}.cc, exist in the Octave sources.  With
modern compilers, I'm not sure that is necessary, or is even the best
approach.

Should we keep the explicit instantiation files like
Array-{d,C,b,i,...}?

Should we have both Array.h and Array.cc, or combine them into a
single file?

If we do keep both, maybe we should follow the lead of the GNU
libstdc++ files and rename the .cc file .tcc, since it is not a normal
source file, but a set of templates.  Also, the libstdc++ sources use
(for example)

  #ifndef _GLIBCXX_EXPORT_TEMPLATE
  # include <bits/basic_string.tcc> 
  #endif

so I think the basic_string.tcc file is normally included in the
<string> header file.

But some of these files like the Array.{h,cc} combo are fairly large.
If we merge them so that Array.h contains the entire declaration and
definition of this large template class, will that slow down
compilation substantially?

To see what changes like this might do, I took a shot at eliminating
the files {u,}int{8,16,32,64}NDArray.cc and merging the intNDArray.cc
file into the existing intNDArray.h header file.  I'm attaching the
diffs below.  With these changes, all information about the
intNDArray<T> type is in the single header file.  It is now 859 lines
long.

So, does anyone object to these changes?

Should we try to remove other files that perform explicit
instantiations?

Should we try to combine the .h and .cc files that define other
template classes?

Comments?

Thanks,

jwe

diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,26 @@
+2008-11-12  John W. Eaton  <address@hidden>
+
+       * mx-op-defs.h (SND_MINMAX_FCN, NDS_MINMAX_FCN, NDND_MINMAX_FCN,
+       MINMAX_FCNS, MINMAX_DECLS): Delete macros.
+
+       * int8NDArray.cc, int16NDArray.cc, int32NDArray.cc,
+       int64NDArray.cc, uint8NDArray.cc, uint16NDArray.cc,
+       uint32NDArray.cc, uint64NDArray.cc: Delete.
+       * int8NDArray.h, int16NDArray.h, int32NDArray.h,
+       int64NDArray.h, uint8NDArray.h, uint16NDArray.h,
+       uint32NDArray.h, uint64NDArray.h: Don't instantiate template
+       functions here.  Simply include intNDArray.h and provide typedef.
+
+       * intNDArray.cc: Delete.
+       * intNDArray.h: Incorporate contents of intNDArray.h here.
+       Provide template definitions for comparison and boolean ops.
+
+       * Makefile.in (EXTRAS): Remove intNDArray.cc from the list.
+       (MATRIX_SRC): Remove int8NDArray.cc, int16NDArray.cc,
+       int32NDArray.cc, int64NDArray.cc, uint8NDArray.cc,
+       uint16NDArray.cc, uint32NDArray.cc, and uint64NDArray.cc from the
+       list.   
+
 2008-11-12  Jaroslav Hajek <address@hidden>
 
        * DiagArray2.h (DiagArray2<T>::maybe_delete_elements): Remove
diff --git a/liboctave/Makefile.in b/liboctave/Makefile.in
--- a/liboctave/Makefile.in
+++ b/liboctave/Makefile.in
@@ -126,8 +126,6 @@
        MSparse.cc Sparse.cc SparseCmplxLU.cc SparsedbleLU.cc \
        SparseCmplxCHOL.cc SparsedbleCHOL.cc \
        SparseCmplxQR.cc SparseQR.cc MatrixType.cc \
-       int8NDArray.cc uint8NDArray.cc int16NDArray.cc uint16NDArray.cc \
-       int32NDArray.cc uint32NDArray.cc int64NDArray.cc uint64NDArray.cc \
        fCColVector.cc fCRowVector.cc fCDiagMatrix.cc fCMatrix.cc fCNDArray.cc \
        fColVector.cc fRowVector.cc fDiagMatrix.cc fMatrix.cc fNDArray.cc \
        fCmplxAEPBAL.cc fCmplxCHOL.cc fCmplxDET.cc fCmplxGEPBAL.cc \
@@ -189,7 +187,7 @@
        $(LIBOCT_READLINE_SOURCES) \
        $(LIBOCT_PATHSEARCH_SOURCES)
 
-EXTRAS := mx-inlines.cc kpse.cc intNDArray.cc
+EXTRAS := mx-inlines.cc kpse.cc
 
 INCLUDES_FOR_INSTALL := $(INCLUDES) $(BUILT_INCLUDES) $(TEMPLATE_SRC) $(EXTRAS)
 
diff --git a/liboctave/int16NDArray.cc b/liboctave/int16NDArray.cc
deleted file mode 100644
--- a/liboctave/int16NDArray.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// N-D Array  manipulations.
-/*
-
-Copyright (C) 2004, 2005, 2006, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "int16NDArray.h"
-
-#include "intNDArray.cc"
-
-template class OCTAVE_API intNDArray<octave_int16>;
-
-template OCTAVE_API
-std::ostream&
-operator << (std::ostream& os, const intNDArray<octave_int16>& a);
-
-template OCTAVE_API
-std::istream&
-operator >> (std::istream& is, intNDArray<octave_int16>& a);
-
-NDS_CMP_OPS (int16NDArray, , octave_int16, )
-NDS_BOOL_OPS (int16NDArray, octave_int16, octave_int16 (0))
-
-SND_CMP_OPS (octave_int16, , int16NDArray, )
-SND_BOOL_OPS (octave_int16, int16NDArray, octave_int16 (0))
-
-NDND_CMP_OPS (int16NDArray, , int16NDArray, )
-NDND_BOOL_OPS (int16NDArray, int16NDArray, octave_int16 (0))
-
-MINMAX_FCNS (int16)
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
diff --git a/liboctave/int16NDArray.h b/liboctave/int16NDArray.h
--- a/liboctave/int16NDArray.h
+++ b/liboctave/int16NDArray.h
@@ -24,23 +24,9 @@
 #define octave_int16NDArray_h 1
 
 #include "intNDArray.h"
-#include "mx-op-defs.h"
 #include "oct-inttypes.h"
 
 typedef intNDArray<octave_int16> int16NDArray;
-
-NDS_CMP_OP_DECLS (int16NDArray, octave_int16, OCTAVE_API)
-NDS_BOOL_OP_DECLS (int16NDArray, octave_int16, OCTAVE_API)
-
-SND_CMP_OP_DECLS (octave_int16, int16NDArray, OCTAVE_API)
-SND_BOOL_OP_DECLS (octave_int16, int16NDArray, OCTAVE_API)
-
-NDND_CMP_OP_DECLS (int16NDArray, int16NDArray, OCTAVE_API)
-NDND_BOOL_OP_DECLS (int16NDArray, int16NDArray, OCTAVE_API)
-
-MARRAY_FORWARD_DEFS (MArrayN, int16NDArray, octave_int16)
-
-MINMAX_DECLS (int16)
 
 #endif
 
diff --git a/liboctave/int32NDArray.cc b/liboctave/int32NDArray.cc
deleted file mode 100644
--- a/liboctave/int32NDArray.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// N-D Array  manipulations.
-/*
-
-Copyright (C) 2004, 2005, 2006, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "int32NDArray.h"
-
-#include "intNDArray.cc"
-
-template class OCTAVE_API intNDArray<octave_int32>;
-
-template OCTAVE_API
-std::ostream&
-operator << (std::ostream& os, const intNDArray<octave_int32>& a);
-
-template OCTAVE_API
-std::istream&
-operator >> (std::istream& is, intNDArray<octave_int32>& a);
-
-NDS_CMP_OPS (int32NDArray, , octave_int32, )
-NDS_BOOL_OPS (int32NDArray, octave_int32, octave_int32 (0))
-
-SND_CMP_OPS (octave_int32, , int32NDArray, )
-SND_BOOL_OPS (octave_int32, int32NDArray, octave_int32 (0))
-
-NDND_CMP_OPS (int32NDArray, , int32NDArray, )
-NDND_BOOL_OPS (int32NDArray, int32NDArray, octave_int32 (0))
-
-MINMAX_FCNS (int32)
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
diff --git a/liboctave/int32NDArray.h b/liboctave/int32NDArray.h
--- a/liboctave/int32NDArray.h
+++ b/liboctave/int32NDArray.h
@@ -24,23 +24,9 @@
 #define octave_int32NDArray_h 1
 
 #include "intNDArray.h"
-#include "mx-op-defs.h"
 #include "oct-inttypes.h"
 
 typedef intNDArray<octave_int32> int32NDArray;
-
-NDS_CMP_OP_DECLS (int32NDArray, octave_int32, OCTAVE_API)
-NDS_BOOL_OP_DECLS (int32NDArray, octave_int32, OCTAVE_API)
-
-SND_CMP_OP_DECLS (octave_int32, int32NDArray, OCTAVE_API)
-SND_BOOL_OP_DECLS (octave_int32, int32NDArray, OCTAVE_API)
-
-NDND_CMP_OP_DECLS (int32NDArray, int32NDArray, OCTAVE_API)
-NDND_BOOL_OP_DECLS (int32NDArray, int32NDArray, OCTAVE_API)
-
-MARRAY_FORWARD_DEFS (MArrayN, int32NDArray, octave_int32)
-
-MINMAX_DECLS (int32)
 
 #endif
 
diff --git a/liboctave/int64NDArray.cc b/liboctave/int64NDArray.cc
deleted file mode 100644
--- a/liboctave/int64NDArray.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// N-D Array  manipulations.
-/*
-
-Copyright (C) 2004, 2005, 2006, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "int64NDArray.h"
-
-#include "intNDArray.cc"
-
-template class OCTAVE_API intNDArray<octave_int64>;
-
-template OCTAVE_API
-std::ostream&
-operator << (std::ostream& os, const intNDArray<octave_int64>& a);
-
-template OCTAVE_API
-std::istream&
-operator >> (std::istream& is, intNDArray<octave_int64>& a);
-
-NDS_CMP_OPS (int64NDArray, , octave_int64, )
-NDS_BOOL_OPS (int64NDArray, octave_int64, octave_int64 (0))
-
-SND_CMP_OPS (octave_int64, , int64NDArray, )
-SND_BOOL_OPS (octave_int64, int64NDArray, octave_int64 (0))
-
-NDND_CMP_OPS (int64NDArray, , int64NDArray, )
-NDND_BOOL_OPS (int64NDArray, int64NDArray, octave_int64 (0))
-
-MINMAX_FCNS (int64)
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
diff --git a/liboctave/int64NDArray.h b/liboctave/int64NDArray.h
--- a/liboctave/int64NDArray.h
+++ b/liboctave/int64NDArray.h
@@ -24,23 +24,9 @@
 #define octave_int64NDArray_h 1
 
 #include "intNDArray.h"
-#include "mx-op-defs.h"
 #include "oct-inttypes.h"
 
 typedef intNDArray<octave_int64> int64NDArray;
-
-NDS_CMP_OP_DECLS (int64NDArray, octave_int64, OCTAVE_API)
-NDS_BOOL_OP_DECLS (int64NDArray, octave_int64, OCTAVE_API)
-
-SND_CMP_OP_DECLS (octave_int64, int64NDArray, OCTAVE_API)
-SND_BOOL_OP_DECLS (octave_int64, int64NDArray, OCTAVE_API)
-
-NDND_CMP_OP_DECLS (int64NDArray, int64NDArray, OCTAVE_API)
-NDND_BOOL_OP_DECLS (int64NDArray, int64NDArray, OCTAVE_API)
-
-MARRAY_FORWARD_DEFS (MArrayN, int64NDArray, octave_int64)
-
-MINMAX_DECLS (int64)
 
 #endif
 
diff --git a/liboctave/int8NDArray.cc b/liboctave/int8NDArray.cc
deleted file mode 100644
--- a/liboctave/int8NDArray.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// N-D Array  manipulations.
-/*
-
-Copyright (C) 2004, 2005, 2006, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "int8NDArray.h"
-
-#include "intNDArray.cc"
-
-template class OCTAVE_API intNDArray<octave_int8>;
-
-template OCTAVE_API
-std::ostream&
-operator << (std::ostream& os, const intNDArray<octave_int8>& a);
-
-template OCTAVE_API
-std::istream&
-operator >> (std::istream& is, intNDArray<octave_int8>& a);
-
-NDS_CMP_OPS (int8NDArray, , octave_int8, )
-NDS_BOOL_OPS (int8NDArray, octave_int8, octave_int8 (0))
-
-SND_CMP_OPS (octave_int8, , int8NDArray, )
-SND_BOOL_OPS (octave_int8, int8NDArray, octave_int8 (0))
-
-NDND_CMP_OPS (int8NDArray, , int8NDArray, )
-NDND_BOOL_OPS (int8NDArray, int8NDArray, octave_int8 (0))
-
-MINMAX_FCNS (int8)
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
diff --git a/liboctave/int8NDArray.h b/liboctave/int8NDArray.h
--- a/liboctave/int8NDArray.h
+++ b/liboctave/int8NDArray.h
@@ -24,23 +24,9 @@
 #define octave_int8NDArray_h 1
 
 #include "intNDArray.h"
-#include "mx-op-defs.h"
 #include "oct-inttypes.h"
 
 typedef intNDArray<octave_int8> int8NDArray;
-
-NDS_CMP_OP_DECLS (int8NDArray, octave_int8, OCTAVE_API)
-NDS_BOOL_OP_DECLS (int8NDArray, octave_int8, OCTAVE_API)
-
-SND_CMP_OP_DECLS (octave_int8, int8NDArray, OCTAVE_API)
-SND_BOOL_OP_DECLS (octave_int8, int8NDArray, OCTAVE_API)
-
-NDND_CMP_OP_DECLS (int8NDArray, int8NDArray, OCTAVE_API)
-NDND_BOOL_OP_DECLS (int8NDArray, int8NDArray, OCTAVE_API)
-
-MARRAY_FORWARD_DEFS (MArrayN, int8NDArray, octave_int8)
-
-MINMAX_DECLS (int8)
 
 #endif
 
diff --git a/liboctave/intNDArray.cc b/liboctave/intNDArray.cc
deleted file mode 100644
--- a/liboctave/intNDArray.cc
+++ /dev/null
@@ -1,355 +0,0 @@
-// N-D Array  manipulations.
-/*
-
-Copyright (C) 2004, 2005, 2006, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Array-util.h"
-#include "mx-base.h"
-#include "lo-ieee.h"
-
-// unary operations
-
-template <class T>
-boolNDArray
-intNDArray<T>::operator ! (void) const
-{
-  boolNDArray b (this->dims ());
-
-  for (octave_idx_type i = 0; i < this->length (); i++)
-    b.elem (i) = ! this->elem (i);
-
-  return b;
-}
-
-template <class T>
-bool
-intNDArray<T>::any_element_not_one_or_zero (void) const
-{
-  octave_idx_type nel = this->nelem ();
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      T val = this->elem (i);
-
-      if (val != 0.0 && val != 1.0)
-       return true;
-    }
-
-  return false;
-}
-
-template <class T>
-intNDArray<T>
-intNDArray<T>::diag (octave_idx_type k) const
-{
-  return MArrayN<T>::diag (k);
-}
-
-// FIXME -- this is not quite the right thing.
-
-template <class T>
-boolNDArray
-intNDArray<T>::all (int dim) const
-{
-  MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (this->elem (iter_idx) == T (0)), 
true);
-}
-
-template <class T>
-boolNDArray
-intNDArray<T>::any (int dim) const
-{
-  MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (this->elem (iter_idx) != T (0)), 
false);
-}
-
-template <class T>
-void
-intNDArray<T>::increment_index (Array<octave_idx_type>& ra_idx,
-                              const dim_vector& dimensions,
-                              int start_dimension)
-{
-  ::increment_index (ra_idx, dimensions, start_dimension);
-}
-
-template <class T>
-octave_idx_type 
-intNDArray<T>::compute_index (Array<octave_idx_type>& ra_idx,
-                             const dim_vector& dimensions)
-{
-  return ::compute_index (ra_idx, dimensions);
-}
-
-template <class T>
-intNDArray<T>
-intNDArray<T>::concat (const intNDArray<T>& rb, const Array<octave_idx_type>& 
ra_idx)
-{
-  if (rb.numel () > 0)
-    insert (rb, ra_idx);
-  return *this;
-}
-
-template <class T>
-intNDArray<T>&
-intNDArray<T>::insert (const intNDArray<T>& a, octave_idx_type r, 
octave_idx_type c)
-{
-  Array<T>::insert (a, r, c);
-  return *this;
-}
-
-template <class T>
-intNDArray<T>&
-intNDArray<T>::insert (const intNDArray<T>& a, const Array<octave_idx_type>& 
ra_idx)
-{
-  Array<T>::insert (a, ra_idx);
-  return *this;
-}
-
-// This contains no information on the array structure !!!
-
-template <class T>
-std::ostream&
-operator << (std::ostream& os, const intNDArray<T>& a)
-{
-  octave_idx_type nel = a.nelem ();
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    os << " " << a.elem (i) << "\n";
-
-  return os;
-}
-
-template <class T>
-std::istream&
-operator >> (std::istream& is, intNDArray<T>& a)
-{
-  octave_idx_type nel = a.nelem ();
-
-  if (nel < 1 )
-    is.clear (std::ios::badbit);
-  else
-    {
-      T tmp;
-
-      for (octave_idx_type i = 0; i < nel; i++)
-       {
-         is >> tmp;
-
-         if (is)
-           a.elem (i) = tmp;
-         else
-           goto done;
-       }
-    }
-
- done:
-
-  return is;
-}
-
-// FIXME -- should abs and signum just be mapper functions?
-
-template <class T>
-intNDArray<T>
-intNDArray<T>::abs (void) const
-{
-  octave_idx_type nel = this->nelem ();
-  intNDArray<T> ret (*this);
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      T val = this->elem (i);
-      ret.xelem (i) = val.abs ();
-    }
-
-  return ret;
-}
-
-template <class T>
-intNDArray<T>
-intNDArray<T>::signum (void) const
-{
-  octave_idx_type nel = this->nelem ();
-  intNDArray<T> ret (*this);
-
-  for (octave_idx_type i = 0; i < nel; i++)
-    {
-      T val = this->elem (i);
-      ret.xelem (i) = val.signum ();
-    }
-
-  return ret;
-}
-
-template <class T>
-intNDArray<T>
-intNDArray<T>::sum (int dim) const
-{
-  MX_ND_REDUCTION (retval(result_idx) += intNDArray<T>::elem (iter_idx), 0, 
intNDArray<T>);
-}
-
-template <class T>
-intNDArray<T>
-intNDArray<T>::max (int dim) const
-{
-  ArrayN<octave_idx_type> dummy_idx;
-  return max (dummy_idx, dim);
-}
-
-template <class T>
-intNDArray<T>
-intNDArray<T>::max (ArrayN<octave_idx_type>& idx_arg, int dim) const
-{
-  dim_vector dv = this->dims ();
-  dim_vector dr = this->dims ();
-
-  if (dv.numel () == 0 || dim > dv.length () || dim < 0)
-    return intNDArray<T> ();
-  
-  dr(dim) = 1;
-
-  intNDArray<T> result (dr);
-  idx_arg.resize (dr);
-
-  octave_idx_type x_stride = 1;
-  octave_idx_type x_len = dv(dim);
-  for (int i = 0; i < dim; i++)
-    x_stride *= dv(i);
-
-  for (octave_idx_type i = 0; i < dr.numel (); i++)
-    {
-      octave_idx_type x_offset;
-      if (x_stride == 1)
-       x_offset = i * x_len;
-      else
-       {
-         octave_idx_type x_offset2 = 0;
-         x_offset = i;
-         while (x_offset >= x_stride)
-           {
-             x_offset -= x_stride;
-             x_offset2++;
-           }
-         x_offset += x_offset2 * x_stride * x_len;
-       }
-
-      octave_idx_type idx_j = 0;
-
-      T tmp_max = this->elem (x_offset);
-
-      for (octave_idx_type j = 1; j < x_len; j++)
-       {
-         T tmp = this->elem (j * x_stride + x_offset);
-
-         if (tmp > tmp_max)
-           {
-             idx_j = j;
-             tmp_max = tmp;
-           }
-       }
-
-      result.elem (i) = tmp_max;
-      idx_arg.elem (i) = idx_j;
-    }
-
-  result.chop_trailing_singletons ();
-  idx_arg.chop_trailing_singletons ();
-
-  return result;
-}
-
-template <class T>
-intNDArray<T>
-intNDArray<T>::min (int dim) const
-{
-  ArrayN<octave_idx_type> dummy_idx;
-  return min (dummy_idx, dim);
-}
-
-template <class T>
-intNDArray<T>
-intNDArray<T>::min (ArrayN<octave_idx_type>& idx_arg, int dim) const
-{
-  dim_vector dv = this->dims ();
-  dim_vector dr = this->dims ();
-
-  if (dv.numel () == 0 || dim > dv.length () || dim < 0)
-    return intNDArray<T> ();
-  
-  dr(dim) = 1;
-
-  intNDArray<T> result (dr);
-  idx_arg.resize (dr);
-
-  octave_idx_type x_stride = 1;
-  octave_idx_type x_len = dv(dim);
-  for (int i = 0; i < dim; i++)
-    x_stride *= dv(i);
-
-  for (octave_idx_type i = 0; i < dr.numel (); i++)
-    {
-      octave_idx_type x_offset;
-      if (x_stride == 1)
-       x_offset = i * x_len;
-      else
-       {
-         octave_idx_type x_offset2 = 0;
-         x_offset = i;
-         while (x_offset >= x_stride)
-           {
-             x_offset -= x_stride;
-             x_offset2++;
-           }
-         x_offset += x_offset2 * x_stride * x_len;
-       }
-
-      octave_idx_type idx_j = 0;
-
-      T tmp_min = this->elem (x_offset);
-
-      for (octave_idx_type j = 1; j < x_len; j++)
-       {
-         T tmp = this->elem (j * x_stride + x_offset);
-
-         if (tmp < tmp_min)
-           {
-             idx_j = j;
-             tmp_min = tmp;
-           }
-       }
-
-      result.elem (i) = tmp_min;
-      idx_arg.elem (i) = idx_j;
-    }
-
-  result.chop_trailing_singletons ();
-  idx_arg.chop_trailing_singletons ();
-
-  return result;
-}
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
diff --git a/liboctave/intNDArray.h b/liboctave/intNDArray.h
--- a/liboctave/intNDArray.h
+++ b/liboctave/intNDArray.h
@@ -23,8 +23,10 @@
 #if !defined (octave_intNDArray_h)
 #define octave_intNDArray_h 1
 
+#include "Array-util.h"
 #include "MArrayN.h"
 #include "boolNDArray.h"
+#include "lo-ieee.h"
 
 template <class T>
 class
@@ -67,8 +69,6 @@
 
   intNDArray diag (octave_idx_type k = 0) const;
 
-  // FIXME -- this is not quite the right thing.
-
   boolNDArray all (int dim = -1) const;
   boolNDArray any (int dim = -1) const;
 
@@ -88,10 +88,14 @@
   intNDArray transpose (void) const
     { return intNDArray<T> (MArrayN<T>::transpose ()); }
 
-  intNDArray concat (const intNDArray<T>& rb, const Array<octave_idx_type>& 
ra_idx);
+  intNDArray concat (const intNDArray<T>& rb,
+                    const Array<octave_idx_type>& ra_idx);
 
-  intNDArray& insert (const intNDArray<T>& a, octave_idx_type r, 
octave_idx_type c);
-  intNDArray& insert (const intNDArray<T>& a, const Array<octave_idx_type>& 
ra_idx);
+  intNDArray& insert (const intNDArray<T>& a,
+                     octave_idx_type r, octave_idx_type c);
+
+  intNDArray& insert (const intNDArray<T>& a,
+                     const Array<octave_idx_type>& ra_idx);
 
   static void increment_index (Array<octave_idx_type>& ra_idx,
                               const dim_vector& dimensions,
@@ -109,11 +113,742 @@
 
 // i/o
 
-template <class T>
-std::ostream& operator << (std::ostream& os, const intNDArray<T>& a);
+// This contains no information on the array structure !!!
 
 template <class T>
-std::istream& operator >> (std::istream& is, intNDArray<T>& a);
+std::ostream&
+operator << (std::ostream& os, const intNDArray<T>& a)
+{
+  octave_idx_type nel = a.nelem ();
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    os << " " << a.elem (i) << "\n";
+
+  return os;
+}
+
+template <class T>
+std::istream&
+operator >> (std::istream& is, intNDArray<T>& a)
+{
+  octave_idx_type nel = a.nelem ();
+
+  if (nel < 1)
+    is.clear (std::ios::badbit);
+  else
+    {
+      T tmp;
+
+      for (octave_idx_type i = 0; i < nel; i++)
+       {
+         is >> tmp;
+
+         if (is)
+           a.elem (i) = tmp;
+         else
+           goto done;
+       }
+    }
+
+ done:
+
+  return is;
+}
+
+// unary operations
+
+template <class T>
+boolNDArray
+intNDArray<T>::operator ! (void) const
+{
+  boolNDArray b (this->dims ());
+
+  for (octave_idx_type i = 0; i < this->length (); i++)
+    b.elem (i) = ! this->elem (i);
+
+  return b;
+}
+
+template <class T>
+bool
+intNDArray<T>::any_element_not_one_or_zero (void) const
+{
+  octave_idx_type nel = this->nelem ();
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      T val = this->elem (i);
+
+      if (val != 0.0 && val != 1.0)
+       return true;
+    }
+
+  return false;
+}
+
+template <class T>
+intNDArray<T>
+intNDArray<T>::diag (octave_idx_type k) const
+{
+  return MArrayN<T>::diag (k);
+}
+
+template <class T>
+boolNDArray
+intNDArray<T>::all (int dim) const
+{
+  MX_ND_ANY_ALL_REDUCTION (MX_ND_ALL_EVAL (this->elem (iter_idx) == T (0)), 
true);
+}
+
+template <class T>
+boolNDArray
+intNDArray<T>::any (int dim) const
+{
+  MX_ND_ANY_ALL_REDUCTION (MX_ND_ANY_EVAL (this->elem (iter_idx) != T (0)), 
false);
+}
+
+template <class T>
+void
+intNDArray<T>::increment_index (Array<octave_idx_type>& ra_idx,
+                              const dim_vector& dimensions,
+                              int start_dimension)
+{
+  ::increment_index (ra_idx, dimensions, start_dimension);
+}
+
+template <class T>
+octave_idx_type 
+intNDArray<T>::compute_index (Array<octave_idx_type>& ra_idx,
+                             const dim_vector& dimensions)
+{
+  return ::compute_index (ra_idx, dimensions);
+}
+
+template <class T>
+intNDArray<T>
+intNDArray<T>::concat (const intNDArray<T>& rb, const Array<octave_idx_type>& 
ra_idx)
+{
+  if (rb.numel () > 0)
+    insert (rb, ra_idx);
+  return *this;
+}
+
+template <class T>
+intNDArray<T>&
+intNDArray<T>::insert (const intNDArray<T>& a, octave_idx_type r, 
octave_idx_type c)
+{
+  Array<T>::insert (a, r, c);
+  return *this;
+}
+
+template <class T>
+intNDArray<T>&
+intNDArray<T>::insert (const intNDArray<T>& a, const Array<octave_idx_type>& 
ra_idx)
+{
+  Array<T>::insert (a, ra_idx);
+  return *this;
+}
+
+// FIXME -- should abs and signum just be mapper functions?
+
+template <class T>
+intNDArray<T>
+intNDArray<T>::abs (void) const
+{
+  octave_idx_type nel = this->nelem ();
+  intNDArray<T> ret (*this);
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      T val = this->elem (i);
+      ret.xelem (i) = val.abs ();
+    }
+
+  return ret;
+}
+
+template <class T>
+intNDArray<T>
+intNDArray<T>::signum (void) const
+{
+  octave_idx_type nel = this->nelem ();
+  intNDArray<T> ret (*this);
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      T val = this->elem (i);
+      ret.xelem (i) = val.signum ();
+    }
+
+  return ret;
+}
+
+template <class T>
+intNDArray<T>
+intNDArray<T>::sum (int dim) const
+{
+  MX_ND_REDUCTION (retval(result_idx) += intNDArray<T>::elem (iter_idx), 0, 
intNDArray<T>);
+}
+
+template <class T>
+intNDArray<T>
+intNDArray<T>::max (int dim) const
+{
+  ArrayN<octave_idx_type> dummy_idx;
+  return max (dummy_idx, dim);
+}
+
+template <class T>
+intNDArray<T>
+intNDArray<T>::max (ArrayN<octave_idx_type>& idx_arg, int dim) const
+{
+  dim_vector dv = this->dims ();
+  dim_vector dr = this->dims ();
+
+  if (dv.numel () == 0 || dim > dv.length () || dim < 0)
+    return intNDArray<T> ();
+  
+  dr(dim) = 1;
+
+  intNDArray<T> result (dr);
+  idx_arg.resize (dr);
+
+  octave_idx_type x_stride = 1;
+  octave_idx_type x_len = dv(dim);
+  for (int i = 0; i < dim; i++)
+    x_stride *= dv(i);
+
+  for (octave_idx_type i = 0; i < dr.numel (); i++)
+    {
+      octave_idx_type x_offset;
+      if (x_stride == 1)
+       x_offset = i * x_len;
+      else
+       {
+         octave_idx_type x_offset2 = 0;
+         x_offset = i;
+         while (x_offset >= x_stride)
+           {
+             x_offset -= x_stride;
+             x_offset2++;
+           }
+         x_offset += x_offset2 * x_stride * x_len;
+       }
+
+      octave_idx_type idx_j = 0;
+
+      T tmp_max = this->elem (x_offset);
+
+      for (octave_idx_type j = 1; j < x_len; j++)
+       {
+         T tmp = this->elem (j * x_stride + x_offset);
+
+         if (tmp > tmp_max)
+           {
+             idx_j = j;
+             tmp_max = tmp;
+           }
+       }
+
+      result.elem (i) = tmp_max;
+      idx_arg.elem (i) = idx_j;
+    }
+
+  result.chop_trailing_singletons ();
+  idx_arg.chop_trailing_singletons ();
+
+  return result;
+}
+
+template <class T>
+intNDArray<T>
+intNDArray<T>::min (int dim) const
+{
+  ArrayN<octave_idx_type> dummy_idx;
+  return min (dummy_idx, dim);
+}
+
+template <class T>
+intNDArray<T>
+intNDArray<T>::min (ArrayN<octave_idx_type>& idx_arg, int dim) const
+{
+  dim_vector dv = this->dims ();
+  dim_vector dr = this->dims ();
+
+  if (dv.numel () == 0 || dim > dv.length () || dim < 0)
+    return intNDArray<T> ();
+  
+  dr(dim) = 1;
+
+  intNDArray<T> result (dr);
+  idx_arg.resize (dr);
+
+  octave_idx_type x_stride = 1;
+  octave_idx_type x_len = dv(dim);
+  for (int i = 0; i < dim; i++)
+    x_stride *= dv(i);
+
+  for (octave_idx_type i = 0; i < dr.numel (); i++)
+    {
+      octave_idx_type x_offset;
+      if (x_stride == 1)
+       x_offset = i * x_len;
+      else
+       {
+         octave_idx_type x_offset2 = 0;
+         x_offset = i;
+         while (x_offset >= x_stride)
+           {
+             x_offset -= x_stride;
+             x_offset2++;
+           }
+         x_offset += x_offset2 * x_stride * x_len;
+       }
+
+      octave_idx_type idx_j = 0;
+
+      T tmp_min = this->elem (x_offset);
+
+      for (octave_idx_type j = 1; j < x_len; j++)
+       {
+         T tmp = this->elem (j * x_stride + x_offset);
+
+         if (tmp < tmp_min)
+           {
+             idx_j = j;
+             tmp_min = tmp;
+           }
+       }
+
+      result.elem (i) = tmp_min;
+      idx_arg.elem (i) = idx_j;
+    }
+
+  result.chop_trailing_singletons ();
+  idx_arg.chop_trailing_singletons ();
+
+  return result;
+}
+
+#define MINMAX_DECLS(FCN) \
+  template <class T> \
+  extern OCTAVE_API intNDArray<T> \
+  FCN (T d, const intNDArray<T>& m); \
+ \
+  template <class T> \
+  extern OCTAVE_API intNDArray<T> \
+  FCN (const intNDArray<T>& m, T d); \
+ \
+  template <class T> \
+  extern OCTAVE_API intNDArray<T> \
+  FCN (const intNDArray<T>& a, const intNDArray<T>& b);
+
+MINMAX_DECLS (min)
+MINMAX_DECLS (max)
+
+#undef MINMAX_DECLS
+
+#define CMP_OP_DECLS(OP) \
+  template <class T> \
+  extern OCTAVE_API boolNDArray \
+  mx_el_ ## OP (const intNDArray<T>&, const T&); \
+ \
+  template <class T> \
+  extern OCTAVE_API boolNDArray \
+  mx_el_lt (const T&, const intNDArray<T>&); \
+ \
+  template <class T> \
+  extern OCTAVE_API boolNDArray \
+  mx_el_lt (const intNDArray<T>&, const intNDArray<T>&);
+
+CMP_OP_DECLS (lt)
+CMP_OP_DECLS (le)
+CMP_OP_DECLS (ge)
+CMP_OP_DECLS (gt)
+CMP_OP_DECLS (eq)
+CMP_OP_DECLS (ne)
+
+#undef CMP_OP_DECLS
+
+#define BOOL_OP_DECLS(OP) \
+  template <class T> \
+  extern OCTAVE_API boolNDArray \
+  operator OP (const intNDArray<T>&, const T&); \
+ \
+  template <class T> \
+  extern OCTAVE_API boolNDArray \
+  operator OP (const T&, const intNDArray<T>&); \
+ \
+  template <class T> \
+  extern OCTAVE_API boolNDArray \
+  operator OP (const intNDArray<T>&, const intNDArray<T>&);
+
+BOOL_OP_DECLS (&&)
+BOOL_OP_DECLS (||)
+
+#undef BOOL_OP_DECLS
+
+// A function that can be used to forward OP= operations from derived
+// classes back to us.
+#define OP_ASSIGN_FWD_FCN(F, C_X, X_T, C_Y, Y_T) \
+  template <class T> \
+  inline intNDArray<T> \
+  F (X_T& x, const Y_T& y) \
+  { \
+    return intNDArray<T> (F (C_X (x), C_Y (y))); \
+  }
+
+// All the OP= operators that we care about forwarding.
+#define OP_ASSIGN_FWD_DEFS(C_X, X_T, C_Y, Y_T) \
+  OP_ASSIGN_FWD_FCN (operator +=, C_X, X_T, C_Y, Y_T) \
+  OP_ASSIGN_FWD_FCN (operator -=, C_X, X_T, C_Y, Y_T)
+
+OP_ASSIGN_FWD_DEFS (dynamic_cast<MArrayN<T>&>, intNDArray<T>, , T)
+
+OP_ASSIGN_FWD_DEFS (dynamic_cast<MArrayN<T>&>, intNDArray<T>,
+                   dynamic_cast<const MArrayN<T>&>, intNDArray<T>)
+
+#undef OP_ASSIGN_FWD_FCN
+#undef OP_ASSIGN_FWD_DEFS
+
+
+// A function that can be used to forward unary operations from derived
+// classes back to us.
+#define UNOP_FWD_FCN(F, C_X, X_T) \
+  template <class T> \
+  inline intNDArray<T> \
+  F (const X_T& x) \
+  { \
+    return intNDArray<T> (F (C_X (x))); \
+  }
+
+// All the unary operators that we care about forwarding.
+#define UNOP_FWD_DEFS(C_X, X_T) \
+  UNOP_FWD_FCN (operator +, C_X, X_T) \
+  UNOP_FWD_FCN (operator -, C_X, X_T)
+
+UNOP_FWD_DEFS (dynamic_cast<const MArrayN<T>&>, intNDArray<T>)
+
+#undef UNOP_FWD_FCN
+#undef UNOP_FWD_DEFS
+
+
+// A function that can be used to forward binary operations from derived
+// classes back to us.
+#define BINOP_FWD_FCN(F, C_X, X_T, C_Y, Y_T) \
+  template <class T> \
+  inline intNDArray<T> \
+  F (const X_T& x, const Y_T& y) \
+  { \
+    return intNDArray<T> (F (C_X (x), C_Y (y))); \
+  }
+
+// The binary operators that we care about forwarding.  We have two
+// sets of macros since the MArray OP MArray operations use functions
+// (product and quotient) instead of operators (*, /).
+#define BINOP_FWD_DEFS(C_X, X_T, C_Y, Y_T) \
+  BINOP_FWD_FCN (operator +, C_X, X_T, C_Y, Y_T) \
+  BINOP_FWD_FCN (operator -, C_X, X_T, C_Y, Y_T) \
+  BINOP_FWD_FCN (operator *, C_X, X_T, C_Y, Y_T) \
+  BINOP_FWD_FCN (operator /, C_X, X_T, C_Y, Y_T)
+
+BINOP_FWD_DEFS (dynamic_cast<const MArrayN<T>&>, intNDArray<T>, , T)
+
+BINOP_FWD_DEFS ( , T, dynamic_cast<const MArrayN<T>&>, intNDArray<T>)
+
+#define AA_BINOP_FWD_DEFS(C_X, X_T, C_Y, Y_T) \
+  BINOP_FWD_FCN (operator +, C_X, X_T, C_Y, Y_T) \
+  BINOP_FWD_FCN (operator -, C_X, X_T, C_Y, Y_T) \
+  BINOP_FWD_FCN (product,    C_X, X_T, C_Y, Y_T) \
+  BINOP_FWD_FCN (quotient,   C_X, X_T, C_Y, Y_T)
+
+AA_BINOP_FWD_DEFS (dynamic_cast<const MArrayN<T>&>, intNDArray<T>,
+                  dynamic_cast<const MArrayN<T>&>, intNDArray<T>)
+
+#undef BINOP_FWD_FCN
+#undef BINOP_FWD_DEFS
+#undef AA_BINOP_FWD_DEFS
+
+#define SND_MINMAX_FCN(FCN, OP, T) \
+  template <class T> \
+  intNDArray<T> \
+  FCN (T d, const intNDArray<T>& m) \
+  { \
+    dim_vector dv = m.dims (); \
+    octave_idx_type nel = dv.numel (); \
+ \
+    if (nel == 0)      \
+      return intNDArray<T> (dv); \
+ \
+    intNDArray<T> result (dv); \
+ \
+    for (octave_idx_type i = 0; i < nel; i++) \
+      { \
+       OCTAVE_QUIT; \
+       result (i) = d OP m (i) ? d : m(i); \
+      } \
+ \
+    return result; \
+  }
+
+SND_MINMAX_FCN (min, <, T)
+SND_MINMAX_FCN (max, >, T)
+
+#undef SND_MINMAX_FCN
+
+#define NDS_MINMAX_FCN(FCN, OP, T) \
+  template <class T> \
+  intNDArray<T> \
+  FCN (const intNDArray<T>& m, T d) \
+  { \
+    dim_vector dv = m.dims (); \
+    octave_idx_type nel = dv.numel (); \
+ \
+    if (nel == 0)      \
+      return intNDArray<T> (dv); \
+ \
+    intNDArray<T> result (dv); \
+ \
+    for (octave_idx_type i = 0; i < nel; i++) \
+      { \
+       OCTAVE_QUIT; \
+       result (i) = m (i) OP d ? m(i) : d; \
+      } \
+ \
+    return result; \
+  }
+
+NDS_MINMAX_FCN (min, <, T)
+NDS_MINMAX_FCN (max, >, T)
+
+#undef NDS_MINMAX_FCN
+
+#define NDND_MINMAX_FCN(FCN, OP, T) \
+  template <class T> \
+  intNDArray<T> \
+  FCN (const intNDArray<T>& a, const intNDArray<T>& b) \
+  { \
+    dim_vector dv = a.dims (); \
+    octave_idx_type nel = dv.numel (); \
+ \
+    if (dv != b.dims ()) \
+      { \
+       (*current_liboctave_error_handler) \
+         ("two-arg min expecting args of same size"); \
+       return intNDArray<T> (); \
+      } \
+ \
+    if (nel == 0)      \
+      return intNDArray<T> (dv); \
+ \
+    intNDArray<T> result (dv); \
+ \
+    for (octave_idx_type i = 0; i < nel; i++) \
+      { \
+       OCTAVE_QUIT; \
+       result (i) = a(i) OP b(i) ? a(i) : b(i); \
+      } \
+ \
+    return result; \
+  }
+
+NDND_MINMAX_FCN (min, <, T)
+NDND_MINMAX_FCN (max, >, T)
+
+#undef NDND_MINMAX_FCN
+
+#define NDS_CMP_OP_FCN(F, OP) \
+  template <class T> \
+  boolNDArray \
+  F (const intNDArray<T>& m, const T& s) \
+  { \
+    boolNDArray r; \
+ \
+    int len = m.length (); \
+ \
+    r.resize (m.dims ()); \
+ \
+    for (int i = 0; i < len; i++) \
+      r.elem (i) = m.elem (i) OP s; \
+ \
+    return r; \
+  }
+
+NDS_CMP_OP_FCN (mx_el_lt, <)
+NDS_CMP_OP_FCN (mx_el_le, <=)
+NDS_CMP_OP_FCN (mx_el_ge, >=)
+NDS_CMP_OP_FCN (mx_el_gt, >)
+NDS_CMP_OP_FCN (mx_el_eq, ==)
+NDS_CMP_OP_FCN (mx_el_ne, !=)
+
+#undef NDS_CMP_OP_FCN
+
+#define NDS_BOOL_OP_FCN(F, OP) \
+  template <class T> \
+  boolNDArray \
+  F (const intNDArray<T>& m, const T& s) \
+  { \
+    boolNDArray r; \
+ \
+    int len = m.length (); \
+ \
+    if (len > 0) \
+      { \
+        r.resize (m.dims ()); \
+ \
+       if (xisnan (s)) \
+         gripe_nan_to_logical_conversion (); \
+       else \
+         { \
+           for (int i = 0; i < len; i++) \
+             if (xisnan (m.elem (i))) \
+               { \
+                 gripe_nan_to_logical_conversion (); \
+                 return r; \
+               } \
+             else \
+               r.elem (i) = (m.elem (i) != T (0)) OP (s != T (0)); \
+         } \
+      } \
+ \
+    return r; \
+  }
+
+NDS_BOOL_OP_FCN (mx_el_and, &&)
+NDS_BOOL_OP_FCN (mx_el_or,  ||)
+
+#undef NDS_BOOL_OP_FCN
+
+#define SND_CMP_OP_FCN(F, OP) \
+  template <class T> \
+  boolNDArray \
+  F (const T& s, const intNDArray<T>& m) \
+  { \
+    boolNDArray r; \
+ \
+    int len = m.length (); \
+ \
+    r.resize (m.dims ()); \
+ \
+    for (int i = 0; i < len; i++) \
+      r.elem (i) = s OP m.elem (i); \
+ \
+    return r; \
+  }
+
+SND_CMP_OP_FCN (mx_el_lt, <)
+SND_CMP_OP_FCN (mx_el_le, <=)
+SND_CMP_OP_FCN (mx_el_ge, >=)
+SND_CMP_OP_FCN (mx_el_gt, >)
+SND_CMP_OP_FCN (mx_el_eq, ==)
+SND_CMP_OP_FCN (mx_el_ne, !=)
+
+#undef SND_CMP_OP_FCN
+
+#define SND_BOOL_OP_FCN(F, OP) \
+  template <class T> \
+  boolNDArray \
+  F (const T& s, const intNDArray<T>& m) \
+  { \
+    boolNDArray r; \
+ \
+    int len = m.length (); \
+ \
+    if (len > 0) \
+      { \
+        r.resize (m.dims ()); \
+ \
+       if (xisnan (s)) \
+         gripe_nan_to_logical_conversion (); \
+       else \
+         { \
+           for (int i = 0; i < len; i++) \
+             if (xisnan (m.elem (i))) \
+               { \
+                 gripe_nan_to_logical_conversion (); \
+                 return r; \
+               } \
+             else \
+               r.elem (i) = (s != T (0)) OP (m.elem (i) != T (0)); \
+           } \
+      } \
+ \
+    return r; \
+  }
+
+SND_BOOL_OP_FCN (mx_el_and, &&)
+SND_BOOL_OP_FCN (mx_el_or,  ||)
+
+#undef SND_BOOL_OP_FCN
+
+#define NDND_CMP_OP_FCN(F, OP) \
+  template <class T> \
+  boolNDArray \
+  F (const intNDArray<T>& m1, const intNDArray<T>& m2) \
+  { \
+    boolNDArray r; \
+ \
+    dim_vector m1_dims = m1.dims (); \
+    dim_vector m2_dims = m2.dims (); \
+ \
+    if (m1_dims == m2_dims) \
+      { \
+       r.resize (m1_dims); \
+ \
+       for (int i = 0; i < m1.length (); i++) \
+         r.elem (i) = m1.elem (i) OP m2.elem (i); \
+      } \
+    else \
+      gripe_nonconformant (#F, m1_dims, m2_dims); \
+ \
+    return r; \
+  }
+
+NDND_CMP_OP_FCN (mx_el_lt, <)
+NDND_CMP_OP_FCN (mx_el_le, <=)
+NDND_CMP_OP_FCN (mx_el_ge, >=)
+NDND_CMP_OP_FCN (mx_el_gt, >)
+NDND_CMP_OP_FCN (mx_el_eq, ==)
+NDND_CMP_OP_FCN (mx_el_ne, !=)
+
+#undef NDND_CMP_OP_FCN
+
+#define NDND_BOOL_OP_FCN(F, OP) \
+  template <class T> \
+  boolNDArray \
+  F (const intNDArray<T>& m1, const intNDArray<T>& m2) \
+  { \
+    boolNDArray r; \
+ \
+    dim_vector m1_dims = m1.dims (); \
+    dim_vector m2_dims = m2.dims (); \
+ \
+    if (m1_dims == m2_dims) \
+      { \
+       if (! m1_dims.all_zero ()) \
+         { \
+           r.resize (m1_dims); \
+ \
+           for (int i = 0; i < m1.length (); i++) \
+             if (xisnan (m1.elem (i)) || xisnan (m2.elem (i))) \
+               { \
+                 gripe_nan_to_logical_conversion (); \
+                 return r; \
+               } \
+             else \
+               r.elem (i) = (m1.elem(i) != T (0)) OP (m2.elem(i) != T (0)); \
+         } \
+      } \
+    else \
+      gripe_nonconformant (#F, m1_dims, m2_dims); \
+ \
+    return r; \
+  }
+
+NDND_BOOL_OP_FCN (mx_el_and, &&)
+NDND_BOOL_OP_FCN (mx_el_or,  ||)
+
+#undef NDND_BOOL_OP_FCN
 
 #endif
 
diff --git a/liboctave/mx-op-defs.h b/liboctave/mx-op-defs.h
--- a/liboctave/mx-op-defs.h
+++ b/liboctave/mx-op-defs.h
@@ -1200,95 +1200,6 @@
 
 #endif
 
-#define SND_MINMAX_FCN(FCN, OP, T) \
-T ## NDArray \
-FCN (octave_ ## T d, const T ## NDArray& m) \
-{ \
-  dim_vector dv = m.dims (); \
-  octave_idx_type nel = dv.numel (); \
-\
-  if (nel == 0)        \
-    return T ## NDArray (dv); \
-\
-  T ## NDArray result (dv); \
-\
-  for (octave_idx_type i = 0; i < nel; i++) \
-    { \
-      OCTAVE_QUIT; \
-      result (i) = d OP m (i) ? d : m(i); \
-    } \
-\
-  return result; \
-}
-
-#define NDS_MINMAX_FCN(FCN, OP, T) \
-T ## NDArray \
-FCN (const T ## NDArray& m, octave_ ## T d) \
-{ \
-  dim_vector dv = m.dims (); \
-  octave_idx_type nel = dv.numel (); \
-\
-  if (nel == 0)        \
-    return T ## NDArray (dv); \
-\
-  T ## NDArray result (dv); \
-\
-  for (octave_idx_type i = 0; i < nel; i++) \
-    { \
-      OCTAVE_QUIT; \
-      result (i) = m (i) OP d ? m(i) : d; \
-    } \
-\
-  return result; \
-}
-
-#define NDND_MINMAX_FCN(FCN, OP, T) \
-T ## NDArray \
-FCN (const T ## NDArray& a, const T ## NDArray& b) \
-{ \
-  dim_vector dv = a.dims (); \
-  octave_idx_type nel = dv.numel (); \
-\
-  if (dv != b.dims ()) \
-    { \
-      (*current_liboctave_error_handler) \
-       ("two-arg min expecting args of same size"); \
-      return T ## NDArray (); \
-    } \
-\
-  if (nel == 0)        \
-    return T ## NDArray (dv); \
-\
-  T ## NDArray result (dv); \
-\
-  for (octave_idx_type i = 0; i < nel; i++) \
-    { \
-      OCTAVE_QUIT; \
-      result (i) = a(i) OP b(i) ? a(i) : b(i); \
-    } \
-\
-  return result; \
-}
-
-#define MINMAX_FCNS(T) \
-  SND_MINMAX_FCN (min, <, T) \
-  NDS_MINMAX_FCN (min, <, T) \
-  NDND_MINMAX_FCN (min, <, T) \
-  SND_MINMAX_FCN (max, >, T) \
-  NDS_MINMAX_FCN (max, >, T) \
-  NDND_MINMAX_FCN (max, >, T)
-
-#define MINMAX_DECLS(T) \
-  extern OCTAVE_API T ## NDArray min (octave_ ## T d, const T ## NDArray& m); \
-  extern OCTAVE_API T ## NDArray min (const T ## NDArray& m, octave_ ## T d); \
-  extern OCTAVE_API T ## NDArray min (const T ## NDArray& a,  \
-                                      const T ## NDArray& b); \
-  extern OCTAVE_API T ## NDArray max (octave_ ## T d, const T ## NDArray& m); \
-  extern OCTAVE_API T ## NDArray max (const T ## NDArray& m, octave_ ## T d); \
-  extern OCTAVE_API T ## NDArray max (const T ## NDArray& a, \
-                                      const T ## NDArray& b);
-
-
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
diff --git a/liboctave/uint16NDArray.cc b/liboctave/uint16NDArray.cc
deleted file mode 100644
--- a/liboctave/uint16NDArray.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// N-D Array  manipulations.
-/*
-
-Copyright (C) 2004, 2005, 2006, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "uint16NDArray.h"
-
-#include "intNDArray.cc"
-
-template class OCTAVE_API intNDArray<octave_uint16>;
-
-template OCTAVE_API
-std::ostream&
-operator << (std::ostream& os, const intNDArray<octave_uint16>& a);
-
-template OCTAVE_API
-std::istream&
-operator >> (std::istream& is, intNDArray<octave_uint16>& a);
-
-NDS_CMP_OPS (uint16NDArray, , octave_uint16, )
-NDS_BOOL_OPS (uint16NDArray, octave_uint16, octave_uint16 (0))
-
-SND_CMP_OPS (octave_uint16, , uint16NDArray, )
-SND_BOOL_OPS (octave_uint16, uint16NDArray, octave_uint16 (0))
-
-NDND_CMP_OPS (uint16NDArray, , uint16NDArray, )
-NDND_BOOL_OPS (uint16NDArray, uint16NDArray, octave_uint16 (0))
-
-MINMAX_FCNS (uint16)
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
diff --git a/liboctave/uint16NDArray.h b/liboctave/uint16NDArray.h
--- a/liboctave/uint16NDArray.h
+++ b/liboctave/uint16NDArray.h
@@ -24,23 +24,9 @@
 #define octave_uint16NDArray_h 1
 
 #include "intNDArray.h"
-#include "mx-op-defs.h"
 #include "oct-inttypes.h"
 
 typedef intNDArray<octave_uint16> uint16NDArray;
-
-NDS_CMP_OP_DECLS (uint16NDArray, octave_uint16, OCTAVE_API)
-NDS_BOOL_OP_DECLS (uint16NDArray, octave_uint16, OCTAVE_API)
-
-SND_CMP_OP_DECLS (octave_uint16, uint16NDArray, OCTAVE_API)
-SND_BOOL_OP_DECLS (octave_uint16, uint16NDArray, OCTAVE_API)
-
-NDND_CMP_OP_DECLS (uint16NDArray, uint16NDArray, OCTAVE_API)
-NDND_BOOL_OP_DECLS (uint16NDArray, uint16NDArray, OCTAVE_API)
-
-MARRAY_FORWARD_DEFS (MArrayN, uint16NDArray, octave_uint16)
-
-MINMAX_DECLS (uint16)
 
 #endif
 
diff --git a/liboctave/uint32NDArray.cc b/liboctave/uint32NDArray.cc
deleted file mode 100644
--- a/liboctave/uint32NDArray.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// N-D Array  manipulations.
-/*
-
-Copyright (C) 2004, 2005, 2006, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "uint32NDArray.h"
-
-#include "intNDArray.cc"
-
-template class OCTAVE_API intNDArray<octave_uint32>;
-
-template OCTAVE_API
-std::ostream&
-operator << (std::ostream& os, const intNDArray<octave_uint32>& a);
-
-template OCTAVE_API
-std::istream&
-operator >> (std::istream& is, intNDArray<octave_uint32>& a);
-
-NDS_CMP_OPS (uint32NDArray, , octave_uint32, )
-NDS_BOOL_OPS (uint32NDArray, octave_uint32, octave_uint32 (0))
-
-SND_CMP_OPS (octave_uint32, , uint32NDArray, )
-SND_BOOL_OPS (octave_uint32, uint32NDArray, octave_uint32 (0))
-
-NDND_CMP_OPS (uint32NDArray, , uint32NDArray, )
-NDND_BOOL_OPS (uint32NDArray, uint32NDArray, octave_uint32 (0))
-
-MINMAX_FCNS (uint32)
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
diff --git a/liboctave/uint32NDArray.h b/liboctave/uint32NDArray.h
--- a/liboctave/uint32NDArray.h
+++ b/liboctave/uint32NDArray.h
@@ -24,23 +24,9 @@
 #define octave_uint32NDArray_h 1
 
 #include "intNDArray.h"
-#include "mx-op-defs.h"
 #include "oct-inttypes.h"
 
 typedef intNDArray<octave_uint32> uint32NDArray;
-
-NDS_CMP_OP_DECLS (uint32NDArray, octave_uint32, OCTAVE_API)
-NDS_BOOL_OP_DECLS (uint32NDArray, octave_uint32, OCTAVE_API)
-
-SND_CMP_OP_DECLS (octave_uint32, uint32NDArray, OCTAVE_API)
-SND_BOOL_OP_DECLS (octave_uint32, uint32NDArray, OCTAVE_API)
-
-NDND_CMP_OP_DECLS (uint32NDArray, uint32NDArray, OCTAVE_API)
-NDND_BOOL_OP_DECLS (uint32NDArray, uint32NDArray, OCTAVE_API)
-
-MARRAY_FORWARD_DEFS (MArrayN, uint32NDArray, octave_uint32)
-
-MINMAX_DECLS (uint32)
 
 #endif
 
diff --git a/liboctave/uint64NDArray.cc b/liboctave/uint64NDArray.cc
deleted file mode 100644
--- a/liboctave/uint64NDArray.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// N-D Array  manipulations.
-/*
-
-Copyright (C) 2004, 2005, 2006, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "uint64NDArray.h"
-
-#include "intNDArray.cc"
-
-template class OCTAVE_API intNDArray<octave_uint64>;
-
-template OCTAVE_API
-std::ostream&
-operator << (std::ostream& os, const intNDArray<octave_uint64>& a);
-
-template OCTAVE_API
-std::istream&
-operator >> (std::istream& is, intNDArray<octave_uint64>& a);
-
-NDS_CMP_OPS (uint64NDArray, , octave_uint64, )
-NDS_BOOL_OPS (uint64NDArray, octave_uint64, octave_uint64 (0))
-
-SND_CMP_OPS (octave_uint64, , uint64NDArray, )
-SND_BOOL_OPS (octave_uint64, uint64NDArray, octave_uint64 (0))
-
-NDND_CMP_OPS (uint64NDArray, , uint64NDArray, )
-NDND_BOOL_OPS (uint64NDArray, uint64NDArray, octave_uint64 (0))
-
-MINMAX_FCNS (uint64)
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
diff --git a/liboctave/uint64NDArray.h b/liboctave/uint64NDArray.h
--- a/liboctave/uint64NDArray.h
+++ b/liboctave/uint64NDArray.h
@@ -24,23 +24,9 @@
 #define octave_uint64NDArray_h 1
 
 #include "intNDArray.h"
-#include "mx-op-defs.h"
 #include "oct-inttypes.h"
 
 typedef intNDArray<octave_uint64> uint64NDArray;
-
-NDS_CMP_OP_DECLS (uint64NDArray, octave_uint64, OCTAVE_API)
-NDS_BOOL_OP_DECLS (uint64NDArray, octave_uint64, OCTAVE_API)
-
-SND_CMP_OP_DECLS (octave_uint64, uint64NDArray, OCTAVE_API)
-SND_BOOL_OP_DECLS (octave_uint64, uint64NDArray, OCTAVE_API)
-
-NDND_CMP_OP_DECLS (uint64NDArray, uint64NDArray, OCTAVE_API)
-NDND_BOOL_OP_DECLS (uint64NDArray, uint64NDArray, OCTAVE_API)
-
-MARRAY_FORWARD_DEFS (MArrayN, uint64NDArray, octave_uint64)
-
-MINMAX_DECLS (uint64)
 
 #endif
 
diff --git a/liboctave/uint8NDArray.cc b/liboctave/uint8NDArray.cc
deleted file mode 100644
--- a/liboctave/uint8NDArray.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// N-D Array  manipulations.
-/*
-
-Copyright (C) 2004, 2005, 2006, 2007 John W. Eaton
-
-This file is part of Octave.
-
-Octave is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-Octave is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with Octave; see the file COPYING.  If not, see
-<http://www.gnu.org/licenses/>.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "uint8NDArray.h"
-
-#include "intNDArray.cc"
-
-template class OCTAVE_API intNDArray<octave_uint8>;
-
-template OCTAVE_API
-std::ostream&
-operator << (std::ostream& os, const intNDArray<octave_uint8>& a);
-
-template OCTAVE_API
-std::istream&
-operator >> (std::istream& is, intNDArray<octave_uint8>& a);
-
-NDS_CMP_OPS (uint8NDArray, , octave_uint8, )
-NDS_BOOL_OPS (uint8NDArray, octave_uint8, octave_uint8 (0))
-
-SND_CMP_OPS (octave_uint8, , uint8NDArray, )
-SND_BOOL_OPS (octave_uint8, uint8NDArray, octave_uint8 (0))
-
-NDND_CMP_OPS (uint8NDArray, , uint8NDArray, )
-NDND_BOOL_OPS (uint8NDArray, uint8NDArray, octave_uint8 (0))
-
-MINMAX_FCNS (uint8)
-
-/*
-;;; Local Variables: ***
-;;; mode: C++ ***
-;;; End: ***
-*/
diff --git a/liboctave/uint8NDArray.h b/liboctave/uint8NDArray.h
--- a/liboctave/uint8NDArray.h
+++ b/liboctave/uint8NDArray.h
@@ -24,23 +24,9 @@
 #define octave_uint8NDArray_h 1
 
 #include "intNDArray.h"
-#include "mx-op-defs.h"
 #include "oct-inttypes.h"
 
 typedef intNDArray<octave_uint8> uint8NDArray;
-
-NDS_CMP_OP_DECLS (uint8NDArray, octave_uint8, OCTAVE_API)
-NDS_BOOL_OP_DECLS (uint8NDArray, octave_uint8, OCTAVE_API)
-
-SND_CMP_OP_DECLS (octave_uint8, uint8NDArray, OCTAVE_API)
-SND_BOOL_OP_DECLS (octave_uint8, uint8NDArray, OCTAVE_API)
-
-NDND_CMP_OP_DECLS (uint8NDArray, uint8NDArray, OCTAVE_API)
-NDND_BOOL_OP_DECLS (uint8NDArray, uint8NDArray, OCTAVE_API)
-
-MARRAY_FORWARD_DEFS (MArrayN, uint8NDArray, octave_uint8)
-
-MINMAX_DECLS (uint8)
 
 #endif
 
diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
+2008-11-12  John W. Eaton  <address@hidden>
+
+       * ov-int8.h, ov-int16.h, ov-int32.h, ov-int64.h, ov-uint8.h,
+       ov-uint16.h, ov-uint32.h, ov-uint64.h: Don't define
+       OCTAVE_INT_NDARRAY_T.
+       * ov-intx.h (class OCTAVE_VALUE_INT_MATRIX_T,
+       class OCTAVE_VALUE_INT_SCALAR_T): Use intNDArray<OCTAVE_INT_T>
+       instead of OCTAVE_INT_NDARRAY_T.
+       (OCTAVE_VALUE_INT_MATRIX_T::increment,
+       OCTAVE_VALUE_INT_MATRIX_T::decrement,
+       OCTAVE_VALUE_INT_SCALAR_T::increment,
+       OCTAVE_VALUE_INT_SCALAR_T::decrement): Convert 1 to OCTAVE_INT_T.
+
 2008-11-12  Michael Goffioul  <address@hidden>
 
        * dirfcn.cc (Ffilesep): Make it return all file separators when 'all'
diff --git a/src/ov-int16.h b/src/ov-int16.h
--- a/src/ov-int16.h
+++ b/src/ov-int16.h
@@ -23,12 +23,12 @@
 #if !defined (octave_int16_h)
 #define octave_int16_h 1
 
+#define OCTAVE_INT_T octave_int16
+
 #define OCTAVE_VALUE_INT_MATRIX_T octave_int16_matrix
-#define OCTAVE_INT_NDARRAY_T int16NDArray
 #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int16_array_value
 
 #define OCTAVE_VALUE_INT_SCALAR_T octave_int16_scalar
-#define OCTAVE_INT_T octave_int16
 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int16_scalar_value
 
 #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int16_type
@@ -37,12 +37,12 @@
 
 #include "ov-intx.h"
 
+#undef OCTAVE_INT_T
+
 #undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_INT_NDARRAY_T
 #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_INT_T
 #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_TYPE_PREDICATE_FUNCTION
diff --git a/src/ov-int32.h b/src/ov-int32.h
--- a/src/ov-int32.h
+++ b/src/ov-int32.h
@@ -23,12 +23,12 @@
 #if !defined (octave_int32_h)
 #define octave_int32_h 1
 
+#define OCTAVE_INT_T octave_int32
+
 #define OCTAVE_VALUE_INT_MATRIX_T octave_int32_matrix
-#define OCTAVE_INT_NDARRAY_T int32NDArray
 #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int32_array_value
 
 #define OCTAVE_VALUE_INT_SCALAR_T octave_int32_scalar
-#define OCTAVE_INT_T octave_int32
 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int32_scalar_value
 
 #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int32_type
@@ -37,12 +37,12 @@
 
 #include "ov-intx.h"
 
+#undef OCTAVE_INT_T
+
 #undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_INT_NDARRAY_T
 #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_INT_T
 #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_TYPE_PREDICATE_FUNCTION
diff --git a/src/ov-int64.h b/src/ov-int64.h
--- a/src/ov-int64.h
+++ b/src/ov-int64.h
@@ -23,12 +23,12 @@
 #if !defined (octave_int64_h)
 #define octave_int64_h 1
 
+#define OCTAVE_INT_T octave_int64
+
 #define OCTAVE_VALUE_INT_MATRIX_T octave_int64_matrix
-#define OCTAVE_INT_NDARRAY_T int64NDArray
 #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int64_array_value
 
 #define OCTAVE_VALUE_INT_SCALAR_T octave_int64_scalar
-#define OCTAVE_INT_T octave_int64
 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int64_scalar_value
 
 #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int64_type
@@ -37,12 +37,12 @@
 
 #include "ov-intx.h"
 
+#undef OCTAVE_INT_T
+
 #undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_INT_NDARRAY_T
 #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_INT_T
 #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_TYPE_PREDICATE_FUNCTION
diff --git a/src/ov-int8.h b/src/ov-int8.h
--- a/src/ov-int8.h
+++ b/src/ov-int8.h
@@ -23,12 +23,12 @@
 #if !defined (octave_int8_h)
 #define octave_int8_h 1
 
+#define OCTAVE_INT_T octave_int8
+
 #define OCTAVE_VALUE_INT_MATRIX_T octave_int8_matrix
-#define OCTAVE_INT_NDARRAY_T int8NDArray
 #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int8_array_value
 
 #define OCTAVE_VALUE_INT_SCALAR_T octave_int8_scalar
-#define OCTAVE_INT_T octave_int8
 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int8_scalar_value
 
 #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int8_type
@@ -37,12 +37,12 @@
 
 #include "ov-intx.h"
 
+#undef OCTAVE_INT_T
+
 #undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_INT_NDARRAY_T
 #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_INT_T
 #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_TYPE_PREDICATE_FUNCTION
diff --git a/src/ov-intx.h b/src/ov-intx.h
--- a/src/ov-intx.h
+++ b/src/ov-intx.h
@@ -42,18 +42,19 @@
 class
 OCTINTERP_API
 OCTAVE_VALUE_INT_MATRIX_T
-  : public octave_base_int_matrix<OCTAVE_INT_NDARRAY_T>
+  : public octave_base_int_matrix<intNDArray<OCTAVE_INT_T> >
 {
 public:
 
   OCTAVE_VALUE_INT_MATRIX_T (void)
-    : octave_base_int_matrix<OCTAVE_INT_NDARRAY_T> () { }
+    : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > () { }
 
-  OCTAVE_VALUE_INT_MATRIX_T (const OCTAVE_INT_NDARRAY_T& nda)
-    : octave_base_int_matrix<OCTAVE_INT_NDARRAY_T> (nda) { }
+  OCTAVE_VALUE_INT_MATRIX_T (const intNDArray<OCTAVE_INT_T>& nda)
+    : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > (nda) { }
 
   OCTAVE_VALUE_INT_MATRIX_T (const ArrayN<OCTAVE_INT_T>& nda)
-    : octave_base_int_matrix<OCTAVE_INT_NDARRAY_T> (OCTAVE_INT_NDARRAY_T 
(nda)) { }
+    : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> >
+        (intNDArray<OCTAVE_INT_T> (nda)) { }
 
   ~OCTAVE_VALUE_INT_MATRIX_T (void) { }
 
@@ -73,7 +74,7 @@
   IM convert_gripe () const
     {
       typedef typename IM::element_type dest_el_type;
-      typedef OCTAVE_INT_NDARRAY_T::element_type src_el_type;
+      typedef intNDArray<OCTAVE_INT_T>::element_type src_el_type;
       dest_el_type::clear_conv_flag ();
       IM retval (matrix);
       if (dest_el_type::get_trunc_flag ())
@@ -300,7 +301,7 @@
 
   void increment (void) 
    { 
-     matrix += 1; 
+     matrix += OCTAVE_INT_T (1); 
      if (OCTAVE_INT_T::get_math_trunc_flag ())
        gripe_unop_integer_math_truncated ("++", type_name (). c_str ());
 
@@ -309,7 +310,7 @@
 
   void decrement (void)
    { 
-     matrix -= 1; 
+     matrix -= OCTAVE_INT_T (1); 
      if (OCTAVE_INT_T::get_math_trunc_flag ())
        gripe_unop_integer_math_truncated ("--", type_name (). c_str ());
       OCTAVE_INT_T::clear_conv_flag ();
@@ -348,8 +349,8 @@
 
   octave_value imag (void) const
   {
-    return OCTAVE_INT_NDARRAY_T (matrix.dims (),
-                                static_cast<OCTAVE_INT_T>(0));
+    return intNDArray<OCTAVE_INT_T> (matrix.dims (),
+                                    static_cast<OCTAVE_INT_T>(0));
   }
 
 #define NO_OP_MAPPER(FCN) \
@@ -515,14 +516,14 @@
     {
       if (fill)
        {
-         OCTAVE_INT_NDARRAY_T retval (dv, 0);
+         intNDArray<OCTAVE_INT_T> retval (dv, 0);
          if (dv.numel())
            retval(0) = scalar;
          return retval;
        }
       else
        {
-         OCTAVE_INT_NDARRAY_T retval (dv);
+         intNDArray<OCTAVE_INT_T> retval (dv);
          if (dv.numel())
            retval(0) = scalar;
          return retval;
@@ -624,7 +625,7 @@
 
   void increment (void) 
    { 
-     scalar += 1; 
+     scalar += OCTAVE_INT_T (1); 
      if (OCTAVE_INT_T::get_math_trunc_flag ())
        gripe_unop_integer_math_truncated ("++", type_name (). c_str ());
       OCTAVE_INT_T::clear_conv_flag ();
@@ -632,7 +633,7 @@
 
   void decrement (void)
    { 
-     scalar -= 1; 
+     scalar -= OCTAVE_INT_T (1); 
      if (OCTAVE_INT_T::get_math_trunc_flag ())
        gripe_unop_integer_math_truncated ("--", type_name (). c_str ());
       OCTAVE_INT_T::clear_conv_flag ();
diff --git a/src/ov-uint16.h b/src/ov-uint16.h
--- a/src/ov-uint16.h
+++ b/src/ov-uint16.h
@@ -23,12 +23,12 @@
 #if !defined (octave_uint16_h)
 #define octave_uint16_h 1
 
+#define OCTAVE_INT_T octave_uint16
+
 #define OCTAVE_VALUE_INT_MATRIX_T octave_uint16_matrix
-#define OCTAVE_INT_NDARRAY_T uint16NDArray
 #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint16_array_value
 
 #define OCTAVE_VALUE_INT_SCALAR_T octave_uint16_scalar
-#define OCTAVE_INT_T octave_uint16
 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint16_scalar_value
 
 #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint16_type
@@ -37,12 +37,12 @@
 
 #include "ov-intx.h"
 
+#undef OCTAVE_INT_T
+
 #undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_INT_NDARRAY_T
 #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_INT_T
 #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_TYPE_PREDICATE_FUNCTION
diff --git a/src/ov-uint32.h b/src/ov-uint32.h
--- a/src/ov-uint32.h
+++ b/src/ov-uint32.h
@@ -23,12 +23,12 @@
 #if !defined (octave_uint32_h)
 #define octave_uint32_h 1
 
+#define OCTAVE_INT_T octave_uint32
+
 #define OCTAVE_VALUE_INT_MATRIX_T octave_uint32_matrix
-#define OCTAVE_INT_NDARRAY_T uint32NDArray
 #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint32_array_value
 
 #define OCTAVE_VALUE_INT_SCALAR_T octave_uint32_scalar
-#define OCTAVE_INT_T octave_uint32
 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint32_scalar_value
 
 #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint32_type
@@ -37,12 +37,12 @@
 
 #include "ov-intx.h"
 
+#undef OCTAVE_INT_T
+
 #undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_INT_NDARRAY_T
 #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_INT_T
 #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_TYPE_PREDICATE_FUNCTION
diff --git a/src/ov-uint64.h b/src/ov-uint64.h
--- a/src/ov-uint64.h
+++ b/src/ov-uint64.h
@@ -23,12 +23,12 @@
 #if !defined (octave_uint64_h)
 #define octave_uint64_h 1
 
+#define OCTAVE_INT_T octave_uint64
+
 #define OCTAVE_VALUE_INT_MATRIX_T octave_uint64_matrix
-#define OCTAVE_INT_NDARRAY_T uint64NDArray
 #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint64_array_value
 
 #define OCTAVE_VALUE_INT_SCALAR_T octave_uint64_scalar
-#define OCTAVE_INT_T octave_uint64
 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint64_scalar_value
 
 #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint64_type
@@ -37,12 +37,12 @@
 
 #include "ov-intx.h"
 
+#undef OCTAVE_INT_T
+
 #undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_INT_NDARRAY_T
 #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_INT_T
 #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_TYPE_PREDICATE_FUNCTION
diff --git a/src/ov-uint8.h b/src/ov-uint8.h
--- a/src/ov-uint8.h
+++ b/src/ov-uint8.h
@@ -23,12 +23,12 @@
 #if !defined (octave_uint8_h)
 #define octave_uint8_h 1
 
+#define OCTAVE_INT_T octave_uint8
+
 #define OCTAVE_VALUE_INT_MATRIX_T octave_uint8_matrix
-#define OCTAVE_INT_NDARRAY_T uint8NDArray
 #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint8_array_value
 
 #define OCTAVE_VALUE_INT_SCALAR_T octave_uint8_scalar
-#define OCTAVE_INT_T octave_uint8
 #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint8_scalar_value
 
 #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint8_type
@@ -37,12 +37,12 @@
 
 #include "ov-intx.h"
 
+#undef OCTAVE_INT_T
+
 #undef OCTAVE_VALUE_INT_MATRIX_T
-#undef OCTAVE_INT_NDARRAY_T
 #undef OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_VALUE_INT_SCALAR_T
-#undef OCTAVE_INT_T
 #undef OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION
 
 #undef OCTAVE_TYPE_PREDICATE_FUNCTION

reply via email to

[Prev in Thread] Current Thread [Next in Thread]