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
chMatrix.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1995-2013 John W. Eaton
4 Copyright (C) 2010 VZLU Prague
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if !defined (octave_chMatrix_h)
25 #define octave_chMatrix_h 1
26 
27 #include <string>
28 
29 #include "Array.h"
30 
31 #include "mx-defs.h"
32 #include "mx-op-decl.h"
33 #include "str-vec.h"
34 
35 class
36 OCTAVE_API
37 charMatrix : public Array<char>
38 {
39  friend class ComplexMatrix;
40 
41 public:
42 
43  charMatrix (void) : Array<char> () { }
44 
46  : Array<char> (dim_vector (r, c)) { }
47 
49  : Array<char> (dim_vector (r, c), val) { }
50 
51  charMatrix (const dim_vector& dv) : Array<char> (dv) { }
52 
53  charMatrix (const dim_vector& dv, char val) : Array<char> (dv, val) { }
54 
55  charMatrix (const Array<char>& a) : Array<char> (a.as_matrix ()) { }
56 
57  charMatrix (const charMatrix& a) : Array<char> (a) { }
58 
59  charMatrix (char c);
60 
61  charMatrix (const char *s);
62 
63  charMatrix (const std::string& s);
64 
65  charMatrix (const string_vector& s, char fill_value = '\0');
66 
68  {
70  return *this;
71  }
72 
73  bool operator == (const charMatrix& a) const;
74  bool operator != (const charMatrix& a) const;
75 
76  charMatrix transpose (void) const { return Array<char>::transpose (); }
77 
78  // destructive insert/delete/reorder operations
79 
80  charMatrix& insert (const char *s, octave_idx_type r, octave_idx_type c);
81  charMatrix& insert (const charMatrix& a,
83 
84  std::string row_as_string (octave_idx_type, bool strip_ws = false) const;
85 
86  // resize is the destructive equivalent for this one
87 
90 
91  void resize (octave_idx_type nr, octave_idx_type nc, char rfv = 0)
92  {
93  Array<char>::resize (dim_vector (nr, nc), rfv);
94  }
95 
96  charMatrix diag (octave_idx_type k = 0) const;
97 
98  boolMatrix all (int dim = -1) const;
99  boolMatrix any (int dim = -1) const;
100 
101 #if 0
102  // i/o
103 
104  friend std::ostream& operator << (std::ostream& os, const Matrix& a);
105  friend std::istream& operator >> (std::istream& is, Matrix& a);
106 #endif
107 };
108 
109 MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API)
110 MS_BOOL_OP_DECLS (charMatrix, char, OCTAVE_API)
111 
112 SM_CMP_OP_DECLS (char, charMatrix, OCTAVE_API)
113 SM_BOOL_OP_DECLS (char, charMatrix, OCTAVE_API)
114 
115 MM_CMP_OP_DECLS (charMatrix, charMatrix, OCTAVE_API)
116 MM_BOOL_OP_DECLS (charMatrix, charMatrix, OCTAVE_API)
117 
118 #endif