Mercurial > octave-nkf
comparison src/OPERATORS/op-i16-i16.cc @ 4901:35bfb4e0b96b
[project @ 2004-06-14 18:33:02 by jwe]
author | jwe |
---|---|
date | Mon, 14 Jun 2004 18:33:02 +0000 |
parents | |
children | f7a337f3fd9e |
comparison
equal
deleted
inserted
replaced
4900:cf470c996819 | 4901:35bfb4e0b96b |
---|---|
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 | |
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) | |
24 #pragma implementation | |
25 #endif | |
26 | |
27 #ifdef HAVE_CONFIG_H | |
28 #include <config.h> | |
29 #endif | |
30 | |
31 #include "gripes.h" | |
32 #include "oct-obj.h" | |
33 #include "ov.h" | |
34 #include "ov-int16.h" | |
35 #include "ov-typeinfo.h" | |
36 #include "ops.h" | |
37 #include "xdiv.h" | |
38 #include "xpow.h" | |
39 | |
40 // matrix unary ops. | |
41 | |
42 DEFNDUNOP_OP (not, int16_matrix, int16_array, !) | |
43 DEFNDUNOP_OP (uminus, int16_matrix, int16_array, -) | |
44 | |
45 DEFUNOP (transpose, int16_matrix) | |
46 { | |
47 CAST_UNOP_ARG (const octave_int16_matrix&); | |
48 | |
49 if (v.ndims () > 2) | |
50 { | |
51 error ("transpose not defined for N-d objects"); | |
52 return octave_value (); | |
53 } | |
54 else | |
55 return octave_value (v.int16_array_value().transpose ()); | |
56 } | |
57 | |
58 //DEFNCUNOP_METHOD (incr, int16_matrix, increment) | |
59 //DEFNCUNOP_METHOD (decr, int16_matrix, decrement) | |
60 | |
61 // matrix by matrix ops. | |
62 | |
63 DEFNDBINOP_OP (add, int16_matrix, int16_matrix, int16_array, int16_array, +) | |
64 DEFNDBINOP_OP (sub, int16_matrix, int16_matrix, int16_array, int16_array, -) | |
65 | |
66 // DEFBINOP_OP (mul, int16_matrix, int16_matrix, *) | |
67 // DEFBINOP_FN (div, int16_matrix, int16_matrix, xdiv) | |
68 | |
69 DEFBINOPX (pow, int16_matrix, int16_matrix) | |
70 { | |
71 error ("can't do A ^ B for A and B both matrices"); | |
72 return octave_value (); | |
73 } | |
74 | |
75 //DEFBINOP_FN (ldiv, int16_matrix, int16_matrix, xleftdiv) | |
76 | |
77 DEFNDBINOP_FN (lt, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_lt) | |
78 DEFNDBINOP_FN (le, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_le) | |
79 DEFNDBINOP_FN (eq, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_eq) | |
80 DEFNDBINOP_FN (ge, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_ge) | |
81 DEFNDBINOP_FN (gt, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_gt) | |
82 DEFNDBINOP_FN (ne, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_ne) | |
83 | |
84 DEFNDBINOP_FN (el_mul, int16_matrix, int16_matrix, int16_array, int16_array, product) | |
85 | |
86 DEFNDBINOP_FN (el_div, int16_matrix, int16_matrix, int16_array, int16_array, quotient) | |
87 | |
88 //DEFNDBINOP_FN (el_pow, int16_matrix, int16_matrix, int16_array, int16_array, elem_xpow) | |
89 | |
90 //DEFBINOP (el_ldiv, int16_matrix, int16_matrix) | |
91 //{ | |
92 // CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); | |
93 // | |
94 // return octave_value (quotient (v2.array_value (), v1.array_value ())); | |
95 //} | |
96 | |
97 DEFNDBINOP_FN (el_and, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_and) | |
98 DEFNDBINOP_FN (el_or, int16_matrix, int16_matrix, int16_array, int16_array, mx_el_or) | |
99 | |
100 DEFNDASSIGNOP_FN (assign, int16_matrix, int16_matrix, int16_array, assign) | |
101 | |
102 void | |
103 install_i16_i16_ops (void) | |
104 { | |
105 INSTALL_UNOP (op_not, octave_int16_matrix, not); | |
106 INSTALL_UNOP (op_uminus, octave_int16_matrix, uminus); | |
107 INSTALL_UNOP (op_transpose, octave_int16_matrix, transpose); | |
108 INSTALL_UNOP (op_hermitian, octave_int16_matrix, transpose); | |
109 | |
110 // INSTALL_NCUNOP (op_incr, octave_int16_matrix, incr); | |
111 // INSTALL_NCUNOP (op_decr, octave_int16_matrix, decr); | |
112 | |
113 INSTALL_BINOP (op_add, octave_int16_matrix, octave_int16_matrix, add); | |
114 INSTALL_BINOP (op_sub, octave_int16_matrix, octave_int16_matrix, sub); | |
115 // INSTALL_BINOP (op_mul, octave_int16_matrix, octave_int16_matrix, mul); | |
116 // INSTALL_BINOP (op_div, octave_int16_matrix, octave_int16_matrix, div); | |
117 INSTALL_BINOP (op_pow, octave_int16_matrix, octave_int16_matrix, pow); | |
118 // INSTALL_BINOP (op_ldiv, octave_int16_matrix, octave_int16_matrix, ldiv); | |
119 INSTALL_BINOP (op_lt, octave_int16_matrix, octave_int16_matrix, lt); | |
120 INSTALL_BINOP (op_le, octave_int16_matrix, octave_int16_matrix, le); | |
121 INSTALL_BINOP (op_eq, octave_int16_matrix, octave_int16_matrix, eq); | |
122 INSTALL_BINOP (op_ge, octave_int16_matrix, octave_int16_matrix, ge); | |
123 INSTALL_BINOP (op_gt, octave_int16_matrix, octave_int16_matrix, gt); | |
124 INSTALL_BINOP (op_ne, octave_int16_matrix, octave_int16_matrix, ne); | |
125 INSTALL_BINOP (op_el_mul, octave_int16_matrix, octave_int16_matrix, el_mul); | |
126 INSTALL_BINOP (op_el_div, octave_int16_matrix, octave_int16_matrix, el_div); | |
127 // INSTALL_BINOP (op_el_pow, octave_int16_matrix, octave_int16_matrix, el_pow); | |
128 // INSTALL_BINOP (op_el_ldiv, octave_int16_matrix, octave_int16_matrix, el_ldiv); | |
129 INSTALL_BINOP (op_el_and, octave_int16_matrix, octave_int16_matrix, el_and); | |
130 INSTALL_BINOP (op_el_or, octave_int16_matrix, octave_int16_matrix, el_or); | |
131 | |
132 INSTALL_ASSIGNOP (op_asn_eq, octave_int16_matrix, octave_int16_matrix, assign); | |
133 } | |
134 | |
135 /* | |
136 ;;; Local Variables: *** | |
137 ;;; mode: C++ *** | |
138 ;;; End: *** | |
139 */ |