GNU Octave  4.2.1
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-2017 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 "octave-config.h"
27 
28 #include <string>
29 
30 #include "Array.h"
31 
32 #include "mx-defs.h"
33 #include "mx-op-decl.h"
34 #include "bsxfun-decl.h"
35 #include "str-vec.h"
36 
37 class
38 OCTAVE_API
39 charNDArray : public Array<char>
40 {
41 public:
42 
44 
45  charNDArray (void) : Array<char> () { }
46 
47  charNDArray (const dim_vector& dv) : Array<char> (dv) { }
48 
49  charNDArray (const dim_vector& dv, char val) : Array<char> (dv, val) { }
50 
51  charNDArray (const charNDArray& a) : Array<char> (a) { }
52 
53  charNDArray (const Array<char>& a) : Array<char> (a) { }
54 
55  charNDArray (char c);
56 
57  charNDArray (const char *s);
58 
59  charNDArray (const std::string& s);
60 
61  charNDArray (const string_vector& s, char fill_value = '\0');
62 
64  {
66  return *this;
67  }
68 
69  bool any_element_is_nan (void) const { return false; }
70 
71  // FIXME: this is not quite the right thing.
72 
73  boolNDArray all (int dim = -1) const;
74  boolNDArray any (int dim = -1) const;
75  charNDArray concat (const charNDArray& rb,
78 
79  charNDArray max (int dim = -1) const;
80  charNDArray max (Array<octave_idx_type>& index, int dim = -1) const;
81  charNDArray min (int dim = -1) const;
82  charNDArray min (Array<octave_idx_type>& index, int dim = -1) const;
83 
88 
89  charNDArray squeeze (void) const { return Array<char>::squeeze (); }
90 
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
dim_vector dimensions
Definition: Array.h:214
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:176
const octave_base_value const Array< octave_idx_type > & ra_idx
#define BSXFUN_STDREL_DECLS(ARRAY, API)
Definition: bsxfun-decl.h:53
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
#define NDND_CMP_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:218
OCTAVE_API charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:205
for large enough k
Definition: lu.cc:606
charNDArray(void)
Definition: chNDArray.h:45
#define SND_BOOL_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:199
charNDArray(const Array< char > &a)
Definition: chNDArray.h:53
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:655
#define NDND_BOOL_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:226
s
Definition: file-io.cc:2682
charNDArray(const dim_vector &dv)
Definition: chNDArray.h:47
#define NDS_BOOL_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:172
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
#define NDS_CMP_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:164
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
#define SND_CMP_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:191
charNDArray(const charNDArray &a)
Definition: chNDArray.h:51
bool any_element_is_nan(void) const
Definition: chNDArray.h:69
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
Definition: Array-util.cc:59
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
boolMatrix all(int dim=-1) const
Definition: CMatrix.cc:2832
Array< T > squeeze(void) const
Chop off leading singleton dimensions.
Definition: Array.cc:125
OCTAVE_API charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:228
charMatrix matrix_type
Definition: chNDArray.h:43
ComplexNDArray & operator=(const ComplexNDArray &a)
Definition: CNDArray.h:57
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
ComplexMatrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
Definition: CMatrix.cc:198
charNDArray squeeze(void) const
Definition: chNDArray.h:89
b
Definition: cellfun.cc:398
ComplexMatrix diag(octave_idx_type k=0) const
Definition: CMatrix.cc:2880
charNDArray(const dim_vector &dv, char val)
Definition: chNDArray.h:49
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
the second is matched to the second specifier and placed in the second column and so forth If there are more words than specifiers then the process is repeated until all words have been processed or the limit imposed by any(non-whitespace) text in the format that is not one of these specifiers is considered a literal.If there is a literal between two format specifiers then that same literal must appear in the input stream between the matching words.The following specifiers are valid
Definition: file-io.cc:1491
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
Array< T > & operator=(const Array< T > &a)
Definition: Array.h:309
dim_vector dv
Definition: sub2ind.cc:263
Array< Complex > index(const idx_vector &i) const
Indexing without resizing.