GNU Octave  4.2.1
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-2017 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 "octave-config.h"
28 
29 #include <string>
30 
31 #include "Array.h"
32 #include "chNDArray.h"
33 
34 #include "mx-defs.h"
35 #include "mx-op-decl.h"
36 #include "str-vec.h"
37 
38 class
39 OCTAVE_API
40 charMatrix : public charNDArray
41 {
42  friend class ComplexMatrix;
43 
44 public:
45 
46  charMatrix (void) : charNDArray () { }
47 
49  : charNDArray (dim_vector (r, c)) { }
50 
52  : charNDArray (dim_vector (r, c), val) { }
53 
54  charMatrix (const dim_vector& dv) : charNDArray (dv.redim (2)) { }
55 
56  charMatrix (const dim_vector& dv, char val)
57  : charNDArray (dv.redim (2), val) { }
58 
60 
61  charMatrix (const charMatrix& a) : charNDArray (a) { }
62 
63  charMatrix (char c) : charNDArray (c) { }
64 
65  charMatrix (const char *s) : charNDArray (s) { }
66 
67  charMatrix (const std::string& s) : charNDArray (s) { }
68 
69  charMatrix (const string_vector& s, char fill_value = '\0')
70  : charNDArray (s, fill_value) { }
71 
72  bool operator == (const charMatrix& a) const;
73  bool operator != (const charMatrix& a) const;
74 
75  charMatrix transpose (void) const { return Array<char>::transpose (); }
76 
77  // destructive insert/delete/reorder operations
78 
80  charMatrix& insert (const charMatrix& a,
82 
83  std::string row_as_string (octave_idx_type, bool strip_ws = false) const;
84 
85  // resize is the destructive equivalent for this one
86 
88  octave_idx_type r2, octave_idx_type c2) const;
89 
90  void resize (octave_idx_type nr, octave_idx_type nc, char rfv = 0)
91  {
92  Array<char>::resize (dim_vector (nr, nc), rfv);
93  }
94 
95 #if 0
96  // i/o
97 
98  friend std::ostream& operator << (std::ostream& os, const Matrix& a);
99  friend std::istream& operator >> (std::istream& is, Matrix& a);
100 #endif
101 };
102 
103 MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API)
104 MS_BOOL_OP_DECLS (charMatrix, char, OCTAVE_API)
105 
106 SM_CMP_OP_DECLS (char, charMatrix, OCTAVE_API)
107 SM_BOOL_OP_DECLS (char, charMatrix, OCTAVE_API)
108 
109 MM_CMP_OP_DECLS (charMatrix, charMatrix, OCTAVE_API)
110 MM_BOOL_OP_DECLS (charMatrix, charMatrix, OCTAVE_API)
111 
112 #endif
Array< Complex > as_matrix(void) const
Return the array as a matrix.
Definition: Array.h:387
charMatrix(octave_idx_type r, octave_idx_type c, char val)
Definition: chMatrix.h:51
charMatrix transpose(void) const
Definition: chMatrix.h:75
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:567
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
charMatrix(const dim_vector &dv)
Definition: chMatrix.h:54
#define SM_CMP_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:114
s
Definition: file-io.cc:2682
charMatrix(const charMatrix &a)
Definition: chMatrix.h:61
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
charMatrix(const char *s)
Definition: chMatrix.h:65
#define SM_BOOL_OP_DECLS(S, M, API)
Definition: mx-op-decl.h:122
#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
Array< T > transpose(void) const
Definition: Array.cc:1616
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1028
void resize(octave_idx_type nr, octave_idx_type nc, char rfv=0)
Definition: chMatrix.h:90
Definition: dMatrix.h:37
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
ComplexMatrix & insert(const Matrix &a, octave_idx_type r, octave_idx_type c)
Definition: CMatrix.cc:198
charMatrix(const std::string &s)
Definition: chMatrix.h:67
charMatrix(const dim_vector &dv, char val)
Definition: chMatrix.h:56
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:538
charMatrix(octave_idx_type r, octave_idx_type c)
Definition: chMatrix.h:48
#define MS_CMP_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:89
charMatrix(const string_vector &s, char fill_value= '\0')
Definition: chMatrix.h:69
charMatrix(char c)
Definition: chMatrix.h:63
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
#define MS_BOOL_OP_DECLS(M, S, API)
Definition: mx-op-decl.h:97
charMatrix(void)
Definition: chMatrix.h:46
charMatrix(const Array< char > &a)
Definition: chMatrix.h:59
write the output to stdout if nargout is
Definition: load-save.cc:1576
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
dim_vector dv
Definition: sub2ind.cc:263
ComplexMatrix extract(octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const
Definition: CMatrix.cc:686