The docs for many functions in PDL::Ops give 3 ways to call the function. Using 'lt' as an example:
$c = lt $a, $b, 0; # explicit call with trailing 0
$c = $a < $b; # overloaded call
$a->inplace->lt($b,0); # modify $a inplace
The first form does not work as advertised.
$a = pdl(1,2,3); $b = pdl(3,2,1);
$c = lt $a, $b, 0;
syntax error at (eval 67) line 4, near "= lt"
Similarly 'plus' gives this example that does not work:
$c = plus $a, $b, 0;
Usage: PDL::plus(a,b,c,swap) (you may leave temporaries or output variables out of list)
and so on... The ->inplace form seems to work OK.
perldl -V attached.
Marking as priority '7' because it seems pretty important, but my guess is very few people actually try to call the functions that way (as evidenced by the fact that nobody has reported this before).
I think this may be a case of more than one definition of lt(), plus() that are conflicting.
When I do PDL::lt($a,$b,0) it seems to work fine. Similarly for PDL::plus($a,$b,0).
This is for PDL-2.012.
A little debugging shows the failure with 'lt' is because that is a perl builtin and presumably the prototypes are different.
The issue with 'plus' is that it is a non-swap binary operator but the biop() routine to generate the pp_def doesn't correctly omit the declaration of the swap in OtherPars.
This is in PDL/Basic/Ops/ops.pd
Well, plus() was not being generated correctly and that has been fixed. The actual problem is that plus is not exported by PDL::Ops so when you run $c = plus $a, $b, 0; you are actually using indirect object syntax which is why you get the error. This is enough of a mess to properly sort out, I think we may not want to address this for PDL-2.014.
This matter will now be tracked at https://github.com/PDLPorters/pdl/issues/125