/* Copyright (C) 2004 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 2, 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if !defined (octave_intNDArray_h) #define octave_intNDArray_h 1 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) #pragma interface #endif #include "MArrayN.h" #include "boolNDArray.h" template class intNDArray : public MArrayN { public: intNDArray (void) : MArrayN () { } intNDArray (T val) : MArrayN (dim_vector (1, 1), val) { } intNDArray (const dim_vector& dv) : MArrayN (dv) { } intNDArray (const dim_vector& dv, T val) : MArrayN (dv, val) { } template explicit intNDArray (const Array& a) : MArrayN (a) { } template explicit intNDArray (const ArrayN& a) : MArrayN (a) { } template intNDArray (const MArrayN& a) : MArrayN (a) { } template intNDArray (const intNDArray& a) : MArrayN (a) { } intNDArray& operator = (const intNDArray& a) { MArrayN::operator = (a); return *this; } boolNDArray operator ! (void) const; // XXX FIXME XXX -- this is not quite the right thing. boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; intNDArray squeeze (void) const { return intNDArray (MArrayN::squeeze ()); } intNDArray transpose (void) const { return intNDArray (MArrayN::transpose ()); } intNDArray concat (const intNDArray& rb, const Array& ra_idx); intNDArray& insert (const intNDArray& a, int r, int c); intNDArray& insert (const intNDArray& a, const Array& ra_idx); static void increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension = 0); static int compute_index (Array& ra_idx, const dim_vector& dimensions); static T resize_fill_value (void) { return 0; } protected: intNDArray (T *d, dim_vector& dv) : MArrayN (d, dv) { } }; // i/o template std::ostream& operator << (std::ostream& os, const intNDArray& a); template std::istream& operator >> (std::istream& is, intNDArray& a); #endif /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */