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-range.h" |
4915
|
32 #include "ov-ch-mat.h" |
|
33 #include "ov-scalar.h" |
|
34 #include "ov-re-mat.h" |
|
35 #include "ov-complex.h" |
|
36 #include "ov-cx-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 // range unary ops. |
|
43 |
|
44 DEFUNOP (not, range) |
|
45 { |
|
46 CAST_UNOP_ARG (const octave_range&); |
|
47 |
|
48 return octave_value (! v.matrix_value()); |
|
49 } |
|
50 |
4965
|
51 DEFUNOP_OP (uplus, range, /* no-op */) |
3207
|
52 DEFUNOP_OP (uminus, range, -) |
|
53 |
|
54 DEFUNOP (transpose, range) |
|
55 { |
|
56 CAST_UNOP_ARG (const octave_range&); |
|
57 |
|
58 return octave_value (v.matrix_value().transpose ()); |
|
59 } |
|
60 |
4915
|
61 DEFNDCATOP_FN (r_r, range, range, array, array, concat) |
|
62 DEFNDCATOP_FN (r_s, range, scalar, array, array, concat) |
|
63 DEFNDCATOP_FN (r_m, range, matrix, array, array, concat) |
|
64 DEFNDCATOP_FN (r_cs, range, complex, array, complex_array, concat) |
|
65 DEFNDCATOP_FN (r_cm, range, complex_matrix, array, complex_array, concat) |
|
66 DEFNDCATOP_FN (r_b, range, bool, array, array, concat) |
|
67 DEFNDCATOP_FN (r_bm, range, bool_matrix, array, array, concat) |
|
68 DEFNDCATOP_FN (r_chm, range, char_matrix, array, char_array, concat) |
|
69 DEFNDCATOP_FN (s_r, scalar, range, array, array, concat) |
|
70 DEFNDCATOP_FN (m_r, matrix, range, array, array, concat) |
|
71 DEFNDCATOP_FN (cs_r, complex, range, complex_array, array, concat) |
|
72 DEFNDCATOP_FN (cm_r, complex_matrix, range, complex_array, array, concat) |
|
73 DEFNDCATOP_FN (b_r, bool, range, array, array, concat) |
|
74 DEFNDCATOP_FN (bm_r, bool_matrix, range, array, array, concat) |
|
75 DEFNDCATOP_FN (chm_r, char_matrix, range, char_array, array, concat) |
|
76 |
3207
|
77 void |
|
78 install_range_ops (void) |
|
79 { |
3538
|
80 INSTALL_UNOP (op_not, octave_range, not); |
4965
|
81 INSTALL_UNOP (op_uplus, octave_range, uplus); |
3538
|
82 INSTALL_UNOP (op_uminus, octave_range, uminus); |
|
83 INSTALL_UNOP (op_transpose, octave_range, transpose); |
|
84 INSTALL_UNOP (op_hermitian, octave_range, transpose); |
4915
|
85 |
|
86 INSTALL_CATOP (octave_range, octave_range, r_r); |
|
87 INSTALL_CATOP (octave_range, octave_scalar, r_s); |
|
88 INSTALL_CATOP (octave_range, octave_matrix, r_m); |
|
89 INSTALL_CATOP (octave_range, octave_complex, r_cs); |
|
90 INSTALL_CATOP (octave_range, octave_complex_matrix, r_cm); |
|
91 INSTALL_CATOP (octave_range, octave_bool, r_b); |
|
92 INSTALL_CATOP (octave_range, octave_bool_matrix, r_bm); |
|
93 INSTALL_CATOP (octave_range, octave_char_matrix, r_chm); |
|
94 INSTALL_CATOP (octave_scalar, octave_range, s_r); |
|
95 INSTALL_CATOP (octave_matrix, octave_range, m_r); |
|
96 INSTALL_CATOP (octave_complex, octave_range, cs_r); |
|
97 INSTALL_CATOP (octave_complex_matrix, octave_range, cm_r); |
|
98 INSTALL_CATOP (octave_bool, octave_range, b_r); |
|
99 INSTALL_CATOP (octave_bool_matrix, octave_range, bm_r); |
|
100 INSTALL_CATOP (octave_char_matrix, octave_range, chm_r); |
3207
|
101 } |
|
102 |
|
103 /* |
|
104 ;;; Local Variables: *** |
|
105 ;;; mode: C++ *** |
|
106 ;;; End: *** |
|
107 */ |