GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
chMatrix.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1995-2022 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
39class
42{
43 friend class ComplexMatrix;
44
45public:
46
47 charMatrix (void) = default;
48
49 charMatrix (const charMatrix& a) = default;
50
51 charMatrix& operator = (const charMatrix& a) = default;
52
53 ~charMatrix (void) = 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
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
80 charMatrix transpose (void) const { return Array<char>::transpose (); }
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#if 0
104 // i/o
105
106 friend OCTAVE_API std::ostream&
107 operator << (std::ostream& os, const Matrix& a);
108 friend OCTAVE_API std::istream& operator >> (std::istream& is, Matrix& a);
109#endif
110};
111
114
117
120
121#endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
OCTARRAY_API Array< T, Alloc > transpose(void) const
Size of the specified dimension.
Definition: Array.cc:1603
OCTARRAY_API void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array.cc:1010
Array< Complex, Alloc > as_matrix(void) const
Return the array as a matrix.
Definition: Array.h:435
OCTAVE_API ComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
Definition: CMatrix.cc:683
OCTAVE_API ComplexMatrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
Definition: CMatrix.cc:195
ComplexMatrix & operator=(const ComplexMatrix &a)=default
Definition: dMatrix.h:42
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(const std::string &s)
Definition: chMatrix.h:72
charMatrix(char c)
Definition: chMatrix.h:68
charMatrix(void)=default
charMatrix(const Array< char > &a)
Definition: chMatrix.h:66
charMatrix(const dim_vector &dv)
Definition: chMatrix.h:61
charMatrix transpose(void) const
Definition: chMatrix.h:80
~charMatrix(void)=default
charMatrix(octave_idx_type r, octave_idx_type c)
Definition: chMatrix.h:55
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.in.cc:55
class OCTAVE_API charMatrix
Definition: mx-fwd.h:36
#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