3207
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
3207
|
21 |
|
22 */ |
|
23 |
|
24 #ifdef HAVE_CONFIG_H |
|
25 #include <config.h> |
|
26 #endif |
|
27 |
|
28 #include "gripes.h" |
4055
|
29 #include "oct-obj.h" |
3207
|
30 #include "ov.h" |
|
31 #include "ov-ch-mat.h" |
4915
|
32 #include "ov-scalar.h" |
|
33 #include "ov-re-mat.h" |
|
34 #include "ov-bool.h" |
|
35 #include "ov-bool-mat.h" |
3207
|
36 #include "ov-typeinfo.h" |
|
37 #include "ops.h" |
|
38 |
|
39 // char matrix unary ops. |
|
40 |
|
41 DEFUNOP (transpose, char_matrix) |
|
42 { |
|
43 CAST_UNOP_ARG (const octave_char_matrix&); |
|
44 |
|
45 return octave_value (v.matrix_value().transpose ()); |
|
46 } |
|
47 |
5073
|
48 DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array, |
|
49 concat) |
4915
|
50 |
|
51 DEFCATOP (chm_s, char_matrix, scalar) |
|
52 { |
5073
|
53 CAST_BINOP_ARGS (octave_char_matrix&, const octave_scalar&); |
4915
|
54 |
5781
|
55 gripe_implicit_conversion ("Octave:num-to-str", |
|
56 v2.type_name (), v1.type_name ()); |
4915
|
57 |
5073
|
58 return octave_value (v1.char_array_value (). concat(v2.array_value (), |
4915
|
59 ra_idx)); |
|
60 } |
|
61 |
|
62 DEFCATOP (chm_m, char_matrix, matrix) |
|
63 { |
5073
|
64 CAST_BINOP_ARGS (octave_char_matrix&, const octave_matrix&); |
4915
|
65 |
5781
|
66 gripe_implicit_conversion ("Octave:num-to-str", |
|
67 v2.type_name (), v1.type_name ()); |
4915
|
68 |
5073
|
69 return octave_value (v1.char_array_value (). concat (v2.array_value (), |
4915
|
70 ra_idx)); |
|
71 } |
|
72 |
|
73 DEFCATOP (s_chm, scalar, char_matrix) |
|
74 { |
5073
|
75 CAST_BINOP_ARGS (octave_scalar&, const octave_char_matrix&); |
4915
|
76 |
5781
|
77 gripe_implicit_conversion ("Octave:num-to-str", |
|
78 v1.type_name (), v2.type_name ()); |
4915
|
79 |
5073
|
80 return octave_value (v1.array_value (). concat (v2.char_array_value (), |
4915
|
81 ra_idx)); |
|
82 } |
|
83 |
|
84 DEFCATOP (m_chm, matrix, char_matrix) |
|
85 { |
5073
|
86 CAST_BINOP_ARGS (octave_matrix&, const octave_char_matrix&); |
4915
|
87 |
5781
|
88 gripe_implicit_conversion ("Octave:num-to-str", |
|
89 v1.type_name (), v2.type_name ()); |
4915
|
90 |
5073
|
91 return octave_value (v1.array_value (). concat (v2.char_array_value (), |
4915
|
92 ra_idx)); |
|
93 } |
|
94 |
3207
|
95 void |
|
96 install_chm_ops (void) |
|
97 { |
3538
|
98 INSTALL_UNOP (op_transpose, octave_char_matrix, transpose); |
|
99 INSTALL_UNOP (op_hermitian, octave_char_matrix, transpose); |
4915
|
100 |
|
101 INSTALL_CATOP (octave_char_matrix, octave_char_matrix, chm_chm); |
|
102 INSTALL_CATOP (octave_char_matrix, octave_scalar, chm_s); |
|
103 INSTALL_CATOP (octave_char_matrix, octave_matrix, chm_m); |
|
104 INSTALL_CATOP (octave_scalar, octave_char_matrix, s_chm); |
|
105 INSTALL_CATOP (octave_matrix, octave_char_matrix, m_chm); |
3207
|
106 } |
|
107 |
|
108 /* |
|
109 ;;; Local Variables: *** |
|
110 ;;; mode: C++ *** |
|
111 ;;; End: *** |
|
112 */ |