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