2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2008-2008 - DIGITEO - Antoine ELIAS
4 * Copyright (C) 2010-2010 - DIGITEO - Bruno JOFRET
6 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at
10 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
16 #include "types_subtraction.hxx"
17 #include "types_opposite.hxx"
19 #include "polynom.hxx"
22 #include "generic_operations.hxx"
26 #include "elem_common.h" //dset
29 using namespace types;
31 //define arrays on operation functions
32 static sub_function pSubfunction[types::InternalType::IdLast][types::InternalType::IdLast] = {NULL};
34 void fillSubtractFunction()
36 #define scilab_fill_sub(id1, id2, func, typeIn1, typeIn2, typeOut) \
37 pSubfunction[types::InternalType::Id ## id1][types::InternalType::Id ## id2] = (sub_function)&sub_##func<typeIn1, typeIn2, typeOut>
41 scilab_fill_sub(Double, Double, M_M, Double, Double, Double);
42 scilab_fill_sub(Double, Int8, M_M, Double, Int8, Int8);
43 scilab_fill_sub(Double, UInt8, M_M, Double, UInt8, UInt8);
44 scilab_fill_sub(Double, Int16, M_M, Double, Int16, Int16);
45 scilab_fill_sub(Double, UInt16, M_M, Double, UInt16, UInt16);
46 scilab_fill_sub(Double, Int32, M_M, Double, Int32, Int32);
47 scilab_fill_sub(Double, UInt32, M_M, Double, UInt32, UInt32);
48 scilab_fill_sub(Double, Int64, M_M, Double, Int64, Int64);
49 scilab_fill_sub(Double, UInt64, M_M, Double, UInt64, UInt64);
50 scilab_fill_sub(Double, Bool, M_M, Double, Bool, Double);
51 scilab_fill_sub(Double, Polynom, M_M, Double, Polynom, Polynom);
52 scilab_fill_sub(Double, Sparse, M_M, Double, Sparse, Double);
54 //Matrix - Matrix Complex
55 scilab_fill_sub(Double, DoubleComplex, M_MC, Double, Double, Double);
56 scilab_fill_sub(Double, PolynomComplex, M_M, Double, Polynom, Polynom);
57 scilab_fill_sub(Double, SparseComplex, M_M, Double, Sparse, Double);
60 scilab_fill_sub(Double, ScalarDouble, M_S, Double, Double, Double);
61 scilab_fill_sub(Double, ScalarInt8, M_S, Double, Int8, Int8);
62 scilab_fill_sub(Double, ScalarUInt8, M_S, Double, UInt8, UInt8);
63 scilab_fill_sub(Double, ScalarInt16, M_S, Double, Int16, Int16);
64 scilab_fill_sub(Double, ScalarUInt16, M_S, Double, UInt16, UInt16);
65 scilab_fill_sub(Double, ScalarInt32, M_S, Double, Int32, Int32);
66 scilab_fill_sub(Double, ScalarUInt32, M_S, Double, UInt32, UInt32);
67 scilab_fill_sub(Double, ScalarInt64, M_S, Double, Int64, Int64);
68 scilab_fill_sub(Double, ScalarUInt64, M_S, Double, UInt64, UInt64);
69 scilab_fill_sub(Double, ScalarBool, M_S, Double, Bool, Double);
70 scilab_fill_sub(Double, ScalarPolynom, M_M, Double, Polynom, Polynom);
72 //Matrix - Scalar Complex
73 scilab_fill_sub(Double, ScalarDoubleComplex, M_SC, Double, Double, Double);
74 scilab_fill_sub(Double, ScalarPolynomComplex, M_M, Double, Polynom, Polynom);
76 scilab_fill_sub(Double, Empty, M_E, Double, Double, Double);
79 //Matrix Complex - Matrix
80 scilab_fill_sub(DoubleComplex, Double, MC_M, Double, Double, Double);
81 scilab_fill_sub(DoubleComplex, DoubleComplex, MC_MC, Double, Double, Double);
82 scilab_fill_sub(DoubleComplex, ScalarDouble, MC_S, Double, Double, Double);
83 scilab_fill_sub(DoubleComplex, ScalarDoubleComplex, MC_SC, Double, Double, Double);
84 scilab_fill_sub(DoubleComplex, Empty, MC_E, Double, Double, Double);
85 scilab_fill_sub(DoubleComplex, Polynom, M_M, Double, Polynom, Polynom);
86 scilab_fill_sub(DoubleComplex, PolynomComplex, M_M, Double, Polynom, Polynom);
87 scilab_fill_sub(DoubleComplex, ScalarPolynom, M_M, Double, Polynom, Polynom);
88 scilab_fill_sub(DoubleComplex, ScalarPolynomComplex, M_M, Double, Polynom, Polynom);
89 scilab_fill_sub(DoubleComplex, Sparse, M_M, Double, Sparse, Double);
90 scilab_fill_sub(DoubleComplex, SparseComplex, M_M, Double, Sparse, Double);
93 scilab_fill_sub(ScalarDouble, Double, S_M, Double, Double, Double);
94 scilab_fill_sub(ScalarDouble, Int8, S_M, Double, Int8, Int8);
95 scilab_fill_sub(ScalarDouble, UInt8, S_M, Double, UInt8, UInt8);
96 scilab_fill_sub(ScalarDouble, Int16, S_M, Double, Int16, Int16);
97 scilab_fill_sub(ScalarDouble, UInt16, S_M, Double, UInt16, UInt16);
98 scilab_fill_sub(ScalarDouble, Int32, S_M, Double, Int32, Int32);
99 scilab_fill_sub(ScalarDouble, UInt32, S_M, Double, UInt32, UInt32);
100 scilab_fill_sub(ScalarDouble, Int64, S_M, Double, Int64, Int64);
101 scilab_fill_sub(ScalarDouble, UInt64, S_M, Double, UInt64, UInt64);
102 scilab_fill_sub(ScalarDouble, Bool, S_M, Double, Bool, Double);
103 scilab_fill_sub(ScalarDouble, Polynom, M_M, Double, Polynom, Polynom);
104 scilab_fill_sub(ScalarDouble, Sparse, M_M, Double, Sparse, Double);
106 //Scalar - Matrix Complex
107 scilab_fill_sub(ScalarDouble, DoubleComplex, S_MC, Double, Double, Double);
108 scilab_fill_sub(ScalarDouble, PolynomComplex, M_M, Double, Polynom, Polynom);
109 scilab_fill_sub(ScalarDouble, SparseComplex, M_M, Double, Sparse, Double);
112 scilab_fill_sub(ScalarDouble, ScalarDouble, S_S, Double, Double, Double);
113 scilab_fill_sub(ScalarDouble, ScalarInt8, S_S, Double, Int8, Int8);
114 scilab_fill_sub(ScalarDouble, ScalarUInt8, S_S, Double, UInt8, UInt8);
115 scilab_fill_sub(ScalarDouble, ScalarInt16, S_S, Double, Int16, Int16);
116 scilab_fill_sub(ScalarDouble, ScalarUInt16, S_S, Double, UInt16, UInt16);
117 scilab_fill_sub(ScalarDouble, ScalarInt32, S_S, Double, Int32, Int32);
118 scilab_fill_sub(ScalarDouble, ScalarUInt32, S_S, Double, UInt32, UInt32);
119 scilab_fill_sub(ScalarDouble, ScalarInt64, S_S, Double, Int64, Int64);
120 scilab_fill_sub(ScalarDouble, ScalarUInt64, S_S, Double, UInt64, UInt64);
121 scilab_fill_sub(ScalarDouble, ScalarBool, S_S, Double, Bool, Double);
122 scilab_fill_sub(ScalarDouble, ScalarPolynom, M_M, Double, Polynom, Polynom);
124 //Scalar - Scalar Complex
125 scilab_fill_sub(ScalarDouble, ScalarDoubleComplex, S_SC, Double, Double, Double);
126 scilab_fill_sub(ScalarDouble, PolynomComplex, M_M, Double, Polynom, Polynom);
127 scilab_fill_sub(ScalarDouble, ScalarPolynomComplex, M_M, Double, Polynom, Polynom);
130 scilab_fill_sub(ScalarDouble, Empty, S_E, Double, Double, Double);
132 //Scalar Complex - Matrix
133 scilab_fill_sub(ScalarDoubleComplex, Double, SC_M, Double, Double, Double);
134 scilab_fill_sub(ScalarDoubleComplex, Polynom, M_M, Double, Polynom, Polynom);
135 scilab_fill_sub(ScalarDoubleComplex, Sparse, M_M, Double, Sparse, Double);
136 //Scalar Complex - Matrix Complex
137 scilab_fill_sub(ScalarDoubleComplex, DoubleComplex, SC_MC, Double, Double, Double);
138 scilab_fill_sub(ScalarDoubleComplex, PolynomComplex, M_M, Double, Polynom, Polynom);
139 scilab_fill_sub(ScalarDoubleComplex, SparseComplex, M_M, Double, Sparse, Double);
140 //Scalar Complex - Scalar
141 scilab_fill_sub(ScalarDoubleComplex, ScalarDouble, SC_S, Double, Double, Double);
142 scilab_fill_sub(ScalarDoubleComplex, ScalarPolynom, M_M, Double, Polynom, Polynom);
143 //Scalar Complex - Scalar Complex
144 scilab_fill_sub(ScalarDoubleComplex, ScalarDoubleComplex, SC_SC, Double, Double, Double);
145 scilab_fill_sub(ScalarDoubleComplex, ScalarPolynomComplex, M_M, Double, Polynom, Polynom);
146 //Scalar Complex - Empty
147 scilab_fill_sub(ScalarDoubleComplex, Empty, SC_E, Double, Double, Double);
150 scilab_fill_sub(Empty, Double, E_M, Double, Double, Double);
151 scilab_fill_sub(Empty, Int8, E_M, Double, Int8, Int8);
152 scilab_fill_sub(Empty, UInt8, E_M, Double, UInt8, UInt8);
153 scilab_fill_sub(Empty, Int16, E_M, Double, Int16, Int16);
154 scilab_fill_sub(Empty, UInt16, E_M, Double, UInt16, UInt16);
155 scilab_fill_sub(Empty, Int32, E_M, Double, Int32, Int32);
156 scilab_fill_sub(Empty, UInt32, E_M, Double, UInt32, UInt32);
157 scilab_fill_sub(Empty, Int64, E_M, Double, Int64, Int64);
158 scilab_fill_sub(Empty, UInt64, E_M, Double, UInt64, UInt64);
159 //scilab_fill_sub(Empty, Bool, E_M, Double, Bool, Double);
160 scilab_fill_sub(Empty, Polynom, E_M, Double, Polynom, Polynom);
161 scilab_fill_sub(Empty, PolynomComplex, E_MC, Double, Polynom, Polynom);
162 scilab_fill_sub(Empty, Sparse, E_M, Double, Sparse, Sparse);
163 scilab_fill_sub(Empty, SparseComplex, E_MC, Double, Sparse, Sparse);
165 //Empty - Matrix Complex
166 scilab_fill_sub(Empty, DoubleComplex, E_MC, Double, Double, Double);
168 scilab_fill_sub(Empty, ScalarDouble, E_M, Double, Double, Double);
169 scilab_fill_sub(Empty, ScalarInt8, E_M, Double, Int8, Int8);
170 scilab_fill_sub(Empty, ScalarUInt8, E_M, Double, UInt8, UInt8);
171 scilab_fill_sub(Empty, ScalarInt16, E_M, Double, Int16, Int16);
172 scilab_fill_sub(Empty, ScalarUInt16, E_M, Double, UInt16, UInt16);
173 scilab_fill_sub(Empty, ScalarInt32, E_M, Double, Int32, Int32);
174 scilab_fill_sub(Empty, ScalarUInt32, E_M, Double, UInt32, UInt32);
175 scilab_fill_sub(Empty, ScalarInt64, E_M, Double, Int64, Int64);
176 scilab_fill_sub(Empty, ScalarUInt64, E_M, Double, UInt64, UInt64);
177 scilab_fill_sub(Empty, ScalarBool, E_M, Double, Bool, Double);
178 scilab_fill_sub(Empty, ScalarPolynom, E_M, Double, Polynom, Polynom);
180 //Empty - Scalar Complex
181 scilab_fill_sub(Empty, ScalarDoubleComplex, E_MC, Double, Double, Double);
182 scilab_fill_sub(Empty, ScalarPolynomComplex, E_MC, Double, Polynom, Polynom);
184 scilab_fill_sub(Empty, Empty, E_M, Double, Double, Double);
186 scilab_fill_sub(Empty, Identity, E_I, Double, Double, Double);
187 scilab_fill_sub(Empty, IdentityComplex, E_IC, Double, Double, Double);
190 scilab_fill_sub(Double, Identity, M_I, Double, Double, Double);
191 scilab_fill_sub(Double, IdentityComplex, M_IC, Double, Double, Double);
192 scilab_fill_sub(DoubleComplex, Identity, MC_I, Double, Double, Double);
193 scilab_fill_sub(DoubleComplex, IdentityComplex, MC_IC, Double, Double, Double);
194 scilab_fill_sub(ScalarDouble, Identity, S_I, Double, Double, Double);
195 scilab_fill_sub(ScalarDouble, IdentityComplex, S_IC, Double, Double, Double);
196 scilab_fill_sub(ScalarDoubleComplex, Identity, SC_I, Double, Double, Double);
197 scilab_fill_sub(ScalarDoubleComplex, IdentityComplex, SC_IC, Double, Double, Double);
201 scilab_fill_sub(Int8, Double, M_M, Int8, Double, Int8);
202 scilab_fill_sub(Int8, Int8, M_M, Int8, Int8, Int8);
203 scilab_fill_sub(Int8, UInt8, M_M, Int8, UInt8, UInt8);
204 scilab_fill_sub(Int8, Int16, M_M, Int8, Int16, Int16);
205 scilab_fill_sub(Int8, UInt16, M_M, Int8, UInt16, UInt16);
206 scilab_fill_sub(Int8, Int32, M_M, Int8, Int32, Int32);
207 scilab_fill_sub(Int8, UInt32, M_M, Int8, UInt32, UInt32);
208 scilab_fill_sub(Int8, Int64, M_M, Int8, Int64, Int64);
209 scilab_fill_sub(Int8, UInt64, M_M, Int8, UInt64, UInt64);
210 scilab_fill_sub(Int8, Bool, M_M, Int8, Bool, Int8);
211 scilab_fill_sub(Int8, Empty, M_E, Int8, Double, Int8);
214 scilab_fill_sub(Int8, ScalarDouble, M_S, Int8, Double, Int8);
215 scilab_fill_sub(Int8, ScalarInt8, M_S, Int8, Int8, Int8);
216 scilab_fill_sub(Int8, ScalarUInt8, M_S, Int8, UInt8, UInt8);
217 scilab_fill_sub(Int8, ScalarInt16, M_S, Int8, Int16, Int16);
218 scilab_fill_sub(Int8, ScalarUInt16, M_S, Int8, UInt16, UInt16);
219 scilab_fill_sub(Int8, ScalarInt32, M_S, Int8, Int32, Int32);
220 scilab_fill_sub(Int8, ScalarUInt32, M_S, Int8, UInt32, UInt32);
221 scilab_fill_sub(Int8, ScalarInt64, M_S, Int8, Int64, Int64);
222 scilab_fill_sub(Int8, ScalarUInt64, M_S, Int8, UInt64, UInt64);
223 scilab_fill_sub(Int8, ScalarBool, M_S, Int8, Bool, Int8);
226 scilab_fill_sub(ScalarInt8, Double, S_M, Int8, Double, Int8);
227 scilab_fill_sub(ScalarInt8, Int8, S_M, Int8, Int8, Int8);
228 scilab_fill_sub(ScalarInt8, UInt8, S_M, Int8, UInt8, UInt8);
229 scilab_fill_sub(ScalarInt8, Int16, S_M, Int8, Int16, Int16);
230 scilab_fill_sub(ScalarInt8, UInt16, S_M, Int8, UInt16, UInt16);
231 scilab_fill_sub(ScalarInt8, Int32, S_M, Int8, Int32, Int32);
232 scilab_fill_sub(ScalarInt8, UInt32, S_M, Int8, UInt32, UInt32);
233 scilab_fill_sub(ScalarInt8, Int64, S_M, Int8, Int64, Int64);
234 scilab_fill_sub(ScalarInt8, UInt64, S_M, Int8, UInt64, UInt64);
235 scilab_fill_sub(ScalarInt8, Bool, S_M, Int8, Bool, Int8);
236 scilab_fill_sub(ScalarInt8, Empty, S_E, Int8, Double, Int8);
239 scilab_fill_sub(ScalarInt8, ScalarDouble, S_S, Int8, Double, Int8);
240 scilab_fill_sub(ScalarInt8, ScalarInt8, S_S, Int8, Int8, Int8);
241 scilab_fill_sub(ScalarInt8, ScalarUInt8, S_S, Int8, UInt8, UInt8);
242 scilab_fill_sub(ScalarInt8, ScalarInt16, S_S, Int8, Int16, Int16);
243 scilab_fill_sub(ScalarInt8, ScalarUInt16, S_S, Int8, UInt16, UInt16);
244 scilab_fill_sub(ScalarInt8, ScalarInt32, S_S, Int8, Int32, Int32);
245 scilab_fill_sub(ScalarInt8, ScalarUInt32, S_S, Int8, UInt32, UInt32);
246 scilab_fill_sub(ScalarInt8, ScalarInt64, S_S, Int8, Int64, Int64);
247 scilab_fill_sub(ScalarInt8, ScalarUInt64, S_S, Int8, UInt64, UInt64);
248 scilab_fill_sub(ScalarInt8, ScalarBool, S_S, Int8, Bool, Int8);
252 scilab_fill_sub(UInt8, Double, M_M, UInt8, Double, UInt8);
253 scilab_fill_sub(UInt8, Int8, M_M, UInt8, Int8, UInt8);
254 scilab_fill_sub(UInt8, UInt8, M_M, UInt8, UInt8, UInt8);
255 scilab_fill_sub(UInt8, Int16, M_M, UInt8, Int16, UInt16);
256 scilab_fill_sub(UInt8, UInt16, M_M, UInt8, UInt16, UInt16);
257 scilab_fill_sub(UInt8, Int32, M_M, UInt8, Int32, UInt32);
258 scilab_fill_sub(UInt8, UInt32, M_M, UInt8, UInt32, UInt32);
259 scilab_fill_sub(UInt8, Int64, M_M, UInt8, Int64, UInt64);
260 scilab_fill_sub(UInt8, UInt64, M_M, UInt8, UInt64, UInt64);
261 scilab_fill_sub(UInt8, Bool, M_M, UInt8, Bool, UInt8);
262 scilab_fill_sub(UInt8, Empty, M_E, UInt8, Double, UInt8);
265 scilab_fill_sub(UInt8, ScalarDouble, M_S, UInt8, Double, UInt8);
266 scilab_fill_sub(UInt8, ScalarInt8, M_S, UInt8, Int8, UInt8);
267 scilab_fill_sub(UInt8, ScalarUInt8, M_S, UInt8, UInt8, UInt8);
268 scilab_fill_sub(UInt8, ScalarInt16, M_S, UInt8, Int16, UInt16);
269 scilab_fill_sub(UInt8, ScalarUInt16, M_S, UInt8, UInt16, UInt16);
270 scilab_fill_sub(UInt8, ScalarInt32, M_S, UInt8, Int32, UInt32);
271 scilab_fill_sub(UInt8, ScalarUInt32, M_S, UInt8, UInt32, UInt32);
272 scilab_fill_sub(UInt8, ScalarInt64, M_S, UInt8, Int64, UInt64);
273 scilab_fill_sub(UInt8, ScalarUInt64, M_S, UInt8, UInt64, UInt64);
274 scilab_fill_sub(UInt8, ScalarBool, M_S, UInt8, Bool, UInt8);
277 scilab_fill_sub(ScalarUInt8, Double, S_M, UInt8, Double, UInt8);
278 scilab_fill_sub(ScalarUInt8, Int8, S_M, UInt8, Int8, UInt8);
279 scilab_fill_sub(ScalarUInt8, UInt8, S_M, UInt8, UInt8, UInt8);
280 scilab_fill_sub(ScalarUInt8, Int16, S_M, UInt8, Int16, UInt16);
281 scilab_fill_sub(ScalarUInt8, UInt16, S_M, UInt8, UInt16, UInt16);
282 scilab_fill_sub(ScalarUInt8, Int32, S_M, UInt8, Int32, UInt32);
283 scilab_fill_sub(ScalarUInt8, UInt32, S_M, UInt8, UInt32, UInt32);
284 scilab_fill_sub(ScalarUInt8, Int64, S_M, UInt8, Int64, UInt64);
285 scilab_fill_sub(ScalarUInt8, UInt64, S_M, UInt8, UInt64, UInt64);
286 scilab_fill_sub(ScalarUInt8, Bool, S_M, UInt8, Bool, UInt8);
287 scilab_fill_sub(ScalarUInt8, Empty, S_E, UInt8, Double, UInt8);
290 scilab_fill_sub(ScalarUInt8, ScalarDouble, S_S, UInt8, Double, UInt8);
291 scilab_fill_sub(ScalarUInt8, ScalarInt8, S_S, UInt8, Int8, UInt8);
292 scilab_fill_sub(ScalarUInt8, ScalarUInt8, S_S, UInt8, UInt8, UInt8);
293 scilab_fill_sub(ScalarUInt8, ScalarInt16, S_S, UInt8, Int16, UInt16);
294 scilab_fill_sub(ScalarUInt8, ScalarUInt16, S_S, UInt8, UInt16, UInt16);
295 scilab_fill_sub(ScalarUInt8, ScalarInt32, S_S, UInt8, Int32, UInt32);
296 scilab_fill_sub(ScalarUInt8, ScalarUInt32, S_S, UInt8, UInt32, UInt32);
297 scilab_fill_sub(ScalarUInt8, ScalarInt64, S_S, UInt8, Int64, UInt64);
298 scilab_fill_sub(ScalarUInt8, ScalarUInt64, S_S, UInt8, UInt64, UInt64);
299 scilab_fill_sub(ScalarUInt8, ScalarBool, S_S, UInt8, Bool, UInt8);
303 scilab_fill_sub(Int16, Double, M_M, Int16, Double, Int16);
304 scilab_fill_sub(Int16, Int8, M_M, Int16, Int8, Int16);
305 scilab_fill_sub(Int16, UInt8, M_M, Int16, UInt8, UInt16);
306 scilab_fill_sub(Int16, Int16, M_M, Int16, Int16, Int16);
307 scilab_fill_sub(Int16, UInt16, M_M, Int16, UInt16, UInt16);
308 scilab_fill_sub(Int16, Int32, M_M, Int16, Int32, Int32);
309 scilab_fill_sub(Int16, UInt32, M_M, Int16, UInt32, UInt32);
310 scilab_fill_sub(Int16, Int64, M_M, Int16, Int64, Int64);
311 scilab_fill_sub(Int16, UInt64, M_M, Int16, UInt64, UInt64);
312 scilab_fill_sub(Int16, Bool, M_M, Int16, Bool, Int16);
313 scilab_fill_sub(Int16, Empty, M_E, Int16, Double, Int16);
316 scilab_fill_sub(Int16, ScalarDouble, M_S, Int16, Double, Int16);
317 scilab_fill_sub(Int16, ScalarInt8, M_S, Int16, Int8, Int16);
318 scilab_fill_sub(Int16, ScalarUInt8, M_S, Int16, UInt8, UInt16);
319 scilab_fill_sub(Int16, ScalarInt16, M_S, Int16, Int16, Int16);
320 scilab_fill_sub(Int16, ScalarUInt16, M_S, Int16, UInt16, UInt16);
321 scilab_fill_sub(Int16, ScalarInt32, M_S, Int16, Int32, Int32);
322 scilab_fill_sub(Int16, ScalarUInt32, M_S, Int16, UInt32, UInt32);
323 scilab_fill_sub(Int16, ScalarInt64, M_S, Int16, Int64, Int64);
324 scilab_fill_sub(Int16, ScalarUInt64, M_S, Int16, UInt64, UInt64);
325 scilab_fill_sub(Int16, ScalarBool, M_S, Int16, Bool, Int16);
328 scilab_fill_sub(ScalarInt16, Double, S_M, Int16, Double, Int16);
329 scilab_fill_sub(ScalarInt16, Int8, S_M, Int16, Int8, Int16);
330 scilab_fill_sub(ScalarInt16, UInt8, S_M, Int16, UInt8, UInt16);
331 scilab_fill_sub(ScalarInt16, Int16, S_M, Int16, Int16, Int16);
332 scilab_fill_sub(ScalarInt16, UInt16, S_M, Int16, UInt16, UInt16);
333 scilab_fill_sub(ScalarInt16, Int32, S_M, Int16, Int32, Int32);
334 scilab_fill_sub(ScalarInt16, UInt32, S_M, Int16, UInt32, UInt32);
335 scilab_fill_sub(ScalarInt16, Int64, S_M, Int16, Int64, Int64);
336 scilab_fill_sub(ScalarInt16, UInt64, S_M, Int16, UInt64, UInt64);
337 scilab_fill_sub(ScalarInt16, Bool, S_M, Int16, Bool, Int16);
338 scilab_fill_sub(ScalarInt16, Empty, S_E, Int16, Double, Int16);
341 scilab_fill_sub(ScalarInt16, ScalarDouble, S_S, Int16, Double, Int16);
342 scilab_fill_sub(ScalarInt16, ScalarInt8, S_S, Int16, Int8, Int16);
343 scilab_fill_sub(ScalarInt16, ScalarUInt8, S_S, Int16, UInt8, UInt16);
344 scilab_fill_sub(ScalarInt16, ScalarInt16, S_S, Int16, Int16, Int16);
345 scilab_fill_sub(ScalarInt16, ScalarUInt16, S_S, Int16, UInt16, UInt16);
346 scilab_fill_sub(ScalarInt16, ScalarInt32, S_S, Int16, Int32, Int32);
347 scilab_fill_sub(ScalarInt16, ScalarUInt32, S_S, Int16, UInt32, UInt32);
348 scilab_fill_sub(ScalarInt16, ScalarInt64, S_S, Int16, Int64, Int64);
349 scilab_fill_sub(ScalarInt16, ScalarUInt64, S_S, Int16, UInt64, UInt64);
350 scilab_fill_sub(ScalarInt16, ScalarBool, S_S, Int16, Bool, Int16);
354 scilab_fill_sub(UInt16, Double, M_M, UInt16, Double, UInt16);
355 scilab_fill_sub(UInt16, Int8, M_M, UInt16, Int8, UInt16);
356 scilab_fill_sub(UInt16, UInt8, M_M, UInt16, UInt8, UInt16);
357 scilab_fill_sub(UInt16, Int16, M_M, UInt16, Int16, UInt16);
358 scilab_fill_sub(UInt16, UInt16, M_M, UInt16, UInt16, UInt16);
359 scilab_fill_sub(UInt16, Int32, M_M, UInt16, Int32, UInt32);
360 scilab_fill_sub(UInt16, UInt32, M_M, UInt16, UInt32, UInt32);
361 scilab_fill_sub(UInt16, Int64, M_M, UInt16, Int64, UInt64);
362 scilab_fill_sub(UInt16, UInt64, M_M, UInt16, UInt64, UInt64);
363 scilab_fill_sub(UInt16, Bool, M_M, UInt16, Bool, UInt16);
364 scilab_fill_sub(UInt16, Empty, M_E, UInt16, Double, UInt16);
367 scilab_fill_sub(UInt16, ScalarDouble, M_S, UInt16, Double, UInt16);
368 scilab_fill_sub(UInt16, ScalarInt8, M_S, UInt16, Int8, UInt16);
369 scilab_fill_sub(UInt16, ScalarUInt8, M_S, UInt16, UInt8, UInt16);
370 scilab_fill_sub(UInt16, ScalarInt16, M_S, UInt16, Int16, UInt16);
371 scilab_fill_sub(UInt16, ScalarUInt16, M_S, UInt16, UInt16, UInt16);
372 scilab_fill_sub(UInt16, ScalarInt32, M_S, UInt16, Int32, UInt32);
373 scilab_fill_sub(UInt16, ScalarUInt32, M_S, UInt16, UInt32, UInt32);
374 scilab_fill_sub(UInt16, ScalarInt64, M_S, UInt16, Int64, UInt64);
375 scilab_fill_sub(UInt16, ScalarUInt64, M_S, UInt16, UInt64, UInt64);
376 scilab_fill_sub(UInt16, ScalarBool, M_S, UInt16, Bool, UInt16);
379 scilab_fill_sub(ScalarUInt16, Double, S_M, UInt16, Double, UInt16);
380 scilab_fill_sub(ScalarUInt16, Int8, S_M, UInt16, Int8, UInt16);
381 scilab_fill_sub(ScalarUInt16, UInt8, S_M, UInt16, UInt8, UInt16);
382 scilab_fill_sub(ScalarUInt16, Int16, S_M, UInt16, Int16, UInt16);
383 scilab_fill_sub(ScalarUInt16, UInt16, S_M, UInt16, UInt16, UInt16);
384 scilab_fill_sub(ScalarUInt16, Int32, S_M, UInt16, Int32, UInt32);
385 scilab_fill_sub(ScalarUInt16, UInt32, S_M, UInt16, UInt32, UInt32);
386 scilab_fill_sub(ScalarUInt16, Int64, S_M, UInt16, Int64, UInt64);
387 scilab_fill_sub(ScalarUInt16, UInt64, S_M, UInt16, UInt64, UInt64);
388 scilab_fill_sub(ScalarUInt16, Bool, S_M, UInt16, Bool, UInt16);
389 scilab_fill_sub(ScalarUInt16, Empty, S_E, UInt16, Double, UInt16);
392 scilab_fill_sub(ScalarUInt16, ScalarDouble, S_S, UInt16, Double, UInt16);
393 scilab_fill_sub(ScalarUInt16, ScalarInt8, S_S, UInt16, Int8, UInt16);
394 scilab_fill_sub(ScalarUInt16, ScalarUInt8, S_S, UInt16, UInt8, UInt16);
395 scilab_fill_sub(ScalarUInt16, ScalarInt16, S_S, UInt16, Int16, UInt16);
396 scilab_fill_sub(ScalarUInt16, ScalarUInt16, S_S, UInt16, UInt16, UInt16);
397 scilab_fill_sub(ScalarUInt16, ScalarInt32, S_S, UInt16, Int32, UInt32);
398 scilab_fill_sub(ScalarUInt16, ScalarUInt32, S_S, UInt16, UInt32, UInt32);
399 scilab_fill_sub(ScalarUInt16, ScalarInt64, S_S, UInt16, Int64, UInt64);
400 scilab_fill_sub(ScalarUInt16, ScalarUInt64, S_S, UInt16, UInt64, UInt64);
401 scilab_fill_sub(ScalarUInt16, ScalarBool, S_S, UInt16, Bool, UInt16);
405 scilab_fill_sub(Int32, Double, M_M, Int32, Double, Int32);
406 scilab_fill_sub(Int32, Int8, M_M, Int32, Int8, Int32);
407 scilab_fill_sub(Int32, UInt8, M_M, Int32, UInt8, UInt32);
408 scilab_fill_sub(Int32, Int16, M_M, Int32, Int16, Int32);
409 scilab_fill_sub(Int32, UInt16, M_M, Int32, UInt16, UInt32);
410 scilab_fill_sub(Int32, Int32, M_M, Int32, Int32, Int32);
411 scilab_fill_sub(Int32, UInt32, M_M, Int32, UInt32, UInt32);
412 scilab_fill_sub(Int32, Int64, M_M, Int32, Int64, Int64);
413 scilab_fill_sub(Int32, UInt64, M_M, Int32, UInt64, UInt64);
414 scilab_fill_sub(Int32, Bool, M_M, Int32, Bool, Int32);
415 scilab_fill_sub(Int32, Empty, M_E, Int32, Double, Int32);
418 scilab_fill_sub(Int32, ScalarDouble, M_S, Int32, Double, Int32);
419 scilab_fill_sub(Int32, ScalarInt8, M_S, Int32, Int8, Int32);
420 scilab_fill_sub(Int32, ScalarUInt8, M_S, Int32, UInt8, UInt32);
421 scilab_fill_sub(Int32, ScalarInt16, M_S, Int32, Int16, Int32);
422 scilab_fill_sub(Int32, ScalarUInt16, M_S, Int32, UInt16, UInt32);
423 scilab_fill_sub(Int32, ScalarInt32, M_S, Int32, Int32, Int32);
424 scilab_fill_sub(Int32, ScalarUInt32, M_S, Int32, UInt32, UInt32);
425 scilab_fill_sub(Int32, ScalarInt64, M_S, Int32, Int64, Int64);
426 scilab_fill_sub(Int32, ScalarUInt64, M_S, Int32, UInt64, UInt64);
427 scilab_fill_sub(Int32, ScalarBool, M_S, Int32, Bool, Int32);
430 scilab_fill_sub(ScalarInt32, Double, S_M, Int32, Double, Int32);
431 scilab_fill_sub(ScalarInt32, Int8, S_M, Int32, Int8, Int32);
432 scilab_fill_sub(ScalarInt32, UInt8, S_M, Int32, UInt8, UInt32);
433 scilab_fill_sub(ScalarInt32, Int16, S_M, Int32, Int16, Int32);
434 scilab_fill_sub(ScalarInt32, UInt16, S_M, Int32, UInt16, UInt32);
435 scilab_fill_sub(ScalarInt32, Int32, S_M, Int32, Int32, Int32);
436 scilab_fill_sub(ScalarInt32, UInt32, S_M, Int32, UInt32, UInt32);
437 scilab_fill_sub(ScalarInt32, Int64, S_M, Int32, Int64, Int64);
438 scilab_fill_sub(ScalarInt32, UInt64, S_M, Int32, UInt64, UInt64);
439 scilab_fill_sub(ScalarInt32, Bool, S_M, Int32, Bool, Int32);
440 scilab_fill_sub(ScalarInt32, Empty, S_E, Int32, Double, Int32);
443 scilab_fill_sub(ScalarInt32, ScalarDouble, S_S, Int32, Double, Int32);
444 scilab_fill_sub(ScalarInt32, ScalarInt8, S_S, Int32, Int8, Int32);
445 scilab_fill_sub(ScalarInt32, ScalarUInt8, S_S, Int32, UInt8, UInt32);
446 scilab_fill_sub(ScalarInt32, ScalarInt16, S_S, Int32, Int16, Int32);
447 scilab_fill_sub(ScalarInt32, ScalarUInt16, S_S, Int32, UInt16, UInt32);
448 scilab_fill_sub(ScalarInt32, ScalarInt32, S_S, Int32, Int32, Int32);
449 scilab_fill_sub(ScalarInt32, ScalarUInt32, S_S, Int32, UInt32, UInt32);
450 scilab_fill_sub(ScalarInt32, ScalarInt64, S_S, Int32, Int64, Int64);
451 scilab_fill_sub(ScalarInt32, ScalarUInt64, S_S, Int32, UInt64, UInt64);
452 scilab_fill_sub(ScalarInt32, ScalarBool, S_S, Int32, Bool, Int32);
456 scilab_fill_sub(UInt32, Double, M_M, UInt32, Double, UInt32);
457 scilab_fill_sub(UInt32, Int8, M_M, UInt32, Int8, UInt32);
458 scilab_fill_sub(UInt32, UInt8, M_M, UInt32, UInt8, UInt32);
459 scilab_fill_sub(UInt32, Int16, M_M, UInt32, Int16, UInt32);
460 scilab_fill_sub(UInt32, UInt16, M_M, UInt32, UInt16, UInt32);
461 scilab_fill_sub(UInt32, Int32, M_M, UInt32, Int32, UInt32);
462 scilab_fill_sub(UInt32, UInt32, M_M, UInt32, UInt32, UInt32);
463 scilab_fill_sub(UInt32, Int64, M_M, UInt32, Int64, UInt64);
464 scilab_fill_sub(UInt32, UInt64, M_M, UInt32, UInt64, UInt64);
465 scilab_fill_sub(UInt32, Bool, M_M, UInt32, Bool, UInt32);
466 scilab_fill_sub(UInt32, Empty, M_E, UInt32, Double, UInt32);
469 scilab_fill_sub(UInt32, ScalarDouble, M_S, UInt32, Double, UInt32);
470 scilab_fill_sub(UInt32, ScalarInt8, M_S, UInt32, Int8, UInt32);
471 scilab_fill_sub(UInt32, ScalarUInt8, M_S, UInt32, UInt8, UInt32);
472 scilab_fill_sub(UInt32, ScalarInt16, M_S, UInt32, Int16, UInt32);
473 scilab_fill_sub(UInt32, ScalarUInt16, M_S, UInt32, UInt16, UInt32);
474 scilab_fill_sub(UInt32, ScalarInt32, M_S, UInt32, Int32, UInt32);
475 scilab_fill_sub(UInt32, ScalarUInt32, M_S, UInt32, UInt32, UInt32);
476 scilab_fill_sub(UInt32, ScalarInt64, M_S, UInt32, Int64, UInt64);
477 scilab_fill_sub(UInt32, ScalarUInt64, M_S, UInt32, UInt64, UInt64);
478 scilab_fill_sub(UInt32, ScalarBool, M_S, UInt32, Bool, UInt32);
481 scilab_fill_sub(ScalarUInt32, Double, S_M, UInt32, Double, UInt32);
482 scilab_fill_sub(ScalarUInt32, Int8, S_M, UInt32, Int8, UInt32);
483 scilab_fill_sub(ScalarUInt32, UInt8, S_M, UInt32, UInt8, UInt32);
484 scilab_fill_sub(ScalarUInt32, Int16, S_M, UInt32, Int16, UInt32);
485 scilab_fill_sub(ScalarUInt32, UInt16, S_M, UInt32, UInt16, UInt32);
486 scilab_fill_sub(ScalarUInt32, Int32, S_M, UInt32, Int32, UInt32);
487 scilab_fill_sub(ScalarUInt32, UInt32, S_M, UInt32, UInt32, UInt32);
488 scilab_fill_sub(ScalarUInt32, Int64, S_M, UInt32, Int64, UInt64);
489 scilab_fill_sub(ScalarUInt32, UInt64, S_M, UInt32, UInt64, UInt64);
490 scilab_fill_sub(ScalarUInt32, Bool, S_M, UInt32, Bool, UInt32);
491 scilab_fill_sub(ScalarUInt32, Empty, S_E, UInt32, Double, UInt32);
494 scilab_fill_sub(ScalarUInt32, ScalarDouble, S_S, UInt32, Double, UInt32);
495 scilab_fill_sub(ScalarUInt32, ScalarInt8, S_S, UInt32, Int8, UInt32);
496 scilab_fill_sub(ScalarUInt32, ScalarUInt8, S_S, UInt32, UInt8, UInt32);
497 scilab_fill_sub(ScalarUInt32, ScalarInt16, S_S, UInt32, Int16, UInt32);
498 scilab_fill_sub(ScalarUInt32, ScalarUInt16, S_S, UInt32, UInt16, UInt32);
499 scilab_fill_sub(ScalarUInt32, ScalarInt32, S_S, UInt32, Int32, UInt32);
500 scilab_fill_sub(ScalarUInt32, ScalarUInt32, S_S, UInt32, UInt32, UInt32);
501 scilab_fill_sub(ScalarUInt32, ScalarInt64, S_S, UInt32, Int64, UInt64);
502 scilab_fill_sub(ScalarUInt32, ScalarUInt64, S_S, UInt32, UInt64, UInt64);
503 scilab_fill_sub(ScalarUInt32, ScalarBool, S_S, UInt32, Bool, UInt32);
507 scilab_fill_sub(Int64, Double, M_M, Int64, Double, Int64);
508 scilab_fill_sub(Int64, Int8, M_M, Int64, Int8, Int64);
509 scilab_fill_sub(Int64, UInt8, M_M, Int64, UInt8, UInt64);
510 scilab_fill_sub(Int64, Int16, M_M, Int64, Int16, Int64);
511 scilab_fill_sub(Int64, UInt16, M_M, Int64, UInt16, UInt64);
512 scilab_fill_sub(Int64, Int32, M_M, Int64, Int32, Int64);
513 scilab_fill_sub(Int64, UInt32, M_M, Int64, UInt32, UInt64);
514 scilab_fill_sub(Int64, Int64, M_M, Int64, Int64, Int64);
515 scilab_fill_sub(Int64, UInt64, M_M, Int64, UInt64, UInt64);
516 scilab_fill_sub(Int64, Bool, M_M, Int64, Bool, Int64);
517 scilab_fill_sub(Int64, Empty, M_E, Int64, Double, Int64);
520 scilab_fill_sub(Int64, ScalarDouble, M_S, Int64, Double, Int64);
521 scilab_fill_sub(Int64, ScalarInt8, M_S, Int64, Int8, Int64);
522 scilab_fill_sub(Int64, ScalarUInt8, M_S, Int64, UInt8, UInt64);
523 scilab_fill_sub(Int64, ScalarInt16, M_S, Int64, Int16, Int64);
524 scilab_fill_sub(Int64, ScalarUInt16, M_S, Int64, UInt16, UInt64);
525 scilab_fill_sub(Int64, ScalarInt32, M_S, Int64, Int32, Int64);
526 scilab_fill_sub(Int64, ScalarUInt32, M_S, Int64, UInt32, UInt64);
527 scilab_fill_sub(Int64, ScalarInt64, M_S, Int64, Int64, Int64);
528 scilab_fill_sub(Int64, ScalarUInt64, M_S, Int64, UInt64, UInt64);
529 scilab_fill_sub(Int64, ScalarBool, M_S, Int64, Bool, Int64);
532 scilab_fill_sub(ScalarInt64, Double, S_M, Int64, Double, Int64);
533 scilab_fill_sub(ScalarInt64, Int8, S_M, Int64, Int8, Int64);
534 scilab_fill_sub(ScalarInt64, UInt8, S_M, Int64, UInt8, UInt64);
535 scilab_fill_sub(ScalarInt64, Int16, S_M, Int64, Int16, Int64);
536 scilab_fill_sub(ScalarInt64, UInt16, S_M, Int64, UInt16, UInt64);
537 scilab_fill_sub(ScalarInt64, Int32, S_M, Int64, Int32, Int64);
538 scilab_fill_sub(ScalarInt64, UInt32, S_M, Int64, UInt32, UInt64);
539 scilab_fill_sub(ScalarInt64, Int64, S_M, Int64, Int64, Int64);
540 scilab_fill_sub(ScalarInt64, UInt64, S_M, Int64, UInt64, UInt64);
541 scilab_fill_sub(ScalarInt64, Bool, S_M, Int64, Bool, Int64);
542 scilab_fill_sub(ScalarInt64, Empty, S_E, Int64, Double, Int64);
545 scilab_fill_sub(ScalarInt64, ScalarDouble, S_S, Int64, Double, Int64);
546 scilab_fill_sub(ScalarInt64, ScalarInt8, S_S, Int64, Int8, Int64);
547 scilab_fill_sub(ScalarInt64, ScalarUInt8, S_S, Int64, UInt8, UInt64);
548 scilab_fill_sub(ScalarInt64, ScalarInt16, S_S, Int64, Int16, Int64);
549 scilab_fill_sub(ScalarInt64, ScalarUInt16, S_S, Int64, UInt16, UInt64);
550 scilab_fill_sub(ScalarInt64, ScalarInt32, S_S, Int64, Int32, Int64);
551 scilab_fill_sub(ScalarInt64, ScalarUInt32, S_S, Int64, UInt32, UInt64);
552 scilab_fill_sub(ScalarInt64, ScalarInt64, S_S, Int64, Int64, Int64);
553 scilab_fill_sub(ScalarInt64, ScalarUInt64, S_S, Int64, UInt64, UInt64);
554 scilab_fill_sub(ScalarInt64, ScalarBool, S_S, Int64, Bool, Int64);
558 scilab_fill_sub(UInt64, Double, M_M, UInt64, Double, UInt64);
559 scilab_fill_sub(UInt64, Int8, M_M, UInt64, Int8, UInt64);
560 scilab_fill_sub(UInt64, UInt8, M_M, UInt64, UInt8, UInt64);
561 scilab_fill_sub(UInt64, Int16, M_M, UInt64, Int16, UInt64);
562 scilab_fill_sub(UInt64, UInt16, M_M, UInt64, UInt16, UInt64);
563 scilab_fill_sub(UInt64, Int32, M_M, UInt64, Int32, UInt64);
564 scilab_fill_sub(UInt64, UInt32, M_M, UInt64, UInt32, UInt64);
565 scilab_fill_sub(UInt64, Int64, M_M, UInt64, Int64, UInt64);
566 scilab_fill_sub(UInt64, UInt64, M_M, UInt64, UInt64, UInt64);
567 scilab_fill_sub(UInt64, Bool, M_M, UInt64, Bool, UInt64);
568 scilab_fill_sub(UInt64, Empty, M_E, UInt64, Double, UInt64);
571 scilab_fill_sub(UInt64, ScalarDouble, M_S, UInt64, Double, UInt64);
572 scilab_fill_sub(UInt64, ScalarInt8, M_S, UInt64, Int8, UInt64);
573 scilab_fill_sub(UInt64, ScalarUInt8, M_S, UInt64, UInt8, UInt64);
574 scilab_fill_sub(UInt64, ScalarInt16, M_S, UInt64, Int16, UInt64);
575 scilab_fill_sub(UInt64, ScalarUInt16, M_S, UInt64, UInt16, UInt64);
576 scilab_fill_sub(UInt64, ScalarInt32, M_S, UInt64, Int32, UInt64);
577 scilab_fill_sub(UInt64, ScalarUInt32, M_S, UInt64, UInt32, UInt64);
578 scilab_fill_sub(UInt64, ScalarInt64, M_S, UInt64, Int64, UInt64);
579 scilab_fill_sub(UInt64, ScalarUInt64, M_S, UInt64, UInt64, UInt64);
580 scilab_fill_sub(UInt64, ScalarBool, M_S, UInt64, Bool, UInt64);
583 scilab_fill_sub(ScalarUInt64, Double, S_M, UInt64, Double, UInt64);
584 scilab_fill_sub(ScalarUInt64, Int8, S_M, UInt64, Int8, UInt64);
585 scilab_fill_sub(ScalarUInt64, UInt8, S_M, UInt64, UInt8, UInt64);
586 scilab_fill_sub(ScalarUInt64, Int16, S_M, UInt64, Int16, UInt64);
587 scilab_fill_sub(ScalarUInt64, UInt16, S_M, UInt64, UInt16, UInt64);
588 scilab_fill_sub(ScalarUInt64, Int32, S_M, UInt64, Int32, UInt64);
589 scilab_fill_sub(ScalarUInt64, UInt32, S_M, UInt64, UInt32, UInt64);
590 scilab_fill_sub(ScalarUInt64, Int64, S_M, UInt64, Int64, UInt64);
591 scilab_fill_sub(ScalarUInt64, UInt64, S_M, UInt64, UInt64, UInt64);
592 scilab_fill_sub(ScalarUInt64, Bool, S_M, UInt64, Bool, UInt64);
593 scilab_fill_sub(ScalarUInt64, Empty, S_E, UInt64, Double, UInt64);
596 scilab_fill_sub(ScalarUInt64, ScalarDouble, S_S, UInt64, Double, UInt64);
597 scilab_fill_sub(ScalarUInt64, ScalarInt8, S_S, UInt64, Int8, UInt64);
598 scilab_fill_sub(ScalarUInt64, ScalarUInt8, S_S, UInt64, UInt8, UInt64);
599 scilab_fill_sub(ScalarUInt64, ScalarInt16, S_S, UInt64, Int16, UInt64);
600 scilab_fill_sub(ScalarUInt64, ScalarUInt16, S_S, UInt64, UInt16, UInt64);
601 scilab_fill_sub(ScalarUInt64, ScalarInt32, S_S, UInt64, Int32, UInt64);
602 scilab_fill_sub(ScalarUInt64, ScalarUInt32, S_S, UInt64, UInt32, UInt64);
603 scilab_fill_sub(ScalarUInt64, ScalarInt64, S_S, UInt64, Int64, UInt64);
604 scilab_fill_sub(ScalarUInt64, ScalarUInt64, S_S, UInt64, UInt64, UInt64);
605 scilab_fill_sub(ScalarUInt64, ScalarBool, S_S, UInt64, Bool, UInt64);
609 scilab_fill_sub(Bool, Double, M_M, Bool, Double, Double);
610 scilab_fill_sub(Bool, Int8, M_M, Bool, Int8, Int8);
611 scilab_fill_sub(Bool, UInt8, M_M, Bool, UInt8, UInt8);
612 scilab_fill_sub(Bool, Int16, M_M, Bool, Int16, Int16);
613 scilab_fill_sub(Bool, UInt16, M_M, Bool, UInt16, UInt16);
614 scilab_fill_sub(Bool, Int32, M_M, Bool, Int32, Int32);
615 scilab_fill_sub(Bool, UInt32, M_M, Bool, UInt32, UInt32);
616 scilab_fill_sub(Bool, Int64, M_M, Bool, Int64, Int64);
617 scilab_fill_sub(Bool, UInt64, M_M, Bool, UInt64, UInt64);
618 scilab_fill_sub(Bool, Bool, M_M, Bool, Bool, Bool);
619 scilab_fill_sub(Bool, Empty, M_E, Bool, Double, Double);
622 scilab_fill_sub(Bool, ScalarDouble, M_S, Bool, Double, Double);
623 scilab_fill_sub(Bool, ScalarInt8, M_S, Bool, Int8, Int8);
624 scilab_fill_sub(Bool, ScalarUInt8, M_S, Bool, UInt8, UInt8);
625 scilab_fill_sub(Bool, ScalarInt16, M_S, Bool, Int16, Int16);
626 scilab_fill_sub(Bool, ScalarUInt16, M_S, Bool, UInt16, UInt16);
627 scilab_fill_sub(Bool, ScalarInt32, M_S, Bool, Int32, Int32);
628 scilab_fill_sub(Bool, ScalarUInt32, M_S, Bool, UInt32, UInt32);
629 scilab_fill_sub(Bool, ScalarInt64, M_S, Bool, Int64, Int64);
630 scilab_fill_sub(Bool, ScalarUInt64, M_S, Bool, UInt64, UInt64);
631 scilab_fill_sub(Bool, ScalarBool, M_S, Bool, Bool, Bool);
634 scilab_fill_sub(ScalarBool, Double, S_M, Bool, Double, Double);
635 scilab_fill_sub(ScalarBool, Int8, S_M, Bool, Int8, Int8);
636 scilab_fill_sub(ScalarBool, UInt8, S_M, Bool, UInt8, UInt8);
637 scilab_fill_sub(ScalarBool, Int16, S_M, Bool, Int16, Int16);
638 scilab_fill_sub(ScalarBool, UInt16, S_M, Bool, UInt16, UInt16);
639 scilab_fill_sub(ScalarBool, Int32, S_M, Bool, Int32, Int32);
640 scilab_fill_sub(ScalarBool, UInt32, S_M, Bool, UInt32, UInt32);
641 scilab_fill_sub(ScalarBool, Int64, S_M, Bool, Int64, Int64);
642 scilab_fill_sub(ScalarBool, UInt64, S_M, Bool, UInt64, UInt64);
643 scilab_fill_sub(ScalarBool, Bool, S_M, Bool, Bool, Bool);
644 scilab_fill_sub(ScalarBool, Empty, S_E, Bool, Double, Double);
647 scilab_fill_sub(ScalarBool, ScalarDouble, S_S, Bool, Double, Double);
648 scilab_fill_sub(ScalarBool, ScalarInt8, S_S, Bool, Int8, Int8);
649 scilab_fill_sub(ScalarBool, ScalarUInt8, S_S, Bool, UInt8, UInt8);
650 scilab_fill_sub(ScalarBool, ScalarInt16, S_S, Bool, Int16, Int16);
651 scilab_fill_sub(ScalarBool, ScalarUInt16, S_S, Bool, UInt16, UInt16);
652 scilab_fill_sub(ScalarBool, ScalarInt32, S_S, Bool, Int32, Int32);
653 scilab_fill_sub(ScalarBool, ScalarUInt32, S_S, Bool, UInt32, UInt32);
654 scilab_fill_sub(ScalarBool, ScalarInt64, S_S, Bool, Int64, Int64);
655 scilab_fill_sub(ScalarBool, ScalarUInt64, S_S, Bool, UInt64, UInt64);
656 scilab_fill_sub(ScalarBool, ScalarBool, S_S, Bool, Bool, Bool);
659 scilab_fill_sub(Identity, Double, I_M, Double, Double, Double);
660 scilab_fill_sub(Identity, DoubleComplex, I_MC, Double, Double, Double);
661 scilab_fill_sub(Identity, ScalarDouble, I_S, Double, Double, Double);
662 scilab_fill_sub(Identity, ScalarDoubleComplex, I_SC, Double, Double, Double);
663 scilab_fill_sub(Identity, Identity, I_I, Double, Double, Double);
664 scilab_fill_sub(Identity, IdentityComplex, I_IC, Double, Double, Double);
665 scilab_fill_sub(Identity, Empty, I_E, Double, Double, Double);
667 scilab_fill_sub(Identity, Polynom, I_M, Double, Polynom, Polynom);
668 scilab_fill_sub(Identity, PolynomComplex, I_MC, Double, Polynom, Polynom);
669 scilab_fill_sub(Identity, ScalarPolynom, I_M, Double, Polynom, Polynom);
670 scilab_fill_sub(Identity, ScalarPolynomComplex, I_MC, Double, Polynom, Polynom);
671 scilab_fill_sub(Identity, Sparse, M_M, Double, Sparse, Sparse);
672 scilab_fill_sub(Identity, SparseComplex, M_M, Double, Sparse, Sparse);
674 scilab_fill_sub(IdentityComplex, Double, IC_M, Double, Double, Double);
675 scilab_fill_sub(IdentityComplex, DoubleComplex, IC_MC, Double, Double, Double);
676 scilab_fill_sub(IdentityComplex, ScalarDouble, IC_S, Double, Double, Double);
677 scilab_fill_sub(IdentityComplex, ScalarDoubleComplex, IC_SC, Double, Double, Double);
678 scilab_fill_sub(IdentityComplex, Identity, IC_I, Double, Double, Double);
679 scilab_fill_sub(IdentityComplex, IdentityComplex, IC_IC, Double, Double, Double);
680 scilab_fill_sub(IdentityComplex, Empty, IC_E, Double, Double, Double);
682 scilab_fill_sub(IdentityComplex, Polynom, IC_M, Double, Polynom, Polynom);
683 scilab_fill_sub(IdentityComplex, PolynomComplex, IC_MC, Double, Polynom, Polynom);
684 scilab_fill_sub(IdentityComplex, ScalarPolynom, IC_M, Double, Polynom, Polynom);
685 scilab_fill_sub(IdentityComplex, ScalarPolynomComplex, IC_MC, Double, Polynom, Polynom);
686 scilab_fill_sub(IdentityComplex, Sparse, M_M, Double, Sparse, Sparse);
687 scilab_fill_sub(IdentityComplex, SparseComplex, M_M, Double, Sparse, Sparse);
689 scilab_fill_sub(Identity, ScalarInt8, I_S, Double, Int8, Int8);
690 scilab_fill_sub(Identity, ScalarUInt8, I_S, Double, UInt8, UInt8);
691 scilab_fill_sub(Identity, ScalarInt16, I_S, Double, Int16, Int16);
692 scilab_fill_sub(Identity, ScalarUInt16, I_S, Double, UInt16, UInt16);
693 scilab_fill_sub(Identity, ScalarInt32, I_S, Double, Int32, Int32);
694 scilab_fill_sub(Identity, ScalarUInt32, I_S, Double, UInt32, UInt32);
695 scilab_fill_sub(Identity, ScalarInt64, I_S, Double, Int64, Int64);
696 scilab_fill_sub(Identity, ScalarUInt64, I_S, Double, UInt64, UInt64);
698 scilab_fill_sub(Identity, Int8, I_M, Double, Int8, Int8);
699 scilab_fill_sub(Identity, UInt8, I_M, Double, UInt8, UInt8);
700 scilab_fill_sub(Identity, Int16, I_M, Double, Int16, Int16);
701 scilab_fill_sub(Identity, UInt16, I_M, Double, UInt16, UInt16);
702 scilab_fill_sub(Identity, Int32, I_M, Double, Int32, Int32);
703 scilab_fill_sub(Identity, UInt32, I_M, Double, UInt32, UInt32);
704 scilab_fill_sub(Identity, Int64, I_M, Double, Int64, Int64);
705 scilab_fill_sub(Identity, UInt64, I_M, Double, UInt64, UInt64);
710 scilab_fill_sub(Polynom, Polynom, M_M, Polynom, Polynom, Polynom);
711 scilab_fill_sub(Polynom, PolynomComplex, M_M, Polynom, Polynom, Polynom);
712 scilab_fill_sub(PolynomComplex, Polynom, M_M, Polynom, Polynom, Polynom);
713 scilab_fill_sub(PolynomComplex, PolynomComplex, M_M, Polynom, Polynom, Polynom);
716 scilab_fill_sub(Polynom, ScalarPolynom, M_M, Polynom, Polynom, Polynom);
717 scilab_fill_sub(Polynom, ScalarPolynomComplex, M_M, Polynom, Polynom, Polynom);
718 scilab_fill_sub(PolynomComplex, ScalarPolynom, M_M, Polynom, Polynom, Polynom);
719 scilab_fill_sub(PolynomComplex, ScalarPolynomComplex, M_M, Polynom, Polynom, Polynom);
722 scilab_fill_sub(Polynom, Double, M_M, Polynom, Double, Polynom);
723 scilab_fill_sub(Polynom, DoubleComplex, M_M, Polynom, Double, Polynom);
724 scilab_fill_sub(PolynomComplex, Double, M_M, Polynom, Double, Polynom);
725 scilab_fill_sub(PolynomComplex, DoubleComplex, M_M, Polynom, Double, Polynom);
727 //poly - scalar double
728 scilab_fill_sub(Polynom, ScalarDouble, M_M, Polynom, Double, Polynom);
729 scilab_fill_sub(Polynom, ScalarDoubleComplex, M_M, Polynom, Double, Polynom);
730 scilab_fill_sub(PolynomComplex, ScalarDouble, M_M, Polynom, Double, Polynom);
731 scilab_fill_sub(PolynomComplex, ScalarDoubleComplex, M_M, Polynom, Double, Polynom);
734 scilab_fill_sub(Polynom, Empty, M_M, Polynom, Double, Polynom);
735 scilab_fill_sub(PolynomComplex, Empty, M_M, Polynom, Double, Polynom);
738 scilab_fill_sub(Polynom, Identity, M_M, Polynom, Double, Polynom);
739 scilab_fill_sub(Polynom, IdentityComplex, M_M, Polynom, Double, Polynom);
740 scilab_fill_sub(PolynomComplex, Identity, M_M, Polynom, Double, Polynom);
741 scilab_fill_sub(PolynomComplex, IdentityComplex, M_M, Polynom, Double, Polynom);
744 scilab_fill_sub(ScalarPolynom, Polynom, M_M, Polynom, Polynom, Polynom);
745 scilab_fill_sub(ScalarPolynom, PolynomComplex, M_M, Polynom, Polynom, Polynom);
746 scilab_fill_sub(ScalarPolynomComplex, Polynom, M_M, Polynom, Polynom, Polynom);
747 scilab_fill_sub(ScalarPolynomComplex, PolynomComplex, M_M, Polynom, Polynom, Polynom);
749 //scalar poly - scalar poly
750 scilab_fill_sub(ScalarPolynom, ScalarPolynom, M_M, Polynom, Polynom, Polynom);
751 scilab_fill_sub(ScalarPolynom, ScalarPolynomComplex, M_M, Polynom, Polynom, Polynom);
752 scilab_fill_sub(ScalarPolynomComplex, ScalarPolynom, M_M, Polynom, Polynom, Polynom);
753 scilab_fill_sub(ScalarPolynomComplex, ScalarPolynomComplex, M_M, Polynom, Polynom, Polynom);
755 //scalar poly - double
756 scilab_fill_sub(ScalarPolynom, Double, M_M, Polynom, Double, Polynom);
757 scilab_fill_sub(ScalarPolynom, DoubleComplex, M_M, Polynom, Double, Polynom);
758 scilab_fill_sub(ScalarPolynomComplex, Double, M_M, Polynom, Double, Polynom);
759 scilab_fill_sub(ScalarPolynomComplex, DoubleComplex, M_M, Polynom, Double, Polynom);
761 //scalar poly - scalar double
762 scilab_fill_sub(ScalarPolynom, ScalarDouble, M_M, Polynom, Double, Polynom);
763 scilab_fill_sub(ScalarPolynom, ScalarDoubleComplex, M_M, Polynom, Double, Polynom);
764 scilab_fill_sub(ScalarPolynomComplex, ScalarDouble, M_M, Polynom, Double, Polynom);
765 scilab_fill_sub(ScalarPolynomComplex, ScalarDoubleComplex, M_M, Polynom, Double, Polynom);
768 scilab_fill_sub(ScalarPolynom, Empty, M_M, Polynom, Double, Polynom);
769 scilab_fill_sub(ScalarPolynomComplex, Empty, M_M, Polynom, Double, Polynom);
772 scilab_fill_sub(ScalarPolynom, Identity, M_M, Polynom, Double, Polynom);
773 scilab_fill_sub(ScalarPolynom, IdentityComplex, M_M, Polynom, Double, Polynom);
774 scilab_fill_sub(ScalarPolynomComplex, Identity, M_M, Polynom, Double, Polynom);
775 scilab_fill_sub(ScalarPolynomComplex, IdentityComplex, M_M, Polynom, Double, Polynom);
778 scilab_fill_sub(Sparse, Sparse, M_M, Sparse, Sparse, Sparse);
779 scilab_fill_sub(Sparse, SparseComplex, M_M, Sparse, Sparse, Sparse);
780 scilab_fill_sub(Sparse, Double, M_M, Sparse, Double, Double);
781 scilab_fill_sub(Sparse, DoubleComplex, M_M, Sparse, Double, Double);
782 scilab_fill_sub(Sparse, ScalarDouble, M_M, Sparse, Double, Double);
783 scilab_fill_sub(Sparse, ScalarDoubleComplex, M_M, Sparse, Double, Double);
785 scilab_fill_sub(Sparse, Empty, M_M, Sparse, Double, Sparse);
786 scilab_fill_sub(Sparse, Identity, M_M, Sparse, Double, Sparse);
787 scilab_fill_sub(Sparse, IdentityComplex, M_M, Sparse, Double, Sparse);
789 scilab_fill_sub(SparseComplex, Sparse, M_M, Sparse, Sparse, Sparse);
790 scilab_fill_sub(SparseComplex, SparseComplex, M_M, Sparse, Sparse, Sparse);
791 scilab_fill_sub(SparseComplex, Double, M_M, Sparse, Double, Double);
792 scilab_fill_sub(SparseComplex, DoubleComplex, M_M, Sparse, Double, Double);
793 scilab_fill_sub(SparseComplex, ScalarDouble, M_M, Sparse, Double, Double);
794 scilab_fill_sub(SparseComplex, ScalarDoubleComplex, M_M, Sparse, Double, Double);
796 scilab_fill_sub(SparseComplex, Empty, M_M, Sparse, Double, Sparse);
797 scilab_fill_sub(SparseComplex, Identity, M_M, Sparse, Double, Sparse);
798 scilab_fill_sub(SparseComplex, IdentityComplex, M_M, Sparse, Double, Sparse);
800 #undef scilab_fill_sub
803 InternalType* GenericMinus(InternalType* _pLeftOperand, InternalType* _pRightOperand)
805 InternalType *pResult = NULL;
807 sub_function sub = pSubfunction[_pLeftOperand->getId()][_pRightOperand->getId()];
810 pResult = sub(_pLeftOperand, _pRightOperand);
818 ** Default case : Return NULL will Call Overloading.
823 template<class T, class U, class O>
824 InternalType* sub_M_M(T *_pL, U *_pR)
826 int iDimsL = _pL->getDims();
827 int iDimsR = _pR->getDims();
829 if (iDimsL != iDimsR)
831 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
834 int* piDimsL = _pL->getDimsArray();
835 int* piDimsR = _pR->getDimsArray();
837 for (int i = 0 ; i < iDimsL ; ++i)
839 if (piDimsL[i] != piDimsR[i])
841 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
845 O* pOut = new O(iDimsL, piDimsL);
847 sub(_pL->get(), (size_t)_pL->getSize(), _pR->get(), pOut->get());
851 template<class T, class U, class O>
852 InternalType* sub_M_MC(T *_pL, U *_pR)
854 int iDimsL = _pL->getDims();
855 int iDimsR = _pR->getDims();
857 if (iDimsL != iDimsR)
859 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
862 int* piDimsL = _pL->getDimsArray();
863 int* piDimsR = _pR->getDimsArray();
865 for (int i = 0 ; i < iDimsL ; ++i)
867 if (piDimsL[i] != piDimsR[i])
869 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
873 O* pOut = new O(iDimsL, piDimsL, true);
875 sub(_pL->get(), (size_t)_pL->getSize(), _pR->get(), _pR->getImg(), pOut->get(), pOut->getImg());
879 template<class T, class U, class O>
880 InternalType* sub_M_S(T *_pL, U *_pR)
882 O* pOut = new O(_pL->getDims(), _pL->getDimsArray());
883 sub(_pL->get(), (size_t)_pL->getSize(), _pR->get(0), pOut->get());
887 template<class T, class U, class O>
888 InternalType* sub_M_SC(T *_pL, U *_pR)
890 O* pOut = new O(_pL->getDims(), _pL->getDimsArray(), true);
891 sub(_pL->get(), (size_t)_pL->getSize(), _pR->get(0), _pR->getImg(0), pOut->get(), pOut->getImg());
895 template<class T, class U, class O>
896 InternalType* sub_M_E(T *_pL, U *_pR)
902 template<class T, class U, class O>
903 InternalType* sub_MC_M(T *_pL, U *_pR)
905 int iDimsL = _pL->getDims();
906 int iDimsR = _pR->getDims();
908 if (iDimsL != iDimsR)
910 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
913 int* piDimsL = _pL->getDimsArray();
914 int* piDimsR = _pR->getDimsArray();
916 for (int i = 0 ; i < iDimsL ; ++i)
918 if (piDimsL[i] != piDimsR[i])
920 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
924 O* pOut = new O(iDimsL, piDimsL, true);
926 sub(_pL->get(), _pL->getImg(), (size_t)_pL->getSize(), _pR->get(), pOut->get(), pOut->getImg());
930 template<class T, class U, class O>
931 InternalType* sub_MC_MC(T *_pL, U *_pR)
933 int iDimsL = _pL->getDims();
934 int iDimsR = _pR->getDims();
936 if (iDimsL != iDimsR)
938 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
941 int* piDimsL = _pL->getDimsArray();
942 int* piDimsR = _pR->getDimsArray();
944 for (int i = 0 ; i < iDimsL ; ++i)
946 if (piDimsL[i] != piDimsR[i])
948 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
952 O* pOut = new O(iDimsL, piDimsL, true);
954 sub(_pL->get(), _pL->getImg(), (size_t)_pL->getSize(), _pR->get(), _pR->getImg(), pOut->get(), pOut->getImg());
958 template<class T, class U, class O>
959 InternalType* sub_MC_S(T *_pL, U *_pR)
961 O* pOut = new O(_pL->getDims(), _pL->getDimsArray(), true);
962 sub(_pL->get(), _pL->getImg(), (size_t)_pL->getSize(), _pR->get(0), pOut->get(), pOut->getImg());
966 template<class T, class U, class O>
967 InternalType* sub_MC_SC(T *_pL, U *_pR)
969 O* pOut = new O(_pL->getDims(), _pL->getDimsArray(), true);
970 sub(_pL->get(), _pL->getImg(), (size_t)_pL->getSize(), _pR->get(0), _pR->getImg(0), pOut->get(), pOut->getImg());
974 template<class T, class U, class O>
975 InternalType* sub_MC_E(T *_pL, U *_pR)
981 template<class T, class U, class O>
982 InternalType* sub_S_M(T *_pL, U *_pR)
984 O* pOut = new O(_pR->getDims(), _pR->getDimsArray());
985 sub(_pL->get(0), (size_t)_pR->getSize(), _pR->get(), pOut->get());
989 template<class T, class U, class O>
990 InternalType* sub_S_MC(T *_pL, U *_pR)
992 O* pOut = new O(_pR->getDims(), _pR->getDimsArray(), true);
993 sub(_pL->get(0), (size_t)_pR->getSize(), _pR->get(), _pR->getImg(), pOut->get(), pOut->getImg());
997 template<class T, class U, class O>
998 InternalType* sub_S_S(T *_pL, U *_pR)
1001 sub(_pL->get(0), _pR->get(0), pOut->get());
1005 template<class T, class U, class O>
1006 InternalType* sub_S_SC(T *_pL, U *_pR)
1008 O* pOut = new O(0.0, 0.0);
1009 sub(_pL->get(), (size_t)1, _pR->get(0), _pR->getImg(0), pOut->get(), pOut->getImg());
1013 template<class T, class U, class O>
1014 InternalType* sub_S_E(T *_pL, U *_pR)
1017 sub(_pL->get(0), pOut->get());
1022 template<class T, class U, class O>
1023 InternalType* sub_SC_M(T *_pL, U *_pR)
1025 O* pOut = new O(_pR->getDims(), _pR->getDimsArray(), true);
1026 sub(_pL->get(0), _pL->getImg(0), (size_t)_pR->getSize(), _pR->get(), pOut->get(), pOut->getImg());
1030 template<class T, class U, class O>
1031 InternalType* sub_SC_MC(T *_pL, U *_pR)
1033 O* pOut = new O(_pR->getDims(), _pR->getDimsArray(), true);
1034 sub(_pL->get(0), _pL->getImg(0), (size_t)_pR->getSize(), _pR->get(), _pR->getImg(), pOut->get(), pOut->getImg());
1038 template<class T, class U, class O>
1039 InternalType* sub_SC_S(T *_pL, U *_pR)
1041 O* pOut = new O(0.0, 0.0);
1042 sub(_pL->get(), _pL->getImg(), (size_t)1, _pR->get(0), pOut->get(), pOut->getImg());
1046 template<class T, class U, class O>
1047 InternalType* sub_SC_SC(T *_pL, U *_pR)
1049 O* pOut = new O(0.0, 0.0);
1050 sub(_pL->get(0), _pL->getImg(0), _pR->get(0), _pR->getImg(0), pOut->get(), pOut->getImg());
1054 template<class T, class U, class O>
1055 InternalType* sub_SC_E(T *_pL, U *_pR)
1057 O* pOut = new O(0.0, 0.0);
1058 sub(_pL->get(0), _pL->getImg(0), (size_t)1, pOut->get(), pOut->getImg());
1063 template<class T, class U, class O>
1064 InternalType* sub_E_M(T *_pL, U *_pR)
1066 return opposite_M<U, O>(_pR);
1069 template<class T, class U, class O>
1070 InternalType* sub_E_MC(T *_pL, U *_pR)
1072 return opposite_MC<U, O>(_pR);
1075 template<class T, class U, class O>
1076 InternalType* sub_E_E(T *_pL, U *_pR)
1078 Double* pOut = Double::Empty();
1083 template<class T, class U, class O>
1084 InternalType* sub_I_M(T *_pL, U *_pR)
1086 int iDims = _pR->getDims();
1087 int* piDims = _pR->getDimsArray();
1088 O* pOut = (O*)opposite_M<U, O>(_pR);
1089 double dblLeft = _pL->get(0);
1090 int iLeadDims = piDims[0];
1091 int* piIndex = new int[iDims];
1095 for (int i = 1 ; i < iDims ; ++i)
1100 if (iLeadDims > piDims[i])
1102 iLeadDims = piDims[i];
1106 for (int i = 0 ; i < iLeadDims ; ++i)
1108 for (int j = 0 ; j < iDims ; ++j)
1113 int index = _pR->getIndex(piIndex);
1114 sub(dblLeft, _pR->get(index), pOut->get() + index);
1120 template<class T, class U, class O>
1121 InternalType* sub_I_MC(T *_pL, U *_pR)
1123 int iDims = _pR->getDims();
1124 int* piDims = _pR->getDimsArray();
1125 O* pOut = (O*)opposite_MC<U, O>(_pR);
1126 double* pdblOut = pOut->get();
1127 double* pdblRight = _pR->get();
1128 double dblLeft = _pL->get(0);
1129 int iLeadDims = piDims[0];
1130 int* piIndex = new int[iDims];
1134 for (int i = 1 ; i < iDims ; ++i)
1139 if (iLeadDims > piDims[i])
1141 iLeadDims = piDims[i];
1145 for (int i = 0 ; i < iLeadDims ; ++i)
1147 for (int j = 0 ; j < iDims ; ++j)
1152 int index = _pR->getIndex(piIndex);
1153 sub(dblLeft, pdblRight[index], pdblOut + index);
1159 template<class T, class U, class O>
1160 InternalType* sub_IC_M(T *_pL, U *_pR)
1162 int iDims = _pR->getDims();
1163 int* piDims = _pR->getDimsArray();
1164 O* pOut = (O*)opposite_M<U, O>(_pR);
1165 pOut->setComplex(true);
1166 double* pdblOutR = pOut->get();
1167 double* pdblOutI = pOut->getImg();
1168 double* pdblRight = _pR->get();
1169 double dblLeftR = _pL->get(0);
1170 double dblLeftI = _pL->getImg(0);
1171 int iLeadDims = piDims[0];
1172 int* piIndex = new int[iDims];
1176 for (int i = 1 ; i < iDims ; ++i)
1181 if (iLeadDims > piDims[i])
1183 iLeadDims = piDims[i];
1187 for (int i = 0 ; i < iLeadDims ; ++i)
1189 for (int j = 0 ; j < iDims ; ++j)
1194 int index = _pR->getIndex(piIndex);
1195 sub(&dblLeftR, &dblLeftI, (size_t)1, pdblRight[index], pdblOutR + index, pdblOutI + index);
1201 template<class T, class U, class O>
1202 InternalType* sub_IC_MC(T *_pL, U *_pR)
1204 int iDims = _pR->getDims();
1205 int* piDims = _pR->getDimsArray();
1206 O* pOut = (O*)opposite_MC<U, O>(_pR);
1207 double dblLeftR = _pL->get(0);
1208 double dblLeftI = _pL->getImg(0);
1209 double* pdblOutR = pOut->get();
1210 double* pdblOutI = pOut->getImg();
1211 double* pdblRightR = _pR->get();
1212 double* pdblRightI = _pR->getImg();
1213 int iLeadDims = piDims[0];
1214 int* piIndex = new int[iDims];
1217 for (int i = 1 ; i < iDims ; ++i)
1222 if (iLeadDims > piDims[i])
1224 iLeadDims = piDims[i];
1228 for (int i = 0 ; i < iLeadDims ; ++i)
1230 for (int j = 0 ; j < iDims ; ++j)
1235 int index = _pR->getIndex(piIndex);
1236 sub(dblLeftR, dblLeftI, pdblRightR[index], pdblRightI[index], pdblOutR + index, pdblOutI + index);
1242 template<class T, class U, class O>
1243 InternalType* sub_I_S(T *_pL, U *_pR)
1245 return sub_S_S<T, U, O>(_pL, _pR);
1248 template<class T, class U, class O>
1249 InternalType* sub_IC_S(T *_pL, U *_pR)
1251 return sub_SC_S<T, U, O>(_pL, _pR);
1254 template<class T, class U, class O>
1255 InternalType* sub_I_SC(T *_pL, U *_pR)
1257 return sub_S_SC<T, U, O>(_pL, _pR);
1260 template<class T, class U, class O>
1261 InternalType* sub_IC_SC(T *_pL, U *_pR)
1263 return sub_SC_SC<T, U, O>(_pL, _pR);
1266 template<class T, class U, class O> InternalType* sub_M_I(T *_pL, U *_pR)
1268 int iDims = _pL->getDims();
1269 int* piDims = _pL->getDimsArray();
1270 O* pOut = (O*)_pL->clone();
1271 double* pdblOutR = pOut->get();
1272 double* pdblLeft = _pL->get();
1273 double dblRight = _pR->get(0);
1274 int iLeadDims = piDims[0];
1275 int* piIndex = new int[iDims];
1279 for (int i = 1 ; i < iDims ; ++i)
1284 if (iLeadDims > piDims[i])
1286 iLeadDims = piDims[i];
1290 for (int i = 0 ; i < iLeadDims ; ++i)
1292 for (int j = 0 ; j < iDims ; ++j)
1297 int index = _pL->getIndex(piIndex);
1298 sub(pdblLeft[index], (size_t)1, &dblRight, pdblOutR + index);
1304 template<class T, class U, class O> InternalType* sub_MC_I(T *_pL, U *_pR)
1306 return sub_M_I<T, U, O>(_pL, _pR);
1309 template<class T, class U, class O> InternalType* sub_M_IC(T *_pL, U *_pR)
1311 int iDims = _pL->getDims();
1312 int* piDims = _pL->getDimsArray();
1313 O* pOut = (O*)_pL->clone();
1314 pOut->setComplex(true);
1315 double* pdblOutR = pOut->get();
1316 double* pdblOutI = pOut->getImg();
1317 double* pdblLeft = _pL->get();
1318 double dblRightR = _pR->get(0);
1319 double dblRightI = _pR->getImg(0);
1320 int iLeadDims = piDims[0];
1321 int* piIndex = new int[iDims];
1325 for (int i = 1 ; i < iDims ; ++i)
1330 if (iLeadDims > piDims[i])
1332 iLeadDims = piDims[i];
1336 for (int i = 0 ; i < iLeadDims ; ++i)
1338 for (int j = 0 ; j < iDims ; ++j)
1343 int index = _pL->getIndex(piIndex);
1344 sub(pdblLeft[index], (size_t)1, &dblRightR, &dblRightI, pdblOutR + index, pdblOutI + index);
1350 template<class T, class U, class O> InternalType* sub_MC_IC(T *_pL, U *_pR)
1352 int iDims = _pL->getDims();
1353 int* piDims = _pL->getDimsArray();
1354 O* pOut = (O*)_pL->clone();
1355 pOut->setComplex(true);
1356 double* pdblOutR = pOut->get();
1357 double* pdblOutI = pOut->getImg();
1358 double* pdblLeftR = _pL->get();
1359 double* pdblLeftI = _pL->getImg();
1360 double dblRightR = _pR->get(0);
1361 double dblRightI = _pR->getImg(0);
1362 int iLeadDims = piDims[0];
1363 int* piIndex = new int[iDims];
1367 for (int i = 1 ; i < iDims ; ++i)
1372 if (iLeadDims > piDims[i])
1374 iLeadDims = piDims[i];
1378 for (int i = 0 ; i < iLeadDims ; ++i)
1380 for (int j = 0 ; j < iDims ; ++j)
1385 int index = _pL->getIndex(piIndex);
1386 sub(pdblLeftR[index], pdblLeftI[index], (size_t)1, &dblRightR, &dblRightI, pdblOutR + index, pdblOutI + index);
1392 template<class T, class U, class O> InternalType* sub_S_I(T *_pL, U *_pR)
1394 return sub_S_S<T, U, O>(_pL, _pR);
1397 template<class T, class U, class O> InternalType* sub_SC_I(T *_pL, U *_pR)
1399 return sub_SC_SC<T, U, O>(_pL, _pR);
1402 template<class T, class U, class O> InternalType* sub_S_IC(T *_pL, U *_pR)
1404 return sub_S_SC<T, U, O>(_pL, _pR);
1407 template<class T, class U, class O> InternalType* sub_SC_IC(T *_pL, U *_pR)
1409 return sub_SC_SC<T, U, O>(_pL, _pR);
1412 template<class T, class U, class O> InternalType* sub_I_I(T *_pL, U *_pR)
1414 O* pOut = types::Double::Identity(-1, -1);
1415 sub(_pL->get(0), _pR->get(0), pOut->get());
1419 template<class T, class U, class O> InternalType* sub_I_IC(T *_pL, U *_pR)
1421 O* pOut = types::Double::Identity(-1, -1);
1422 pOut->setComplex(true);
1423 sub(_pL->get(), (size_t)1, _pR->get(0), _pR->getImg(0), pOut->get(), pOut->getImg());
1427 template<class T, class U, class O> InternalType* sub_IC_I(T *_pL, U *_pR)
1429 O* pOut = types::Double::Identity(-1, -1);
1430 pOut->setComplex(true);
1431 sub(_pL->get(0), _pL->getImg(0), _pR->get(0), _pR->getImg(0), pOut->get(), pOut->getImg());
1435 template<class T, class U, class O> InternalType* sub_IC_IC(T *_pL, U *_pR)
1437 O* pOut = types::Double::Identity(-1, -1);
1438 pOut->setComplex(true);
1439 sub(_pL->get(0), _pL->getImg(0), _pR->get(0), _pR->getImg(0), pOut->get(), pOut->getImg());
1443 template<class T, class U, class O> types::InternalType* sub_I_E(T *_pL, U *_pR)
1448 template<class T, class U, class O> types::InternalType* sub_IC_E(T *_pL, U *_pR)
1453 template<class T, class U, class O> types::InternalType* sub_E_I(T *_pL, U *_pR)
1455 return opposite_I<U, O>(_pR);
1458 template<class T, class U, class O> types::InternalType* sub_E_IC(T *_pL, U *_pR)
1460 return opposite_IC<U, O>(_pR);
1463 template<> InternalType* sub_M_M<Polynom, Polynom, Polynom>(Polynom* _pL, Polynom* _pR)
1465 Polynom* pOut = NULL;
1466 if (_pL->isScalar())
1468 SinglePoly* p1Coef = _pL->get(0);
1469 int iRank1 = p1Coef->getRank();
1470 int* pRank2 = new int[_pR->getSize()];
1471 int* pRankOut = new int[_pR->getSize()];
1473 _pR->getRank(pRank2);
1474 for (int i = 0 ; i < _pR->getSize() ; i++)
1476 pRankOut[i] = std::max(iRank1, pRank2[i]);
1479 pOut = new Polynom(_pR->getVariableName(), _pR->getDims(), _pR->getDimsArray(), pRankOut);
1480 bool isOutComplex = _pL->isComplex() || _pR->isComplex();
1482 //Result P1(0) - P2(i)
1483 double* p1R = p1Coef->get();
1486 double* p1I = p1Coef->getImg();
1487 for (int i = 0 ; i < _pR->getSize() ; i++)
1489 SinglePoly* p2Coef = _pR->get(i);
1490 double* p2R = p2Coef->get();
1491 double* p2I = p2Coef->getImg();
1493 SinglePoly* pOutCoef = pOut->get(i);
1494 pOutCoef->setComplex(isOutComplex);
1495 double* pOutR = pOutCoef->get();
1496 double* pOutI = pOutCoef->getImg();
1498 for (int j = 0 ; j < pRankOut[i] + 1 ; j++)
1502 pOutR[j] = - p2R[j];
1503 pOutI[j] = - (p2I ? p2I[j] : 0);
1505 else if (j > pRank2[i])
1508 pOutI[j] = (p1I ? p1I[j] : 0);
1512 pOutR[j] = p1R[j] - p2R[j];
1513 pOutI[j] = (p1I ? p1I[j] : 0) - (p2I ? p2I[j] : 0);
1520 for (int i = 0 ; i < _pR->getSize() ; i++)
1522 SinglePoly* p2Coef = _pR->get(i);
1523 double* p2R = p2Coef->get();
1525 SinglePoly* pOutCoef = pOut->get(i);
1526 double* pOutR = pOutCoef->get();
1528 for (int j = 0 ; j < pRankOut[i] + 1 ; j++)
1532 pOutR[j] = - p2R[j];
1534 else if (j > pRank2[i])
1540 pOutR[j] = p1R[j] - p2R[j];
1552 if (_pR->isScalar())
1555 int *pRank1 = new int[_pL->getSize()];
1556 int iRank2 = _pR->get(0)->getRank();
1557 int *pRankOut = new int[_pL->getSize()];
1559 _pL->getRank(pRank1);
1560 for (int i = 0 ; i < _pL->getSize() ; i++)
1562 pRankOut[i] = std::max(pRank1[i], iRank2);
1565 pOut = new Polynom(_pL->getVariableName(), _pL->getDims(), _pL->getDimsArray(), pRankOut);
1566 bool isOutComplex = _pL->isComplex() || _pR->isComplex();
1568 //Result P1(i) - P2(0)
1569 SinglePoly *p2Coef = _pR->get(0);
1570 double *p2R = p2Coef->get();
1574 double *p2I = p2Coef->getImg();
1575 for (int i = 0 ; i < _pL->getSize() ; i++)
1577 SinglePoly *p1Coef = _pL->get(i);
1578 double *p1R = p1Coef->get();
1579 double *p1I = p1Coef->getImg();
1581 SinglePoly *pOutCoef = pOut->get(i);
1582 pOutCoef->setComplex(isOutComplex);
1583 double *pOutR = pOutCoef->get();
1584 double *pOutI = pOutCoef->getImg();
1586 for (int j = 0 ; j < pRankOut[i] + 1 ; j++)
1590 pOutR[j] = - p2R[j];
1591 pOutI[j] = - (p2I ? p2I[j] : 0);
1593 else if (j > iRank2)
1596 pOutI[j] = (p1I ? p1I[j] : 0);
1600 pOutR[j] = p1R[j] - p2R[j];
1601 pOutI[j] = (p1I ? p1I[j] : 0) - (p2I ? p2I[j] : 0);
1608 for (int i = 0 ; i < _pL->getSize() ; i++)
1610 SinglePoly *p1Coef = _pL->get(i);
1611 double *p1R = p1Coef->get();
1613 SinglePoly *pOutCoef = pOut->get(i);
1614 double *pOutR = pOutCoef->get();
1616 for (int j = 0 ; j < pRankOut[i] + 1 ; j++)
1620 pOutR[j] = - p2R[j];
1622 else if (j > iRank2)
1628 pOutR[j] = p1R[j] - p2R[j];
1640 //check dimension compatibilities
1641 int iDims1 = _pL->getDims();
1642 int iDims2 = _pR->getDims();
1644 if (iDims1 != iDims2)
1646 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
1649 int* piDims1 = _pL->getDimsArray();
1650 int* piDims2 = _pR->getDimsArray();
1652 for (int i = 0 ; i < iDims1 ; i++)
1654 if (piDims1[i] != piDims2[i])
1656 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
1660 int *pRankOut = new int[_pL->getSize()];
1661 int *pRank1 = new int[_pL->getSize()];
1662 int *pRank2 = new int[_pR->getSize()];
1664 _pL->getRank(pRank1);
1665 _pR->getRank(pRank2);
1666 for (int i = 0 ; i < _pL->getSize() ; i++)
1668 pRankOut[i] = std::max(pRank1[i], pRank2[i]);
1671 pOut = new Polynom(_pR->getVariableName(), iDims1, piDims1, pRankOut);
1672 bool isOutComplex = _pL->isComplex() || _pR->isComplex();
1674 //Result P1(i) - P2(i)
1675 for (int i = 0 ; i < _pL->getSize() ; i++)
1677 SinglePoly* pOutCoef = pOut->get(i);
1678 pOutCoef->setComplex(isOutComplex);
1680 double *p1R = _pL->get(i)->get();
1681 double *p2R = _pR->get(i)->get();
1682 double *pOutR = pOutCoef->get();
1683 int iMin = std::min(pRank1[i], pRank2[i]);
1684 int iMax = std::max(pRank1[i], pRank2[i]);
1686 for (int j = 0 ; j < iMin + 1 ; j++)
1688 pOutR[j] = p1R[j] - p2R[j];
1691 double *pTemp = NULL;
1693 if (pRank1[i] > pRank2[i])
1704 for (int j = iMin + 1 ; j < iMax + 1 ; j++)
1706 pOutR[j] = pTemp[j] * iCoef;
1711 double *p1I = _pL->get(i)->getImg();
1712 double *p2I = _pR->get(i)->getImg();
1713 double *pOutI = pOutCoef->getImg();
1715 for (int j = 0 ; j < iMin + 1 ; j++)
1717 pOutI[j] = (p1I == NULL ? 0 : p1I[j]) - (p2I == NULL ? 0 : p2I[j]);
1720 for (int j = iMin + 1 ; j < iMax + 1 ; j++)
1722 pOutI[j] = pTemp[j] * iCoef;
1736 template<> InternalType* sub_M_M<Polynom, Double, Polynom>(Polynom* _pL, Double* _pR)
1738 Polynom* pOut = NULL;
1740 bool bComplex1 = _pL->isComplex();
1741 bool bComplex2 = _pR->isComplex();
1742 bool isComplexOut = bComplex2 || bComplex1;
1750 if (_pR->isIdentity())
1752 double dblRightR = _pR->get(0);
1753 double dblRightI = 0;
1754 if (_pR->isComplex())
1756 dblRightI = _pR->getImg(0);
1759 int iDims = _pL->getDims();
1760 int* piDims = _pL->getDimsArray();
1761 pOut = (Polynom*)_pL->clone();
1762 pOut->setComplex(isComplexOut);
1763 SinglePoly** pSPOut = pOut->get();
1764 SinglePoly** pSPLeft = _pL->get();
1765 int iLeadDims = piDims[0];
1766 int* piIndex = new int[iDims];
1770 for (int i = 1 ; i < iDims ; ++i)
1775 if (iLeadDims > piDims[i])
1777 iLeadDims = piDims[i];
1783 for (int i = 0 ; i < iLeadDims ; ++i)
1785 for (int j = 0 ; j < iDims ; ++j)
1790 int index = _pL->getIndex(piIndex);
1791 sub(pSPLeft[index]->get(0), pSPLeft[index]->getImg(0), (size_t)1, &dblRightR, &dblRightI, pSPOut[index]->get(), pSPOut[index]->getImg());
1796 for (int i = 0 ; i < iLeadDims ; ++i)
1798 for (int j = 0 ; j < iDims ; ++j)
1803 int index = _pL->getIndex(piIndex);
1804 sub(pSPLeft[index]->get(0), (size_t)1, &dblRightR, pSPOut[index]->get());
1811 if (_pR->isScalar())
1813 //subtract same value to all polynoms
1814 pOut = (Polynom*)_pL->clone();
1815 pOut->setComplex(isComplexOut);
1817 SinglePoly** pSP = pOut->get();
1818 int iSize = pOut->getSize();
1820 double dblR = _pR->get(0);
1823 double dblI = _pR->getImg(0);
1824 for (int i = 0 ; i < iSize ; ++i)
1826 pSP[i]->get()[0] -= dblR;
1827 pSP[i]->getImg()[0] -= dblI;
1832 for (int i = 0 ; i < iSize ; ++i)
1834 pSP[i]->get()[0] -= dblR;
1841 if (_pL->isScalar())
1844 int iDims = _pR->getDims();
1845 int* piDims = _pR->getDimsArray();
1846 int iSize = _pR->getSize();
1848 pOut = new Polynom(_pL->getVariableName(), iDims, piDims);
1850 SinglePoly* pSPL = _pL->get(0);
1851 if (_pR->isComplex())
1853 double* pdblR = _pR->get();
1854 double* pdblI = _pR->getImg();
1856 for (int i = 0 ; i < iSize ; ++i)
1858 SinglePoly* pSPOut = pSPL->clone();
1859 //in case of original is not complex
1860 pSPOut->setComplex(isComplexOut);
1861 pSPOut->get()[0] -= pdblR[i];
1862 pSPOut->getImg()[0] -= pdblI[i];
1863 pOut->set(i, pSPOut);
1868 double* pdblR = _pR->get();
1870 for (int i = 0 ; i < iSize ; ++i)
1872 SinglePoly* pSPOut = pSPL->clone();
1873 //update 0th rank value
1874 pSPOut->get()[0] -= pdblR[i];
1875 pOut->set(i, pSPOut);
1885 int iDims1 = _pR->getDims();
1886 int iDims2 = _pL->getDims();
1888 if (iDims1 != iDims2)
1891 os_swprintf(pMsg, bsiz, _W("Error: operator %ls: Matrix dimensions must agree (op1 is %ls, op2 is %ls).\n").c_str(), L"-", _pL->DimToString().c_str(), _pR->DimToString().c_str());
1892 throw ast::ScilabError(pMsg);
1895 int* piDims1 = _pR->getDimsArray();
1896 int* piDims2 = _pL->getDimsArray();
1898 for (int i = 0 ; i < iDims1 ; i++)
1900 if (piDims1[i] != piDims2[i])
1903 os_swprintf(pMsg, bsiz, _W("Error: operator %ls: Matrix dimensions must agree (op1 is %ls, op2 is %ls).\n").c_str(), L"-", _pL->DimToString().c_str(), _pR->DimToString().c_str());
1904 throw ast::ScilabError(pMsg);
1908 double* pInDblR = _pR->get();
1909 pOut = (Polynom*)_pL->clone();
1910 if (bComplex1 && bComplex2)
1912 double* pInDblI = _pR->getImg();
1913 for (int i = 0 ; i < pOut->getSize() ; i++)
1915 SinglePoly *pSPOut = pOut->get(i);
1916 double *pOutPolyR = pSPOut->get();
1917 double *pOutPolyI = pSPOut->getImg();
1919 pOutPolyR[0] -= pInDblR[i];
1920 pOutPolyI[0] -= pInDblI[i];
1925 double* pInDblI = _pR->getImg();
1926 pOut->setComplex(true);
1927 for (int i = 0 ; i < pOut->getSize() ; i++)
1929 SinglePoly *pSPOut = pOut->get(i);
1930 double *pOutPolyR = pSPOut->get();
1931 double *pOutPolyI = pSPOut->getImg();
1933 pOutPolyR[0] -= pInDblR[i];
1934 pOutPolyI[0] = -pInDblI[i];
1939 for (int i = 0 ; i < pOut->getSize() ; i++)
1941 SinglePoly *pSPOut = pOut->get(i);
1942 double *pOutPolyR = pSPOut->get();
1944 pOutPolyR[0] -= pInDblR[i];
1951 template<> InternalType* sub_I_M<Double, Polynom, Polynom>(Double* _pL, Polynom* _pR)
1953 Polynom* pOut = (Polynom*)opposite_M<Polynom, Polynom>(_pR);
1954 double dblLeft = _pL->get(0);
1956 int iDims = _pR->getDims();
1957 int* piDims = _pR->getDimsArray();
1958 int iSize = _pR->getSize();
1959 int iLeadDims = piDims[0];
1960 int* piIndex = new int[iDims];
1961 SinglePoly** pSP = _pR->get();
1962 SinglePoly** pSPOut = pOut->get();
1966 for (int i = 1 ; i < iDims ; ++i)
1971 if (iLeadDims > piDims[i])
1973 iLeadDims = piDims[i];
1977 for (int i = 0 ; i < iLeadDims ; ++i)
1979 for (int j = 0 ; j < iDims ; ++j)
1984 int index = _pR->getIndex(piIndex);
1985 sub(dblLeft, pSP[index]->get(0), pSPOut[index]->get());
1991 template<> InternalType* sub_I_MC<Double, Polynom, Polynom>(Double* _pL, Polynom* _pR)
1993 Polynom* pOut = (Polynom*)opposite_MC<Polynom, Polynom>(_pR);
1994 double dblLeft = _pL->get(0);
1996 int iDims = _pR->getDims();
1997 int* piDims = _pR->getDimsArray();
1998 int iSize = _pR->getSize();
1999 int iLeadDims = piDims[0];
2000 int* piIndex = new int[iDims];
2001 SinglePoly** pSP = _pR->get();
2002 SinglePoly** pSPOut = pOut->get();
2005 for (int i = 0 ; i < iDims ; ++i)
2010 if (iLeadDims > piDims[i])
2012 iLeadDims = piDims[i];
2016 for (int i = 0 ; i < iLeadDims ; ++i)
2018 for (int j = 0 ; j < iDims ; ++j)
2023 int index = _pR->getIndex(piIndex);
2024 sub(dblLeft, pSP[index]->get(0), pSPOut[index]->get());
2030 template<> InternalType* sub_IC_M<Double, Polynom, Polynom>(Double* _pL, Polynom* _pR)
2032 Polynom* pOut = (Polynom*)opposite_M<Polynom, Polynom>(_pR);
2033 pOut->setComplex(true);
2034 double dblLeftR = _pL->get(0);
2035 double dblLeftI = _pL->getImg(0);
2037 int iDims = _pR->getDims();
2038 int* piDims = _pR->getDimsArray();
2039 int iSize = _pR->getSize();
2040 int iLeadDims = piDims[0];
2041 int* piIndex = new int[iDims];
2042 SinglePoly** pSP = _pR->get();
2043 SinglePoly** pSPOut = pOut->get();
2046 for (int i = 0 ; i < iDims ; ++i)
2051 if (iLeadDims > piDims[i])
2053 iLeadDims = piDims[i];
2057 for (int i = 0 ; i < iLeadDims ; ++i)
2059 for (int j = 0 ; j < iDims ; ++j)
2064 int index = _pR->getIndex(piIndex);
2065 sub(&dblLeftR, &dblLeftI, (size_t)1, pSP[index]->get(0), pSPOut[index]->get(), pSPOut[index]->getImg());
2071 template<> InternalType* sub_IC_MC<Double, Polynom, Polynom>(Double* _pL, Polynom* _pR)
2073 Polynom* pOut = (Polynom*)opposite_MC<Polynom, Polynom>(_pR);
2074 double dblLeftR = _pL->get(0);
2075 double dblLeftI = _pL->getImg(0);
2077 int iDims = _pR->getDims();
2078 int* piDims = _pR->getDimsArray();
2079 int iSize = _pR->getSize();
2080 int iLeadDims = piDims[0];
2081 int* piIndex = new int[iDims];
2082 SinglePoly** pSP = _pR->get();
2083 SinglePoly** pSPOut = pOut->get();
2086 for (int i = 0 ; i < iDims ; ++i)
2091 if (iLeadDims > piDims[i])
2093 iLeadDims = piDims[i];
2097 for (int i = 0 ; i < iLeadDims ; ++i)
2099 for (int j = 0 ; j < iDims ; ++j)
2104 int index = _pR->getIndex(piIndex);
2105 sub(dblLeftR, dblLeftI, pSP[index]->get(0), pSP[index]->getImg(0), pSPOut[index]->get(), pSPOut[index]->getImg());
2111 template<> InternalType* sub_M_M<Double, Polynom, Polynom>(Double* _pL, Polynom* _pR)
2113 Polynom* pOut = NULL;
2114 bool bComplex1 = _pL->isComplex();
2115 bool bComplex2 = _pR->isComplex();
2117 double *pInDblR = _pL->getReal();
2118 double *pInDblI = _pL->getImg();
2125 if (_pR->isScalar())
2127 int *piRank = new int[_pL->getSize()];
2128 for (int i = 0 ; i < _pL->getSize() ; i++)
2130 piRank[i] = _pR->get(0)->getRank();
2133 pOut = new Polynom(_pR->getVariableName(), _pL->getDims(), _pL->getDimsArray(), piRank);
2134 if (bComplex1 || bComplex2)
2136 pOut->setComplex(true);
2139 for (int i = 0 ; i < pOut->getSize() ; i++)
2141 SinglePoly *pInPoly = _pR->get(0);
2142 SinglePoly *pOutPoly = pOut->get(i);
2143 double *pInPolyR = pInPoly->get();
2144 double *pOutPolyR = pOutPoly->get();
2146 pOutPolyR[0] = pInDblR[i] - pInPolyR[0];
2148 for (int j = 1 ; j < pInPoly->getSize() ; j++)
2150 pOutPolyR[j] = -pInPolyR[j];
2154 if (pOut->isComplex())
2156 for (int i = 0 ; i < pOut->getSize() ; i++)
2158 SinglePoly *pInPoly = _pR->get(0);
2159 SinglePoly *pOutPoly = pOut->get(i);
2160 double *pInPolyI = pInPoly->getImg();
2161 double *pOutPolyI = pOutPoly->getImg();
2163 pOutPolyI[0] = (pInDblI != NULL ? pInDblI[i] : 0) - (pInPolyI != NULL ? pInPolyI[0] : 0);
2165 for (int j = 1 ; j < pInPoly->getSize() ; j++)
2167 pOutPolyI[j] = (pInPolyI != NULL ? -pInPolyI[j] : 0);
2175 if (_pL->isScalar())
2179 pOut = (Polynom*)opposite_MC<Polynom, Polynom>(_pR);
2183 pOut = (Polynom*)opposite_M<Polynom, Polynom>(_pR);
2186 int iSize = pOut->getSize();
2188 if (bComplex1 && bComplex2)
2190 for (int i = 0 ; i < iSize ; i++)
2192 SinglePoly *pSPOut = pOut->get(i);
2193 double *pOutPolyR = pSPOut->get();
2194 double *pOutPolyI = pSPOut->getImg();
2196 pOutPolyR[0] += pInDblR[0];
2197 pOutPolyI[0] += pInDblI[0];
2202 pOut->setComplex(true);
2203 for (int i = 0 ; i < iSize ; i++)
2205 SinglePoly *pSPOut = pOut->get(i);
2206 double *pOutPolyR = pSPOut->get();
2207 double *pOutPolyI = pSPOut->getImg();
2209 pOutPolyR[0] += pInDblR[0];
2210 pOutPolyI[0] = pInDblI[0];
2215 for (int i = 0 ; i < iSize ; i++)
2217 SinglePoly *pSPOut = pOut->get(i);
2218 double *pOutPolyR = pSPOut->get();
2220 pOutPolyR[0] += pInDblR[0];
2227 int iDims1 = _pR->getDims();
2228 int iDims2 = _pL->getDims();
2230 if (iDims1 != iDims2)
2233 os_swprintf(pMsg, bsiz, _W("Error: operator %ls: Matrix dimensions must agree (op1 is %ls, op2 is %ls).\n").c_str(), L"+", _pL->DimToString().c_str(), _pR->DimToString().c_str());
2234 throw ast::ScilabError(pMsg);
2237 int* piDims1 = _pR->getDimsArray();
2238 int* piDims2 = _pL->getDimsArray();
2240 for (int i = 0 ; i < iDims1 ; i++)
2242 if (piDims1[i] != piDims2[i])
2245 os_swprintf(pMsg, bsiz, _W("Error: operator %ls: Matrix dimensions must agree (op1 is %ls, op2 is %ls).\n").c_str(), L"+", _pL->DimToString().c_str(), _pR->DimToString().c_str());
2246 throw ast::ScilabError(pMsg);
2252 pOut = (Polynom*)opposite_MC<Polynom, Polynom>(_pR);
2256 pOut = (Polynom*)opposite_M<Polynom, Polynom>(_pR);
2259 if (bComplex1 && bComplex2)
2261 for (int i = 0 ; i < pOut->getSize() ; i++)
2263 SinglePoly *pSPOut = pOut->get(i);
2264 double *pOutPolyR = pSPOut->get();
2265 double *pOutPolyI = pSPOut->getImg();
2267 pOutPolyR[0] += pInDblR[i];
2268 pOutPolyI[0] += pInDblI[i];
2273 pOut->setComplex(true);
2274 for (int i = 0 ; i < pOut->getSize() ; i++)
2276 SinglePoly *pSPOut = pOut->get(i);
2277 double *pOutPolyR = pSPOut->get();
2278 double *pOutPolyI = pSPOut->getImg();
2280 pOutPolyR[0] += pInDblR[i];
2281 pOutPolyI[0] = pInDblI[i];
2286 for (int i = 0 ; i < pOut->getSize() ; i++)
2288 SinglePoly *pSPOut = pOut->get(i);
2289 double *pOutPolyR = pSPOut->get();
2291 pOutPolyR[0] += pInDblR[i];
2299 template<> InternalType* sub_M_M<Sparse, Sparse, Sparse>(Sparse* _pL, Sparse* _pR)
2301 Sparse* pOut = NULL;
2302 //check scalar hidden in a sparse ;)
2303 if (_pL->getRows() == 1 && _pL->getCols() == 1)
2306 Double* pDbl = NULL;
2307 if (_pL->isComplex())
2309 std::complex<double> dbl = _pL->getImg(0, 0);
2310 pDbl = new Double(dbl.real(), dbl.imag());
2314 pDbl = new Double(_pL->get(0, 0));
2317 //AddSparseToDouble(_pR, pDbl, (GenericType**)pOut);
2322 if (_pR->getRows() == 1 && _pR->getCols() == 1)
2325 Double* pDbl = NULL;
2326 if (_pR->isComplex())
2328 std::complex<double> dbl = _pR->getImg(0, 0);
2329 pDbl = new Double(dbl.real(), dbl.imag());
2333 pDbl = new Double(_pR->get(0, 0));
2336 //AddSparseToDouble(_pL, pDbl, (GenericType**)pOut);
2341 if (_pL->getRows() != _pR->getRows() || _pL->getCols() != _pR->getCols())
2343 //dimensions not match
2344 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
2347 if (_pL->nonZeros() == 0)
2353 if (_pR->nonZeros() == 0)
2359 return _pL->substract(*_pR);
2363 template<> InternalType* sub_M_M<Double, Sparse, Double>(Double* _pL, Sparse* _pR)
2365 Double* pOut = NULL;
2366 int iOne = 1; //fortran
2367 bool bComplex1 = _pL->isComplex();
2368 bool bComplex2 = _pR->isComplex();
2370 if (_pL->isScalar() && _pR->isScalar())
2373 pOut = (Double*)_pL->clone();
2374 pOut->setComplex(bComplex1 | bComplex2);
2377 std::complex<double> dbl = _pR->getImg(0, 0);
2378 pOut->set(0, dbl.real() - pOut->get(0));
2379 pOut->setImg(0, pOut->getImg(0) - dbl.imag());
2383 pOut->set(0, pOut->get(0) - _pL->get(0, 0));
2389 if (_pL->isScalar())
2392 pOut = new Double(_pR->getRows(), _pR->getCols(), bComplex1 | bComplex2);
2393 int iSize = _pR->getSize();
2394 double dblVal = _pL->get(0);
2396 C2F(dset)(&iSize, &dblVal, pOut->get(), &iOne);
2399 //initialize imag part at 0
2400 dblValI = _pL->getImg(0);
2401 C2F(dset)(&iSize, &dblValI, pOut->getImg(), &iOne);
2406 C2F(dset)(&iSize, &dblValI, pOut->getImg(), &iOne);
2409 int nonZeros = static_cast<int>(_pR->nonZeros());
2410 int* pRows = new int[nonZeros * 2];
2411 _pR->outputRowCol(pRows);
2412 int* pCols = pRows + nonZeros;
2414 if (pOut->isComplex())
2416 for (int i = 0 ; i < nonZeros ; i++)
2418 int iRow = static_cast<int>(pRows[i]) - 1;
2419 int iCol = static_cast<int>(pCols[i]) - 1;
2420 std::complex<double> dbl = _pR->getImg(iRow, iCol);
2421 pOut->set(iRow, iCol, dblVal - dbl.real());
2422 pOut->setImg(iRow, iCol, dblValI - dbl.imag());
2427 for (int i = 0 ; i < nonZeros ; i++)
2429 int iRow = static_cast<int>(pRows[i]) - 1;
2430 int iCol = static_cast<int>(pCols[i]) - 1;
2431 pOut->set(iRow, iCol, dblVal - _pR->get(iRow, iCol));
2441 if (_pL->isScalar())
2444 pOut = (Double*)_pR->clone();
2445 pOut->setComplex(bComplex1 | bComplex2);
2447 if (pOut->isComplex())
2449 double* pReal = pOut->get();
2450 double* pImg = pOut->getImg();
2451 int size = pOut->getSize();
2452 for (int i = 0 ; i < size ; i++)
2454 std::complex<double> dbl = _pR->getImg(0, 0);
2455 pReal[i] -= dbl.real();
2456 pImg[i] -= dbl.imag();
2461 double* pReal = pOut->get();
2462 int size = pOut->getSize();
2463 for (int i = 0 ; i < size ; i++)
2465 pReal[i] -= pReal[i];
2473 if (_pL->getRows() == _pR->getRows() && _pL->getCols() == _pR->getCols())
2476 pOut = (Double*)_pL->clone();
2477 pOut->setComplex(bComplex1 | bComplex2);
2479 int nonZeros = static_cast<int>(_pR->nonZeros());
2480 int* pRows = new int[nonZeros * 2];
2481 _pR->outputRowCol(pRows);
2482 int* pCols = pRows + nonZeros;
2486 for (int i = 0 ; i < nonZeros ; i++)
2488 int iRow = static_cast<int>(pRows[i]) - 1;
2489 int iCol = static_cast<int>(pCols[i]) - 1;
2490 std::complex<double> dbl = _pR->getImg(iRow, iCol);
2491 pOut->set(iRow, iCol, pOut->get(iRow, iCol) - dbl.real());
2492 pOut->setImg(iRow, iCol, pOut->getImg(iRow, iCol) - dbl.imag());
2497 for (int i = 0 ; i < nonZeros ; i++)
2499 int iRow = static_cast<int>(pRows[i]) - 1;
2500 int iCol = static_cast<int>(pCols[i]) - 1;
2501 pOut->set(iRow, iCol, pOut->get(iRow, iCol) - _pR->get(iRow, iCol));
2511 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
2516 template<> InternalType* sub_M_M<Sparse, Double, Double>(Sparse* _pL, Double* _pR)
2518 Double* pOut = NULL;
2519 int iOne = 1; //fortran
2520 bool bComplex1 = _pL->isComplex();
2521 bool bComplex2 = _pR->isComplex();
2523 if (_pL->isScalar() && _pR->isScalar())
2526 pOut = (Double*)_pR->clone();
2527 pOut->setComplex(bComplex1 | bComplex2);
2530 std::complex<double> dbl = _pL->getImg(0, 0);
2531 pOut->set(0, pOut->get(0) - dbl.real());
2532 pOut->setImg(0, dbl.imag() - pOut->getImg(0));
2536 pOut->set(0, _pL->get(0, 0) - pOut->get(0));
2542 if (_pR->isScalar())
2545 pOut = new Double(_pL->getRows(), _pL->getCols(), bComplex1 | bComplex2);
2546 int iSize = _pL->getSize();
2547 double dblVal = -_pR->get(0);
2549 C2F(dset)(&iSize, &dblVal, pOut->get(), &iOne);
2552 dblValI = -_pR->getImg(0);
2553 C2F(dset)(&iSize, &dblValI, pOut->getImg(), &iOne);
2557 //initialize imag part at 0
2559 C2F(dset)(&iSize, &dblValI, pOut->getImg(), &iOne);
2562 int nonZeros = static_cast<int>(_pL->nonZeros());
2563 int* pRows = new int[nonZeros * 2];
2564 _pL->outputRowCol(pRows);
2565 int* pCols = pRows + nonZeros;
2569 for (int i = 0 ; i < nonZeros ; i++)
2571 int iRow = static_cast<int>(pRows[i]) - 1;
2572 int iCol = static_cast<int>(pCols[i]) - 1;
2573 std::complex<double> dbl = _pL->getImg(iRow, iCol);
2574 pOut->set(iRow, iCol, dbl.real() - (-dblVal));
2575 pOut->setImg(iRow, iCol, dbl.imag() - (-dblValI));
2580 for (int i = 0 ; i < nonZeros ; i++)
2582 int iRow = static_cast<int>(pRows[i]) - 1;
2583 int iCol = static_cast<int>(pCols[i]) - 1;
2584 pOut->set(iRow, iCol, _pL->get(iRow, iCol) - (-dblVal));
2594 if (_pL->isScalar())
2597 pOut = (Double*)_pR->clone();
2598 pOut->setComplex(bComplex1 | bComplex2);
2602 double* pReal = pOut->get();
2603 double* pImg = pOut->getImg();
2604 int size = pOut->getSize();
2605 for (int i = 0 ; i < size ; i++)
2607 std::complex<double> dbl = _pL->getImg(0, 0);
2608 pReal[i] = dbl.real() - pReal[i];
2609 pImg[i] = dbl.imag() - pImg[i];
2614 double* pReal = pOut->get();
2615 int size = pOut->getSize();
2616 for (int i = 0 ; i < size ; i++)
2618 pReal[i] = _pL->get(0, 0) - pReal[i];
2626 if (_pL->getRows() == _pR->getRows() && _pL->getCols() == _pR->getCols())
2629 pOut = (Double*)_pR->clone();
2630 pOut->setComplex(bComplex1 | bComplex2);
2632 int nonZeros = static_cast<int>(_pL->nonZeros());
2633 int* pRows = new int[nonZeros * 2];
2634 _pL->outputRowCol(pRows);
2635 int* pCols = pRows + nonZeros;
2639 for (int i = 0 ; i < nonZeros ; i++)
2641 int iRow = static_cast<int>(pRows[i]) - 1;
2642 int iCol = static_cast<int>(pCols[i]) - 1;
2643 std::complex<double> dbl = _pL->getImg(iRow, iCol);
2644 pOut->set(iRow, iCol, dbl.real() - pOut->get(iRow, iCol));
2645 pOut->setImg(iRow, iCol, dbl.imag() - pOut->getImg(iRow, iCol));
2650 for (int i = 0 ; i < nonZeros ; i++)
2652 int iRow = static_cast<int>(pRows[i]) - 1;
2653 int iCol = static_cast<int>(pCols[i]) - 1;
2654 pOut->set(iRow, iCol, _pL->get(iRow, iCol) - pOut->get(iRow, iCol));
2664 throw ast::ScilabError(_W("Inconsistent row/column dimensions.\n"));
2669 template<> InternalType* sub_M_M<Double, Sparse, Sparse>(Double* _pL, Sparse* _pR)
2671 return sub_M_M<Sparse, Double, Sparse>(_pR, _pL);
2675 template<> InternalType* sub_M_M<Sparse, Double, Sparse>(Sparse* _pL, Double* _pR)
2677 Sparse* pOut = NULL;
2678 if (_pR->isIdentity())
2681 Sparse* pS = new Sparse(_pL->getRows(), _pL->getCols(), _pR->isComplex());
2682 if (pS->isComplex())
2684 int size = std::min(_pL->getRows(), _pL->getCols());
2685 for (int i = 0 ; i < size ; i++)
2687 pS->set(i, i, std::complex<double>(_pR->get(0), _pR->getImg(0)));
2692 int size = std::min(_pL->getRows(), _pL->getCols());
2693 for (int i = 0 ; i < size ; i++)
2695 pS->set(i, i, _pR->get(0));
2699 //AddSparseToSparse(_pL, pS, (Sparse**)pOut);