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
ov-ch-mat.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
4 Copyright (C) 2009-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_ov_ch_mat_h)
25 #define octave_ov_ch_mat_h 1
26 
27 #include "octave-config.h"
28 
29 #include <cstdlib>
30 
31 #include <iosfwd>
32 #include <string>
33 
34 #include "mx-base.h"
35 #include "str-vec.h"
36 
37 #include "error.h"
38 #include "ov.h"
39 #include "ov-base.h"
40 #include "ov-base-mat.h"
41 #include "ov-int64.h"
42 #include "ov-re-mat.h"
43 #include "ov-typeinfo.h"
44 
45 class octave_value_list;
46 
47 class tree_walker;
48 
49 // Character matrix values.
50 
51 class
53 {
54 protected:
55 
58 
60  : octave_base_matrix<charNDArray> (chm) { }
61 
63  : octave_base_matrix<charNDArray> (chm) { }
64 
66  : octave_base_matrix<charNDArray> (chm) { }
67 
70 
71  octave_char_matrix (const char *s)
73 
76 
79 
81  : octave_base_matrix<charNDArray> (chm) { }
82 
83 public:
84 
86 
87  octave_base_value *clone (void) const
88  { return new octave_char_matrix (*this); }
90  { return new octave_char_matrix (); }
91 
92  idx_vector index_vector (bool require_integers = false) const;
93 
94  builtin_type_t builtin_type (void) const { return btyp_char; }
95 
96  bool is_char_matrix (void) const { return true; }
97  bool is_real_matrix (void) const { return true; }
98 
99  bool is_real_type (void) const { return true; }
100 
101  double double_value (bool = false) const;
102 
103  float float_value (bool = false) const;
104 
105  double scalar_value (bool frc_str_conv = false) const
106  { return double_value (frc_str_conv); }
107 
108  float float_scalar_value (bool frc_str_conv = false) const
109  { return float_value (frc_str_conv); }
110 
111  octave_int64 int64_scalar_value () const;
112  octave_uint64 uint64_scalar_value () const;
113 
114  Matrix matrix_value (bool = false) const
115  { return Matrix (charMatrix (matrix)); }
116 
117  FloatMatrix float_matrix_value (bool = false) const
118  { return FloatMatrix (charMatrix (matrix)); }
119 
120  NDArray array_value (bool = false) const
121  { return NDArray (matrix); }
122 
123  FloatNDArray float_array_value (bool = false) const
124  { return FloatNDArray (matrix); }
125 
126  Complex complex_value (bool = false) const;
127 
128  FloatComplex float_complex_value (bool = false) const;
129 
130  ComplexMatrix complex_matrix_value (bool = false) const
131  { return ComplexMatrix (charMatrix (matrix)); }
132 
134  { return FloatComplexMatrix (charMatrix (matrix)); }
135 
136  ComplexNDArray complex_array_value (bool = false) const
137  { return ComplexNDArray (matrix); }
138 
140  { return FloatComplexNDArray (matrix); }
141 
142  charMatrix char_matrix_value (bool = false) const
143  { return charMatrix (matrix); }
144 
145  charNDArray char_array_value (bool = false) const
146  { return matrix; }
147 
148  octave_value convert_to_str_internal (bool, bool, char type) const
149  { return octave_value (matrix, type); }
150 
151  octave_value as_double (void) const;
152  octave_value as_single (void) const;
153 
154  octave_value as_int8 (void) const;
155  octave_value as_int16 (void) const;
156  octave_value as_int32 (void) const;
157  octave_value as_int64 (void) const;
158 
159  octave_value as_uint8 (void) const;
160  octave_value as_uint16 (void) const;
161  octave_value as_uint32 (void) const;
162  octave_value as_uint64 (void) const;
163 
164  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
165 
166  // Unsafe. This function exists to support the MEX interface.
167  // You should not use it anywhere else.
168  void *mex_get_data (void) const { return matrix.mex_get_data (); }
169 
170  mxArray *as_mxArray (void) const;
171 
172  octave_value map (unary_mapper_t umap) const;
173 };
174 
175 #endif
~octave_char_matrix(void)
Definition: ov-ch-mat.h:85
FloatMatrix float_matrix_value(bool=false) const
Definition: ov-ch-mat.h:117
double scalar_value(bool frc_str_conv=false) const
Definition: ov-ch-mat.h:105
octave_value convert_to_str_internal(bool, bool, char type) const
Definition: ov-ch-mat.h:148
ComplexNDArray complex_array_value(bool=false) const
Definition: ov-ch-mat.h:136
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the then the first element defines the pivoting tolerance for the unsymmetric the values defined such that for full matrix
Definition: lu.cc:138
bool is_real_matrix(void) const
Definition: ov-ch-mat.h:97
octave_char_matrix(void)
Definition: ov-ch-mat.h:56
octave_char_matrix(const charMatrix &chm)
Definition: ov-ch-mat.h:59
octave_base_value * empty_clone(void) const
Definition: ov-ch-mat.h:89
FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition: ov-ch-mat.h:133
FloatComplexNDArray float_complex_array_value(bool=false) const
Definition: ov-ch-mat.h:139
octave_char_matrix(const charNDArray &chm)
Definition: ov-ch-mat.h:62
bool is_real_type(void) const
Definition: ov-ch-mat.h:99
octave_char_matrix(const string_vector &s)
Definition: ov-ch-mat.h:77
s
Definition: file-io.cc:2682
ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-ch-mat.h:130
builtin_type_t
Definition: ov-base.h:61
octave_char_matrix(const std::string &s)
Definition: ov-ch-mat.h:74
void * mex_get_data(void) const
Definition: ov-ch-mat.h:168
Matrix matrix_value(bool=false) const
Definition: ov-ch-mat.h:114
builtin_type_t builtin_type(void) const
Definition: ov-ch-mat.h:94
octave_char_matrix(const char *s)
Definition: ov-ch-mat.h:71
octave_char_matrix(const Array< char > &chm)
Definition: ov-ch-mat.h:65
octave_base_value * clone(void) const
Definition: ov-ch-mat.h:87
idx type
Definition: ov.cc:3129
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
charMatrix char_matrix_value(bool=false) const
Definition: ov-ch-mat.h:142
float float_scalar_value(bool frc_str_conv=false) const
Definition: ov-ch-mat.h:108
octave_char_matrix(const octave_char_matrix &chm)
Definition: ov-ch-mat.h:80
octave_char_matrix(char c)
Definition: ov-ch-mat.h:68
charNDArray char_array_value(bool=false) const
Definition: ov-ch-mat.h:145
octave_map map(dims)
NDArray array_value(bool=false) const
Definition: ov-ch-mat.h:120
std::complex< float > FloatComplex
Definition: oct-cmplx.h:32
bool is_char_matrix(void) const
Definition: ov-ch-mat.h:96
std::complex< double > Complex
Definition: oct-cmplx.h:31
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
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
FloatNDArray float_array_value(bool=false) const
Definition: ov-ch-mat.h:123