annotate src/OPERATORS/op-cm-cm.cc @ 4550:69a9b22a72a2

[project @ 2003-10-27 15:41:55 by jwe]
author jwe
date Mon, 27 Oct 2003 15:41:55 +0000
parents 79df15d4470c
children 6639c2574023
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
1 /*
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
2
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 1996, 1997 John W. Eaton
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
4
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
6
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
10 later version.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
11
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
15 for more details.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
16
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, write to the Free
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
20
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
21 */
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
22
4192
5719210fff4c [project @ 2002-11-20 16:56:47 by jwe]
jwe
parents: 4066
diff changeset
23 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
24 #pragma implementation
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
25 #endif
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
26
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
27 #ifdef HAVE_CONFIG_H
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
28 #include <config.h>
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
29 #endif
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
30
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
31 #include "gripes.h"
4055
7690958e7726 [project @ 2002-08-18 01:56:58 by jwe]
jwe
parents: 3538
diff changeset
32 #include "oct-obj.h"
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
33 #include "ov.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
34 #include "ov-cx-mat.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
35 #include "ov-typeinfo.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
36 #include "ops.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
37 #include "xdiv.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
38 #include "xpow.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
39
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
40 // unary complex matrix ops.
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
41
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
42 DEFNDUNOP_OP (not, complex_matrix, complex_array, !)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
43 DEFNDUNOP_OP (uminus, complex_matrix, complex_array, -)
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
44
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
45 DEFUNOP (transpose, complex_matrix)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
46 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
47 CAST_UNOP_ARG (const octave_complex_matrix&);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
48
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
49 return octave_value (v.complex_matrix_value().transpose ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
50 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
51
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
52 DEFUNOP (hermitian, complex_matrix)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
53 {
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
54 CAST_UNOP_ARG (const octave_complex_matrix&);
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
55
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
56 return octave_value (v.complex_matrix_value().hermitian ());
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
57 }
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
58
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
59 DEFNCUNOP_METHOD (incr, complex_matrix, increment)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
60 DEFNCUNOP_METHOD (decr, complex_matrix, decrement)
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
61
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
62 // complex matrix by complex matrix ops.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
63
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
64 DEFNDBINOP_OP (add, complex_matrix, complex_matrix, complex_array, complex_array, +)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
65 DEFNDBINOP_OP (sub, complex_matrix, complex_matrix, complex_array, complex_array, -)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4192
diff changeset
66
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
67 DEFBINOP_OP (mul, complex_matrix, complex_matrix, *)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
68 DEFBINOP_FN (div, complex_matrix, complex_matrix, xdiv)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
69
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
70 DEFBINOPX (pow, complex_matrix, complex_matrix)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
71 {
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
72 error ("can't do A ^ B for A and B both matrices");
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
73 return octave_value ();
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
74 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
75
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
76 DEFBINOP_FN (ldiv, complex_matrix, complex_matrix, xleftdiv)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
77
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
78 DEFNDBINOP_FN (lt, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_lt)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
79 DEFNDBINOP_FN (le, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_le)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
80 DEFNDBINOP_FN (eq, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_eq)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
81 DEFNDBINOP_FN (ge, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_ge)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
82 DEFNDBINOP_FN (gt, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_gt)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
83 DEFNDBINOP_FN (ne, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_ne)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
84
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
85 DEFNDBINOP_FN (el_mul, complex_matrix, complex_matrix, complex_array, complex_array, product)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
86 DEFNDBINOP_FN (el_div, complex_matrix, complex_matrix, complex_array, complex_array, quotient)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
87 DEFNDBINOP_FN (el_pow, complex_matrix, complex_matrix, complex_array, complex_array, elem_xpow)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
88
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
89 DEFBINOP (el_ldiv, complex_matrix, complex_matrix)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
90 {
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
91 CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&);
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
92
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
93 return octave_value (quotient (v2.complex_array_value (), v1.complex_array_value ()));
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
94 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
95
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
96 DEFNDBINOP_FN (el_and, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_and)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
97 DEFNDBINOP_FN (el_or, complex_matrix, complex_matrix, complex_array, complex_array, mx_el_or)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
98
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
99 DEFASSIGNOP_FN (assign, complex_matrix, complex_matrix, assign)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
100
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
101 void
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
102 install_cm_cm_ops (void)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
103 {
3538
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
104 INSTALL_UNOP (op_not, octave_complex_matrix, not);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
105 INSTALL_UNOP (op_uminus, octave_complex_matrix, uminus);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
106 INSTALL_UNOP (op_transpose, octave_complex_matrix, transpose);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
107 INSTALL_UNOP (op_hermitian, octave_complex_matrix, hermitian);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
108
3538
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
109 INSTALL_NCUNOP (op_incr, octave_complex_matrix, incr);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
110 INSTALL_NCUNOP (op_decr, octave_complex_matrix, decr);
3203
bc61b0e8d60e [project @ 1998-10-30 20:26:27 by jwe]
jwe
parents: 2928
diff changeset
111
3538
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
112 INSTALL_BINOP (op_add, octave_complex_matrix, octave_complex_matrix, add);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
113 INSTALL_BINOP (op_sub, octave_complex_matrix, octave_complex_matrix, sub);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
114 INSTALL_BINOP (op_mul, octave_complex_matrix, octave_complex_matrix, mul);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
115 INSTALL_BINOP (op_div, octave_complex_matrix, octave_complex_matrix, div);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
116 INSTALL_BINOP (op_pow, octave_complex_matrix, octave_complex_matrix, pow);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
117 INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_complex_matrix, ldiv);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
118 INSTALL_BINOP (op_lt, octave_complex_matrix, octave_complex_matrix, lt);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
119 INSTALL_BINOP (op_le, octave_complex_matrix, octave_complex_matrix, le);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
120 INSTALL_BINOP (op_eq, octave_complex_matrix, octave_complex_matrix, eq);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
121 INSTALL_BINOP (op_ge, octave_complex_matrix, octave_complex_matrix, ge);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
122 INSTALL_BINOP (op_gt, octave_complex_matrix, octave_complex_matrix, gt);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
123 INSTALL_BINOP (op_ne, octave_complex_matrix, octave_complex_matrix, ne);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
124 INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_complex_matrix, el_mul);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
125 INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_complex_matrix, el_div);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
126 INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_complex_matrix, el_pow);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
127 INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_complex_matrix, el_ldiv);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
128 INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_complex_matrix, el_and);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
129 INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_complex_matrix, el_or);
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
130
3538
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 3203
diff changeset
131 INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_complex_matrix, assign);
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
132 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
133
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
134 /*
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
135 ;;; Local Variables: ***
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
136 ;;; mode: C++ ***
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
137 ;;; End: ***
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
138 */