GNU Octave  4.0.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-2015 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 #include "chNDArray.h"
31 
32 #include "mx-defs.h"
33 #include "mx-op-decl.h"
34 #include "str-vec.h"
35 
36 class
37 OCTAVE_API
38 charMatrix : public charNDArray
39 {
40  friend class ComplexMatrix;
41 
42 public:
43 
44  charMatrix (void) : charNDArray () { }
45 
47  : charNDArray (dim_vector (r, c)) { }
48 
50  : charNDArray (dim_vector (r, c), val) { }
51 
52  charMatrix (const dim_vector& dv) : charNDArray (dv.redim (2)) { }
53 
54  charMatrix (const dim_vector& dv, char val)
55  : charNDArray (dv.redim (2), val) { }
56 
57  charMatrix (const Array<char>& a) : charNDArray (a.as_matrix ()) { }
58 
59  charMatrix (const charMatrix& a) : charNDArray (a) { }
60 
61  charMatrix (char c) : charNDArray (c) { }
62 
63  charMatrix (const char *s) : charNDArray (s) { }
64 
65  charMatrix (const std::string& s) : charNDArray (s) { }
66 
67  charMatrix (const string_vector& s, char fill_value = '\0')
68  : charNDArray (s, fill_value) { }
69 
70  bool operator == (const charMatrix& a) const;
71  bool operator != (const charMatrix& a) const;
72 
73  charMatrix transpose (void) const { return Array<char>::transpose (); }
74 
75  // destructive insert/delete/reorder operations
76 
77  charMatrix& insert (const char *s, octave_idx_type r, octave_idx_type c);
78  charMatrix& insert (const charMatrix& a,
80 
81  std::string row_as_string (octave_idx_type, bool strip_ws = false) const;
82 
83  // resize is the destructive equivalent for this one
84 
87 
88  void resize (octave_idx_type nr, octave_idx_type nc, char rfv = 0)
89  {
90  Array<char>::resize (dim_vector (nr, nc), rfv);
91  }
92 
93 #if 0
94  // i/o
95 
96  friend std::ostream& operator << (std::ostream& os, const Matrix& a);
97  friend std::istream& operator >> (std::istream& is, Matrix& a);
98 #endif
99 };
100 
101 MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API)
102 MS_BOOL_OP_DECLS (charMatrix, char, OCTAVE_API)
103 
104 SM_CMP_OP_DECLS (char, charMatrix, OCTAVE_API)
105 SM_BOOL_OP_DECLS (char, charMatrix, OCTAVE_API)
106 
107 MM_CMP_OP_DECLS (charMatrix, charMatrix, OCTAVE_API)
108 MM_BOOL_OP_DECLS (charMatrix, charMatrix, OCTAVE_API)
109 
110 #endif
Array< Complex > as_matrix(void) const
Return the array as a matrix.
Definition: Array.h:299
charMatrix(octave_idx_type r, octave_idx_type c, char val)
Definition: chMatrix.h:49
charMatrix transpose(void) const
Definition: chMatrix.h:73
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:548
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
charMatrix(const dim_vector &dv)
Definition: chMatrix.h:52
#define SM_CMP_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:112
charMatrix(const charMatrix &a)
Definition: chMatrix.h:59
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type r2
charMatrix(const char *s)
Definition: chMatrix.h:63
#define SM_BOOL_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:120
#define MM_CMP_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:137
#define MM_BOOL_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:145
Array< T > transpose(void) const
Definition: Array.cc:1607
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1033
void resize(octave_idx_type nr, octave_idx_type nc, char rfv=0)
Definition: chMatrix.h:88
Definition: dMatrix.h:35
ComplexMatrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
Definition: CMatrix.cc:400
charMatrix(const std::string &s)
Definition: chMatrix.h:65
charMatrix(const dim_vector &dv, char val)
Definition: chMatrix.h:54
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:519
charMatrix(octave_idx_type r, octave_idx_type c)
Definition: chMatrix.h:46
#define MS_CMP_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:87
charMatrix(const string_vector &s, char fill_value= '\0')
Definition: chMatrix.h:67
charMatrix(char c)
Definition: chMatrix.h:61
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
#define MS_BOOL_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:95
charMatrix(void)
Definition: chMatrix.h:44
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type r1
charMatrix(const Array< char > &a)
Definition: chMatrix.h:57
ComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
Definition: CMatrix.cc:971