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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
4192
|
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
3207
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
|
31 #include "gripes.h" |
4055
|
32 #include "oct-obj.h" |
3207
|
33 #include "ov.h" |
|
34 #include "ov-ch-mat.h" |
4915
|
35 #include "ov-scalar.h" |
|
36 #include "ov-re-mat.h" |
|
37 #include "ov-bool.h" |
|
38 #include "ov-bool-mat.h" |
3207
|
39 #include "ov-typeinfo.h" |
|
40 #include "ops.h" |
|
41 |
|
42 // char matrix unary ops. |
|
43 |
|
44 DEFUNOP (transpose, char_matrix) |
|
45 { |
|
46 CAST_UNOP_ARG (const octave_char_matrix&); |
|
47 |
|
48 return octave_value (v.matrix_value().transpose ()); |
|
49 } |
|
50 |
4915
|
51 DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array, concat) |
|
52 |
|
53 DEFCATOP (chm_s, char_matrix, scalar) |
|
54 { |
|
55 CAST_BINOP_ARGS (const octave_char_matrix&, const octave_scalar&); |
|
56 |
|
57 if (Vwarn_num_to_str) |
|
58 gripe_implicit_conversion (v2.type_name (), v1.type_name ()); |
|
59 |
|
60 return octave_value (concat (v1.char_array_value (), v2.array_value (), |
|
61 ra_idx)); |
|
62 } |
|
63 |
|
64 DEFCATOP (chm_m, char_matrix, matrix) |
|
65 { |
|
66 CAST_BINOP_ARGS (const octave_char_matrix&, const octave_matrix&); |
|
67 |
|
68 if (Vwarn_num_to_str) |
|
69 gripe_implicit_conversion (v2.type_name (), v1.type_name ()); |
|
70 |
|
71 return octave_value (concat (v1.char_array_value (), v2.array_value (), |
|
72 ra_idx)); |
|
73 } |
|
74 |
|
75 DEFCATOP (s_chm, scalar, char_matrix) |
|
76 { |
|
77 CAST_BINOP_ARGS (const octave_scalar&, const octave_char_matrix&); |
|
78 |
|
79 if (Vwarn_num_to_str) |
|
80 gripe_implicit_conversion (v1.type_name (), v2.type_name ()); |
|
81 |
|
82 return octave_value (concat (v1.array_value (), v2.char_array_value (), |
|
83 ra_idx)); |
|
84 } |
|
85 |
|
86 DEFCATOP (m_chm, matrix, char_matrix) |
|
87 { |
|
88 CAST_BINOP_ARGS (const octave_matrix&, const octave_char_matrix&); |
|
89 |
|
90 if (Vwarn_num_to_str) |
|
91 gripe_implicit_conversion (v1.type_name (), v2.type_name ()); |
|
92 |
|
93 return octave_value (concat (v1.array_value (), v2.char_array_value (), |
|
94 ra_idx)); |
|
95 } |
|
96 |
3207
|
97 void |
|
98 install_chm_ops (void) |
|
99 { |
3538
|
100 INSTALL_UNOP (op_transpose, octave_char_matrix, transpose); |
|
101 INSTALL_UNOP (op_hermitian, octave_char_matrix, transpose); |
4915
|
102 |
|
103 INSTALL_CATOP (octave_char_matrix, octave_char_matrix, chm_chm); |
|
104 INSTALL_CATOP (octave_char_matrix, octave_scalar, chm_s); |
|
105 INSTALL_CATOP (octave_char_matrix, octave_matrix, chm_m); |
|
106 INSTALL_CATOP (octave_scalar, octave_char_matrix, s_chm); |
|
107 INSTALL_CATOP (octave_matrix, octave_char_matrix, m_chm); |
3207
|
108 } |
|
109 |
|
110 /* |
|
111 ;;; Local Variables: *** |
|
112 ;;; mode: C++ *** |
|
113 ;;; End: *** |
|
114 */ |