GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
chNDArray.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2003-2018 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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 <https://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 "Array.h"
29 #include "bsxfun-decl.h"
30 #include "mx-defs.h"
31 #include "mx-op-decl.h"
32 #include "str-vec.h"
33 
34 class
35 OCTAVE_API
36 charNDArray : public Array<char>
37 {
38 public:
39 
41 
42  charNDArray (void) : Array<char> () { }
43 
44  charNDArray (const dim_vector& dv) : Array<char> (dv) { }
45 
46  charNDArray (const dim_vector& dv, char val) : Array<char> (dv, val) { }
47 
48  charNDArray (const charNDArray& a) : Array<char> (a) { }
49 
50  charNDArray (const Array<char>& a) : Array<char> (a) { }
51 
52  charNDArray (char c);
53 
54  charNDArray (const char *s);
55 
56  charNDArray (const std::string& s);
57 
58  charNDArray (const string_vector& s, char fill_value = '\0');
59 
61  {
63  return *this;
64  }
65 
66  bool any_element_is_nan (void) const { return false; }
67 
68  // FIXME: this is not quite the right thing.
69 
70  boolNDArray all (int dim = -1) const;
71  boolNDArray any (int dim = -1) const;
72  charNDArray concat (const charNDArray& rb,
75 
76  charNDArray max (int dim = -1) const;
77  charNDArray max (Array<octave_idx_type>& index, int dim = -1) const;
78  charNDArray min (int dim = -1) const;
79  charNDArray min (Array<octave_idx_type>& index, int dim = -1) const;
80 
85 
86  charNDArray squeeze (void) const { return Array<char>::squeeze (); }
87 
89  const dim_vector& dimensions,
90  int start_dimension = 0);
91 
93  const dim_vector& dimensions);
94 
95  // i/o
96 
97  // friend std::ostream& operator << (std::ostream& os, const charNDArray& a);
98  // friend std::istream& operator >> (std::istream& is, charNDArray& a);
99 
100  charNDArray diag (octave_idx_type k = 0) const;
101 
103 };
104 
105 extern OCTAVE_API charNDArray min (char d, const charNDArray& m);
106 extern OCTAVE_API charNDArray min (const charNDArray& m, char d);
107 extern OCTAVE_API charNDArray min (const charNDArray& a, const charNDArray& b);
108 extern OCTAVE_API charNDArray max (char d, const charNDArray& m);
109 extern OCTAVE_API charNDArray max (const charNDArray& m, char d);
110 extern OCTAVE_API charNDArray max (const charNDArray& a, const charNDArray& b);
111 
112 NDS_CMP_OP_DECLS (charNDArray, char, OCTAVE_API)
113 NDS_BOOL_OP_DECLS (charNDArray, char, OCTAVE_API)
114 
115 SND_CMP_OP_DECLS (char, charNDArray, OCTAVE_API)
116 SND_BOOL_OP_DECLS (char, charNDArray, OCTAVE_API)
117 
120 
121 BSXFUN_STDREL_DECLS (charNDArray, OCTAVE_API)
122 
123 #endif
dim_vector dimensions
Definition: Array.h:216
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
Definition: Array-util.cc:175
bool any_element_is_nan(void) const
Definition: chNDArray.h:66
const octave_base_value const Array< octave_idx_type > & ra_idx
#define BSXFUN_STDREL_DECLS(ARRAY, API)
Definition: bsxfun-decl.h:51
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
#define NDND_CMP_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:218
Array< T > squeeze(void) const
Chop off leading singleton dimensions.
Definition: Array.cc:116
OCTAVE_API charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:204
for large enough k
Definition: lu.cc:617
charNDArray(void)
Definition: chNDArray.h:42
#define SND_BOOL_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:199
charNDArray(const Array< char > &a)
Definition: chNDArray.h:50
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:653
#define NDND_BOOL_OP_DECLS(ND1, ND2, API)
Definition: mx-op-decl.h:226
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:1499
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
s
Definition: file-io.cc:2729
charNDArray(const dim_vector &dv)
Definition: chNDArray.h:44
#define NDS_BOOL_OP_DECLS(ND, S, API)
Definition: mx-op-decl.h:172
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &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:400
boolMatrix all(int dim=-1) const
Definition: CMatrix.cc:2951
#define SND_CMP_OP_DECLS(S, ND, API)
Definition: mx-op-decl.h:191
Array< Complex > index(const idx_vector &i) const
Indexing without resizing.
Definition: Array.cc:697
charNDArray(const charNDArray &a)
Definition: chNDArray.h:48
ComplexMatrix diag(octave_idx_type k=0) const
Definition: CMatrix.cc:2999
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
Definition: Array-util.cc:58
OCTAVE_API charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:227
charMatrix matrix_type
Definition: chNDArray.h:40
ComplexNDArray & operator=(const ComplexNDArray &a)
Definition: CNDArray.h:56
ComplexMatrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
Definition: CMatrix.cc:194
charNDArray squeeze(void) const
Definition: chNDArray.h:86
b
Definition: cellfun.cc:400
charNDArray(const dim_vector &dv, char val)
Definition: chNDArray.h:46
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
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:888
Array< T > & operator=(const Array< T > &a)
Definition: Array.h:311
dim_vector dv
Definition: sub2ind.cc:263