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 |
|
36 #include "data-conv.h" |
|
37 #include "mach-info.h" |
|
38 |
|
39 class |
|
40 boolNDArray : public ArrayN<bool> |
|
41 { |
|
42 public: |
|
43 |
|
44 boolNDArray (void) : ArrayN<bool> () { } |
|
45 |
|
46 boolNDArray (dim_vector& dims) : ArrayN<bool> (dims) { } |
|
47 |
|
48 boolNDArray (dim_vector& dims, const bool& val) |
|
49 : ArrayN<bool> (dims, val) { } |
|
50 |
|
51 boolNDArray (const boolNDArray& a) : ArrayN<bool> (a) { } |
|
52 |
|
53 boolNDArray (const boolMatrix& a) : ArrayN<bool> (a) { } |
|
54 |
|
55 boolNDArray (const Array2<bool>& a) : ArrayN<bool> (a) { } |
|
56 |
|
57 boolNDArray (const ArrayN<bool>& a) : ArrayN<bool> (a) { } |
|
58 |
|
59 boolNDArray& operator = (const boolNDArray& a) |
|
60 { |
|
61 ArrayN<bool>::operator = (a); |
|
62 return *this; |
|
63 } |
|
64 |
4543
|
65 // unary operations |
|
66 |
|
67 boolNDArray operator ! (void) const; |
|
68 |
4514
|
69 // XXX FIXME XXX -- this is not quite the right thing. |
|
70 |
4556
|
71 boolNDArray all (int dim = -1) const; |
|
72 boolNDArray any (int dim = -1) const; |
4514
|
73 |
|
74 boolMatrix matrix_value (void) const; |
|
75 |
4532
|
76 boolNDArray squeeze (void) const { return ArrayN<bool>::squeeze (); } |
|
77 |
|
78 static void increment_index (Array<int>& ra_idx, |
|
79 const dim_vector& dimensions, |
|
80 int start_dimension = 0); |
|
81 |
4556
|
82 static int compute_index (Array<int>& ra_idx, |
|
83 const dim_vector& dimensions); |
|
84 |
4514
|
85 // i/o |
|
86 |
|
87 // friend std::ostream& operator << (std::ostream& os, const NDArray& a); |
|
88 // friend std::istream& operator >> (std::istream& is, NDArray& a); |
|
89 |
|
90 static bool resize_fill_value (void) { return false; } |
|
91 |
|
92 // bool all_elements_are_real (void) const; |
|
93 // bool all_integers (double& max_val, double& min_val) const; |
|
94 |
|
95 private: |
|
96 |
|
97 boolNDArray (bool *d, dim_vector& dims) : ArrayN<bool> (d, dims) { } |
|
98 }; |
|
99 |
4543
|
100 NDND_CMP_OP_DECLS (boolNDArray, boolNDArray) |
|
101 |
4514
|
102 #endif |
|
103 |
|
104 /* |
|
105 ;;; Local Variables: *** |
|
106 ;;; mode: C++ *** |
|
107 ;;; End: *** |
|
108 */ |