GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
op-chm.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2024 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 (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include "errwarn.h"
31 #include "ovl.h"
32 #include "ov.h"
33 #include "ov-ch-mat.h"
34 #include "ov-scalar.h"
35 #include "ov-re-mat.h"
36 #include "ov-bool.h"
37 #include "ov-bool-mat.h"
38 #include "ov-typeinfo.h"
39 #include "ops.h"
40 
42 
43 // char matrix unary ops.
44 
45 DEFUNOP (transpose, char_matrix)
46 {
48 
49  return octave_value (v.matrix_value ().transpose ());
50 }
51 
52 DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array,
53  concat)
54 
55 DEFCATOP (chm_s, char_matrix, scalar)
56 {
59 
60  warn_implicit_conversion ("Octave:num-to-str",
61  v2.type_name (), v1.type_name ());
62 
63  return octave_value (v1.char_array_value (). concat (v2.array_value (),
64  ra_idx));
65 }
66 
67 DEFCATOP (chm_m, char_matrix, matrix)
68 {
71 
72  warn_implicit_conversion ("Octave:num-to-str",
73  v2.type_name (), v1.type_name ());
74 
75  return octave_value (v1.char_array_value (). concat (v2.array_value (),
76  ra_idx));
77 }
78 
79 DEFCATOP (s_chm, scalar, char_matrix)
80 {
81  OCTAVE_CAST_BASE_VALUE (const octave_scalar&, v1, a1);
83 
84  warn_implicit_conversion ("Octave:num-to-str",
85  v1.type_name (), v2.type_name ());
86 
87  return octave_value (v1.array_value (). concat (v2.char_array_value (),
88  ra_idx));
89 }
90 
91 DEFCATOP (m_chm, matrix, char_matrix)
92 {
93  OCTAVE_CAST_BASE_VALUE (const octave_matrix&, v1, a1);
95 
96  warn_implicit_conversion ("Octave:num-to-str",
97  v1.type_name (), v2.type_name ());
98 
99  return octave_value (v1.array_value (). concat (v2.char_array_value (),
100  ra_idx));
101 }
102 
103 void
104 install_chm_ops (octave::type_info& ti)
105 {
108 
114 }
115 
116 OCTAVE_END_NAMESPACE(octave)
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:418
virtual std::string type_name() const
Definition: ov-base.h:954
charNDArray char_array_value(bool=false) const
Definition: ov-ch-mat.h:145
NDArray array_value(bool=false) const
Definition: ov-ch-mat.h:120
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void warn_implicit_conversion(const char *id, const char *from, const char *to)
Definition: errwarn.cc:344
void install_chm_ops(octave::type_info &ti)
Definition: op-chm.cc:104
const octave_base_value & a2
const octave_base_value const Array< octave_idx_type > & ra_idx
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
const octave_char_matrix & v2
#define OCTAVE_CAST_BASE_VALUE(T, T_VAL, BASE_VAL)
Definition: ops.h:52
#define DEFNDCATOP_FN(name, t1, t2, e1, e2, f)
Definition: ops.h:364
#define DEFUNOP(name, t)
Definition: ops.h:194
#define INSTALL_CATOP_TI(ti, t1, t2, f)
Definition: ops.h:75
#define INSTALL_UNOP_TI(ti, op, t, f)
Definition: ops.h:62
#define DEFCATOP(name, t1, t2)
Definition: ops.h:344
octave_value op_transpose(const octave_value &a)
Definition: ov.h:1637
octave_value op_hermitian(const octave_value &a)
Definition: ov.h:1638