GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
chMatrix.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1995-2025 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
40{
41 friend class ComplexMatrix;
42
43public:
44
45 charMatrix () = default;
46
47 charMatrix (const charMatrix& a) = default;
48
49 charMatrix& operator = (const charMatrix& a) = default;
50
51 ~charMatrix () = default;
52
55
57 : charNDArray (dim_vector (r, c), val) { }
58
59 charMatrix (const dim_vector& dv) : charNDArray (dv.redim (2)) { }
60
61 charMatrix (const dim_vector& dv, char val)
62 : charNDArray (dv.redim (2), val) { }
63
64 charMatrix (const Array<char>& a) : charNDArray (a.as_matrix ()) { }
65
66 charMatrix (char c) : charNDArray (c) { }
67
68 charMatrix (const char *s) : charNDArray (s) { }
69
70 charMatrix (const std::string& s) : charNDArray (s) { }
71
72 charMatrix (const string_vector& s, char fill_value = '\0')
73 : charNDArray (s, fill_value) { }
74
75 OCTAVE_API bool operator == (const charMatrix& a) const;
76 OCTAVE_API bool operator != (const charMatrix& a) const;
77
79
80 // destructive insert/delete/reorder operations
81
83 insert (const char *s, octave_idx_type r, octave_idx_type c);
86
87 OCTAVE_API std::string
88 row_as_string (octave_idx_type, bool strip_ws = false) const;
89
90 // resize is the destructive equivalent for this one
91
93 extract (octave_idx_type r1, octave_idx_type c1,
94 octave_idx_type r2, octave_idx_type c2) const;
95
96 void resize (octave_idx_type nr, octave_idx_type nc, char rfv = 0)
97 {
98 Array<char>::resize (dim_vector (nr, nc), rfv);
99 }
100
101};
102
105
108
111
112#endif
N Dimensional Array with copy-on-write semantics.
Definition Array.h:130
Array< T, Alloc > transpose() const
Size of the specified dimension.
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
charMatrix transpose() const
Definition chMatrix.h:78
void resize(octave_idx_type nr, octave_idx_type nc, char rfv=0)
Definition chMatrix.h:96
charMatrix(const char *s)
Definition chMatrix.h:68
~charMatrix()=default
charMatrix(const std::string &s)
Definition chMatrix.h:70
charMatrix(char c)
Definition chMatrix.h:66
charMatrix(const Array< char > &a)
Definition chMatrix.h:64
charMatrix(const dim_vector &dv)
Definition chMatrix.h:59
charMatrix(octave_idx_type r, octave_idx_type c)
Definition chMatrix.h:53
charMatrix()=default
charMatrix(const string_vector &s, char fill_value='\0')
Definition chMatrix.h:72
charMatrix(const charMatrix &a)=default
charMatrix(const dim_vector &dv, char val)
Definition chMatrix.h:61
charMatrix(octave_idx_type r, octave_idx_type c, char val)
Definition chMatrix.h:56
charNDArray & insert(const charNDArray &a, octave_idx_type r, octave_idx_type c)
Definition chNDArray.cc:166
charNDArray & operator=(const charNDArray &a)
Definition chNDArray.h:61
Vector representing the dimensions (size) of an Array.
Definition dim-vector.h:90
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition dim-vector.h:532
bool operator==(const dim_vector &a, const dim_vector &b)
Definition dim-vector.h:516
#define OCTAVE_API
Definition main.in.cc:55
#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