annotate src/OPERATORS/op-cs-cm.cc @ 9933:ac4b97c6bf8b

eliminate Emacs local variables from some files
author John W. Eaton <jwe@octave.org>
date Mon, 07 Dec 2009 16:18:28 -0500
parents 319e2ab9b8ae
children fd0a3ac60b0e
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
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
3 Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
4 2007 John W. Eaton
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
5
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
7
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
8 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
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5785
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5785
diff changeset
11 option) any later version.
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
12
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
13 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
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
15 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
16 for more details.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
17
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5785
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5785
diff changeset
20 <http://www.gnu.org/licenses/>.
2928
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 */
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
23
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
25 #include <config.h>
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
26 #endif
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
27
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
28 #include "gripes.h"
4055
7690958e7726 [project @ 2002-08-18 01:56:58 by jwe]
jwe
parents: 3766
diff changeset
29 #include "oct-obj.h"
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
30 #include "ov.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
31 #include "ov-complex.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
32 #include "ov-cx-mat.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
33 #include "ov-typeinfo.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
34 #include "ops.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
35 #include "xdiv.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
36 #include "xpow.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
37
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
38 // complex scalar by complex matrix ops.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
39
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
40 DEFNDBINOP_OP (add, complex, complex_matrix, complex, complex_array, +)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
41 DEFNDBINOP_OP (sub, complex, complex_matrix, complex, complex_array, -)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
42 DEFNDBINOP_OP (mul, complex, complex_matrix, complex, complex_array, *)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
43
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
44 DEFBINOP (div, complex, complex_matrix)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
45 {
3766
df962bbf1788 [project @ 2001-01-29 14:33:07 by jwe]
jwe
parents: 3540
diff changeset
46 CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
df962bbf1788 [project @ 2001-01-29 14:33:07 by jwe]
jwe
parents: 3540
diff changeset
47
df962bbf1788 [project @ 2001-01-29 14:33:07 by jwe]
jwe
parents: 3540
diff changeset
48 ComplexMatrix m1 = v1.complex_matrix_value ();
df962bbf1788 [project @ 2001-01-29 14:33:07 by jwe]
jwe
parents: 3540
diff changeset
49 ComplexMatrix m2 = v2.complex_matrix_value ();
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
50 MatrixType typ = v2.matrix_type ();
3766
df962bbf1788 [project @ 2001-01-29 14:33:07 by jwe]
jwe
parents: 3540
diff changeset
51
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
52 ComplexMatrix ret = xdiv (m1, m2, typ);
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
53
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
54 v2.matrix_type (typ);
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
55 return ret;
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
56 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
57
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
58 DEFBINOP_FN (pow, complex, complex_matrix, xpow)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
59
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
60 DEFBINOP (ldiv, complex, complex_matrix)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
61 {
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
62 CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
63
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
64 Complex d = v1.complex_value ();
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
65
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
66 if (d == 0.0)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
67 gripe_divide_by_zero ();
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
68
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
69 return octave_value (v2.complex_array_value () / d);
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
70 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
71
9588
319e2ab9b8ae warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents: 7017
diff changeset
72 DEFNDCMPLXCMPOP_FN (lt, complex, complex_matrix, complex, complex_array, mx_el_lt)
319e2ab9b8ae warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents: 7017
diff changeset
73 DEFNDCMPLXCMPOP_FN (le, complex, complex_matrix, complex, complex_array, mx_el_le)
319e2ab9b8ae warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents: 7017
diff changeset
74 DEFNDCMPLXCMPOP_FN (eq, complex, complex_matrix, complex, complex_array, mx_el_eq)
319e2ab9b8ae warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents: 7017
diff changeset
75 DEFNDCMPLXCMPOP_FN (ge, complex, complex_matrix, complex, complex_array, mx_el_ge)
319e2ab9b8ae warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents: 7017
diff changeset
76 DEFNDCMPLXCMPOP_FN (gt, complex, complex_matrix, complex, complex_array, mx_el_gt)
319e2ab9b8ae warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents: 7017
diff changeset
77 DEFNDCMPLXCMPOP_FN (ne, complex, complex_matrix, complex, complex_array, mx_el_ne)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
78
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
79 DEFNDBINOP_OP (el_mul, complex, complex_matrix, complex, complex_array, *)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
80 DEFNDBINOP_FN (el_div, complex, complex_matrix, complex, complex_array, x_el_div)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
81 DEFNDBINOP_FN (el_pow, complex, complex_matrix, complex, complex_array, elem_xpow)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
82
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
83 DEFBINOP (el_ldiv, complex, complex_matrix)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
84 {
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
85 CAST_BINOP_ARGS (const octave_complex&, const octave_complex_matrix&);
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
86
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
87 Complex d = v1.complex_value ();
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 if (d == 0.0)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
90 gripe_divide_by_zero ();
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
91
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
92 return octave_value (v2.complex_array_value () / d);
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
93 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
94
4550
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
95 DEFNDBINOP_FN (el_and, complex, complex_matrix, complex, complex_array, mx_el_and)
69a9b22a72a2 [project @ 2003-10-27 15:41:55 by jwe]
jwe
parents: 4543
diff changeset
96 DEFNDBINOP_FN (el_or, complex, complex_matrix, complex, complex_array, mx_el_or)
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
97
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4550
diff changeset
98 DEFNDCATOP_FN (cs_cm, complex, complex_matrix, complex_array, complex_array, concat)
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4550
diff changeset
99
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
100 DEFCONV (complex_matrix_conv, complex, complex_matrix)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
101 {
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
102 CAST_CONV_ARG (const octave_complex&);
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
103
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
104 return new octave_complex_matrix (v.complex_matrix_value ());
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
105 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
106
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
107 void
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
108 install_cs_cm_ops (void)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
109 {
3538
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
110 INSTALL_BINOP (op_add, octave_complex, octave_complex_matrix, add);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
111 INSTALL_BINOP (op_sub, octave_complex, octave_complex_matrix, sub);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
112 INSTALL_BINOP (op_mul, octave_complex, octave_complex_matrix, mul);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
113 INSTALL_BINOP (op_div, octave_complex, octave_complex_matrix, div);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
114 INSTALL_BINOP (op_pow, octave_complex, octave_complex_matrix, pow);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
115 INSTALL_BINOP (op_ldiv, octave_complex, octave_complex_matrix, ldiv);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
116 INSTALL_BINOP (op_lt, octave_complex, octave_complex_matrix, lt);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
117 INSTALL_BINOP (op_le, octave_complex, octave_complex_matrix, le);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
118 INSTALL_BINOP (op_eq, octave_complex, octave_complex_matrix, eq);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
119 INSTALL_BINOP (op_ge, octave_complex, octave_complex_matrix, ge);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
120 INSTALL_BINOP (op_gt, octave_complex, octave_complex_matrix, gt);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
121 INSTALL_BINOP (op_ne, octave_complex, octave_complex_matrix, ne);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
122 INSTALL_BINOP (op_el_mul, octave_complex, octave_complex_matrix, el_mul);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
123 INSTALL_BINOP (op_el_div, octave_complex, octave_complex_matrix, el_div);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
124 INSTALL_BINOP (op_el_pow, octave_complex, octave_complex_matrix, el_pow);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
125 INSTALL_BINOP (op_el_ldiv, octave_complex, octave_complex_matrix, el_ldiv);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
126 INSTALL_BINOP (op_el_and, octave_complex, octave_complex_matrix, el_and);
0ff7323dab8b [project @ 2000-02-02 12:36:25 by jwe]
jwe
parents: 2928
diff changeset
127 INSTALL_BINOP (op_el_or, octave_complex, octave_complex_matrix, el_or);
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
128
4915
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4550
diff changeset
129 INSTALL_CATOP (octave_complex, octave_complex_matrix, cs_cm);
c638c144d4da [project @ 2004-07-23 19:01:22 by jwe]
jwe
parents: 4550
diff changeset
130
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
131 INSTALL_ASSIGNCONV (octave_complex, octave_complex_matrix, octave_complex_matrix);
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
132
3540
6741bef26719 [project @ 2000-02-02 12:58:27 by jwe]
jwe
parents: 3538
diff changeset
133 INSTALL_WIDENOP (octave_complex, octave_complex_matrix, complex_matrix_conv);
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
134 }