Mercurial > octave-nkf
comparison src/OPERATORS/op-fm-fcs.cc @ 7789:82be108cc558
First attempt at single precision tyeps
* * *
corrections to qrupdate single precision routines
* * *
prefer demotion to single over promotion to double
* * *
Add single precision support to log2 function
* * *
Trivial PROJECT file update
* * *
Cache optimized hermitian/transpose methods
* * *
Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 27 Apr 2008 22:34:17 +0200 |
parents | |
children | 87865ed7405f |
comparison
equal
deleted
inserted
replaced
7788:45f5faba05a2 | 7789:82be108cc558 |
---|---|
1 /* | |
2 | |
3 Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | |
4 2007 John W. Eaton | |
5 | |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 3 of the License, or (at your | |
11 option) any later version. | |
12 | |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with Octave; see the file COPYING. If not, see | |
20 <http://www.gnu.org/licenses/>. | |
21 | |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
28 #include "mx-fm-fcs.h" | |
29 #include "mx-fcs-fm.h" | |
30 #include "mx-fnda-fcs.h" | |
31 #include "mx-fcs-fnda.h" | |
32 | |
33 #include "gripes.h" | |
34 #include "oct-obj.h" | |
35 #include "ov.h" | |
36 #include "ov-re-mat.h" | |
37 #include "ov-flt-re-mat.h" | |
38 #include "ov-cx-mat.h" | |
39 #include "ov-flt-cx-mat.h" | |
40 #include "ov-flt-complex.h" | |
41 #include "ov-typeinfo.h" | |
42 #include "ops.h" | |
43 #include "xdiv.h" | |
44 #include "xpow.h" | |
45 | |
46 // matrix by complex scalar ops. | |
47 | |
48 DEFNDBINOP_OP (add, float_matrix, float_complex, float_array, float_complex, +) | |
49 DEFNDBINOP_OP (sub, float_matrix, float_complex, float_array, float_complex, -) | |
50 DEFNDBINOP_OP (mul, float_matrix, float_complex, float_array, float_complex, *) | |
51 | |
52 DEFBINOP (div, float_matrix, float_complex) | |
53 { | |
54 CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&); | |
55 | |
56 FloatComplex d = v2.float_complex_value (); | |
57 | |
58 if (d == static_cast<float>(0.0)) | |
59 gripe_divide_by_zero (); | |
60 | |
61 return octave_value (v1.float_array_value () / d); | |
62 } | |
63 | |
64 DEFBINOP_FN (pow, float_matrix, float_complex, xpow) | |
65 | |
66 DEFBINOP (ldiv, float_matrix, float_complex) | |
67 { | |
68 CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&); | |
69 | |
70 FloatMatrix m1 = v1.float_matrix_value (); | |
71 FloatComplexMatrix m2 = v2.float_complex_matrix_value (); | |
72 MatrixType typ = v1.matrix_type (); | |
73 | |
74 FloatComplexMatrix ret = xleftdiv (m1, m2, typ); | |
75 | |
76 v1.matrix_type (typ); | |
77 return ret; | |
78 } | |
79 | |
80 DEFNDBINOP_FN (lt, float_matrix, float_complex, float_array, | |
81 float_complex, mx_el_lt) | |
82 DEFNDBINOP_FN (le, float_matrix, float_complex, float_array, | |
83 float_complex, mx_el_le) | |
84 DEFNDBINOP_FN (eq, float_matrix, float_complex, float_array, | |
85 float_complex, mx_el_eq) | |
86 DEFNDBINOP_FN (ge, float_matrix, float_complex, float_array, | |
87 float_complex, mx_el_ge) | |
88 DEFNDBINOP_FN (gt, float_matrix, float_complex, float_array, | |
89 float_complex, mx_el_gt) | |
90 DEFNDBINOP_FN (ne, float_matrix, float_complex, float_array, | |
91 float_complex, mx_el_ne) | |
92 | |
93 DEFNDBINOP_OP (el_mul, float_matrix, float_complex, float_array, | |
94 float_complex, *) | |
95 | |
96 DEFBINOP (el_div, float_matrix, float_complex) | |
97 { | |
98 CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&); | |
99 | |
100 FloatComplex d = v2.float_complex_value (); | |
101 | |
102 if (d == static_cast<float>(0.0)) | |
103 gripe_divide_by_zero (); | |
104 | |
105 return octave_value (v1.float_array_value () / d); | |
106 } | |
107 | |
108 DEFNDBINOP_FN (el_pow, float_matrix, float_complex, float_array, | |
109 float_complex, elem_xpow) | |
110 | |
111 DEFBINOP (el_ldiv, float_matrix, flaot_complex) | |
112 { | |
113 CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex&); | |
114 | |
115 return x_el_div (v2.float_complex_value (), v1.float_array_value ()); | |
116 } | |
117 | |
118 DEFNDBINOP_FN (el_and, float_matrix, float_complex, float_array, | |
119 float_complex, mx_el_and) | |
120 DEFNDBINOP_FN (el_or, float_matrix, float_complex, float_array, | |
121 float_complex, mx_el_or) | |
122 | |
123 DEFNDCATOP_FN (fm_fcs, float_matrix, float_complex, float_array, | |
124 float_complex_array, concat) | |
125 | |
126 void | |
127 install_fm_fcs_ops (void) | |
128 { | |
129 INSTALL_BINOP (op_add, octave_float_matrix, octave_float_complex, add); | |
130 INSTALL_BINOP (op_sub, octave_float_matrix, octave_float_complex, sub); | |
131 INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_complex, mul); | |
132 INSTALL_BINOP (op_div, octave_float_matrix, octave_float_complex, div); | |
133 INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_complex, pow); | |
134 INSTALL_BINOP (op_ldiv, octave_float_matrix, octave_float_complex, ldiv); | |
135 INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_complex, lt); | |
136 INSTALL_BINOP (op_le, octave_float_matrix, octave_float_complex, le); | |
137 INSTALL_BINOP (op_eq, octave_float_matrix, octave_float_complex, eq); | |
138 INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_complex, ge); | |
139 INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_complex, gt); | |
140 INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_complex, ne); | |
141 INSTALL_BINOP (op_el_mul, octave_float_matrix, octave_float_complex, el_mul); | |
142 INSTALL_BINOP (op_el_div, octave_float_matrix, octave_float_complex, el_div); | |
143 INSTALL_BINOP (op_el_pow, octave_float_matrix, octave_float_complex, el_pow); | |
144 INSTALL_BINOP (op_el_ldiv, octave_float_matrix, octave_float_complex, el_ldiv); | |
145 INSTALL_BINOP (op_el_and, octave_float_matrix, octave_float_complex, el_and); | |
146 INSTALL_BINOP (op_el_or, octave_float_matrix, octave_float_complex, el_or); | |
147 | |
148 INSTALL_CATOP (octave_float_matrix, octave_float_complex, fm_fcs); | |
149 | |
150 INSTALL_ASSIGNCONV (octave_float_matrix, octave_float_complex, | |
151 octave_float_complex_matrix); | |
152 INSTALL_ASSIGNCONV (octave_matrix, octave_float_complex, | |
153 octave_complex_matrix); | |
154 } | |
155 | |
156 /* | |
157 ;;; Local Variables: *** | |
158 ;;; mode: C++ *** | |
159 ;;; End: *** | |
160 */ |