GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
chNDArray.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2003-2013 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 3 of the License, or (at your
10 option) any 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, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if !defined (octave_chNDArray_h)
24 #define octave_chNDArray_h 1
25 
26 #include "Array.h"
27 #include "chMatrix.h"
28 
29 #include "mx-defs.h"
30 #include "mx-op-decl.h"
31 #include "bsxfun-decl.h"
32 
33 class
34 OCTAVE_API
35 charNDArray : public Array<char>
36 {
37 public:
38 
40 
41  charNDArray (void) : Array<char> () { }
42 
43  charNDArray (const dim_vector& dv) : Array<char> (dv) { }
44 
45  charNDArray (const dim_vector& dv, char val) : Array<char> (dv, val) { }
46 
47  charNDArray (const charNDArray& a) : Array<char> (a) { }
48 
49  charNDArray (const charMatrix& a) : Array<char> (a) { }
50 
51  charNDArray (char c) : Array<char> (charMatrix (c)) { }
52 
53  charNDArray (const char *s) : Array<char> (charMatrix (s)) { }
54 
55  charNDArray (const std::string& s) : Array<char> (charMatrix (s)) { }
56 
57  charNDArray (const string_vector& s) : Array<char> (charMatrix (s)) { }
58 
59  charNDArray (const Array<char>& a) : Array<char> (a) { }
60 
62  {
64  return *this;
65  }
66 
67  bool any_element_is_nan (void) const { return false; }
68 
69  // FIXME: this is not quite the right thing.
70 
71  boolNDArray all (int dim = -1) const;
72  boolNDArray any (int dim = -1) const;
73  charNDArray concat (const charNDArray& rb,
74  const Array<octave_idx_type>& ra_idx);
75  charNDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx);
76 
77  charNDArray max (int dim = -1) const;
78  charNDArray max (Array<octave_idx_type>& index, int dim = -1) const;
79  charNDArray min (int dim = -1) const;
80  charNDArray min (Array<octave_idx_type>& index, int dim = -1) const;
81 
82  charNDArray& insert (const charNDArray& a,
84  charNDArray& insert (const charNDArray& a,
85  const Array<octave_idx_type>& ra_idx);
86 
87  charMatrix matrix_value (void) const;
88 
89  charNDArray squeeze (void) const { return Array<char>::squeeze (); }
90 
91  static void increment_index (Array<octave_idx_type>& ra_idx,
92  const dim_vector& dimensions,
93  int start_dimension = 0);
94 
96  const dim_vector& dimensions);
97 
98  // i/o
99 
100  // friend std::ostream& operator << (std::ostream& os, const charNDArray& a);
101  // friend std::istream& operator >> (std::istream& is, charNDArray& a);
102 
103  charNDArray diag (octave_idx_type k = 0) const;
104 
106 };
107 
108 extern OCTAVE_API charNDArray min (char d, const charNDArray& m);
109 extern OCTAVE_API charNDArray min (const charNDArray& m, char d);
110 extern OCTAVE_API charNDArray min (const charNDArray& a, const charNDArray& b);
111 extern OCTAVE_API charNDArray max (char d, const charNDArray& m);
112 extern OCTAVE_API charNDArray max (const charNDArray& m, char d);
113 extern OCTAVE_API charNDArray max (const charNDArray& a, const charNDArray& b);
114 
115 NDS_CMP_OP_DECLS (charNDArray, char, OCTAVE_API)
116 NDS_BOOL_OP_DECLS (charNDArray, char, OCTAVE_API)
117 
118 SND_CMP_OP_DECLS (char, charNDArray, OCTAVE_API)
119 SND_BOOL_OP_DECLS (char, charNDArray, OCTAVE_API)
120 
121 NDND_CMP_OP_DECLS (charNDArray, charNDArray, OCTAVE_API)
122 NDND_BOOL_OP_DECLS (charNDArray, charNDArray, OCTAVE_API)
123 
124 BSXFUN_STDREL_DECLS (charNDArray, OCTAVE_API)
125 
126 #endif