File Coverage

blib/lib/PDL/Ops.pm
Criterion Covered Total %
statement 26 26 100.0
branch 10 12 83.3
condition 8 15 53.3
subroutine 6 6 100.0
pod 0 3 0.0
total 50 62 80.6


line stmt bran cond sub pod time code
1             #
2             # GENERATED WITH PDL::PP from lib/PDL/Ops.pd! Don't modify!
3             #
4             package PDL::Ops;
5              
6             our @EXPORT_OK = qw(log10 assgn carg conj czip ipow abs2 r2C i2C );
7             our %EXPORT_TAGS = (Func=>\@EXPORT_OK);
8              
9 70     70   475 use PDL::Core;
  70         153  
  70         492  
10 70     70   557 use PDL::Exporter;
  70         216  
  70         480  
11 70     70   399 use DynaLoader;
  70         137  
  70         69395  
12              
13              
14            
15             our @ISA = ( 'PDL::Exporter','DynaLoader' );
16             push @PDL::Core::PP, __PACKAGE__;
17             bootstrap PDL::Ops ;
18              
19             { package # hide from MetaCPAN
20             PDL;
21              
22             #line 1440 "lib/PDL/PP.pm"
23             {
24             my ($foo, $overload_sub);
25             use overload '+' => $overload_sub = sub {
26             Carp::confess("PDL::plus: overloaded '+' given undef")
27             if grep !defined, @_[0,1];
28             return PDL::plus(@_) unless ref $_[1]
29             && (ref $_[1] ne 'PDL')
30             && defined($foo = overload::Method($_[1], '+'))
31             && $foo != $overload_sub; # recursion guard
32             goto &$foo;
33             };
34             }
35              
36             #line 1455 "lib/PDL/PP.pm"
37             # in1, in2, out, swap if true
38             use overload '+=' => sub {
39             Carp::confess("PDL::plus: overloaded '+=' given undef")
40             if grep !defined, @_[0,1];
41             PDL::plus($_[0]->inplace, $_[1]); $_[0]
42             };
43             #line 44 "lib/PDL/Ops.pm"
44             }
45             { package # hide from MetaCPAN
46             PDL;
47              
48             #line 1440 "lib/PDL/PP.pm"
49             {
50             my ($foo, $overload_sub);
51             use overload '*' => $overload_sub = sub {
52             Carp::confess("PDL::mult: overloaded '*' given undef")
53             if grep !defined, @_[0,1];
54             return PDL::mult(@_) unless ref $_[1]
55             && (ref $_[1] ne 'PDL')
56             && defined($foo = overload::Method($_[1], '*'))
57             && $foo != $overload_sub; # recursion guard
58             goto &$foo;
59             };
60             }
61              
62             #line 1455 "lib/PDL/PP.pm"
63             # in1, in2, out, swap if true
64             use overload '*=' => sub {
65             Carp::confess("PDL::mult: overloaded '*=' given undef")
66             if grep !defined, @_[0,1];
67             PDL::mult($_[0]->inplace, $_[1]); $_[0]
68             };
69             #line 70 "lib/PDL/Ops.pm"
70             }
71             { package # hide from MetaCPAN
72             PDL;
73              
74             #line 1440 "lib/PDL/PP.pm"
75             {
76             my ($foo, $overload_sub);
77             use overload '-' => $overload_sub = sub {
78             Carp::confess("PDL::minus: overloaded '-' given undef")
79             if grep !defined, @_[0,1];
80             return PDL::minus(@_) unless ref $_[1]
81             && (ref $_[1] ne 'PDL')
82             && defined($foo = overload::Method($_[1], '-'))
83             && $foo != $overload_sub; # recursion guard
84             goto &$foo;
85             };
86             }
87              
88             #line 1455 "lib/PDL/PP.pm"
89             # in1, in2, out, swap if true
90             use overload '-=' => sub {
91             Carp::confess("PDL::minus: overloaded '-=' given undef")
92             if grep !defined, @_[0,1];
93             PDL::minus($_[0]->inplace, $_[1]); $_[0]
94             };
95             #line 96 "lib/PDL/Ops.pm"
96             }
97             { package # hide from MetaCPAN
98             PDL;
99              
100             #line 1440 "lib/PDL/PP.pm"
101             {
102             my ($foo, $overload_sub);
103             use overload '/' => $overload_sub = sub {
104             Carp::confess("PDL::divide: overloaded '/' given undef")
105             if grep !defined, @_[0,1];
106             return PDL::divide(@_) unless ref $_[1]
107             && (ref $_[1] ne 'PDL')
108             && defined($foo = overload::Method($_[1], '/'))
109             && $foo != $overload_sub; # recursion guard
110             goto &$foo;
111             };
112             }
113              
114             #line 1455 "lib/PDL/PP.pm"
115             # in1, in2, out, swap if true
116             use overload '/=' => sub {
117             Carp::confess("PDL::divide: overloaded '/=' given undef")
118             if grep !defined, @_[0,1];
119             PDL::divide($_[0]->inplace, $_[1]); $_[0]
120             };
121             #line 122 "lib/PDL/Ops.pm"
122             }
123             { package # hide from MetaCPAN
124             PDL;
125              
126             #line 1440 "lib/PDL/PP.pm"
127             {
128             my ($foo, $overload_sub);
129             use overload '>' => $overload_sub = sub {
130             Carp::confess("PDL::gt: overloaded '>' given undef")
131             if grep !defined, @_[0,1];
132             return PDL::gt(@_) unless ref $_[1]
133             && (ref $_[1] ne 'PDL')
134             && defined($foo = overload::Method($_[1], '>'))
135             && $foo != $overload_sub; # recursion guard
136             goto &$foo;
137             };
138             }
139             #line 140 "lib/PDL/Ops.pm"
140             }
141             { package # hide from MetaCPAN
142             PDL;
143              
144             #line 1440 "lib/PDL/PP.pm"
145             {
146             my ($foo, $overload_sub);
147             use overload '<' => $overload_sub = sub {
148             Carp::confess("PDL::lt: overloaded '<' given undef")
149             if grep !defined, @_[0,1];
150             return PDL::lt(@_) unless ref $_[1]
151             && (ref $_[1] ne 'PDL')
152             && defined($foo = overload::Method($_[1], '<'))
153             && $foo != $overload_sub; # recursion guard
154             goto &$foo;
155             };
156             }
157             #line 158 "lib/PDL/Ops.pm"
158             }
159             { package # hide from MetaCPAN
160             PDL;
161              
162             #line 1440 "lib/PDL/PP.pm"
163             {
164             my ($foo, $overload_sub);
165             use overload '<=' => $overload_sub = sub {
166             Carp::confess("PDL::le: overloaded '<=' given undef")
167             if grep !defined, @_[0,1];
168             return PDL::le(@_) unless ref $_[1]
169             && (ref $_[1] ne 'PDL')
170             && defined($foo = overload::Method($_[1], '<='))
171             && $foo != $overload_sub; # recursion guard
172             goto &$foo;
173             };
174             }
175             #line 176 "lib/PDL/Ops.pm"
176             }
177             { package # hide from MetaCPAN
178             PDL;
179              
180             #line 1440 "lib/PDL/PP.pm"
181             {
182             my ($foo, $overload_sub);
183             use overload '>=' => $overload_sub = sub {
184             Carp::confess("PDL::ge: overloaded '>=' given undef")
185             if grep !defined, @_[0,1];
186             return PDL::ge(@_) unless ref $_[1]
187             && (ref $_[1] ne 'PDL')
188             && defined($foo = overload::Method($_[1], '>='))
189             && $foo != $overload_sub; # recursion guard
190             goto &$foo;
191             };
192             }
193             #line 194 "lib/PDL/Ops.pm"
194             }
195             { package # hide from MetaCPAN
196             PDL;
197              
198             #line 1440 "lib/PDL/PP.pm"
199             {
200             my ($foo, $overload_sub);
201             use overload '==' => $overload_sub = sub {
202             Carp::confess("PDL::eq: overloaded '==' given undef")
203             if grep !defined, @_[0,1];
204             return PDL::eq(@_) unless ref $_[1]
205             && (ref $_[1] ne 'PDL')
206             && defined($foo = overload::Method($_[1], '=='))
207             && $foo != $overload_sub; # recursion guard
208             goto &$foo;
209             };
210             }
211             #line 212 "lib/PDL/Ops.pm"
212             }
213             { package # hide from MetaCPAN
214             PDL;
215              
216             #line 1440 "lib/PDL/PP.pm"
217             {
218             my ($foo, $overload_sub);
219             use overload '!=' => $overload_sub = sub {
220             Carp::confess("PDL::ne: overloaded '!=' given undef")
221             if grep !defined, @_[0,1];
222             return PDL::ne(@_) unless ref $_[1]
223             && (ref $_[1] ne 'PDL')
224             && defined($foo = overload::Method($_[1], '!='))
225             && $foo != $overload_sub; # recursion guard
226             goto &$foo;
227             };
228             }
229             #line 230 "lib/PDL/Ops.pm"
230             }
231             { package # hide from MetaCPAN
232             PDL;
233              
234             #line 1440 "lib/PDL/PP.pm"
235             {
236             my ($foo, $overload_sub);
237             use overload '<<' => $overload_sub = sub {
238             Carp::confess("PDL::shiftleft: overloaded '<<' given undef")
239             if grep !defined, @_[0,1];
240             return PDL::shiftleft(@_) unless ref $_[1]
241             && (ref $_[1] ne 'PDL')
242             && defined($foo = overload::Method($_[1], '<<'))
243             && $foo != $overload_sub; # recursion guard
244             goto &$foo;
245             };
246             }
247              
248             #line 1455 "lib/PDL/PP.pm"
249             # in1, in2, out, swap if true
250             use overload '<<=' => sub {
251             Carp::confess("PDL::shiftleft: overloaded '<<=' given undef")
252             if grep !defined, @_[0,1];
253             PDL::shiftleft($_[0]->inplace, $_[1]); $_[0]
254             };
255             #line 256 "lib/PDL/Ops.pm"
256             }
257             { package # hide from MetaCPAN
258             PDL;
259              
260             #line 1440 "lib/PDL/PP.pm"
261             {
262             my ($foo, $overload_sub);
263             use overload '>>' => $overload_sub = sub {
264             Carp::confess("PDL::shiftright: overloaded '>>' given undef")
265             if grep !defined, @_[0,1];
266             return PDL::shiftright(@_) unless ref $_[1]
267             && (ref $_[1] ne 'PDL')
268             && defined($foo = overload::Method($_[1], '>>'))
269             && $foo != $overload_sub; # recursion guard
270             goto &$foo;
271             };
272             }
273              
274             #line 1455 "lib/PDL/PP.pm"
275             # in1, in2, out, swap if true
276             use overload '>>=' => sub {
277             Carp::confess("PDL::shiftright: overloaded '>>=' given undef")
278             if grep !defined, @_[0,1];
279             PDL::shiftright($_[0]->inplace, $_[1]); $_[0]
280             };
281             #line 282 "lib/PDL/Ops.pm"
282             }
283             { package # hide from MetaCPAN
284             PDL;
285              
286             #line 1440 "lib/PDL/PP.pm"
287             {
288             my ($foo, $overload_sub);
289             use overload '|' => $overload_sub = sub {
290             Carp::confess("PDL::or2: overloaded '|' given undef")
291             if grep !defined, @_[0,1];
292             return PDL::or2($_[2]?@_[1,0]:@_[0,1]) unless ref $_[1]
293             && (ref $_[1] ne 'PDL')
294             && defined($foo = overload::Method($_[1], '|'))
295             && $foo != $overload_sub; # recursion guard
296             goto &$foo;
297             };
298             }
299              
300             #line 1455 "lib/PDL/PP.pm"
301             # in1, in2, out, swap if true
302             use overload '|=' => sub {
303             Carp::confess("PDL::or2: overloaded '|=' given undef")
304             if grep !defined, @_[0,1];
305             PDL::or2($_[0]->inplace, $_[1]); $_[0]
306             };
307             #line 308 "lib/PDL/Ops.pm"
308             }
309             { package # hide from MetaCPAN
310             PDL;
311              
312             #line 1440 "lib/PDL/PP.pm"
313             {
314             my ($foo, $overload_sub);
315             use overload '&' => $overload_sub = sub {
316             Carp::confess("PDL::and2: overloaded '&' given undef")
317             if grep !defined, @_[0,1];
318             return PDL::and2($_[2]?@_[1,0]:@_[0,1]) unless ref $_[1]
319             && (ref $_[1] ne 'PDL')
320             && defined($foo = overload::Method($_[1], '&'))
321             && $foo != $overload_sub; # recursion guard
322             goto &$foo;
323             };
324             }
325              
326             #line 1455 "lib/PDL/PP.pm"
327             # in1, in2, out, swap if true
328             use overload '&=' => sub {
329             Carp::confess("PDL::and2: overloaded '&=' given undef")
330             if grep !defined, @_[0,1];
331             PDL::and2($_[0]->inplace, $_[1]); $_[0]
332             };
333             #line 334 "lib/PDL/Ops.pm"
334             }
335             { package # hide from MetaCPAN
336             PDL;
337              
338             #line 1440 "lib/PDL/PP.pm"
339             {
340             my ($foo, $overload_sub);
341             use overload '^' => $overload_sub = sub {
342             Carp::confess("PDL::xor: overloaded '^' given undef")
343             if grep !defined, @_[0,1];
344             return PDL::xor($_[2]?@_[1,0]:@_[0,1]) unless ref $_[1]
345             && (ref $_[1] ne 'PDL')
346             && defined($foo = overload::Method($_[1], '^'))
347             && $foo != $overload_sub; # recursion guard
348             goto &$foo;
349             };
350             }
351              
352             #line 1455 "lib/PDL/PP.pm"
353             # in1, in2, out, swap if true
354             use overload '^=' => sub {
355             Carp::confess("PDL::xor: overloaded '^=' given undef")
356             if grep !defined, @_[0,1];
357             PDL::xor($_[0]->inplace, $_[1]); $_[0]
358             };
359             #line 360 "lib/PDL/Ops.pm"
360             }
361             { package # hide from MetaCPAN
362             PDL;
363              
364             #line 1440 "lib/PDL/PP.pm"
365             {
366             my ($foo, $overload_sub);
367             use overload '**' => $overload_sub = sub {
368             Carp::confess("PDL::power: overloaded '**' given undef")
369             if grep !defined, @_[0,1];
370             return PDL::power(@_) unless ref $_[1]
371             && (ref $_[1] ne 'PDL')
372             && defined($foo = overload::Method($_[1], '**'))
373             && $foo != $overload_sub; # recursion guard
374             goto &$foo;
375             };
376             }
377              
378             #line 1455 "lib/PDL/PP.pm"
379             # in1, in2, out, swap if true
380             use overload '**=' => sub {
381             Carp::confess("PDL::power: overloaded '**=' given undef")
382             if grep !defined, @_[0,1];
383             PDL::power($_[0]->inplace, $_[1]); $_[0]
384             };
385             #line 386 "lib/PDL/Ops.pm"
386             }
387             { package # hide from MetaCPAN
388             PDL;
389              
390             #line 1440 "lib/PDL/PP.pm"
391             {
392             my ($foo, $overload_sub);
393             use overload 'atan2' => $overload_sub = sub {
394             Carp::confess("PDL::atan2: overloaded 'atan2' given undef")
395             if grep !defined, @_[0,1];
396             return PDL::atan2(@_) unless ref $_[1]
397             && (ref $_[1] ne 'PDL')
398             && defined($foo = overload::Method($_[1], 'atan2'))
399             && $foo != $overload_sub; # recursion guard
400             goto &$foo;
401             };
402             }
403             #line 404 "lib/PDL/Ops.pm"
404             }
405             { package # hide from MetaCPAN
406             PDL;
407              
408             #line 1440 "lib/PDL/PP.pm"
409             {
410             my ($foo, $overload_sub);
411             use overload '%' => $overload_sub = sub {
412             Carp::confess("PDL::modulo: overloaded '%' given undef")
413             if grep !defined, @_[0,1];
414             return PDL::modulo(@_) unless ref $_[1]
415             && (ref $_[1] ne 'PDL')
416             && defined($foo = overload::Method($_[1], '%'))
417             && $foo != $overload_sub; # recursion guard
418             goto &$foo;
419             };
420             }
421              
422             #line 1455 "lib/PDL/PP.pm"
423             # in1, in2, out, swap if true
424             use overload '%=' => sub {
425             Carp::confess("PDL::modulo: overloaded '%=' given undef")
426             if grep !defined, @_[0,1];
427             PDL::modulo($_[0]->inplace, $_[1]); $_[0]
428             };
429             #line 430 "lib/PDL/Ops.pm"
430             }
431             { package # hide from MetaCPAN
432             PDL;
433              
434             #line 1440 "lib/PDL/PP.pm"
435             {
436             my ($foo, $overload_sub);
437             use overload '<=>' => $overload_sub = sub {
438             Carp::confess("PDL::spaceship: overloaded '<=>' given undef")
439             if grep !defined, @_[0,1];
440             return PDL::spaceship(@_) unless ref $_[1]
441             && (ref $_[1] ne 'PDL')
442             && defined($foo = overload::Method($_[1], '<=>'))
443             && $foo != $overload_sub; # recursion guard
444             goto &$foo;
445             };
446             }
447             #line 448 "lib/PDL/Ops.pm"
448             }
449             { package # hide from MetaCPAN
450             PDL;
451              
452             #line 1432 "lib/PDL/PP.pm"
453             use overload '~' => sub {
454             Carp::confess("PDL::bitnot: overloaded '~' given undef")
455             if grep !defined, $_[0];
456             PDL::bitnot($_[0]);
457             };
458             #line 459 "lib/PDL/Ops.pm"
459             }
460             { package # hide from MetaCPAN
461             PDL;
462              
463             #line 1432 "lib/PDL/PP.pm"
464             use overload 'sqrt' => sub {
465             Carp::confess("PDL::sqrt: overloaded 'sqrt' given undef")
466             if grep !defined, $_[0];
467             PDL::sqrt($_[0]);
468             };
469             #line 470 "lib/PDL/Ops.pm"
470             }
471             { package # hide from MetaCPAN
472             PDL;
473              
474             #line 1432 "lib/PDL/PP.pm"
475             use overload 'sin' => sub {
476             Carp::confess("PDL::sin: overloaded 'sin' given undef")
477             if grep !defined, $_[0];
478             PDL::sin($_[0]);
479             };
480             #line 481 "lib/PDL/Ops.pm"
481             }
482             { package # hide from MetaCPAN
483             PDL;
484              
485             #line 1432 "lib/PDL/PP.pm"
486             use overload 'cos' => sub {
487             Carp::confess("PDL::cos: overloaded 'cos' given undef")
488             if grep !defined, $_[0];
489             PDL::cos($_[0]);
490             };
491             #line 492 "lib/PDL/Ops.pm"
492             }
493             { package # hide from MetaCPAN
494             PDL;
495              
496             #line 1432 "lib/PDL/PP.pm"
497             use overload '!' => sub {
498             Carp::confess("PDL::not: overloaded '!' given undef")
499             if grep !defined, $_[0];
500             PDL::not($_[0]);
501             };
502             #line 503 "lib/PDL/Ops.pm"
503             }
504             { package # hide from MetaCPAN
505             PDL;
506              
507             #line 1432 "lib/PDL/PP.pm"
508             use overload 'exp' => sub {
509             Carp::confess("PDL::exp: overloaded 'exp' given undef")
510             if grep !defined, $_[0];
511             PDL::exp($_[0]);
512             };
513             #line 514 "lib/PDL/Ops.pm"
514             }
515             { package # hide from MetaCPAN
516             PDL;
517              
518             #line 1432 "lib/PDL/PP.pm"
519             use overload 'log' => sub {
520             Carp::confess("PDL::log: overloaded 'log' given undef")
521             if grep !defined, $_[0];
522             PDL::log($_[0]);
523             };
524             #line 525 "lib/PDL/Ops.pm"
525             }
526              
527              
528              
529              
530              
531              
532              
533             #line 20 "lib/PDL/Ops.pd"
534              
535             use strict;
536             use warnings;
537              
538             =head1 NAME
539              
540             PDL::Ops - Fundamental mathematical operators
541              
542             =head1 DESCRIPTION
543              
544             This module provides the functions used by PDL to
545             overload the basic mathematical operators (C<+ - / *>
546             etc.) and functions (C etc.)
547              
548             It also includes the function C, which should
549             be a perl function so that we can overload it!
550              
551             Matrix multiplication (the operator C) is handled
552             by the module L.
553              
554             =head1 SYNOPSIS
555              
556             none
557              
558             =cut
559             #line 560 "lib/PDL/Ops.pm"
560              
561              
562             =head1 FUNCTIONS
563              
564             =cut
565              
566              
567              
568              
569              
570              
571             =head2 plus
572              
573             =for sig
574              
575             Signature: (a(); b(); [o]c(); int $swap)
576             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
577             float double ldouble cfloat cdouble cldouble)
578              
579             =for usage
580              
581             $c = $a + $b; # overloads the Perl '+' operator
582             $a += $b;
583             $c = PDL::plus($a, $b); # using default value of swap=0
584             $c = PDL::plus($a, $b, $swap); # overriding default
585             PDL::plus($a, $b, $c, $swap); # all arguments given
586             $c = $a->plus($b); # method call
587             $c = $a->plus($b, $swap);
588             $a->plus($b, $c, $swap);
589             $a->inplace->plus($b, $swap); # can be used inplace
590             PDL::plus($a->inplace, $b, $swap);
591              
592             =for ref
593              
594             add two ndarrays
595              
596             =pod
597              
598             Broadcasts over its inputs.
599              
600             =for bad
601              
602             C processes bad values.
603             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
604              
605             =cut
606              
607              
608              
609              
610             *plus = \&PDL::plus;
611              
612              
613              
614              
615              
616              
617             =head2 mult
618              
619             =for sig
620              
621             Signature: (a(); b(); [o]c(); int $swap)
622             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
623             float double ldouble cfloat cdouble cldouble)
624              
625             =for usage
626              
627             $c = $a * $b; # overloads the Perl '*' operator
628             $a *= $b;
629             $c = PDL::mult($a, $b); # using default value of swap=0
630             $c = PDL::mult($a, $b, $swap); # overriding default
631             PDL::mult($a, $b, $c, $swap); # all arguments given
632             $c = $a->mult($b); # method call
633             $c = $a->mult($b, $swap);
634             $a->mult($b, $c, $swap);
635             $a->inplace->mult($b, $swap); # can be used inplace
636             PDL::mult($a->inplace, $b, $swap);
637              
638             =for ref
639              
640             multiply two ndarrays
641              
642             =pod
643              
644             Broadcasts over its inputs.
645              
646             =for bad
647              
648             C processes bad values.
649             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
650              
651             =cut
652              
653              
654              
655              
656             *mult = \&PDL::mult;
657              
658              
659              
660              
661              
662              
663             =head2 minus
664              
665             =for sig
666              
667             Signature: (a(); b(); [o]c(); int $swap)
668             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
669             float double ldouble cfloat cdouble cldouble)
670              
671             =for usage
672              
673             $c = $a - $b; # overloads the Perl '-' operator
674             $a -= $b;
675             $c = PDL::minus($a, $b); # using default value of swap=0
676             $c = PDL::minus($a, $b, $swap); # overriding default
677             PDL::minus($a, $b, $c, $swap); # all arguments given
678             $c = $a->minus($b); # method call
679             $c = $a->minus($b, $swap);
680             $a->minus($b, $c, $swap);
681             $a->inplace->minus($b, $swap); # can be used inplace
682             PDL::minus($a->inplace, $b, $swap);
683              
684             =for ref
685              
686             subtract two ndarrays
687              
688             =pod
689              
690             Broadcasts over its inputs.
691              
692             =for bad
693              
694             C processes bad values.
695             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
696              
697             =cut
698              
699              
700              
701              
702             *minus = \&PDL::minus;
703              
704              
705              
706              
707              
708              
709             =head2 divide
710              
711             =for sig
712              
713             Signature: (a(); b(); [o]c(); int $swap)
714             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
715             float double ldouble cfloat cdouble cldouble)
716              
717             =for usage
718              
719             $c = $a / $b; # overloads the Perl '/' operator
720             $a /= $b;
721             $c = PDL::divide($a, $b); # using default value of swap=0
722             $c = PDL::divide($a, $b, $swap); # overriding default
723             PDL::divide($a, $b, $c, $swap); # all arguments given
724             $c = $a->divide($b); # method call
725             $c = $a->divide($b, $swap);
726             $a->divide($b, $c, $swap);
727             $a->inplace->divide($b, $swap); # can be used inplace
728             PDL::divide($a->inplace, $b, $swap);
729              
730             =for ref
731              
732             divide two ndarrays
733              
734             =pod
735              
736             Broadcasts over its inputs.
737              
738             =for bad
739              
740             C processes bad values.
741             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
742              
743             =cut
744              
745              
746              
747              
748             *divide = \&PDL::divide;
749              
750              
751              
752              
753              
754              
755             =head2 gt
756              
757             =for sig
758              
759             Signature: (a(); b(); [o]c(); int $swap)
760             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
761             float double ldouble)
762              
763             =for usage
764              
765             $c = $a > $b; # overloads the Perl '>' operator
766             $c = PDL::gt($a, $b); # using default value of swap=0
767             $c = PDL::gt($a, $b, $swap); # overriding default
768             PDL::gt($a, $b, $c, $swap); # all arguments given
769             $c = $a->gt($b); # method call
770             $c = $a->gt($b, $swap);
771             $a->gt($b, $c, $swap);
772             $a->inplace->gt($b, $swap); # can be used inplace
773             PDL::gt($a->inplace, $b, $swap);
774              
775             =for ref
776              
777             the binary E (greater than) operation
778              
779             =pod
780              
781             Broadcasts over its inputs.
782              
783             =for bad
784              
785             C processes bad values.
786             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
787              
788             =cut
789              
790              
791              
792              
793             *gt = \&PDL::gt;
794              
795              
796              
797              
798              
799              
800             =head2 lt
801              
802             =for sig
803              
804             Signature: (a(); b(); [o]c(); int $swap)
805             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
806             float double ldouble)
807              
808             =for usage
809              
810             $c = $a < $b; # overloads the Perl '<' operator
811             $c = PDL::lt($a, $b); # using default value of swap=0
812             $c = PDL::lt($a, $b, $swap); # overriding default
813             PDL::lt($a, $b, $c, $swap); # all arguments given
814             $c = $a->lt($b); # method call
815             $c = $a->lt($b, $swap);
816             $a->lt($b, $c, $swap);
817             $a->inplace->lt($b, $swap); # can be used inplace
818             PDL::lt($a->inplace, $b, $swap);
819              
820             =for ref
821              
822             the binary E (less than) operation
823              
824             =pod
825              
826             Broadcasts over its inputs.
827              
828             =for bad
829              
830             C processes bad values.
831             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
832              
833             =cut
834              
835              
836              
837              
838             *lt = \&PDL::lt;
839              
840              
841              
842              
843              
844              
845             =head2 le
846              
847             =for sig
848              
849             Signature: (a(); b(); [o]c(); int $swap)
850             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
851             float double ldouble)
852              
853             =for usage
854              
855             $c = $a <= $b; # overloads the Perl '<=' operator
856             $c = PDL::le($a, $b); # using default value of swap=0
857             $c = PDL::le($a, $b, $swap); # overriding default
858             PDL::le($a, $b, $c, $swap); # all arguments given
859             $c = $a->le($b); # method call
860             $c = $a->le($b, $swap);
861             $a->le($b, $c, $swap);
862             $a->inplace->le($b, $swap); # can be used inplace
863             PDL::le($a->inplace, $b, $swap);
864              
865             =for ref
866              
867             the binary E= (less equal) operation
868              
869             =pod
870              
871             Broadcasts over its inputs.
872              
873             =for bad
874              
875             C processes bad values.
876             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
877              
878             =cut
879              
880              
881              
882              
883             *le = \&PDL::le;
884              
885              
886              
887              
888              
889              
890             =head2 ge
891              
892             =for sig
893              
894             Signature: (a(); b(); [o]c(); int $swap)
895             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
896             float double ldouble)
897              
898             =for usage
899              
900             $c = $a >= $b; # overloads the Perl '>=' operator
901             $c = PDL::ge($a, $b); # using default value of swap=0
902             $c = PDL::ge($a, $b, $swap); # overriding default
903             PDL::ge($a, $b, $c, $swap); # all arguments given
904             $c = $a->ge($b); # method call
905             $c = $a->ge($b, $swap);
906             $a->ge($b, $c, $swap);
907             $a->inplace->ge($b, $swap); # can be used inplace
908             PDL::ge($a->inplace, $b, $swap);
909              
910             =for ref
911              
912             the binary E= (greater equal) operation
913              
914             =pod
915              
916             Broadcasts over its inputs.
917              
918             =for bad
919              
920             C processes bad values.
921             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
922              
923             =cut
924              
925              
926              
927              
928             *ge = \&PDL::ge;
929              
930              
931              
932              
933              
934              
935             =head2 eq
936              
937             =for sig
938              
939             Signature: (a(); b(); [o]c(); int $swap)
940             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
941             float double ldouble cfloat cdouble cldouble)
942              
943             =for usage
944              
945             $c = $a == $b; # overloads the Perl '==' operator
946             $c = PDL::eq($a, $b); # using default value of swap=0
947             $c = PDL::eq($a, $b, $swap); # overriding default
948             PDL::eq($a, $b, $c, $swap); # all arguments given
949             $c = $a->eq($b); # method call
950             $c = $a->eq($b, $swap);
951             $a->eq($b, $c, $swap);
952             $a->inplace->eq($b, $swap); # can be used inplace
953             PDL::eq($a->inplace, $b, $swap);
954              
955             =for ref
956              
957             binary I operation (C<==>)
958              
959             =pod
960              
961             Broadcasts over its inputs.
962              
963             =for bad
964              
965             C processes bad values.
966             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
967              
968             =cut
969              
970              
971              
972              
973             *eq = \&PDL::eq;
974              
975              
976              
977              
978              
979              
980             =head2 ne
981              
982             =for sig
983              
984             Signature: (a(); b(); [o]c(); int $swap)
985             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
986             float double ldouble cfloat cdouble cldouble)
987              
988             =for usage
989              
990             $c = $a != $b; # overloads the Perl '!=' operator
991             $c = PDL::ne($a, $b); # using default value of swap=0
992             $c = PDL::ne($a, $b, $swap); # overriding default
993             PDL::ne($a, $b, $c, $swap); # all arguments given
994             $c = $a->ne($b); # method call
995             $c = $a->ne($b, $swap);
996             $a->ne($b, $c, $swap);
997             $a->inplace->ne($b, $swap); # can be used inplace
998             PDL::ne($a->inplace, $b, $swap);
999              
1000             =for ref
1001              
1002             binary I operation (C)
1003              
1004             =pod
1005              
1006             Broadcasts over its inputs.
1007              
1008             =for bad
1009              
1010             C processes bad values.
1011             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1012              
1013             =cut
1014              
1015              
1016              
1017              
1018             *ne = \&PDL::ne;
1019              
1020              
1021              
1022              
1023              
1024              
1025             =head2 shiftleft
1026              
1027             =for sig
1028              
1029             Signature: (a(); b(); [o]c(); int $swap)
1030             Types: (sbyte byte short ushort long ulong indx ulonglong longlong)
1031              
1032             =for usage
1033              
1034             $c = $a << $b; # overloads the Perl '<<' operator
1035             $a <<= $b;
1036             $c = PDL::shiftleft($a, $b); # using default value of swap=0
1037             $c = PDL::shiftleft($a, $b, $swap); # overriding default
1038             PDL::shiftleft($a, $b, $c, $swap); # all arguments given
1039             $c = $a->shiftleft($b); # method call
1040             $c = $a->shiftleft($b, $swap);
1041             $a->shiftleft($b, $c, $swap);
1042             $a->inplace->shiftleft($b, $swap); # can be used inplace
1043             PDL::shiftleft($a->inplace, $b, $swap);
1044              
1045             =for ref
1046              
1047             bitwise leftshift C<$a> by C<$b>
1048              
1049             =pod
1050              
1051             Broadcasts over its inputs.
1052              
1053             =for bad
1054              
1055             C processes bad values.
1056             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1057              
1058             =cut
1059              
1060              
1061              
1062              
1063             *shiftleft = \&PDL::shiftleft;
1064              
1065              
1066              
1067              
1068              
1069              
1070             =head2 shiftright
1071              
1072             =for sig
1073              
1074             Signature: (a(); b(); [o]c(); int $swap)
1075             Types: (sbyte byte short ushort long ulong indx ulonglong longlong)
1076              
1077             =for usage
1078              
1079             $c = $a >> $b; # overloads the Perl '>>' operator
1080             $a >>= $b;
1081             $c = PDL::shiftright($a, $b); # using default value of swap=0
1082             $c = PDL::shiftright($a, $b, $swap); # overriding default
1083             PDL::shiftright($a, $b, $c, $swap); # all arguments given
1084             $c = $a->shiftright($b); # method call
1085             $c = $a->shiftright($b, $swap);
1086             $a->shiftright($b, $c, $swap);
1087             $a->inplace->shiftright($b, $swap); # can be used inplace
1088             PDL::shiftright($a->inplace, $b, $swap);
1089              
1090             =for ref
1091              
1092             bitwise rightshift C<$a> by C<$b>
1093              
1094             =pod
1095              
1096             Broadcasts over its inputs.
1097              
1098             =for bad
1099              
1100             C processes bad values.
1101             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1102              
1103             =cut
1104              
1105              
1106              
1107              
1108             *shiftright = \&PDL::shiftright;
1109              
1110              
1111              
1112              
1113              
1114              
1115             =head2 or2
1116              
1117             =for sig
1118              
1119             Signature: (a(); b(); [o]c(); int $swap)
1120             Types: (sbyte byte short ushort long ulong indx ulonglong longlong)
1121              
1122             =for usage
1123              
1124             $c = $a | $b; # overloads the Perl '|' operator
1125             $a |= $b;
1126             $c = PDL::or2($a, $b); # using default value of swap=0
1127             $c = PDL::or2($a, $b, $swap); # overriding default
1128             PDL::or2($a, $b, $c, $swap); # all arguments given
1129             $c = $a->or2($b); # method call
1130             $c = $a->or2($b, $swap);
1131             $a->or2($b, $c, $swap);
1132             $a->inplace->or2($b, $swap); # can be used inplace
1133             PDL::or2($a->inplace, $b, $swap);
1134              
1135             =for ref
1136              
1137             bitwise I of two ndarrays
1138              
1139             =pod
1140              
1141             Broadcasts over its inputs.
1142              
1143             =for bad
1144              
1145             C processes bad values.
1146             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1147              
1148             =cut
1149              
1150              
1151              
1152              
1153             *or2 = \&PDL::or2;
1154              
1155              
1156              
1157              
1158              
1159              
1160             =head2 and2
1161              
1162             =for sig
1163              
1164             Signature: (a(); b(); [o]c(); int $swap)
1165             Types: (sbyte byte short ushort long ulong indx ulonglong longlong)
1166              
1167             =for usage
1168              
1169             $c = $a & $b; # overloads the Perl '&' operator
1170             $a &= $b;
1171             $c = PDL::and2($a, $b); # using default value of swap=0
1172             $c = PDL::and2($a, $b, $swap); # overriding default
1173             PDL::and2($a, $b, $c, $swap); # all arguments given
1174             $c = $a->and2($b); # method call
1175             $c = $a->and2($b, $swap);
1176             $a->and2($b, $c, $swap);
1177             $a->inplace->and2($b, $swap); # can be used inplace
1178             PDL::and2($a->inplace, $b, $swap);
1179              
1180             =for ref
1181              
1182             bitwise I of two ndarrays
1183              
1184             =pod
1185              
1186             Broadcasts over its inputs.
1187              
1188             =for bad
1189              
1190             C processes bad values.
1191             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1192              
1193             =cut
1194              
1195              
1196              
1197              
1198             *and2 = \&PDL::and2;
1199              
1200              
1201              
1202              
1203              
1204              
1205             =head2 xor
1206              
1207             =for sig
1208              
1209             Signature: (a(); b(); [o]c(); int $swap)
1210             Types: (sbyte byte short ushort long ulong indx ulonglong longlong)
1211              
1212             =for usage
1213              
1214             $c = $a ^ $b; # overloads the Perl '^' operator
1215             $a ^= $b;
1216             $c = PDL::xor($a, $b); # using default value of swap=0
1217             $c = PDL::xor($a, $b, $swap); # overriding default
1218             PDL::xor($a, $b, $c, $swap); # all arguments given
1219             $c = $a->xor($b); # method call
1220             $c = $a->xor($b, $swap);
1221             $a->xor($b, $c, $swap);
1222             $a->inplace->xor($b, $swap); # can be used inplace
1223             PDL::xor($a->inplace, $b, $swap);
1224              
1225             =for ref
1226              
1227             bitwise I of two ndarrays
1228              
1229             =pod
1230              
1231             Broadcasts over its inputs.
1232              
1233             =for bad
1234              
1235             C processes bad values.
1236             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1237              
1238             =cut
1239              
1240              
1241              
1242              
1243             *xor = \&PDL::xor;
1244              
1245              
1246              
1247              
1248              
1249             #line 306 "lib/PDL/Ops.pd"
1250              
1251             =head2 xor2
1252              
1253             =for ref
1254              
1255             Synonym for L.
1256              
1257             =cut
1258              
1259             *PDL::xor2 = *xor2 = \&PDL::xor;
1260             #line 1261 "lib/PDL/Ops.pm"
1261              
1262              
1263             =head2 power
1264              
1265             =for sig
1266              
1267             Signature: (a(); b(); [o]c(); int $swap)
1268             Types: (cfloat cdouble cldouble float ldouble double)
1269              
1270             =for usage
1271              
1272             $c = $a ** $b; # overloads the Perl '**' operator
1273             $a **= $b;
1274             $c = PDL::power($a, $b); # using default value of swap=0
1275             $c = PDL::power($a, $b, $swap); # overriding default
1276             PDL::power($a, $b, $c, $swap); # all arguments given
1277             $c = $a->power($b); # method call
1278             $c = $a->power($b, $swap);
1279             $a->power($b, $c, $swap);
1280             $a->inplace->power($b, $swap); # can be used inplace
1281             PDL::power($a->inplace, $b, $swap);
1282              
1283             =for ref
1284              
1285             raise ndarray C<$a> to the power C<$b>
1286              
1287             =pod
1288              
1289             Broadcasts over its inputs.
1290              
1291             =for bad
1292              
1293             C processes bad values.
1294             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1295              
1296             =cut
1297              
1298              
1299              
1300              
1301             *power = \&PDL::power;
1302              
1303              
1304              
1305              
1306              
1307              
1308             =head2 atan2
1309              
1310             =for sig
1311              
1312             Signature: (a(); b(); [o]c(); int $swap)
1313             Types: (float ldouble double)
1314              
1315             =for usage
1316              
1317             $c = atan2 $a, $b; # overloads the Perl 'atan2' operator
1318             $c = PDL::atan2($a, $b); # using default value of swap=0
1319             $c = PDL::atan2($a, $b, $swap); # overriding default
1320             PDL::atan2($a, $b, $c, $swap); # all arguments given
1321             $c = $a->atan2($b); # method call
1322             $c = $a->atan2($b, $swap);
1323             $a->atan2($b, $c, $swap);
1324             $a->inplace->atan2($b, $swap); # can be used inplace
1325             PDL::atan2($a->inplace, $b, $swap);
1326              
1327             =for ref
1328              
1329             elementwise C of two ndarrays
1330              
1331             =pod
1332              
1333             Broadcasts over its inputs.
1334              
1335             =for bad
1336              
1337             C processes bad values.
1338             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1339              
1340             =cut
1341              
1342              
1343              
1344              
1345             *atan2 = \&PDL::atan2;
1346              
1347              
1348              
1349              
1350              
1351              
1352             =head2 modulo
1353              
1354             =for sig
1355              
1356             Signature: (a(); b(); [o]c(); int $swap)
1357             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
1358             float double ldouble)
1359              
1360             =for usage
1361              
1362             $c = $a % $b; # overloads the Perl '%' operator
1363             $a %= $b;
1364             $c = PDL::modulo($a, $b); # using default value of swap=0
1365             $c = PDL::modulo($a, $b, $swap); # overriding default
1366             PDL::modulo($a, $b, $c, $swap); # all arguments given
1367             $c = $a->modulo($b); # method call
1368             $c = $a->modulo($b, $swap);
1369             $a->modulo($b, $c, $swap);
1370             $a->inplace->modulo($b, $swap); # can be used inplace
1371             PDL::modulo($a->inplace, $b, $swap);
1372              
1373             =for ref
1374              
1375             elementwise C operation
1376              
1377             =pod
1378              
1379             Broadcasts over its inputs.
1380              
1381             =for bad
1382              
1383             C processes bad values.
1384             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1385              
1386             =cut
1387              
1388              
1389              
1390              
1391             *modulo = \&PDL::modulo;
1392              
1393              
1394              
1395              
1396              
1397              
1398             =head2 spaceship
1399              
1400             =for sig
1401              
1402             Signature: (a(); b(); [o]c(); int $swap)
1403             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
1404             float double ldouble)
1405              
1406             =for usage
1407              
1408             $c = $a <=> $b; # overloads the Perl '<=>' operator
1409             $c = PDL::spaceship($a, $b); # using default value of swap=0
1410             $c = PDL::spaceship($a, $b, $swap); # overriding default
1411             PDL::spaceship($a, $b, $c, $swap); # all arguments given
1412             $c = $a->spaceship($b); # method call
1413             $c = $a->spaceship($b, $swap);
1414             $a->spaceship($b, $c, $swap);
1415             $a->inplace->spaceship($b, $swap); # can be used inplace
1416             PDL::spaceship($a->inplace, $b, $swap);
1417              
1418             =for ref
1419              
1420             elementwise "<=>" operation
1421              
1422             =pod
1423              
1424             Broadcasts over its inputs.
1425              
1426             =for bad
1427              
1428             C processes bad values.
1429             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1430              
1431             =cut
1432              
1433              
1434              
1435              
1436             *spaceship = \&PDL::spaceship;
1437              
1438              
1439              
1440              
1441              
1442              
1443             =head2 bitnot
1444              
1445             =for sig
1446              
1447             Signature: (a(); [o]b())
1448             Types: (sbyte byte short ushort long ulong indx ulonglong longlong)
1449              
1450             =for usage
1451              
1452             $b = ~$a; # overloads the Perl '~' operator
1453             $b = PDL::bitnot($a);
1454             PDL::bitnot($a, $b); # all arguments given
1455             $b = $a->bitnot; # method call
1456             $a->bitnot($b);
1457             $a->inplace->bitnot; # can be used inplace
1458             PDL::bitnot($a->inplace);
1459              
1460             =for ref
1461              
1462             unary bitwise negation
1463              
1464             =pod
1465              
1466             Broadcasts over its inputs.
1467              
1468             =for bad
1469              
1470             C processes bad values.
1471             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1472              
1473             =cut
1474              
1475              
1476              
1477              
1478             *bitnot = \&PDL::bitnot;
1479              
1480              
1481              
1482              
1483              
1484              
1485             =head2 sqrt
1486              
1487             =for sig
1488              
1489             Signature: (a(); [o]b())
1490             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
1491             float double ldouble cfloat cdouble cldouble)
1492              
1493             =for usage
1494              
1495             $b = sqrt $a; # overloads the Perl 'sqrt' operator
1496             $b = PDL::sqrt($a);
1497             PDL::sqrt($a, $b); # all arguments given
1498             $b = $a->sqrt; # method call
1499             $a->sqrt($b);
1500             $a->inplace->sqrt; # can be used inplace
1501             PDL::sqrt($a->inplace);
1502              
1503             =for ref
1504              
1505             elementwise square root
1506              
1507             =pod
1508              
1509             Broadcasts over its inputs.
1510              
1511             =for bad
1512              
1513             C processes bad values.
1514             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1515              
1516             =cut
1517              
1518              
1519              
1520              
1521             *sqrt = \&PDL::sqrt;
1522              
1523              
1524              
1525              
1526              
1527              
1528             =head2 sin
1529              
1530             =for sig
1531              
1532             Signature: (a(); [o]b())
1533             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
1534             float double ldouble cfloat cdouble cldouble)
1535              
1536             =for usage
1537              
1538             $b = sin $a; # overloads the Perl 'sin' operator
1539             $b = PDL::sin($a);
1540             PDL::sin($a, $b); # all arguments given
1541             $b = $a->sin; # method call
1542             $a->sin($b);
1543             $a->inplace->sin; # can be used inplace
1544             PDL::sin($a->inplace);
1545              
1546             =for ref
1547              
1548             the sin function
1549              
1550             =pod
1551              
1552             Broadcasts over its inputs.
1553              
1554             =for bad
1555              
1556             C processes bad values.
1557             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1558              
1559             =cut
1560              
1561              
1562              
1563              
1564             *sin = \&PDL::sin;
1565              
1566              
1567              
1568              
1569              
1570              
1571             =head2 cos
1572              
1573             =for sig
1574              
1575             Signature: (a(); [o]b())
1576             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
1577             float double ldouble cfloat cdouble cldouble)
1578              
1579             =for usage
1580              
1581             $b = cos $a; # overloads the Perl 'cos' operator
1582             $b = PDL::cos($a);
1583             PDL::cos($a, $b); # all arguments given
1584             $b = $a->cos; # method call
1585             $a->cos($b);
1586             $a->inplace->cos; # can be used inplace
1587             PDL::cos($a->inplace);
1588              
1589             =for ref
1590              
1591             the cos function
1592              
1593             =pod
1594              
1595             Broadcasts over its inputs.
1596              
1597             =for bad
1598              
1599             C processes bad values.
1600             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1601              
1602             =cut
1603              
1604              
1605              
1606              
1607             *cos = \&PDL::cos;
1608              
1609              
1610              
1611              
1612              
1613              
1614             =head2 not
1615              
1616             =for sig
1617              
1618             Signature: (a(); [o]b())
1619             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
1620             float double ldouble)
1621              
1622             =for usage
1623              
1624             $b = !$a; # overloads the Perl '!' operator
1625             $b = PDL::not($a);
1626             PDL::not($a, $b); # all arguments given
1627             $b = $a->not; # method call
1628             $a->not($b);
1629             $a->inplace->not; # can be used inplace
1630             PDL::not($a->inplace);
1631              
1632             =for ref
1633              
1634             the elementwise I operation
1635              
1636             =pod
1637              
1638             Broadcasts over its inputs.
1639              
1640             =for bad
1641              
1642             C processes bad values.
1643             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1644              
1645             =cut
1646              
1647              
1648              
1649              
1650             *not = \&PDL::not;
1651              
1652              
1653              
1654              
1655              
1656              
1657             =head2 exp
1658              
1659             =for sig
1660              
1661             Signature: (a(); [o]b())
1662             Types: (cfloat cdouble cldouble float ldouble double)
1663              
1664             =for usage
1665              
1666             $b = exp $a; # overloads the Perl 'exp' operator
1667             $b = PDL::exp($a);
1668             PDL::exp($a, $b); # all arguments given
1669             $b = $a->exp; # method call
1670             $a->exp($b);
1671             $a->inplace->exp; # can be used inplace
1672             PDL::exp($a->inplace);
1673              
1674             =for ref
1675              
1676             the exponential function
1677              
1678             =pod
1679              
1680             Broadcasts over its inputs.
1681              
1682             =for bad
1683              
1684             C processes bad values.
1685             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1686              
1687             =cut
1688              
1689              
1690              
1691              
1692             *exp = \&PDL::exp;
1693              
1694              
1695              
1696              
1697              
1698              
1699             =head2 log
1700              
1701             =for sig
1702              
1703             Signature: (a(); [o]b())
1704             Types: (cfloat cdouble cldouble float ldouble double)
1705              
1706             =for usage
1707              
1708             $b = log $a; # overloads the Perl 'log' operator
1709             $b = PDL::log($a);
1710             PDL::log($a, $b); # all arguments given
1711             $b = $a->log; # method call
1712             $a->log($b);
1713             $a->inplace->log; # can be used inplace
1714             PDL::log($a->inplace);
1715              
1716             =for ref
1717              
1718             the natural logarithm
1719              
1720             =pod
1721              
1722             Broadcasts over its inputs.
1723              
1724             =for bad
1725              
1726             C processes bad values.
1727             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1728              
1729             =cut
1730              
1731              
1732              
1733              
1734             *log = \&PDL::log;
1735              
1736              
1737              
1738              
1739              
1740              
1741             =head2 re
1742              
1743             =for sig
1744              
1745             Signature: (complexv(); real [o]b())
1746             Types: (cfloat cdouble cldouble)
1747              
1748             =for usage
1749              
1750             $b = PDL::re($complexv);
1751             PDL::re($complexv, $b); # all arguments given
1752             $b = $complexv->re; # method call
1753             $complexv->re($b);
1754              
1755             =for ref
1756              
1757             Returns the real part of a complex number. Flows data back & forth.
1758              
1759             =pod
1760              
1761             Broadcasts over its inputs.
1762             Creates data-flow back and forth by default.
1763              
1764             =for bad
1765              
1766             C processes bad values.
1767             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1768              
1769             =cut
1770              
1771              
1772              
1773              
1774             *re = \&PDL::re;
1775              
1776              
1777              
1778              
1779              
1780              
1781             =head2 im
1782              
1783             =for sig
1784              
1785             Signature: (complexv(); real [o]b())
1786             Types: (cfloat cdouble cldouble)
1787              
1788             =for usage
1789              
1790             $b = PDL::im($complexv);
1791             PDL::im($complexv, $b); # all arguments given
1792             $b = $complexv->im; # method call
1793             $complexv->im($b);
1794              
1795             =for ref
1796              
1797             Returns the imaginary part of a complex number. Flows data back & forth.
1798              
1799             =pod
1800              
1801             Broadcasts over its inputs.
1802             Creates data-flow back and forth by default.
1803              
1804             =for bad
1805              
1806             C processes bad values.
1807             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1808              
1809             =cut
1810              
1811              
1812              
1813              
1814             *im = \&PDL::im;
1815              
1816              
1817              
1818              
1819              
1820              
1821             =head2 _cabs
1822              
1823             =for sig
1824              
1825             Signature: (complexv(); real [o]b())
1826             Types: (cfloat cdouble cldouble)
1827              
1828             =for usage
1829              
1830             $b = PDL::_cabs($complexv);
1831             PDL::_cabs($complexv, $b); # all arguments given
1832             $b = $complexv->_cabs; # method call
1833             $complexv->_cabs($b);
1834              
1835             =for ref
1836              
1837             Returns the absolute (length) of a complex number.
1838              
1839             =pod
1840              
1841             Broadcasts over its inputs.
1842              
1843             =for bad
1844              
1845             C<_cabs> processes bad values.
1846             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1847              
1848             =cut
1849              
1850              
1851              
1852              
1853              
1854              
1855              
1856              
1857              
1858              
1859              
1860              
1861              
1862              
1863             =head2 log10
1864              
1865             =for sig
1866              
1867             Signature: (a(); [o]b())
1868             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
1869             float double ldouble cfloat cdouble cldouble)
1870              
1871             =for usage
1872              
1873             $b = log10($a);
1874             log10($a, $b); # all arguments given
1875             $b = $a->log10; # method call
1876             $a->log10($b);
1877             $a->inplace->log10; # can be used inplace
1878             log10($a->inplace);
1879              
1880             =for ref
1881              
1882             the base 10 logarithm
1883              
1884             =pod
1885              
1886             Broadcasts over its inputs.
1887              
1888             =for bad
1889              
1890             C processes bad values.
1891             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1892              
1893             =cut
1894              
1895              
1896              
1897              
1898             sub PDL::log10 {
1899 13     13 0 3549 my ($x, $y) = @_;
1900 13 100       78 return log($x) / log(10) if !UNIVERSAL::isa($x,"PDL");
1901 11 50 66     99 barf "inplace but output given" if $x->is_inplace and defined $y;
1902 11 100       62 if ($x->is_inplace) { $x->set_inplace(0); $y = $x; }
  2 100       10  
  2         5  
1903 7         35 elsif (!defined $y) { $y = $x->initialize; }
1904 11         436 &PDL::_log10_int( $x, $y );
1905 11         68 $y;
1906             };
1907              
1908              
1909              
1910             *log10 = \&PDL::log10;
1911              
1912              
1913              
1914              
1915              
1916              
1917             =head2 assgn
1918              
1919             =for sig
1920              
1921             Signature: (a(); [o]b())
1922             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
1923             float double ldouble cfloat cdouble cldouble)
1924              
1925             =for usage
1926              
1927             $b = assgn($a);
1928             assgn($a, $b); # all arguments given
1929             $b = $a->assgn; # method call
1930             $a->assgn($b);
1931              
1932             =for ref
1933              
1934             Plain numerical assignment. This is used to implement the ".=" operator
1935              
1936             =pod
1937              
1938             Broadcasts over its inputs.
1939              
1940             =for bad
1941              
1942             C processes bad values.
1943             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1944              
1945             =cut
1946              
1947              
1948              
1949              
1950             *assgn = \&PDL::assgn;
1951              
1952              
1953              
1954              
1955              
1956              
1957             =head2 carg
1958              
1959             =for sig
1960              
1961             Signature: (!real complexv(); real [o]b())
1962             Types: (cfloat cdouble cldouble)
1963              
1964             =for usage
1965              
1966             $b = carg($complexv);
1967             carg($complexv, $b); # all arguments given
1968             $b = $complexv->carg; # method call
1969             $complexv->carg($b);
1970              
1971             =for ref
1972              
1973             Returns the polar angle of a complex number.
1974              
1975             =pod
1976              
1977             Broadcasts over its inputs.
1978              
1979             =for bad
1980              
1981             C processes bad values.
1982             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1983              
1984             =cut
1985              
1986              
1987              
1988              
1989             *carg = \&PDL::carg;
1990              
1991              
1992              
1993              
1994              
1995              
1996             =head2 conj
1997              
1998             =for sig
1999              
2000             Signature: (complexv(); [o]b())
2001             Types: (cfloat cdouble cldouble)
2002              
2003             =for usage
2004              
2005             $b = conj($complexv);
2006             conj($complexv, $b); # all arguments given
2007             $b = $complexv->conj; # method call
2008             $complexv->conj($b);
2009             $complexv->inplace->conj; # can be used inplace
2010             conj($complexv->inplace);
2011              
2012             =for ref
2013              
2014             complex conjugate.
2015              
2016             =pod
2017              
2018             Broadcasts over its inputs.
2019              
2020             =for bad
2021              
2022             C processes bad values.
2023             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2024              
2025             =cut
2026              
2027              
2028              
2029              
2030             *conj = \&PDL::conj;
2031              
2032              
2033              
2034              
2035              
2036              
2037             =head2 czip
2038              
2039             =for sig
2040              
2041             Signature: (!complex r(); !complex i(); complex [o]c())
2042             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
2043             float double ldouble)
2044              
2045             =for usage
2046              
2047             $c = czip($r, $i);
2048             czip($r, $i, $c); # all arguments given
2049             $c = $r->czip($i); # method call
2050             $r->czip($i, $c);
2051              
2052             convert real, imaginary to native complex, (sort of) like LISP zip
2053             function. Will add the C ndarray to "i" times the C ndarray. Only
2054             takes real ndarrays as input.
2055              
2056             =pod
2057              
2058             Broadcasts over its inputs.
2059              
2060             =for bad
2061              
2062             C does not process bad values.
2063             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2064              
2065             =cut
2066              
2067              
2068              
2069              
2070             *czip = \&PDL::czip;
2071              
2072              
2073              
2074              
2075              
2076              
2077             =head2 ipow
2078              
2079             =for sig
2080              
2081             Signature: (a(); longlong b(); [o] ans())
2082             Types: (ulonglong longlong float ldouble cfloat cdouble cldouble
2083             double)
2084              
2085             =for usage
2086              
2087             $ans = ipow($a, $b);
2088             ipow($a, $b, $ans); # all arguments given
2089             $ans = $a->ipow($b); # method call
2090             $a->ipow($b, $ans);
2091             $a->inplace->ipow($b); # can be used inplace
2092             ipow($a->inplace, $b);
2093              
2094             =for ref
2095              
2096             raise ndarray C<$a> to integer power C<$b>
2097              
2098             Algorithm from L
2099              
2100             =pod
2101              
2102             Broadcasts over its inputs.
2103              
2104             =for bad
2105              
2106             C does not process bad values.
2107             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2108              
2109             =cut
2110              
2111              
2112              
2113              
2114             *ipow = \&PDL::ipow;
2115              
2116              
2117              
2118              
2119              
2120             #line 468 "lib/PDL/Ops.pd"
2121              
2122             =head2 abs
2123              
2124             =for ref
2125              
2126             Returns the absolute value of a number.
2127              
2128             =cut
2129              
2130             sub PDL::abs { $_[0]->type->real ? goto &PDL::_rabs : goto &PDL::_cabs }
2131             #line 2132 "lib/PDL/Ops.pm"
2132              
2133              
2134             =head2 abs2
2135              
2136             =for sig
2137              
2138             Signature: (a(); real [o]b())
2139             Types: (sbyte byte short ushort long ulong indx ulonglong longlong
2140             float double ldouble cfloat cdouble cldouble)
2141              
2142             =for usage
2143              
2144             $b = abs2($a);
2145             abs2($a, $b); # all arguments given
2146             $b = $a->abs2; # method call
2147             $a->abs2($b);
2148              
2149             =for ref
2150              
2151             Returns the square of the absolute value of a number.
2152              
2153             =pod
2154              
2155             Broadcasts over its inputs.
2156              
2157             =for bad
2158              
2159             C processes bad values.
2160             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2161              
2162             =cut
2163              
2164              
2165              
2166              
2167             *abs2 = \&PDL::abs2;
2168              
2169              
2170              
2171              
2172              
2173              
2174             =head2 r2C
2175              
2176             =for sig
2177              
2178             Signature: (r(); complex [o]c())
2179             Types: (float ldouble cfloat cdouble cldouble double)
2180              
2181             =for usage
2182              
2183             $c = r2C($r);
2184             r2C($r, $c); # all arguments given
2185             $c = $r->r2C; # method call
2186             $r->r2C($c);
2187              
2188             =for ref
2189              
2190             convert real to native complex, with an imaginary part of zero
2191              
2192             =pod
2193              
2194             Broadcasts over its inputs.
2195              
2196             =for bad
2197              
2198             C does not process bad values.
2199             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2200              
2201             =cut
2202              
2203              
2204              
2205              
2206             sub PDL::r2C ($) {
2207 34 100 100 34 0 345 return $_[0] if UNIVERSAL::isa($_[0], 'PDL') and !$_[0]->type->real;
2208 26   33     151 my $r = $_[1] // PDL->nullcreate($_[0]);
2209 26         15590 PDL::_r2C_int($_[0], $r);
2210 26         181 $r;
2211             }
2212              
2213              
2214              
2215             *r2C = \&PDL::r2C;
2216              
2217              
2218              
2219              
2220              
2221              
2222             =head2 i2C
2223              
2224             =for sig
2225              
2226             Signature: (i(); complex [o]c())
2227             Types: (float ldouble cfloat cdouble cldouble double)
2228              
2229             =for usage
2230              
2231             $c = i2C($i);
2232             i2C($i, $c); # all arguments given
2233             $c = $i->i2C; # method call
2234             $i->i2C($c);
2235              
2236             =for ref
2237              
2238             convert imaginary to native complex, with a real part of zero
2239              
2240             =pod
2241              
2242             Broadcasts over its inputs.
2243              
2244             =for bad
2245              
2246             C does not process bad values.
2247             It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2248              
2249             =cut
2250              
2251              
2252              
2253              
2254             sub PDL::i2C ($) {
2255 3 50 33 3 0 39 return $_[0] if UNIVERSAL::isa($_[0], 'PDL') and !$_[0]->type->real;
2256 3   33     29 my $r = $_[1] // PDL->nullcreate($_[0]);
2257 3         116 PDL::_i2C_int($_[0], $r);
2258 3         21 $r;
2259             }
2260              
2261              
2262              
2263             *i2C = \&PDL::i2C;
2264              
2265              
2266              
2267              
2268              
2269             #line 525 "lib/PDL/Ops.pd"
2270              
2271             # This is to used warn if an operand is non-numeric or non-PDL.
2272             sub warn_non_numeric_op_wrapper {
2273             require Scalar::Util;
2274             my ($cb, $op_name) = @_;
2275             return sub {
2276             my ($op1, $op2) = @_;
2277             warn "'$op2' is not numeric nor a PDL in operator $op_name"
2278             unless Scalar::Util::looks_like_number($op2)
2279             || ( Scalar::Util::blessed($op2) && $op2->isa('PDL') );
2280             $cb->(@_);
2281             }
2282             }
2283              
2284             { package # hide from MetaCPAN
2285             PDL;
2286             use overload
2287             "eq" => PDL::Ops::warn_non_numeric_op_wrapper(\&PDL::eq, 'eq'),
2288             ".=" => sub {
2289             my @args = !$_[2] ? @_[1,0] : @_[0,1];
2290             PDL::Ops::assgn(@args);
2291             return $args[1];
2292             },
2293             'abs' => sub { PDL::abs($_[0]) },
2294             '++' => sub { $_[0] += ($PDL::Core::pdl_ones[$_[0]->get_datatype]//barf "Couldn't find 'one' for type ", $_[0]->get_datatype) },
2295             '--' => sub { $_[0] -= ($PDL::Core::pdl_ones[$_[0]->get_datatype]//barf "Couldn't find 'one' for type ", $_[0]->get_datatype) },
2296             ;
2297             }
2298              
2299             #line 49 "lib/PDL/Ops.pd"
2300              
2301             =head1 AUTHOR
2302              
2303             Tuomas J. Lukka (lukka@fas.harvard.edu),
2304             Karl Glazebrook (kgb@aaoepp.aao.gov.au),
2305             Doug Hunt (dhunt@ucar.edu),
2306             Christian Soeller (c.soeller@auckland.ac.nz),
2307             Doug Burke (burke@ifa.hawaii.edu),
2308             and Craig DeForest (deforest@boulder.swri.edu).
2309              
2310             =cut
2311             #line 2312 "lib/PDL/Ops.pm"
2312              
2313             # Exit with OK status
2314              
2315             1;