Ops.pm (PDL-2.082) | : | Ops.pm (PDL-2.083) | ||
---|---|---|---|---|
skipping to change at line 51 | skipping to change at line 51 | |||
none | none | |||
=cut | =cut | |||
#line 54 "Ops.pm" | #line 54 "Ops.pm" | |||
=head1 FUNCTIONS | =head1 FUNCTIONS | |||
=cut | =cut | |||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'+'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'+'} = $overload_sub = sub(;@) { | |||
return PDL::plus(@_) unless ref $_[1] | goto &PDL::plus unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '+')) | && defined($foo = overload::Method($_[1], '+')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'+='} = sub { PDL::plus($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'+='} = sub { PDL::plus($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 84 "Ops.pm" | #line 83 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 plus | =head2 plus | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
add two ndarrays | add two ndarrays | |||
=for example | =for example | |||
$c = $x + $y; # overloaded call | $c = $x + $y; # overloaded call | |||
$c = plus $x, $y; # explicit call with default swap of 0 | $c = plus $x, $y; # explicit call with default swap of 0 | |||
$c = plus $x, $y, 1; # explicit call with trailing 1 to swap args | $c = plus $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 99 | skipping to change at line 100 | |||
This function is used to overload the binary C<+> operator. | This function is used to overload the binary C<+> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
plus processes bad values. | plus processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 123 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*plus = \&PDL::plus; | *plus = \&PDL::plus; | |||
#line 130 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'*'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'*'} = $overload_sub = sub(;@) { | |||
return PDL::mult(@_) unless ref $_[1] | goto &PDL::mult unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '*')) | && defined($foo = overload::Method($_[1], '*')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'*='} = sub { PDL::mult($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'*='} = sub { PDL::mult($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 150 "Ops.pm" | #line 142 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 mult | =head2 mult | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
multiply two ndarrays | multiply two ndarrays | |||
=for example | =for example | |||
$c = $x * $y; # overloaded call | $c = $x * $y; # overloaded call | |||
$c = mult $x, $y; # explicit call with default swap of 0 | $c = mult $x, $y; # explicit call with default swap of 0 | |||
$c = mult $x, $y, 1; # explicit call with trailing 1 to swap args | $c = mult $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 154 | skipping to change at line 152 | |||
This function is used to overload the binary C<*> operator. | This function is used to overload the binary C<*> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
mult processes bad values. | mult processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 189 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*mult = \&PDL::mult; | *mult = \&PDL::mult; | |||
#line 196 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'-'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'-'} = $overload_sub = sub(;@) { | |||
return PDL::minus(@_) unless ref $_[1] | goto &PDL::minus unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '-')) | && defined($foo = overload::Method($_[1], '-')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'-='} = sub { PDL::minus($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'-='} = sub { PDL::minus($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 216 "Ops.pm" | #line 201 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 minus | =head2 minus | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
subtract two ndarrays | subtract two ndarrays | |||
=for example | =for example | |||
$c = $x - $y; # overloaded call | $c = $x - $y; # overloaded call | |||
$c = minus $x, $y; # explicit call with default swap of 0 | $c = minus $x, $y; # explicit call with default swap of 0 | |||
$c = minus $x, $y, 1; # explicit call with trailing 1 to swap args | $c = minus $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 209 | skipping to change at line 204 | |||
This function is used to overload the binary C<-> operator. | This function is used to overload the binary C<-> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
minus processes bad values. | minus processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 255 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*minus = \&PDL::minus; | *minus = \&PDL::minus; | |||
#line 262 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'/'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'/'} = $overload_sub = sub(;@) { | |||
return PDL::divide(@_) unless ref $_[1] | goto &PDL::divide unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '/')) | && defined($foo = overload::Method($_[1], '/')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'/='} = sub { PDL::divide($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'/='} = sub { PDL::divide($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 282 "Ops.pm" | #line 260 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 divide | =head2 divide | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
divide two ndarrays | divide two ndarrays | |||
=for example | =for example | |||
$c = $x / $y; # overloaded call | $c = $x / $y; # overloaded call | |||
$c = divide $x, $y; # explicit call with default swap of 0 | $c = divide $x, $y; # explicit call with default swap of 0 | |||
$c = divide $x, $y, 1; # explicit call with trailing 1 to swap args | $c = divide $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 264 | skipping to change at line 256 | |||
This function is used to overload the binary C</> operator. | This function is used to overload the binary C</> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
divide processes bad values. | divide processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 321 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*divide = \&PDL::divide; | *divide = \&PDL::divide; | |||
#line 328 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'>'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'>'} = $overload_sub = sub(;@) { | |||
return PDL::gt(@_) unless ref $_[1] | goto &PDL::gt unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '>')) | && defined($foo = overload::Method($_[1], '>')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 344 "Ops.pm" | #line 313 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 gt | =head2 gt | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
the binary E<gt> (greater than) operation | the binary E<gt> (greater than) operation | |||
=for example | =for example | |||
$c = $x > $y; # overloaded call | $c = $x > $y; # overloaded call | |||
$c = gt $x, $y; # explicit call with default swap of 0 | $c = gt $x, $y; # explicit call with default swap of 0 | |||
$c = gt $x, $y, 1; # explicit call with trailing 1 to swap args | $c = gt $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 315 | skipping to change at line 302 | |||
This function is used to overload the binary C<E<gt>> operator. | This function is used to overload the binary C<E<gt>> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
gt processes bad values. | gt processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 383 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*gt = \&PDL::gt; | *gt = \&PDL::gt; | |||
#line 390 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'<'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'<'} = $overload_sub = sub(;@) { | |||
return PDL::lt(@_) unless ref $_[1] | goto &PDL::lt unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '<')) | && defined($foo = overload::Method($_[1], '<')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 406 "Ops.pm" | #line 366 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 lt | =head2 lt | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
the binary E<lt> (less than) operation | the binary E<lt> (less than) operation | |||
=for example | =for example | |||
$c = $x < $y; # overloaded call | $c = $x < $y; # overloaded call | |||
$c = lt $x, $y; # explicit call with default swap of 0 | $c = lt $x, $y; # explicit call with default swap of 0 | |||
$c = lt $x, $y, 1; # explicit call with trailing 1 to swap args | $c = lt $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 366 | skipping to change at line 348 | |||
This function is used to overload the binary C<E<lt>> operator. | This function is used to overload the binary C<E<lt>> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
lt processes bad values. | lt processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 445 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*lt = \&PDL::lt; | *lt = \&PDL::lt; | |||
#line 452 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'<='} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'<='} = $overload_sub = sub(;@) { | |||
return PDL::le(@_) unless ref $_[1] | goto &PDL::le unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '<=')) | && defined($foo = overload::Method($_[1], '<=')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 468 "Ops.pm" | #line 419 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 le | =head2 le | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
the binary E<lt>= (less equal) operation | the binary E<lt>= (less equal) operation | |||
=for example | =for example | |||
$c = $x <= $y; # overloaded call | $c = $x <= $y; # overloaded call | |||
$c = le $x, $y; # explicit call with default swap of 0 | $c = le $x, $y; # explicit call with default swap of 0 | |||
$c = le $x, $y, 1; # explicit call with trailing 1 to swap args | $c = le $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 417 | skipping to change at line 394 | |||
This function is used to overload the binary C<E<lt>=> operator. | This function is used to overload the binary C<E<lt>=> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
le processes bad values. | le processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 507 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*le = \&PDL::le; | *le = \&PDL::le; | |||
#line 514 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'>='} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'>='} = $overload_sub = sub(;@) { | |||
return PDL::ge(@_) unless ref $_[1] | goto &PDL::ge unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '>=')) | && defined($foo = overload::Method($_[1], '>=')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 530 "Ops.pm" | #line 472 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 ge | =head2 ge | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
the binary E<gt>= (greater equal) operation | the binary E<gt>= (greater equal) operation | |||
=for example | =for example | |||
$c = $x >= $y; # overloaded call | $c = $x >= $y; # overloaded call | |||
$c = ge $x, $y; # explicit call with default swap of 0 | $c = ge $x, $y; # explicit call with default swap of 0 | |||
$c = ge $x, $y, 1; # explicit call with trailing 1 to swap args | $c = ge $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 468 | skipping to change at line 440 | |||
This function is used to overload the binary C<E<gt>=> operator. | This function is used to overload the binary C<E<gt>=> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
ge processes bad values. | ge processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 569 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*ge = \&PDL::ge; | *ge = \&PDL::ge; | |||
#line 576 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'=='} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'=='} = $overload_sub = sub(;@) { | |||
return PDL::eq(@_) unless ref $_[1] | goto &PDL::eq unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '==')) | && defined($foo = overload::Method($_[1], '==')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 592 "Ops.pm" | #line 525 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 eq | =head2 eq | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
binary I<equal to> operation (C<==>) | binary I<equal to> operation (C<==>) | |||
=for example | =for example | |||
$c = $x == $y; # overloaded call | $c = $x == $y; # overloaded call | |||
$c = eq $x, $y; # explicit call with default swap of 0 | $c = eq $x, $y; # explicit call with default swap of 0 | |||
$c = eq $x, $y, 1; # explicit call with trailing 1 to swap args | $c = eq $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 519 | skipping to change at line 486 | |||
This function is used to overload the binary C<==> operator. | This function is used to overload the binary C<==> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
eq processes bad values. | eq processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 631 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*eq = \&PDL::eq; | *eq = \&PDL::eq; | |||
#line 638 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'!='} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'!='} = $overload_sub = sub(;@) { | |||
return PDL::ne(@_) unless ref $_[1] | goto &PDL::ne unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '!=')) | && defined($foo = overload::Method($_[1], '!=')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 654 "Ops.pm" | #line 578 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 ne | =head2 ne | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
binary I<not equal to> operation (C<!=>) | binary I<not equal to> operation (C<!=>) | |||
=for example | =for example | |||
$c = $x != $y; # overloaded call | $c = $x != $y; # overloaded call | |||
$c = ne $x, $y; # explicit call with default swap of 0 | $c = ne $x, $y; # explicit call with default swap of 0 | |||
$c = ne $x, $y, 1; # explicit call with trailing 1 to swap args | $c = ne $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 570 | skipping to change at line 532 | |||
This function is used to overload the binary C<!=> operator. | This function is used to overload the binary C<!=> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
ne processes bad values. | ne processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 693 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*ne = \&PDL::ne; | *ne = \&PDL::ne; | |||
#line 700 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'<<'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'<<'} = $overload_sub = sub(;@) { | |||
return PDL::shiftleft(@_) unless ref $_[1] | goto &PDL::shiftleft unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '<<')) | && defined($foo = overload::Method($_[1], '<<')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'<<='} = sub { PDL::shiftleft($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'<<='} = sub { PDL::shiftleft($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 720 "Ops.pm" | #line 637 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 shiftleft | =head2 shiftleft | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
leftshift C<$a> by C<$b> | leftshift C<$a> by C<$b> | |||
=for example | =for example | |||
$c = $x << $y; # overloaded call | $c = $x << $y; # overloaded call | |||
$c = shiftleft $x, $y; # explicit call with default swap of 0 | $c = shiftleft $x, $y; # explicit call with default swap of 0 | |||
$c = shiftleft $x, $y, 1; # explicit call with trailing 1 to swap args | $c = shiftleft $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 625 | skipping to change at line 584 | |||
This function is used to overload the binary C<E<lt>E<lt>> operator. | This function is used to overload the binary C<E<lt>E<lt>> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
shiftleft processes bad values. | shiftleft processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 759 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*shiftleft = \&PDL::shiftleft; | *shiftleft = \&PDL::shiftleft; | |||
#line 766 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'>>'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'>>'} = $overload_sub = sub(;@) { | |||
return PDL::shiftright(@_) unless ref $_[1] | goto &PDL::shiftright unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '>>')) | && defined($foo = overload::Method($_[1], '>>')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'>>='} = sub { PDL::shiftright($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'>>='} = sub { PDL::shiftright($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 786 "Ops.pm" | #line 696 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 shiftright | =head2 shiftright | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
rightshift C<$a> by C<$b> | rightshift C<$a> by C<$b> | |||
=for example | =for example | |||
$c = $x >> $y; # overloaded call | $c = $x >> $y; # overloaded call | |||
$c = shiftright $x, $y; # explicit call with default swap of 0 | $c = shiftright $x, $y; # explicit call with default swap of 0 | |||
$c = shiftright $x, $y, 1; # explicit call with trailing 1 to swap args | $c = shiftright $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 680 | skipping to change at line 636 | |||
This function is used to overload the binary C<E<gt>E<gt>> operator. | This function is used to overload the binary C<E<gt>E<gt>> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
shiftright processes bad values. | shiftright processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 825 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*shiftright = \&PDL::shiftright; | *shiftright = \&PDL::shiftright; | |||
#line 832 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'|'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'|'} = $overload_sub = sub(;@) { | |||
return PDL::or2($_[2]?@_[1,0]:@_[0,1]) unless ref $_[1] | goto &PDL::or2 unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '|')) | && defined($foo = overload::Method($_[1], '|')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'|='} = sub { PDL::or2($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'|='} = sub { PDL::or2($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 852 "Ops.pm" | #line 755 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 or2 | =head2 or2 | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap; SV *$ign; int $ign2) | |||
=for ref | =for ref | |||
binary I<or> of two ndarrays | binary I<or> of two ndarrays | |||
=for example | =for example | |||
$c = $x | $y; # overloaded call | $c = $x | $y; # overloaded call | |||
$c = or2 $x, $y; # explicit call with default swap of 0 | $c = or2 $x, $y; # explicit call with default swap of 0 | |||
$c = or2 $x, $y, 1; # explicit call with trailing 1 to swap args | $c = or2 $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 735 | skipping to change at line 688 | |||
This function is used to overload the binary C<|> operator. | This function is used to overload the binary C<|> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
or2 processes bad values. | or2 processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 891 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*or2 = \&PDL::or2; | *or2 = \&PDL::or2; | |||
#line 898 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'&'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'&'} = $overload_sub = sub(;@) { | |||
return PDL::and2($_[2]?@_[1,0]:@_[0,1]) unless ref $_[1] | goto &PDL::and2 unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '&')) | && defined($foo = overload::Method($_[1], '&')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'&='} = sub { PDL::and2($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'&='} = sub { PDL::and2($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 918 "Ops.pm" | #line 814 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 and2 | =head2 and2 | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap; SV *$ign; int $ign2) | |||
=for ref | =for ref | |||
binary I<and> of two ndarrays | binary I<and> of two ndarrays | |||
=for example | =for example | |||
$c = $x & $y; # overloaded call | $c = $x & $y; # overloaded call | |||
$c = and2 $x, $y; # explicit call with default swap of 0 | $c = and2 $x, $y; # explicit call with default swap of 0 | |||
$c = and2 $x, $y, 1; # explicit call with trailing 1 to swap args | $c = and2 $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 790 | skipping to change at line 740 | |||
This function is used to overload the binary C<&> operator. | This function is used to overload the binary C<&> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
and2 processes bad values. | and2 processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 957 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*and2 = \&PDL::and2; | *and2 = \&PDL::and2; | |||
#line 964 "Ops.pm" | ||||
#line 132 "ops.pd" | #line 130 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'^'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'^'} = $overload_sub = sub(;@) { | |||
return PDL::xor($_[2]?@_[1,0]:@_[0,1]) unless ref $_[1] | goto &PDL::xor unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '^')) | && defined($foo = overload::Method($_[1], '^')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'^='} = sub { PDL::xor($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'^='} = sub { PDL::xor($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 984 "Ops.pm" | #line 873 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 xor | =head2 xor | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap; SV *$ign; int $ign2) | |||
=for ref | =for ref | |||
binary I<exclusive or> of two ndarrays | binary I<exclusive or> of two ndarrays | |||
=for example | =for example | |||
$c = $x ^ $y; # overloaded call | $c = $x ^ $y; # overloaded call | |||
$c = xor $x, $y; # explicit call with default swap of 0 | $c = xor $x, $y; # explicit call with default swap of 0 | |||
$c = xor $x, $y, 1; # explicit call with trailing 1 to swap args | $c = xor $x, $y, 1; # explicit call with trailing 1 to swap args | |||
skipping to change at line 845 | skipping to change at line 792 | |||
This function is used to overload the binary C<^> operator. | This function is used to overload the binary C<^> operator. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see second example), or supply it (see third one). | the third argument (see second example), or supply it (see third one). | |||
=for bad | =for bad | |||
xor processes bad values. | xor processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1023 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*xor = \&PDL::xor; | *xor = \&PDL::xor; | |||
#line 1030 "Ops.pm" | ||||
#line 308 "ops.pd" | #line 307 "ops.pd" | |||
#line 176 "ops.pd" | ||||
BEGIN { $OVERLOADS{'~'} = sub { PDL::bitnot($_[0]) } } | BEGIN { $OVERLOADS{'~'} = sub { PDL::bitnot($_[0]) } } | |||
#line 1037 "Ops.pm" | #line 917 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 bitnot | =head2 bitnot | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
unary bit negation | unary bit negation | |||
skipping to change at line 883 | skipping to change at line 825 | |||
It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | |||
This function is used to overload the unary C<~> operator/function. | This function is used to overload the unary C<~> operator/function. | |||
=for bad | =for bad | |||
bitnot processes bad values. | bitnot processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1072 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*bitnot = \&PDL::bitnot; | *bitnot = \&PDL::bitnot; | |||
#line 1079 "Ops.pm" | ||||
#line 241 "ops.pd" | #line 239 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'**'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'**'} = $overload_sub = sub(;@) { | |||
return PDL::power(@_) unless ref $_[1] | goto &PDL::power unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '**')) | && defined($foo = overload::Method($_[1], '**')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'**='} = sub { PDL::power($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'**='} = sub { PDL::power($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 1099 "Ops.pm" | #line 972 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 power | =head2 power | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
raise ndarray C<$a> to the power C<$b> | raise ndarray C<$a> to the power C<$b> | |||
=for example | =for example | |||
$c = $x->power($y); # explicit call with default swap of 0 | $c = $x->power($y); # explicit call with default swap of 0 | |||
$c = $x->power($y, 1); # explicit call with trailing 1 to swap args | $c = $x->power($y, 1); # explicit call with trailing 1 to swap args | |||
$c = $a ** $b; # overloaded use | $c = $a ** $b; # overloaded use | |||
skipping to change at line 938 | skipping to change at line 877 | |||
This function is used to overload the binary C<**> function. | This function is used to overload the binary C<**> function. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see first example), or supply it (see second one). | the third argument (see first example), or supply it (see second one). | |||
=for bad | =for bad | |||
power processes bad values. | power processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1138 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*power = \&PDL::power; | *power = \&PDL::power; | |||
#line 1145 "Ops.pm" | ||||
#line 241 "ops.pd" | #line 239 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'atan2'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'atan2'} = $overload_sub = sub(;@) { | |||
return PDL::atan2(@_) unless ref $_[1] | goto &PDL::atan2 unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], 'atan2')) | && defined($foo = overload::Method($_[1], 'atan2')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 1161 "Ops.pm" | #line 1025 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 atan2 | =head2 atan2 | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
elementwise C<atan2> of two ndarrays | elementwise C<atan2> of two ndarrays | |||
=for example | =for example | |||
$c = $x->atan2($y); # explicit call with default swap of 0 | $c = $x->atan2($y); # explicit call with default swap of 0 | |||
$c = $x->atan2($y, 1); # explicit call with trailing 1 to swap args | $c = $x->atan2($y, 1); # explicit call with trailing 1 to swap args | |||
$c = atan2 $a, $b; # overloaded use | $c = atan2 $a, $b; # overloaded use | |||
skipping to change at line 989 | skipping to change at line 923 | |||
This function is used to overload the binary C<atan2> function. | This function is used to overload the binary C<atan2> function. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see first example), or supply it (see second one). | the third argument (see first example), or supply it (see second one). | |||
=for bad | =for bad | |||
atan2 processes bad values. | atan2 processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1200 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*atan2 = \&PDL::atan2; | *atan2 = \&PDL::atan2; | |||
#line 1207 "Ops.pm" | ||||
#line 241 "ops.pd" | #line 239 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'%'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'%'} = $overload_sub = sub(;@) { | |||
return PDL::modulo(@_) unless ref $_[1] | goto &PDL::modulo unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '%')) | && defined($foo = overload::Method($_[1], '%')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 193 "ops.pd" | ||||
BEGIN { | BEGIN { | |||
# in1, in2, out, swap if true | # in1, in2, out, swap if true | |||
$OVERLOADS{'%='} = sub { PDL::modulo($_[0], $_[1], $_[0], 0); $_[0] }; | $OVERLOADS{'%='} = sub { PDL::modulo($_[0]->inplace, $_[1]); $_[0] }; | |||
} | } | |||
#line 1227 "Ops.pm" | #line 1084 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 modulo | =head2 modulo | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
elementwise C<modulo> operation | elementwise C<modulo> operation | |||
=for example | =for example | |||
$c = $x->modulo($y); # explicit call with default swap of 0 | $c = $x->modulo($y); # explicit call with default swap of 0 | |||
$c = $x->modulo($y, 1); # explicit call with trailing 1 to swap args | $c = $x->modulo($y, 1); # explicit call with trailing 1 to swap args | |||
$c = $a % $b; # overloaded use | $c = $a % $b; # overloaded use | |||
skipping to change at line 1044 | skipping to change at line 975 | |||
This function is used to overload the binary C<%> function. | This function is used to overload the binary C<%> function. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see first example), or supply it (see second one). | the third argument (see first example), or supply it (see second one). | |||
=for bad | =for bad | |||
modulo processes bad values. | modulo processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1266 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*modulo = \&PDL::modulo; | *modulo = \&PDL::modulo; | |||
#line 1273 "Ops.pm" | ||||
#line 241 "ops.pd" | #line 239 "ops.pd" | |||
#line 180 "ops.pd" | ||||
{ | { | |||
my ($foo, $overload_sub); | my ($foo, $overload_sub); | |||
BEGIN { $OVERLOADS{'<=>'} = $overload_sub = sub(;@) { | BEGIN { $OVERLOADS{'<=>'} = $overload_sub = sub(;@) { | |||
return PDL::spaceship(@_) unless ref $_[1] | goto &PDL::spaceship unless ref $_[1] | |||
&& (ref $_[1] ne 'PDL') | && (ref $_[1] ne 'PDL') | |||
&& defined($foo = overload::Method($_[1], '<=>')) | && defined($foo = overload::Method($_[1], '<=>')) | |||
&& $foo != $overload_sub; # recursion guard | && $foo != $overload_sub; # recursion guard | |||
$foo->($_[1], $_[0], !$_[2]); | goto &$foo; | |||
}; } | }; } | |||
} | } | |||
#line 1289 "Ops.pm" | #line 1137 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 spaceship | =head2 spaceship | |||
=for sig | =for sig | |||
Signature: (a(); b(); [o]c(); int swap) | Signature: (a(); b(); [o]c(); int $swap) | |||
=for ref | =for ref | |||
elementwise "<=>" operation | elementwise "<=>" operation | |||
=for example | =for example | |||
$c = $x->spaceship($y); # explicit call with default swap of 0 | $c = $x->spaceship($y); # explicit call with default swap of 0 | |||
$c = $x->spaceship($y, 1); # explicit call with trailing 1 to swap args | $c = $x->spaceship($y, 1); # explicit call with trailing 1 to swap args | |||
$c = $a <=> $b; # overloaded use | $c = $a <=> $b; # overloaded use | |||
skipping to change at line 1095 | skipping to change at line 1021 | |||
This function is used to overload the binary C<E<lt>=E<gt>> function. | This function is used to overload the binary C<E<lt>=E<gt>> function. | |||
As of 2.065, when calling this function explicitly you can omit | As of 2.065, when calling this function explicitly you can omit | |||
the third argument (see first example), or supply it (see second one). | the third argument (see first example), or supply it (see second one). | |||
=for bad | =for bad | |||
spaceship processes bad values. | spaceship processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1328 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*spaceship = \&PDL::spaceship; | *spaceship = \&PDL::spaceship; | |||
#line 1335 "Ops.pm" | ||||
#line 308 "ops.pd" | #line 307 "ops.pd" | |||
#line 176 "ops.pd" | ||||
BEGIN { $OVERLOADS{'sqrt'} = sub { PDL::sqrt($_[0]) } } | BEGIN { $OVERLOADS{'sqrt'} = sub { PDL::sqrt($_[0]) } } | |||
#line 1342 "Ops.pm" | #line 1181 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 sqrt | =head2 sqrt | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
elementwise square root | elementwise square root | |||
skipping to change at line 1133 | skipping to change at line 1054 | |||
It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | |||
This function is used to overload the unary C<sqrt> operator/function. | This function is used to overload the unary C<sqrt> operator/function. | |||
=for bad | =for bad | |||
sqrt processes bad values. | sqrt processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1377 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*sqrt = \&PDL::sqrt; | *sqrt = \&PDL::sqrt; | |||
#line 1384 "Ops.pm" | ||||
#line 308 "ops.pd" | #line 307 "ops.pd" | |||
#line 176 "ops.pd" | ||||
BEGIN { $OVERLOADS{'sin'} = sub { PDL::sin($_[0]) } } | BEGIN { $OVERLOADS{'sin'} = sub { PDL::sin($_[0]) } } | |||
#line 1391 "Ops.pm" | #line 1221 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 sin | =head2 sin | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
the sin function | the sin function | |||
skipping to change at line 1171 | skipping to change at line 1087 | |||
It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | |||
This function is used to overload the unary C<sin> operator/function. | This function is used to overload the unary C<sin> operator/function. | |||
=for bad | =for bad | |||
sin processes bad values. | sin processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1426 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*sin = \&PDL::sin; | *sin = \&PDL::sin; | |||
#line 1433 "Ops.pm" | ||||
#line 308 "ops.pd" | #line 307 "ops.pd" | |||
#line 176 "ops.pd" | ||||
BEGIN { $OVERLOADS{'cos'} = sub { PDL::cos($_[0]) } } | BEGIN { $OVERLOADS{'cos'} = sub { PDL::cos($_[0]) } } | |||
#line 1440 "Ops.pm" | #line 1261 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 cos | =head2 cos | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
the cos function | the cos function | |||
skipping to change at line 1209 | skipping to change at line 1120 | |||
It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | |||
This function is used to overload the unary C<cos> operator/function. | This function is used to overload the unary C<cos> operator/function. | |||
=for bad | =for bad | |||
cos processes bad values. | cos processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1475 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*cos = \&PDL::cos; | *cos = \&PDL::cos; | |||
#line 1482 "Ops.pm" | ||||
#line 308 "ops.pd" | #line 307 "ops.pd" | |||
#line 176 "ops.pd" | ||||
BEGIN { $OVERLOADS{'!'} = sub { PDL::not($_[0]) } } | BEGIN { $OVERLOADS{'!'} = sub { PDL::not($_[0]) } } | |||
#line 1489 "Ops.pm" | #line 1301 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 not | =head2 not | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
the elementwise I<not> operation | the elementwise I<not> operation | |||
skipping to change at line 1247 | skipping to change at line 1153 | |||
It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | |||
This function is used to overload the unary C<!> operator/function. | This function is used to overload the unary C<!> operator/function. | |||
=for bad | =for bad | |||
not processes bad values. | not processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1524 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*not = \&PDL::not; | *not = \&PDL::not; | |||
#line 1531 "Ops.pm" | ||||
#line 308 "ops.pd" | #line 307 "ops.pd" | |||
#line 176 "ops.pd" | ||||
BEGIN { $OVERLOADS{'exp'} = sub { PDL::exp($_[0]) } } | BEGIN { $OVERLOADS{'exp'} = sub { PDL::exp($_[0]) } } | |||
#line 1538 "Ops.pm" | #line 1341 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 exp | =head2 exp | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
the exponential function | the exponential function | |||
skipping to change at line 1285 | skipping to change at line 1186 | |||
It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | |||
This function is used to overload the unary C<exp> operator/function. | This function is used to overload the unary C<exp> operator/function. | |||
=for bad | =for bad | |||
exp processes bad values. | exp processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1573 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*exp = \&PDL::exp; | *exp = \&PDL::exp; | |||
#line 1580 "Ops.pm" | ||||
#line 308 "ops.pd" | #line 307 "ops.pd" | |||
#line 176 "ops.pd" | ||||
BEGIN { $OVERLOADS{'log'} = sub { PDL::log($_[0]) } } | BEGIN { $OVERLOADS{'log'} = sub { PDL::log($_[0]) } } | |||
#line 1587 "Ops.pm" | #line 1381 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 log | =head2 log | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
the natural logarithm | the natural logarithm | |||
skipping to change at line 1323 | skipping to change at line 1219 | |||
It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | |||
This function is used to overload the unary C<log> operator/function. | This function is used to overload the unary C<log> operator/function. | |||
=for bad | =for bad | |||
log processes bad values. | log processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1622 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*log = \&PDL::log; | *log = \&PDL::log; | |||
#line 1629 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 re | =head2 re | |||
=for sig | =for sig | |||
Signature: (complexv(); real [o]b()) | Signature: (complexv(); real [o]b()) | |||
=for ref | =for ref | |||
Returns the real part of a complex number. Flows data back & forth. | Returns the real part of a complex number. Flows data back & forth. | |||
=for bad | =for bad | |||
re processes bad values. | re processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1654 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*re = \&PDL::re; | *re = \&PDL::re; | |||
#line 1661 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 im | =head2 im | |||
=for sig | =for sig | |||
Signature: (complexv(); real [o]b()) | Signature: (complexv(); real [o]b()) | |||
=for ref | =for ref | |||
Returns the imaginary part of a complex number. Flows data back & forth. | Returns the imaginary part of a complex number. Flows data back & forth. | |||
=for bad | =for bad | |||
im processes bad values. | im processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1686 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*im = \&PDL::im; | *im = \&PDL::im; | |||
#line 1693 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 _cabs | =head2 _cabs | |||
=for sig | =for sig | |||
Signature: (complexv(); real [o]b()) | Signature: (complexv(); real [o]b()) | |||
=for ref | =for ref | |||
Returns the absolute (length) of a complex number. | Returns the absolute (length) of a complex number. | |||
=for bad | =for bad | |||
_cabs processes bad values. | _cabs processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1718 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
#line 1723 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
#line 1728 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 log10 | =head2 log10 | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
the base 10 logarithm | the base 10 logarithm | |||
skipping to change at line 1432 | skipping to change at line 1301 | |||
It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | |||
This function is used to overload the unary C<log10> operator/function. | This function is used to overload the unary C<log10> operator/function. | |||
=for bad | =for bad | |||
log10 processes bad values. | log10 processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1763 "Ops.pm" | ||||
#line 959 "../../blib/lib/PDL/PP.pm" | ||||
sub PDL::log10 { | sub PDL::log10 { | |||
my $x = shift; | my $x = shift; | |||
if ( ! UNIVERSAL::isa($x,"PDL") ) { return log($x) / log(10); } | if ( ! UNIVERSAL::isa($x,"PDL") ) { return log($x) / log(10); } | |||
my $y; | my $y; | |||
if ( $x->is_inplace ) { $x->set_inplace(0); $y = $x; } | if ( $x->is_inplace ) { $x->set_inplace(0); $y = $x; } | |||
elsif( ref($x) eq "PDL"){ | elsif( ref($x) eq "PDL"){ | |||
#PDL Objects, use nullcreate: | #PDL Objects, use nullcreate: | |||
$y = PDL->nullcreate($x); | $y = PDL->nullcreate($x); | |||
}else{ | }else{ | |||
#PDL-Derived Object, use copy: (Consistent with | #PDL-Derived Object, use copy: (Consistent with | |||
# Auto-creation docs in Objects.pod) | # Auto-creation docs in Objects.pod) | |||
$y = $x->copy; | $y = $x->copy; | |||
} | } | |||
&PDL::_log10_int( $x, $y ); | &PDL::_log10_int( $x, $y ); | |||
return $y; | return $y; | |||
}; | }; | |||
#line 1786 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*log10 = \&PDL::log10; | *log10 = \&PDL::log10; | |||
#line 1793 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 assgn | =head2 assgn | |||
=for sig | =for sig | |||
Signature: (a(); [o]b()) | Signature: (a(); [o]b()) | |||
=for ref | =for ref | |||
Plain numerical assignment. This is used to implement the ".=" operator | Plain numerical assignment. This is used to implement the ".=" operator | |||
=for bad | =for bad | |||
assgn processes bad values. | assgn processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1818 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*assgn = \&PDL::assgn; | *assgn = \&PDL::assgn; | |||
#line 1825 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 carg | =head2 carg | |||
=for sig | =for sig | |||
Signature: (complexv(); real [o]b()) | Signature: (complexv(); real [o]b()) | |||
=for ref | =for ref | |||
Returns the polar angle of a complex number. | Returns the polar angle of a complex number. | |||
=for bad | =for bad | |||
carg processes bad values. | carg processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1850 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*carg = \&PDL::carg; | *carg = \&PDL::carg; | |||
#line 1857 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 conj | =head2 conj | |||
=for sig | =for sig | |||
Signature: (complexv(); [o]b()) | Signature: (complexv(); [o]b()) | |||
=for ref | =for ref | |||
complex conjugate. | complex conjugate. | |||
=for bad | =for bad | |||
conj processes bad values. | conj processes bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1882 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*conj = \&PDL::conj; | *conj = \&PDL::conj; | |||
#line 1889 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 czip | =head2 czip | |||
=for sig | =for sig | |||
Signature: (r(); i(); complex [o]c()) | Signature: (r(); i(); complex [o]c()) | |||
convert real, imaginary to native complex, (sort of) like LISP zip | convert real, imaginary to native complex, (sort of) like LISP zip | |||
function. Will add the C<r> ndarray to "i" times the C<i> ndarray. Only | function. Will add the C<r> ndarray to "i" times the C<i> ndarray. Only | |||
takes real ndarrays as input. | takes real ndarrays as input. | |||
=for bad | =for bad | |||
czip does not process bad values. | czip does not process bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1915 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*czip = \&PDL::czip; | *czip = \&PDL::czip; | |||
#line 1922 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 ipow | =head2 ipow | |||
=for sig | =for sig | |||
Signature: (a(); indx b(); [o] ans()) | Signature: (a(); indx b(); [o] ans()) | |||
=for ref | =for ref | |||
raise ndarray C<$a> to integer power C<$b> | raise ndarray C<$a> to integer power C<$b> | |||
skipping to change at line 1587 | skipping to change at line 1423 | |||
It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | It can be made to work inplace with the C<$x-E<gt>inplace> syntax. | |||
Algorithm from L<Wikipedia|http://en.wikipedia.org/wiki/Exponentiation_by_squari ng> | Algorithm from L<Wikipedia|http://en.wikipedia.org/wiki/Exponentiation_by_squari ng> | |||
=for bad | =for bad | |||
ipow does not process bad values. | ipow does not process bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 1960 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*ipow = \&PDL::ipow; | *ipow = \&PDL::ipow; | |||
#line 1967 "Ops.pm" | ||||
#line 568 "ops.pd" | #line 567 "ops.pd" | |||
=head2 abs | =head2 abs | |||
=for ref | =for ref | |||
Returns the absolute value of a number. | Returns the absolute value of a number. | |||
=cut | =cut | |||
sub PDL::abs { $_[0]->type->real ? goto &PDL::_rabs : goto &PDL::_cabs } | sub PDL::abs { $_[0]->type->real ? goto &PDL::_rabs : goto &PDL::_cabs } | |||
#line 1983 "Ops.pm" | ||||
#line 580 "ops.pd" | ||||
#line 176 "ops.pd" | ||||
BEGIN { $OVERLOADS{'abs'} = sub { PDL::abs($_[0]) } } | BEGIN { $OVERLOADS{'abs'} = sub { PDL::abs($_[0]) } } | |||
#line 1990 "Ops.pm" | #line 581 "ops.pd" | |||
#line 582 "ops.pd" | ||||
=head2 abs2 | =head2 abs2 | |||
=for ref | =for ref | |||
Returns the square of the absolute value of a number. | Returns the square of the absolute value of a number. | |||
=cut | =cut | |||
sub PDL::abs2 ($) { my $r = &PDL::abs; $r * $r } | sub PDL::abs2 ($) { my $r = &PDL::abs; $r * $r } | |||
#line 2006 "Ops.pm" | #line 1726 "Ops.pm" | |||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 r2C | =head2 r2C | |||
=for sig | =for sig | |||
Signature: (r(); complex [o]c()) | Signature: (r(); complex [o]c()) | |||
=for ref | =for ref | |||
convert real to native complex, with an imaginary part of zero | convert real to native complex, with an imaginary part of zero | |||
=for bad | =for bad | |||
r2C does not process bad values. | r2C does not process bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 2031 "Ops.pm" | ||||
#line 959 "../../blib/lib/PDL/PP.pm" | ||||
sub PDL::r2C ($) { | sub PDL::r2C ($) { | |||
return $_[0] if UNIVERSAL::isa($_[0], 'PDL') and !$_[0]->type->real; | return $_[0] if UNIVERSAL::isa($_[0], 'PDL') and !$_[0]->type->real; | |||
my $r = $_[1] // PDL->nullcreate($_[0]); | my $r = $_[1] // PDL->nullcreate($_[0]); | |||
PDL::_r2C_int($_[0], $r); | PDL::_r2C_int($_[0], $r); | |||
$r; | $r; | |||
} | } | |||
#line 2043 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*r2C = \&PDL::r2C; | *r2C = \&PDL::r2C; | |||
#line 2050 "Ops.pm" | ||||
#line 958 "../../blib/lib/PDL/PP.pm" | ||||
=head2 i2C | =head2 i2C | |||
=for sig | =for sig | |||
Signature: (i(); complex [o]c()) | Signature: (i(); complex [o]c()) | |||
=for ref | =for ref | |||
convert imaginary to native complex, with a real part of zero | convert imaginary to native complex, with a real part of zero | |||
=for bad | =for bad | |||
i2C does not process bad values. | i2C does not process bad values. | |||
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. | |||
=cut | =cut | |||
#line 2075 "Ops.pm" | ||||
#line 959 "../../blib/lib/PDL/PP.pm" | ||||
sub PDL::i2C ($) { | sub PDL::i2C ($) { | |||
return $_[0] if UNIVERSAL::isa($_[0], 'PDL') and !$_[0]->type->real; | return $_[0] if UNIVERSAL::isa($_[0], 'PDL') and !$_[0]->type->real; | |||
my $r = $_[1] // PDL->nullcreate($_[0]); | my $r = $_[1] // PDL->nullcreate($_[0]); | |||
PDL::_i2C_int($_[0], $r); | PDL::_i2C_int($_[0], $r); | |||
$r; | $r; | |||
} | } | |||
#line 2087 "Ops.pm" | ||||
#line 960 "../../blib/lib/PDL/PP.pm" | ||||
*i2C = \&PDL::i2C; | *i2C = \&PDL::i2C; | |||
#line 2094 "Ops.pm" | ||||
#line 625 "ops.pd" | #line 624 "ops.pd" | |||
# This is to used warn if an operand is non-numeric or non-PDL. | # This is to used warn if an operand is non-numeric or non-PDL. | |||
sub warn_non_numeric_op_wrapper { | sub warn_non_numeric_op_wrapper { | |||
require Scalar::Util; | require Scalar::Util; | |||
my ($cb, $op_name) = @_; | my ($cb, $op_name) = @_; | |||
return sub { | return sub { | |||
my ($op1, $op2) = @_; | my ($op1, $op2) = @_; | |||
warn "'$op2' is not numeric nor a PDL in operator $op_name" | warn "'$op2' is not numeric nor a PDL in operator $op_name" | |||
unless Scalar::Util::looks_like_number($op2) | unless Scalar::Util::looks_like_number($op2) | |||
|| ( Scalar::Util::blessed($op2) && $op2->isa('PDL') ); | || ( Scalar::Util::blessed($op2) && $op2->isa('PDL') ); | |||
skipping to change at line 1722 | skipping to change at line 1532 | |||
"eq" => PDL::Ops::warn_non_numeric_op_wrapper(\&PDL::eq, 'eq'), | "eq" => PDL::Ops::warn_non_numeric_op_wrapper(\&PDL::eq, 'eq'), | |||
".=" => sub { | ".=" => sub { | |||
my @args = !$_[2] ? @_[1,0] : @_[0,1]; | my @args = !$_[2] ? @_[1,0] : @_[0,1]; | |||
PDL::Ops::assgn(@args); | PDL::Ops::assgn(@args); | |||
return $args[1]; | return $args[1]; | |||
}, | }, | |||
'++' => sub { $_[0] += 1 }, | '++' => sub { $_[0] += 1 }, | |||
'--' => sub { $_[0] -= 1 }, | '--' => sub { $_[0] -= 1 }, | |||
; | ; | |||
} | } | |||
#line 2125 "Ops.pm" | ||||
#line 49 "ops.pd" | #line 49 "ops.pd" | |||
=head1 AUTHOR | =head1 AUTHOR | |||
Tuomas J. Lukka (lukka@fas.harvard.edu), | Tuomas J. Lukka (lukka@fas.harvard.edu), | |||
Karl Glazebrook (kgb@aaoepp.aao.gov.au), | Karl Glazebrook (kgb@aaoepp.aao.gov.au), | |||
Doug Hunt (dhunt@ucar.edu), | Doug Hunt (dhunt@ucar.edu), | |||
Christian Soeller (c.soeller@auckland.ac.nz), | Christian Soeller (c.soeller@auckland.ac.nz), | |||
Doug Burke (burke@ifa.hawaii.edu), | Doug Burke (burke@ifa.hawaii.edu), | |||
and Craig DeForest (deforest@boulder.swri.edu). | and Craig DeForest (deforest@boulder.swri.edu). | |||
=cut | =cut | |||
#line 2144 "Ops.pm" | #line 1838 "Ops.pm" | |||
# Exit with OK status | # Exit with OK status | |||
1; | 1; | |||
End of changes. 242 change blocks. | ||||
366 lines changed or deleted | 174 lines changed or added |