GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ov-ch-mat.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-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_ov_ch_mat_h)
27#define octave_ov_ch_mat_h 1
28
29#include "octave-config.h"
30
31#include <cstdlib>
32
33#include <iosfwd>
34#include <string>
35
36#include "mx-base.h"
37#include "str-vec.h"
38
39#include "error.h"
40#include "ov.h"
41#include "ov-base.h"
42#include "ov-base-mat.h"
43#include "ov-int64.h"
44#include "ov-re-mat.h"
45#include "ov-typeinfo.h"
46
48
49// Character matrix values.
50
51extern template class OCTINTERP_EXTERN_TEMPLATE_API octave_base_matrix<charNDArray>;
52
54{
55protected:
56
59
62
65
68
71
72 octave_char_matrix (const char *s)
74
75 octave_char_matrix (const std::string& s)
77
80
83
84public:
85
86 ~octave_char_matrix () = default;
87
89 { return new octave_char_matrix (*this); }
91 { return new octave_char_matrix (); }
92
93 octave::idx_vector index_vector (bool require_integers = false) const;
94
96
97 bool is_char_matrix () const { return true; }
98 bool is_real_matrix () const { return true; }
99
100 bool isreal () const { return true; }
101
102 double double_value (bool = false) const;
103
104 float float_value (bool = false) const;
105
106 double scalar_value (bool frc_str_conv = false) const
107 { return double_value (frc_str_conv); }
108
109 float float_scalar_value (bool frc_str_conv = false) const
110 { return float_value (frc_str_conv); }
111
112 octave_int64 int64_scalar_value () const;
113 octave_uint64 uint64_scalar_value () const;
114
115 Matrix matrix_value (bool = false) const
116 { return Matrix (charMatrix (m_matrix)); }
117
118 FloatMatrix float_matrix_value (bool = false) const
119 { return FloatMatrix (charMatrix (m_matrix)); }
120
121 NDArray array_value (bool = false) const
122 { return NDArray (m_matrix); }
123
124 FloatNDArray float_array_value (bool = false) const
125 { return FloatNDArray (m_matrix); }
126
127 Complex complex_value (bool = false) const;
128
129 FloatComplex float_complex_value (bool = false) const;
130
132 { return ComplexMatrix (charMatrix (m_matrix)); }
133
135 { return FloatComplexMatrix (charMatrix (m_matrix)); }
136
138 { return ComplexNDArray (m_matrix); }
139
141 { return FloatComplexNDArray (m_matrix); }
142
143 charMatrix char_matrix_value (bool = false) const
144 { return charMatrix (m_matrix); }
145
146 charNDArray char_array_value (bool = false) const
147 { return m_matrix; }
148
149 octave_value convert_to_str_internal (bool, bool, char type) const
150 { return octave_value (m_matrix, type); }
151
152 octave_value as_double () const;
153 octave_value as_single () const;
154
155 octave_value as_int8 () const;
156 octave_value as_int16 () const;
157 octave_value as_int32 () const;
158 octave_value as_int64 () const;
159
160 octave_value as_uint8 () const;
161 octave_value as_uint16 () const;
162 octave_value as_uint32 () const;
163 octave_value as_uint64 () const;
164
165 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
166
167 mxArray * as_mxArray (bool interleaved) const;
168
169 octave_value map (unary_mapper_t umap) const;
170};
171
172#endif
N Dimensional Array with copy-on-write semantics.
Definition Array.h:130
octave_char_matrix(char c)
Definition ov-ch-mat.h:69
ComplexMatrix complex_matrix_value(bool=false) const
Definition ov-ch-mat.h:131
octave_base_value * clone() const
Definition ov-ch-mat.h:88
builtin_type_t builtin_type() const
Definition ov-ch-mat.h:95
FloatNDArray float_array_value(bool=false) const
Definition ov-ch-mat.h:124
octave_char_matrix(const std::string &s)
Definition ov-ch-mat.h:75
octave_char_matrix(const char *s)
Definition ov-ch-mat.h:72
octave_value convert_to_str_internal(bool, bool, char type) const
Definition ov-ch-mat.h:149
octave_char_matrix(const charMatrix &chm)
Definition ov-ch-mat.h:60
FloatMatrix float_matrix_value(bool=false) const
Definition ov-ch-mat.h:118
octave_base_value * empty_clone() const
Definition ov-ch-mat.h:90
charMatrix char_matrix_value(bool=false) const
Definition ov-ch-mat.h:143
charNDArray char_array_value(bool=false) const
Definition ov-ch-mat.h:146
ComplexNDArray complex_array_value(bool=false) const
Definition ov-ch-mat.h:137
bool isreal() const
Definition ov-ch-mat.h:100
octave_char_matrix(const octave_char_matrix &chm)
Definition ov-ch-mat.h:81
Matrix matrix_value(bool=false) const
Definition ov-ch-mat.h:115
~octave_char_matrix()=default
float float_scalar_value(bool frc_str_conv=false) const
Definition ov-ch-mat.h:109
octave_char_matrix(const charNDArray &chm)
Definition ov-ch-mat.h:63
double scalar_value(bool frc_str_conv=false) const
Definition ov-ch-mat.h:106
FloatComplexNDArray float_complex_array_value(bool=false) const
Definition ov-ch-mat.h:140
FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition ov-ch-mat.h:134
bool is_char_matrix() const
Definition ov-ch-mat.h:97
octave_char_matrix(const string_vector &s)
Definition ov-ch-mat.h:78
octave_char_matrix(const Array< char > &chm)
Definition ov-ch-mat.h:66
NDArray array_value(bool=false) const
Definition ov-ch-mat.h:121
bool is_real_matrix() const
Definition ov-ch-mat.h:98
std::complex< double > Complex
Definition oct-cmplx.h:33
std::complex< float > FloatComplex
Definition oct-cmplx.h:34
builtin_type_t
Definition ov-base.h:83
@ btyp_char
Definition ov-base.h:97