4514
|
1 /* |
|
2 |
|
3 Copyright (C) 2003 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_boolNDArray_h) |
|
24 #define octave_boolNDArray_h 1 |
|
25 |
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include "ArrayN.h" |
|
31 #include "CMatrix.h" |
|
32 |
|
33 #include "mx-defs.h" |
|
34 #include "mx-op-defs.h" |
|
35 |
4650
|
36 #include "boolMatrix.h" |
|
37 |
4514
|
38 class |
|
39 boolNDArray : public ArrayN<bool> |
|
40 { |
|
41 public: |
|
42 |
|
43 boolNDArray (void) : ArrayN<bool> () { } |
|
44 |
4730
|
45 boolNDArray (const dim_vector& dv) : ArrayN<bool> (dv) { } |
4514
|
46 |
4730
|
47 boolNDArray (const dim_vector& dv, const bool& val) |
4587
|
48 : ArrayN<bool> (dv, val) { } |
4514
|
49 |
|
50 boolNDArray (const boolNDArray& a) : ArrayN<bool> (a) { } |
|
51 |
|
52 boolNDArray (const boolMatrix& a) : ArrayN<bool> (a) { } |
|
53 |
|
54 boolNDArray (const Array2<bool>& a) : ArrayN<bool> (a) { } |
|
55 |
|
56 boolNDArray (const ArrayN<bool>& a) : ArrayN<bool> (a) { } |
|
57 |
|
58 boolNDArray& operator = (const boolNDArray& a) |
|
59 { |
|
60 ArrayN<bool>::operator = (a); |
|
61 return *this; |
|
62 } |
|
63 |
4543
|
64 // unary operations |
|
65 |
|
66 boolNDArray operator ! (void) const; |
|
67 |
4514
|
68 // XXX FIXME XXX -- this is not quite the right thing. |
|
69 |
4556
|
70 boolNDArray all (int dim = -1) const; |
|
71 boolNDArray any (int dim = -1) const; |
4514
|
72 |
|
73 boolMatrix matrix_value (void) const; |
|
74 |
4532
|
75 boolNDArray squeeze (void) const { return ArrayN<bool>::squeeze (); } |
|
76 |
|
77 static void increment_index (Array<int>& ra_idx, |
|
78 const dim_vector& dimensions, |
|
79 int start_dimension = 0); |
|
80 |
4556
|
81 static int compute_index (Array<int>& ra_idx, |
|
82 const dim_vector& dimensions); |
|
83 |
4514
|
84 // i/o |
|
85 |
|
86 // friend std::ostream& operator << (std::ostream& os, const NDArray& a); |
|
87 // friend std::istream& operator >> (std::istream& is, NDArray& a); |
|
88 |
|
89 static bool resize_fill_value (void) { return false; } |
|
90 |
|
91 // bool all_elements_are_real (void) const; |
|
92 // bool all_integers (double& max_val, double& min_val) const; |
|
93 |
|
94 private: |
|
95 |
4587
|
96 boolNDArray (bool *d, dim_vector& dv) : ArrayN<bool> (d, dv) { } |
4514
|
97 }; |
|
98 |
4669
|
99 NDND_BOOL_OP_DECLS (boolNDArray, boolNDArray) |
4543
|
100 NDND_CMP_OP_DECLS (boolNDArray, boolNDArray) |
|
101 |
4669
|
102 NDS_BOOL_OP_DECLS (boolNDArray, bool) |
|
103 NDS_CMP_OP_DECLS (boolNDArray, bool) |
|
104 |
|
105 SND_BOOL_OP_DECLS (bool, boolNDArray) |
|
106 SND_CMP_OP_DECLS (bool, boolNDArray) |
|
107 |
4514
|
108 #endif |
|
109 |
|
110 /* |
|
111 ;;; Local Variables: *** |
|
112 ;;; mode: C++ *** |
|
113 ;;; End: *** |
|
114 */ |