comparison libinterp/operators/op-fcm-fm.cc @ 15195:2fc554ffbc28

split libinterp from src * libinterp: New directory. Move all files from src directory here except Makefile.am, main.cc, main-cli.cc, mkoctfile.in.cc, mkoctfilr.in.sh, octave-config.in.cc, octave-config.in.sh. * libinterp/Makefile.am: New file, extracted from src/Makefile.am. * src/Makefile.am: Delete everything except targets and definitions needed to build and link main and utility programs. * Makefile.am (SUBDIRS): Include libinterp in the list. * autogen.sh: Run config-module.sh in libinterp/dldfcn directory, not src/dldfcn directory. * configure.ac (AC_CONFIG_SRCDIR): Use libinterp/octave.cc, not src/octave.cc. (DL_LDFLAGS, LIBOCTINTERP): Use libinterp, not src. (AC_CONFIG_FILES): Include libinterp/Makefile in the list. * find-docstring-files.sh: Look in libinterp, not src. * gui/src/Makefile.am (liboctgui_la_CPPFLAGS): Find header files in libinterp, not src.
author John W. Eaton <jwe@octave.org>
date Sat, 18 Aug 2012 16:23:39 -0400
parents src/operators/op-fcm-fm.cc@46b19589b593
children
comparison
equal deleted inserted replaced
15194:0f0b795044c3 15195:2fc554ffbc28
1 /*
2
3 Copyright (C) 1996-2012 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 3 of the License, or (at your
10 option) any 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, see
19 <http://www.gnu.org/licenses/>.
20
21 */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26
27 #include "mx-fcm-fm.h"
28 #include "mx-fm-fcm.h"
29 #include "mx-fcnda-fnda.h"
30 #include "mx-fnda-fcnda.h"
31
32 #include "gripes.h"
33 #include "oct-obj.h"
34 #include "ov.h"
35 #include "ov-cx-mat.h"
36 #include "ov-flt-cx-mat.h"
37 #include "ov-flt-re-mat.h"
38 #include "ov-re-mat.h"
39 #include "ov-typeinfo.h"
40 #include "ops.h"
41 #include "xdiv.h"
42 #include "xpow.h"
43
44 // complex matrix by matrix ops.
45
46 DEFNDBINOP_OP (add, float_complex_matrix, float_matrix, float_complex_array, float_array, +)
47 DEFNDBINOP_OP (sub, float_complex_matrix, float_matrix, float_complex_array, float_array, -)
48
49 DEFBINOP_OP (mul, float_complex_matrix, float_matrix, *)
50
51 DEFBINOP (mul_trans, float_complex_matrix, float_matrix)
52 {
53 CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_matrix&);
54
55 FloatComplexMatrix m1 = v1.float_complex_matrix_value ();
56 FloatMatrix m2 = v2.float_matrix_value ();
57
58 return FloatComplexMatrix (xgemm (real (m1), m2, blas_no_trans, blas_trans),
59 xgemm (imag (m1), m2, blas_no_trans, blas_trans));
60 }
61
62 DEFBINOP (div, float_complex_matrix, float_matrix)
63 {
64 CAST_BINOP_ARGS (const octave_float_complex_matrix&,
65 const octave_float_matrix&);
66 MatrixType typ = v2.matrix_type ();
67
68 FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (),
69 v2.float_matrix_value (), typ);
70
71 v2.matrix_type (typ);
72 return ret;
73 }
74
75
76 DEFBINOPX (pow, float_complex_matrix, float_matrix)
77 {
78 error ("can't do A ^ B for A and B both matrices");
79 return octave_value ();
80 }
81
82 DEFBINOP (ldiv, float_complex_matrix, float_matrix)
83 {
84 CAST_BINOP_ARGS (const octave_float_complex_matrix&,
85 const octave_float_matrix&);
86 MatrixType typ = v1.matrix_type ();
87
88 FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (),
89 v2.float_matrix_value (), typ);
90
91 v1.matrix_type (typ);
92 return ret;
93 }
94
95 DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_matrix,
96 float_complex_array, float_array, mx_el_lt)
97 DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_matrix,
98 float_complex_array, float_array, mx_el_le)
99 DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_matrix,
100 float_complex_array, float_array, mx_el_eq)
101 DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_matrix,
102 float_complex_array, float_array, mx_el_ge)
103 DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_matrix,
104 float_complex_array, float_array, mx_el_gt)
105 DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_matrix,
106 float_complex_array, float_array, mx_el_ne)
107
108 DEFNDBINOP_FN (el_mul, float_complex_matrix, float_matrix,
109 float_complex_array, float_array, product)
110 DEFNDBINOP_FN (el_div, float_complex_matrix, float_matrix,
111 float_complex_array, float_array, quotient)
112 DEFNDBINOP_FN (el_pow, float_complex_matrix, float_matrix,
113 float_complex_array, float_array, elem_xpow)
114
115 DEFBINOP (el_ldiv, float_complex_matrix, float_matrix)
116 {
117 CAST_BINOP_ARGS (const octave_float_complex_matrix&,
118 const octave_float_matrix&);
119
120 return quotient (v2.float_array_value (), v1.float_complex_array_value ());
121 }
122
123 DEFNDBINOP_FN (el_and, float_complex_matrix, float_matrix,
124 float_complex_array, float_array, mx_el_and)
125 DEFNDBINOP_FN (el_or, float_complex_matrix, float_matrix,
126 float_complex_array, float_array, mx_el_or)
127
128 DEFNDCATOP_FN (fcm_fm, float_complex_matrix, float_matrix,
129 float_complex_array, float_array, concat)
130
131 DEFNDCATOP_FN (cm_fm, complex_matrix, float_matrix,
132 float_complex_array, float_array, concat)
133
134 DEFNDCATOP_FN (fcm_m, float_complex_matrix, matrix,
135 float_complex_array, float_array, concat)
136
137 DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_matrix,
138 float_complex_array, assign)
139 DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_matrix,
140 complex_array, assign)
141
142 void
143 install_fcm_fm_ops (void)
144 {
145 INSTALL_BINOP (op_add, octave_float_complex_matrix, octave_float_matrix, add);
146 INSTALL_BINOP (op_sub, octave_float_complex_matrix, octave_float_matrix, sub);
147 INSTALL_BINOP (op_mul, octave_float_complex_matrix, octave_float_matrix, mul);
148 INSTALL_BINOP (op_div, octave_float_complex_matrix, octave_float_matrix, div);
149 INSTALL_BINOP (op_pow, octave_float_complex_matrix, octave_float_matrix, pow);
150 INSTALL_BINOP (op_ldiv, octave_float_complex_matrix,
151 octave_float_matrix, ldiv);
152 INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_matrix, lt);
153 INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_matrix, le);
154 INSTALL_BINOP (op_eq, octave_float_complex_matrix, octave_float_matrix, eq);
155 INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_matrix, ge);
156 INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_matrix, gt);
157 INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_matrix, ne);
158 INSTALL_BINOP (op_el_mul, octave_float_complex_matrix,
159 octave_float_matrix, el_mul);
160 INSTALL_BINOP (op_el_div, octave_float_complex_matrix,
161 octave_float_matrix, el_div);
162 INSTALL_BINOP (op_el_pow, octave_float_complex_matrix,
163 octave_float_matrix, el_pow);
164 INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix,
165 octave_float_matrix, el_ldiv);
166 INSTALL_BINOP (op_el_and, octave_float_complex_matrix,
167 octave_float_matrix, el_and);
168 INSTALL_BINOP (op_el_or, octave_float_complex_matrix,
169 octave_float_matrix, el_or);
170 INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix,
171 octave_float_matrix, mul_trans);
172 INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix,
173 octave_float_matrix, mul_trans);
174
175 INSTALL_CATOP (octave_float_complex_matrix, octave_float_matrix, fcm_fm);
176 INSTALL_CATOP (octave_complex_matrix, octave_float_matrix, cm_fm);
177 INSTALL_CATOP (octave_float_complex_matrix, octave_matrix, fcm_m);
178
179 INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix,
180 octave_float_matrix, assign);
181 INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix,
182 octave_float_matrix, dbl_assign);
183 }