ops.pd (PDL-2.080) | : | ops.pd (PDL-2.081) | ||
---|---|---|---|---|
skipping to change at line 266 | skipping to change at line 266 | |||
if (anybad) \$PDLSTATESETBAD(c); | if (anybad) \$PDLSTATESETBAD(c); | |||
}), | }), | |||
%extra, | %extra, | |||
Doc => << "EOD"); | Doc => << "EOD"); | |||
=for ref | =for ref | |||
$doc | $doc | |||
=for example | =for example | |||
\$c = \$x->$name(\$y,0); # explicit function call | \$c = \$x->$name(\$y); # explicit call with default swap of 0 | |||
\$c = \$x->$name(\$y, 1); # explicit call with trailing 1 to swap args | ||||
$ovcall | $ovcall | |||
\$x->inplace->$name(\$y,0); # modify \$x inplace | \$x->inplace->$name(\$y,0); # modify \$x inplace | |||
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 binary C<$funcovp> function. | This function is used to overload the binary C<$funcovp> function. | |||
Note that when calling this function explicitly you need to supply | As of 2.065, when calling this function explicitly you can omit | |||
a third argument that should generally be zero (see first example). | the third argument (see first example), or supply it (see second one). | |||
This restriction is expected to go away in future releases. | ||||
=cut | =cut | |||
EOD | EOD | |||
} # sub: bifunc() | } # sub: bifunc() | |||
# simple unary functions and operators | # simple unary functions and operators | |||
sub ufunc { | sub ufunc { | |||
my ($name,$func,$overload,$doc,%extra) = @_; | my ($name,$func,$overload,$doc,%extra) = @_; | |||
my $funcov = ref $func eq 'ARRAY' ? $func->[1] : $func; | my $funcov = ref $func eq 'ARRAY' ? $func->[1] : $func; | |||
skipping to change at line 528 | skipping to change at line 528 | |||
); | ); | |||
pp_def('ipow', | pp_def('ipow', | |||
Doc => qq{ | Doc => qq{ | |||
=for ref | =for ref | |||
raise ndarray C<\$a> to integer power C<\$b> | raise ndarray C<\$a> to integer power C<\$b> | |||
=for example | =for example | |||
\$c = \$x->ipow(\$y,0); # explicit function call | \$c = \$x->ipow(\$y); # as method | |||
\$c = ipow \$x, \$y; | \$c = ipow \$x, \$y; | |||
\$x->inplace->ipow(\$y,0); # modify \$x inplace | \$x->inplace->ipow(\$y); # modify \$x inplace | |||
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. | |||
Note that when calling this function explicitly you need to supply | ||||
a third argument that should generally be zero (see first example). | ||||
This restriction is expected to go away in future releases. | ||||
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> | |||
=cut | =cut | |||
}, | }, | |||
Pars => 'a(); indx b(); [o] ans()', | Pars => 'a(); indx b(); [o] ans()', | |||
GenericTypes => $AF, | GenericTypes => $AF, | |||
Code => pp_line_numbers(__LINE__, q{ | Code => pp_line_numbers(__LINE__, q{ | |||
PDL_Indx n = $b(); | PDL_Indx n = $b(); | |||
End of changes. 5 change blocks. | ||||
9 lines changed or deleted | 6 lines changed or added |