"Fossies" - the Fresh Open Source Software Archive

Member "PDL-2.080/GENERATED/PDL/Ops.pm" (28 May 2022, 39239 Bytes) of package /linux/misc/PDL-2.080.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Ops.pm" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.079_vs_2.080.

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