GNU Octave  6.2.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-2021 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 
41 // char matrix unary ops.
42 
43 DEFUNOP (transpose, char_matrix)
44 {
45  const octave_char_matrix& v = dynamic_cast<const octave_char_matrix&> (a);
46 
47  return octave_value (v.matrix_value ().transpose ());
48 }
49 
50 DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array,
52 
53 DEFCATOP (chm_s, char_matrix, scalar)
54 {
55  octave_char_matrix& v1 = dynamic_cast<octave_char_matrix&> (a1);
56  const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2);
57 
58  warn_implicit_conversion ("Octave:num-to-str",
59  v2.type_name (), v1.type_name ());
60 
62  ra_idx));
63 }
64 
65 DEFCATOP (chm_m, char_matrix, matrix)
66 {
67  octave_char_matrix& v1 = dynamic_cast<octave_char_matrix&> (a1);
68  const octave_matrix& v2 = dynamic_cast<const octave_matrix&> (a2);
69 
70  warn_implicit_conversion ("Octave:num-to-str",
71  v2.type_name (), v1.type_name ());
72 
74  ra_idx));
75 }
76 
77 DEFCATOP (s_chm, scalar, char_matrix)
78 {
79  octave_scalar& v1 = dynamic_cast<octave_scalar&> (a1);
80  const octave_char_matrix& v2 = dynamic_cast<const octave_char_matrix&> (a2);
81 
82  warn_implicit_conversion ("Octave:num-to-str",
83  v1.type_name (), v2.type_name ());
84 
86  ra_idx));
87 }
88 
89 DEFCATOP (m_chm, matrix, char_matrix)
90 {
91  octave_matrix& v1 = dynamic_cast<octave_matrix&> (a1);
92  const octave_char_matrix& v2 = dynamic_cast<const octave_char_matrix&> (a2);
93 
94  warn_implicit_conversion ("Octave:num-to-str",
95  v1.type_name (), v2.type_name ());
96 
98  ra_idx));
99 }
100 
101 void
103 {
106 
112 }
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:418
Matrix transpose(void) const
Definition: dMatrix.h:135
virtual std::string type_name(void) const
Definition: ov-base.h:874
charNDArray char_array_value(bool=false) const
Definition: ov-ch-mat.h:145
Matrix matrix_value(bool=false) const
Definition: ov-ch-mat.h:114
NDArray array_value(bool=false) const
Definition: ov-ch-mat.h:120
std::string type_name(void) const
Definition: ov-re-mat.h:250
NDArray array_value(bool=false) const
Definition: ov-re-mat.h:172
std::string type_name(void) const
Definition: ov-scalar.h:280
NDArray array_value(bool=false) const
Definition: ov-scalar.h:162
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:102
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 DEFNDCATOP_FN(name, t1, t2, e1, e2, f)
Definition: ops.h:348
#define DEFUNOP(name, t)
Definition: ops.h:179
#define INSTALL_CATOP_TI(ti, t1, t2, f)
Definition: ops.h:60
#define INSTALL_UNOP_TI(ti, op, t, f)
Definition: ops.h:47
#define DEFCATOP(name, t1, t2)
Definition: ops.h:328
static bool scalar(const dim_vector &dims)
Definition: ov-struct.cc:669
octave_value op_transpose(const octave_value &a)
Definition: ov.h:1540
octave_value op_hermitian(const octave_value &a)
Definition: ov.h:1541
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
Definition: symrcm.cc:389