GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
chMatrix.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1995-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_chMatrix_h)
27 #define octave_chMatrix_h 1
28 
29 #include "octave-config.h"
30 
31 #include <string>
32 
33 #include "Array.h"
34 #include "chNDArray.h"
35 #include "mx-defs.h"
36 #include "mx-op-decl.h"
37 #include "str-vec.h"
38 
39 class
41 charMatrix : public charNDArray
42 {
43  friend class ComplexMatrix;
44 
45 public:
46 
47  charMatrix () = default;
48 
49  charMatrix (const charMatrix& a) = default;
50 
51  charMatrix& operator = (const charMatrix& a) = default;
52 
53  ~charMatrix () = default;
54 
56  : charNDArray (dim_vector (r, c)) { }
57 
59  : charNDArray (dim_vector (r, c), val) { }
60 
61  charMatrix (const dim_vector& dv) : charNDArray (dv.redim (2)) { }
62 
63  charMatrix (const dim_vector& dv, char val)
64  : charNDArray (dv.redim (2), val) { }
65 
66  charMatrix (const Array<char>& a) : charNDArray (a.as_matrix ()) { }
67 
68  charMatrix (char c) : charNDArray (c) { }
69 
70  charMatrix (const char *s) : charNDArray (s) { }
71 
72  charMatrix (const std::string& s) : charNDArray (s) { }
73 
74  charMatrix (const string_vector& s, char fill_value = '\0')
75  : charNDArray (s, fill_value) { }
76 
77  OCTAVE_API bool operator == (const charMatrix& a) const;
78  OCTAVE_API bool operator != (const charMatrix& a) const;
79 
81 
82  // destructive insert/delete/reorder operations
83 
85  insert (const char *s, octave_idx_type r, octave_idx_type c);
88 
89  OCTAVE_API std::string
90  row_as_string (octave_idx_type, bool strip_ws = false) const;
91 
92  // resize is the destructive equivalent for this one
93 
96  octave_idx_type r2, octave_idx_type c2) const;
97 
98  void resize (octave_idx_type nr, octave_idx_type nc, char rfv = 0)
99  {
100  Array<char>::resize (dim_vector (nr, nc), rfv);
101  }
102 
103 };
104 
107 
110 
113 
114 #endif
Array< T, Alloc > transpose() const
Size of the specified dimension.
Definition: Array-base.cc:1623
Array< T, Alloc > as_matrix() const
Return the array as a matrix.
Definition: Array.h:442
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array-base.cc:1023
ComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
Definition: CMatrix.cc:683
ComplexMatrix & operator=(const ComplexMatrix &a)=default
ComplexMatrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
Definition: CMatrix.cc:195
charMatrix transpose() const
Definition: chMatrix.h:80
void resize(octave_idx_type nr, octave_idx_type nc, char rfv=0)
Definition: chMatrix.h:98
charMatrix(const char *s)
Definition: chMatrix.h:70
~charMatrix()=default
charMatrix(const std::string &s)
Definition: chMatrix.h:72
charMatrix(char c)
Definition: chMatrix.h:68
charMatrix(const Array< char > &a)
Definition: chMatrix.h:66
charMatrix(const dim_vector &dv)
Definition: chMatrix.h:61
charMatrix(octave_idx_type r, octave_idx_type c)
Definition: chMatrix.h:55
charMatrix()=default
charMatrix(const string_vector &s, char fill_value='\0')
Definition: chMatrix.h:74
charMatrix(const charMatrix &a)=default
charMatrix(const dim_vector &dv, char val)
Definition: chMatrix.h:63
charMatrix(octave_idx_type r, octave_idx_type c, char val)
Definition: chMatrix.h:58
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:536
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:520
#define OCTAVE_API
Definition: main.cc:55
T * r
Definition: mx-inlines.cc:781
#define SM_BOOL_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:122
#define MS_CMP_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:89
#define SM_CMP_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:114
#define MS_BOOL_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:97
#define MM_CMP_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:139
#define MM_BOOL_OP_DECLS(M1, M2, API)
Definition: mx-op-decl.h:147