00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_intNDArray_h)
00024 #define octave_intNDArray_h 1
00025
00026 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
00027 #pragma interface
00028 #endif
00029
00030 #include "MArrayN.h"
00031 #include "boolNDArray.h"
00032
00033 template <class T>
00034 class
00035 intNDArray : public MArrayN<T>
00036 {
00037 public:
00038
00039 intNDArray (void) : MArrayN<T> () { }
00040
00041 intNDArray (T val) : MArrayN<T> (dim_vector (1, 1), val) { }
00042
00043 intNDArray (const dim_vector& dv) : MArrayN<T> (dv) { }
00044
00045 intNDArray (const dim_vector& dv, T val)
00046 : MArrayN<T> (dv, val) { }
00047
00048 template <class U>
00049 explicit intNDArray (const Array<U>& a) : MArrayN<T> (a) { }
00050
00051 template <class U>
00052 explicit intNDArray (const ArrayN<U>& a) : MArrayN<T> (a) { }
00053
00054 template <class U>
00055 intNDArray (const MArrayN<U>& a) : MArrayN<T> (a) { }
00056
00057 template <class U>
00058 intNDArray (const intNDArray<U>& a) : MArrayN<T> (a) { }
00059
00060 intNDArray& operator = (const intNDArray<T>& a)
00061 {
00062 MArrayN<T>::operator = (a);
00063 return *this;
00064 }
00065
00066 boolNDArray operator ! (void) const;
00067
00068
00069
00070 boolNDArray all (int dim = -1) const;
00071 boolNDArray any (int dim = -1) const;
00072
00073 intNDArray squeeze (void) const
00074 { return intNDArray<T> (MArrayN<T>::squeeze ()); }
00075
00076 intNDArray transpose (void) const
00077 { return intNDArray<T> (MArrayN<T>::transpose ()); }
00078
00079 intNDArray concat (const intNDArray<T>& rb, const Array<int>& ra_idx);
00080
00081 intNDArray& insert (const intNDArray<T>& a, int r, int c);
00082 intNDArray& insert (const intNDArray<T>& a, const Array<int>& ra_idx);
00083
00084 static void increment_index (Array<int>& ra_idx,
00085 const dim_vector& dimensions,
00086 int start_dimension = 0);
00087
00088 static int compute_index (Array<int>& ra_idx,
00089 const dim_vector& dimensions);
00090
00091 static T resize_fill_value (void) { return 0; }
00092
00093 protected:
00094
00095 intNDArray (T *d, dim_vector& dv) : MArrayN<T> (d, dv) { }
00096 };
00097
00098
00099
00100 template <class T>
00101 std::ostream& operator << (std::ostream& os, const intNDArray<T>& a);
00102
00103 template <class T>
00104 std::istream& operator >> (std::istream& is, intNDArray<T>& a);
00105
00106 #endif
00107
00108
00109
00110
00111
00112