File Coverage

lib/PDL/Ops.xs
Criterion Covered Total %
statement 213 264 80.6
branch 704 1560 45.1
condition n/a
subroutine n/a
pod n/a
total 917 1824 50.2


line stmt bran cond sub pod time code
1              
2             #line 453 "lib/PDL/PP.pm"
3             /*
4             * THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/Ops.pd! Do not modify!
5             */
6              
7             #define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \
8             if (destroy) { \
9             comp_free_code \
10             } \
11             if ((trans)->dims_redone) { \
12             ntpriv_free_code \
13             }
14              
15             #include "EXTERN.h"
16             #include "perl.h"
17             #include "XSUB.h"
18             #include "pdl.h"
19             #include "pdlcore.h"
20             #define PDL PDL_Ops
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/Ops.xs"
23              
24             #include
25              
26             #define MOD(X,N) (((N) == 0) ? 0 : ( (X) - (PDL_ABS(N)) * ((long long)((X)/(PDL_ABS(N))) + ( ( ((N) * ((long long)((X)/(N)))) != (X) ) ? ( ( ((N)<0) ? 1 : 0 ) + ( (((X)<0) ? -1 : 0))) : 0 ))))
27             #define BU_MOD(X,N)(((N) == 0) ? 0 : ( (X)-(N)*((uint64_t)((X)/(N))) ))
28             #define SPACE(A,B) ( ((A)<(B)) ? -1 : ((A)!=(B)) )
29              
30             #line 83 "lib/PDL/Ops.pd"
31             #define PDL_BADVAL_WARN_X(datatype, ctype, ppsym, ...) \
32             bad_anyval.type = datatype; bad_anyval.value.ppsym = PDL->bvals.ppsym;
33             #define PDL_BADVAL_WARN(var) \
34             { \
35             PDL_Anyval bad_anyval = { PDL_INVALID, {0} }; \
36             if (!(var->has_badvalue && var->badvalue.type != var->datatype)) { \
37             if (var->has_badvalue) \
38             bad_anyval = var->badvalue; \
39             else { \
40             PDL_GENERICSWITCH(PDL_TYPELIST_ALL, var->datatype, PDL_BADVAL_WARN_X, ) \
41             } \
42             } \
43             if (bad_anyval.type < 0) \
44             barf("Error getting badvalue, type=%d", bad_anyval.type); \
45             complex double bad_c; \
46             ANYVAL_TO_CTYPE(bad_c, complex double, bad_anyval); \
47             if( bad_c == 0 || bad_c == 1 ) \
48             warn(#var " badvalue is set to 0 or 1. This will cause data loss when using badvalues for comparison operators."); \
49             }
50             #line 51 "lib/PDL/Ops.xs"
51             pdl_error pdl_run_plus(pdl *a,pdl *b,pdl *c);
52             pdl_error pdl_run_mult(pdl *a,pdl *b,pdl *c);
53             pdl_error pdl_run_minus(pdl *a,pdl *b,pdl *c);
54             pdl_error pdl_run_divide(pdl *a,pdl *b,pdl *c);
55             pdl_error pdl_run_gt(pdl *a,pdl *b,pdl *c);
56             pdl_error pdl_run_lt(pdl *a,pdl *b,pdl *c);
57             pdl_error pdl_run_le(pdl *a,pdl *b,pdl *c);
58             pdl_error pdl_run_ge(pdl *a,pdl *b,pdl *c);
59             pdl_error pdl_run_eq(pdl *a,pdl *b,pdl *c);
60             pdl_error pdl_run_ne(pdl *a,pdl *b,pdl *c);
61             pdl_error pdl_run_shiftleft(pdl *a,pdl *b,pdl *c);
62             pdl_error pdl_run_shiftright(pdl *a,pdl *b,pdl *c);
63             pdl_error pdl_run_or2(pdl *a,pdl *b,pdl *c);
64             pdl_error pdl_run_and2(pdl *a,pdl *b,pdl *c);
65             pdl_error pdl_run_xor(pdl *a,pdl *b,pdl *c);
66             pdl_error pdl_run_power(pdl *a,pdl *b,pdl *c);
67             pdl_error pdl_run_atan2(pdl *a,pdl *b,pdl *c);
68             pdl_error pdl_run_modulo(pdl *a,pdl *b,pdl *c);
69             pdl_error pdl_run_spaceship(pdl *a,pdl *b,pdl *c);
70             pdl_error pdl_run_bitnot(pdl *a,pdl *b);
71             pdl_error pdl_run_sqrt(pdl *a,pdl *b);
72             pdl_error pdl_run_sin(pdl *a,pdl *b);
73             pdl_error pdl_run_cos(pdl *a,pdl *b);
74             pdl_error pdl_run_not(pdl *a,pdl *b);
75             pdl_error pdl_run_exp(pdl *a,pdl *b);
76             pdl_error pdl_run_log(pdl *a,pdl *b);
77             pdl_error pdl_run_re(pdl *complexv,pdl *b);
78             pdl_error pdl_run_im(pdl *complexv,pdl *b);
79             pdl_error pdl_run__cabs(pdl *complexv,pdl *b);
80             pdl_error pdl_run__rabs(pdl *a,pdl *b);
81             pdl_error pdl_run_log10(pdl *a,pdl *b);
82             pdl_error pdl_run_assgn(pdl *a,pdl *b);
83             pdl_error pdl_run_carg(pdl *complexv,pdl *b);
84             pdl_error pdl_run_conj(pdl *complexv,pdl *b);
85             pdl_error pdl_run_czip(pdl *r,pdl *i,pdl *c);
86             pdl_error pdl_run_ipow(pdl *a,pdl *b,pdl *ans);
87             pdl_error pdl_run_abs2(pdl *a,pdl *b);
88             pdl_error pdl_run_r2C(pdl *r,pdl *c);
89             pdl_error pdl_run_i2C(pdl *i,pdl *c);
90              
91             #line 449 "lib/PDL/PP.pm"
92             #include "pdlperl.h"
93             #line 94 "lib/PDL/Ops.xs"
94              
95             Core* PDL = NULL; /* Structure hold core C functions */
96              
97             MODULE = PDL::Ops PACKAGE = PDL PREFIX=pdl_run_
98              
99             PROTOTYPES: DISABLE
100              
101              
102             void
103             pdl_run_plus(a, b, c=c, swap=swap)
104             SV *c_SV = (items == 4) ? ST(2) : NULL;
105             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
106             PREINIT:
107 751 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
108             INPUT:
109             pdl *a
110             pdl *b
111             pdl *c=NO_INIT
112             int swap=NO_INIT
113             PPCODE:
114 751 100         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
115 751 100         if (swap) {
116 89           pdl *tmp = a;
117 89           a = b;
118 89           b = tmp;
119             }
120 751 100         PDL_XS_INPLACE(a, c)
    50          
    100          
    50          
121 751           PDL->barf_if_error(pdl_run_plus(a,b,c));
122 749 100         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    50          
123              
124             void
125             pdl_run_mult(a, b, c=c, swap=swap)
126             SV *c_SV = (items == 4) ? ST(2) : NULL;
127             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
128             PREINIT:
129 1201 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
130             INPUT:
131             pdl *a
132             pdl *b
133             pdl *c=NO_INIT
134             int swap=NO_INIT
135             PPCODE:
136 1201 100         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
137 1201 100         if (swap) {
138 301           pdl *tmp = a;
139 301           a = b;
140 301           b = tmp;
141             }
142 1201 100         PDL_XS_INPLACE(a, c)
    50          
    50          
    50          
143 1201           PDL->barf_if_error(pdl_run_mult(a,b,c));
144 1201 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
145              
146             void
147             pdl_run_minus(a, b, c=c, swap=swap)
148             SV *c_SV = (items == 4) ? ST(2) : NULL;
149             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
150             PREINIT:
151 718 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
152             INPUT:
153             pdl *a
154             pdl *b
155             pdl *c=NO_INIT
156             int swap=NO_INIT
157             PPCODE:
158 718 100         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
159 718 100         if (swap) {
160 90           pdl *tmp = a;
161 90           a = b;
162 90           b = tmp;
163             }
164 718 100         PDL_XS_INPLACE(a, c)
    50          
    100          
    50          
165 718           PDL->barf_if_error(pdl_run_minus(a,b,c));
166 718 100         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    50          
167              
168             void
169             pdl_run_divide(a, b, c=c, swap=swap)
170             SV *c_SV = (items == 4) ? ST(2) : NULL;
171             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
172             PREINIT:
173 444 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
174             INPUT:
175             pdl *a
176             pdl *b
177             pdl *c=NO_INIT
178             int swap=NO_INIT
179             PPCODE:
180 444 100         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
181 444 100         if (swap) {
182 12           pdl *tmp = a;
183 12           a = b;
184 12           b = tmp;
185             }
186 444 100         PDL_XS_INPLACE(a, c)
    50          
    50          
    50          
187 444           PDL->barf_if_error(pdl_run_divide(a,b,c));
188 444 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
189              
190             void
191             pdl_run_gt(a, b, c=c, swap=swap)
192             SV *c_SV = (items == 4) ? ST(2) : NULL;
193             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
194             PREINIT:
195 365 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
196             INPUT:
197             pdl *a
198             pdl *b
199             pdl *c=NO_INIT
200             int swap=NO_INIT
201             PPCODE:
202 365 50         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
203 365 50         if (swap) {
204 0           pdl *tmp = a;
205 0           a = b;
206 0           b = tmp;
207             }
208 365 100         if ((a->datatype >= PDL_CF) || (b->datatype >= PDL_CF))
    50          
209 1           barf("Can't compare complex numbers");
210 364 100         PDL_BADVAL_WARN(a)
    50          
    100          
    50          
    100          
    100          
211 363 50         PDL_BADVAL_WARN(b)
    0          
    50          
    50          
    50          
    50          
212 363 50         PDL_XS_INPLACE(a, c)
    0          
    50          
    50          
213 363           PDL->barf_if_error(pdl_run_gt(a,b,c));
214 363 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
215              
216             void
217             pdl_run_lt(a, b, c=c, swap=swap)
218             SV *c_SV = (items == 4) ? ST(2) : NULL;
219             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
220             PREINIT:
221 294 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
222             INPUT:
223             pdl *a
224             pdl *b
225             pdl *c=NO_INIT
226             int swap=NO_INIT
227             PPCODE:
228 294 50         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
229 294 50         if (swap) {
230 0           pdl *tmp = a;
231 0           a = b;
232 0           b = tmp;
233             }
234 294 100         if ((a->datatype >= PDL_CF) || (b->datatype >= PDL_CF))
    50          
235 1           barf("Can't compare complex numbers");
236 293 100         PDL_BADVAL_WARN(a)
    50          
    100          
    50          
    100          
    50          
237 293 50         PDL_BADVAL_WARN(b)
    0          
    50          
    50          
    50          
    50          
238 293 50         PDL_XS_INPLACE(a, c)
    0          
    50          
    50          
239 293           PDL->barf_if_error(pdl_run_lt(a,b,c));
240 293 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
241              
242             void
243             pdl_run_le(a, b, c=c, swap=swap)
244             SV *c_SV = (items == 4) ? ST(2) : NULL;
245             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
246             PREINIT:
247 21 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
248             INPUT:
249             pdl *a
250             pdl *b
251             pdl *c=NO_INIT
252             int swap=NO_INIT
253             PPCODE:
254 21 50         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
255 21 50         if (swap) {
256 0           pdl *tmp = a;
257 0           a = b;
258 0           b = tmp;
259             }
260 21 100         if ((a->datatype >= PDL_CF) || (b->datatype >= PDL_CF))
    50          
261 1           barf("Can't compare complex numbers");
262 20 100         PDL_BADVAL_WARN(a)
    50          
    100          
    50          
    100          
    50          
263 20 50         PDL_BADVAL_WARN(b)
    0          
    50          
    50          
    50          
    50          
264 20 50         PDL_XS_INPLACE(a, c)
    0          
    50          
    50          
265 20           PDL->barf_if_error(pdl_run_le(a,b,c));
266 20 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
267              
268             void
269             pdl_run_ge(a, b, c=c, swap=swap)
270             SV *c_SV = (items == 4) ? ST(2) : NULL;
271             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
272             PREINIT:
273 16 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
274             INPUT:
275             pdl *a
276             pdl *b
277             pdl *c=NO_INIT
278             int swap=NO_INIT
279             PPCODE:
280 16 50         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
281 16 100         if (swap) {
282 9           pdl *tmp = a;
283 9           a = b;
284 9           b = tmp;
285             }
286 16 100         if ((a->datatype >= PDL_CF) || (b->datatype >= PDL_CF))
    50          
287 1           barf("Can't compare complex numbers");
288 15 100         PDL_BADVAL_WARN(a)
    50          
    100          
    50          
    100          
    50          
289 15 50         PDL_BADVAL_WARN(b)
    0          
    50          
    50          
    50          
    50          
290 15 50         PDL_XS_INPLACE(a, c)
    0          
    50          
    50          
291 15           PDL->barf_if_error(pdl_run_ge(a,b,c));
292 15 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
293              
294             void
295             pdl_run_eq(a, b, c=c, swap=swap)
296             SV *c_SV = (items == 4) ? ST(2) : NULL;
297             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
298             PREINIT:
299 655 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
300             INPUT:
301             pdl *a
302             pdl *b
303             pdl *c=NO_INIT
304             int swap=NO_INIT
305             PPCODE:
306 655 50         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
307 655 100         if (swap) {
308 14           pdl *tmp = a;
309 14           a = b;
310 14           b = tmp;
311             }
312 655 100         PDL_BADVAL_WARN(a)
    50          
    100          
    50          
    100          
    100          
313 655 50         PDL_BADVAL_WARN(b)
    0          
    50          
    50          
    50          
    50          
314 655 50         PDL_XS_INPLACE(a, c)
    0          
    50          
    50          
315 655           PDL->barf_if_error(pdl_run_eq(a,b,c));
316 655 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
317              
318             void
319             pdl_run_ne(a, b, c=c, swap=swap)
320             SV *c_SV = (items == 4) ? ST(2) : NULL;
321             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
322             PREINIT:
323 206 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
324             INPUT:
325             pdl *a
326             pdl *b
327             pdl *c=NO_INIT
328             int swap=NO_INIT
329             PPCODE:
330 205 50         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
331 205 100         if (swap) {
332 10           pdl *tmp = a;
333 10           a = b;
334 10           b = tmp;
335             }
336 205 100         PDL_BADVAL_WARN(a)
    50          
    100          
    50          
    100          
    50          
337 205 50         PDL_BADVAL_WARN(b)
    0          
    50          
    50          
    50          
    50          
338 205 50         PDL_XS_INPLACE(a, c)
    0          
    50          
    50          
339 205           PDL->barf_if_error(pdl_run_ne(a,b,c));
340 205 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
341              
342             void
343             pdl_run_shiftleft(a, b, c=c, swap=swap)
344             SV *c_SV = (items == 4) ? ST(2) : NULL;
345             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
346             PREINIT:
347 9 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
348             INPUT:
349             pdl *a
350             pdl *b
351             pdl *c=NO_INIT
352             int swap=NO_INIT
353             PPCODE:
354 9 50         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
355 9 50         if (swap) {
356 0           pdl *tmp = a;
357 0           a = b;
358 0           b = tmp;
359             }
360 9 50         PDL_XS_INPLACE(a, c)
    0          
    50          
    50          
361 9           PDL->barf_if_error(pdl_run_shiftleft(a,b,c));
362 9 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
363              
364             void
365             pdl_run_shiftright(a, b, c=c, swap=swap)
366             SV *c_SV = (items == 4) ? ST(2) : NULL;
367             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
368             PREINIT:
369 0 0         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
370             INPUT:
371             pdl *a
372             pdl *b
373             pdl *c=NO_INIT
374             int swap=NO_INIT
375             PPCODE:
376 0 0         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
377 0 0         if (swap) {
378 0           pdl *tmp = a;
379 0           a = b;
380 0           b = tmp;
381             }
382 0 0         PDL_XS_INPLACE(a, c)
    0          
    0          
    0          
383 0           PDL->barf_if_error(pdl_run_shiftright(a,b,c));
384 0 0         PDL_XS_RETURN(ST(0) = c_SV)
    0          
    0          
    0          
    0          
385              
386             void
387             pdl_run_or2(a, b, c=c, swap=swap)
388             SV *c_SV = (items == 4) ? ST(2) : NULL;
389             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
390             PREINIT:
391 69 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
392             INPUT:
393             pdl *a
394             pdl *b
395             pdl *c=NO_INIT
396             int swap=NO_INIT
397             PPCODE:
398 69 50         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
399 69 50         if (swap) {
400 0           pdl *tmp = a;
401 0           a = b;
402 0           b = tmp;
403             }
404 69 100         PDL_XS_INPLACE(a, c)
    50          
    50          
    50          
405 69           PDL->barf_if_error(pdl_run_or2(a,b,c));
406 69 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
407              
408             void
409             pdl_run_and2(a, b, c=c, swap=swap)
410             SV *c_SV = (items == 4) ? ST(2) : NULL;
411             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
412             PREINIT:
413 44 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
414             INPUT:
415             pdl *a
416             pdl *b
417             pdl *c=NO_INIT
418             int swap=NO_INIT
419             PPCODE:
420 44 50         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
421 44 50         if (swap) {
422 0           pdl *tmp = a;
423 0           a = b;
424 0           b = tmp;
425             }
426 44 100         PDL_XS_INPLACE(a, c)
    50          
    50          
    50          
427 44           PDL->barf_if_error(pdl_run_and2(a,b,c));
428 44 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
429              
430             void
431             pdl_run_xor(a, b, c=c, swap=swap)
432             SV *c_SV = (items == 4) ? ST(2) : NULL;
433             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
434             PREINIT:
435 4 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
436             INPUT:
437             pdl *a
438             pdl *b
439             pdl *c=NO_INIT
440             int swap=NO_INIT
441             PPCODE:
442 4 100         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
443 4 50         if (swap) {
444 0           pdl *tmp = a;
445 0           a = b;
446 0           b = tmp;
447             }
448 4 50         PDL_XS_INPLACE(a, c)
    0          
    100          
    50          
449 4           PDL->barf_if_error(pdl_run_xor(a,b,c));
450 4 100         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    50          
451              
452             void
453             pdl_run_power(a, b, c=c, swap=swap)
454             SV *c_SV = (items == 4) ? ST(2) : NULL;
455             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
456             PREINIT:
457 80 100         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
458             INPUT:
459             pdl *a
460             pdl *b
461             pdl *c=NO_INIT
462             int swap=NO_INIT
463             PPCODE:
464 80 100         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
465 80 50         if (swap) {
466 0           pdl *tmp = a;
467 0           a = b;
468 0           b = tmp;
469             }
470 80 100         PDL_XS_INPLACE(a, c)
    50          
    50          
    100          
471 80           PDL->barf_if_error(pdl_run_power(a,b,c));
472 80 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
473              
474             void
475             pdl_run_atan2(a, b, c=c, swap=swap)
476             SV *c_SV = (items == 4) ? ST(2) : NULL;
477             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
478             PREINIT:
479 8 100         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
480             INPUT:
481             pdl *a
482             pdl *b
483             pdl *c=NO_INIT
484             int swap=NO_INIT
485             PPCODE:
486 8 100         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
487 8 50         if (swap) {
488 0           pdl *tmp = a;
489 0           a = b;
490 0           b = tmp;
491             }
492 8 50         PDL_XS_INPLACE(a, c)
    0          
    50          
    100          
493 8           PDL->barf_if_error(pdl_run_atan2(a,b,c));
494 8 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
495              
496             void
497             pdl_run_modulo(a, b, c=c, swap=swap)
498             SV *c_SV = (items == 4) ? ST(2) : NULL;
499             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
500             PREINIT:
501 115 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
502             INPUT:
503             pdl *a
504             pdl *b
505             pdl *c=NO_INIT
506             int swap=NO_INIT
507             PPCODE:
508 115 100         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
509 115 50         if (swap) {
510 0           pdl *tmp = a;
511 0           a = b;
512 0           b = tmp;
513             }
514 115 100         PDL_XS_INPLACE(a, c)
    50          
    50          
    50          
515 115           PDL->barf_if_error(pdl_run_modulo(a,b,c));
516 115 50         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    0          
517              
518             void
519             pdl_run_spaceship(a, b, c=c, swap=swap)
520             SV *c_SV = (items == 4) ? ST(2) : NULL;
521             SV *swap_SV = (items == 4) ? ST(3) : !(items == (3-1)) ? ST(2) : NULL;
522             PREINIT:
523 0 0         PDL_XS_PREAMBLE((items == 4) ? 0 : 1);
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
524             INPUT:
525             pdl *a
526             pdl *b
527             pdl *c=NO_INIT
528             int swap=NO_INIT
529             PPCODE:
530 0 0         if (!swap_SV) { swap = (0); } else { swap = (int)SvIV(swap_SV); }
531 0 0         if (swap) {
532 0           pdl *tmp = a;
533 0           a = b;
534 0           b = tmp;
535             }
536 0 0         PDL_XS_INPLACE(a, c)
    0          
    0          
    0          
537 0           PDL->barf_if_error(pdl_run_spaceship(a,b,c));
538 0 0         PDL_XS_RETURN(ST(0) = c_SV)
    0          
    0          
    0          
    0          
539              
540             void
541             pdl_run_bitnot(a, b=b)
542             SV *b_SV = items > 1 ? ST(1) : NULL;
543             PREINIT:
544 5 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
545             INPUT:
546             pdl *a
547             pdl *b=NO_INIT
548             PPCODE:
549 5 50         PDL_XS_INPLACE(a, b)
    0          
    50          
    50          
550 5           PDL->barf_if_error(pdl_run_bitnot(a,b));
551 5 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
552              
553             void
554             pdl_run_sqrt(a, b=b)
555             SV *b_SV = items > 1 ? ST(1) : NULL;
556             PREINIT:
557 39 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
558             INPUT:
559             pdl *a
560             pdl *b=NO_INIT
561             PPCODE:
562 39 100         PDL_XS_INPLACE(a, b)
    50          
    50          
    50          
563 39           PDL->barf_if_error(pdl_run_sqrt(a,b));
564 39 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
565              
566             void
567             pdl_run_sin(a, b=b)
568             SV *b_SV = items > 1 ? ST(1) : NULL;
569             PREINIT:
570 37 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
571             INPUT:
572             pdl *a
573             pdl *b=NO_INIT
574             PPCODE:
575 37 50         PDL_XS_INPLACE(a, b)
    0          
    50          
    50          
576 37           PDL->barf_if_error(pdl_run_sin(a,b));
577 37 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
578              
579             void
580             pdl_run_cos(a, b=b)
581             SV *b_SV = items > 1 ? ST(1) : NULL;
582             PREINIT:
583 43 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
584             INPUT:
585             pdl *a
586             pdl *b=NO_INIT
587             PPCODE:
588 43 50         PDL_XS_INPLACE(a, b)
    0          
    50          
    50          
589 43           PDL->barf_if_error(pdl_run_cos(a,b));
590 43 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
591              
592             void
593             pdl_run_not(a, b=b)
594             SV *b_SV = items > 1 ? ST(1) : NULL;
595             PREINIT:
596 159 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
597             INPUT:
598             pdl *a
599             pdl *b=NO_INIT
600             PPCODE:
601 159 50         PDL_XS_INPLACE(a, b)
    0          
    50          
    50          
602 159           PDL->barf_if_error(pdl_run_not(a,b));
603 159 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
604              
605             void
606             pdl_run_exp(a, b=b)
607             SV *b_SV = items > 1 ? ST(1) : NULL;
608             PREINIT:
609 28 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
610             INPUT:
611             pdl *a
612             pdl *b=NO_INIT
613             PPCODE:
614 28 50         PDL_XS_INPLACE(a, b)
    0          
    50          
    50          
615 28           PDL->barf_if_error(pdl_run_exp(a,b));
616 28 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
617              
618             void
619             pdl_run_log(a, b=b)
620             SV *b_SV = items > 1 ? ST(1) : NULL;
621             PREINIT:
622 9 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
623             INPUT:
624             pdl *a
625             pdl *b=NO_INIT
626             PPCODE:
627 9 100         PDL_XS_INPLACE(a, b)
    50          
    50          
    50          
628 9           PDL->barf_if_error(pdl_run_log(a,b));
629 9 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
630              
631             void
632             pdl_run_re(complexv, b=PDL_XS_PERLINIT_initsv(b_SV))
633             SV *b_SV = items > 1 ? ST(1) : NULL;
634             PREINIT:
635 45 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
636             INPUT:
637             pdl *complexv
638             pdl *b
639             PPCODE:
640 45           PDL->barf_if_error(pdl_run_re(complexv,b));
641 45 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
642              
643             void
644             pdl_run_im(complexv, b=PDL_XS_PERLINIT_initsv(b_SV))
645             SV *b_SV = items > 1 ? ST(1) : NULL;
646             PREINIT:
647 37 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
648             INPUT:
649             pdl *complexv
650             pdl *b
651             PPCODE:
652 37           PDL->barf_if_error(pdl_run_im(complexv,b));
653 37 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
654              
655             void
656             pdl_run__cabs(complexv, b=PDL_XS_PERLINIT_initsv(b_SV))
657             SV *b_SV = items > 1 ? ST(1) : NULL;
658             PREINIT:
659 6 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
660             INPUT:
661             pdl *complexv
662             pdl *b
663             PPCODE:
664 6           PDL->barf_if_error(pdl_run__cabs(complexv,b));
665 6 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
666              
667             void
668             pdl_run__rabs(a, b=b)
669             SV *b_SV = items > 1 ? ST(1) : NULL;
670             PREINIT:
671 262 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    100          
    50          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
672             INPUT:
673             pdl *a
674             pdl *b=NO_INIT
675             PPCODE:
676 262 50         PDL_XS_INPLACE(a, b)
    0          
    50          
    50          
677 262           PDL->barf_if_error(pdl_run__rabs(a,b));
678 262 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
679              
680             void
681             _log10_int(a,b)
682             pdl *a
683             pdl *b
684             CODE:
685 11           PDL->barf_if_error(pdl_run_log10(a,b));
686              
687             void
688             pdl_run_assgn(a, b=PDL_XS_PERLINIT_initsv(b_SV))
689             SV *b_SV = items > 1 ? ST(1) : NULL;
690             PREINIT:
691 5542 100         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
692             INPUT:
693             pdl *a
694             pdl *b
695             PPCODE:
696 5542           PDL->barf_if_error(pdl_run_assgn(a,b));
697 5537 100         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    50          
698              
699             void
700             pdl_run_carg(complexv, b=PDL_XS_PERLINIT_initsv(b_SV))
701             SV *b_SV = items > 1 ? ST(1) : NULL;
702             PREINIT:
703 4 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
704             INPUT:
705             pdl *complexv
706             pdl *b
707             PPCODE:
708 4           PDL->barf_if_error(pdl_run_carg(complexv,b));
709 3 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
710              
711             void
712             pdl_run_conj(complexv, b=b)
713             SV *b_SV = items > 1 ? ST(1) : NULL;
714             PREINIT:
715 2 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
716             INPUT:
717             pdl *complexv
718             pdl *b=NO_INIT
719             PPCODE:
720 2 50         PDL_XS_INPLACE(complexv, b)
    0          
    50          
    50          
721 2           PDL->barf_if_error(pdl_run_conj(complexv,b));
722 2 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
723              
724             void
725             pdl_run_czip(r, i, c=PDL_XS_PERLINIT_initsv(c_SV))
726             SV *c_SV = items > 2 ? ST(2) : NULL;
727             PREINIT:
728 47 100         PDL_XS_PREAMBLE((items == 3) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
729             INPUT:
730             pdl *r
731             pdl *i
732             pdl *c
733             PPCODE:
734 47           PDL->barf_if_error(pdl_run_czip(r,i,c));
735 46 100         PDL_XS_RETURN(ST(0) = c_SV)
    50          
    50          
    50          
    50          
736              
737             void
738             pdl_run_ipow(a, b, ans=ans)
739             SV *ans_SV = items > 2 ? ST(2) : NULL;
740             PREINIT:
741 16 50         PDL_XS_PREAMBLE((items == 3) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
742             INPUT:
743             pdl *a
744             pdl *b
745             pdl *ans=NO_INIT
746             PPCODE:
747 16 50         PDL_XS_INPLACE(a, ans)
    0          
    50          
    50          
748 16           PDL->barf_if_error(pdl_run_ipow(a,b,ans));
749 16 50         PDL_XS_RETURN(ST(0) = ans_SV)
    50          
    50          
    50          
    0          
750              
751             void
752             pdl_run_abs2(a, b=PDL_XS_PERLINIT_initsv(b_SV))
753             SV *b_SV = items > 1 ? ST(1) : NULL;
754             PREINIT:
755 2 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
756             INPUT:
757             pdl *a
758             pdl *b
759             PPCODE:
760 2           PDL->barf_if_error(pdl_run_abs2(a,b));
761 2 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
762              
763             void
764             _r2C_int(r,c)
765             pdl *r
766             pdl *c
767             CODE:
768 26           PDL->barf_if_error(pdl_run_r2C(r,c));
769              
770             void
771             _i2C_int(i,c)
772             pdl *i
773             pdl *c
774             CODE:
775 3           PDL->barf_if_error(pdl_run_i2C(i,c));
776              
777              
778             #line 483 "lib/PDL/PP.pm"
779             BOOT:
780             /* Get pointer to structure of core shared C routines */
781             /* make sure PDL::Core is loaded */
782             #line 783 "lib/PDL/Ops.xs"
783 71           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
784             #ifndef aTHX_
785             #define aTHX_
786             #endif
787 71 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    0          
788 71           SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */
789 71 50         if (!CoreSV)
790 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
791 71 50         if (!(PDL = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */
792 0           Perl_croak(aTHX_ "Got NULL pointer for PDL");
793 71 50         if (PDL->Version != PDL_CORE_VERSION)
794 0           Perl_croak(aTHX_ "[PDL->Version: %ld PDL_CORE_VERSION: %ld XS_VERSION: %s] PDL::Ops needs to be recompiled against the newly installed PDL", (long int)PDL->Version, (long int)PDL_CORE_VERSION, XS_VERSION);