ops.pd (PDL-2.076) | : | ops.pd (PDL-2.077) | ||
---|---|---|---|---|
skipping to change at line 656 | skipping to change at line 656 | |||
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') ); | |||
$cb->(@_); | $cb->(@_); | |||
} | } | |||
} | } | |||
{ package PDL; | { package PDL; | |||
use Carp; | ||||
use overload %OVERLOADS, | use overload %OVERLOADS, | |||
"eq" => PDL::Ops::warn_non_numeric_op_wrapper(\&PDL::eq, 'eq'), | "eq" => PDL::Ops::warn_non_numeric_op_wrapper(\&PDL::eq, 'eq'), | |||
"=" => sub {$_[0]}, # Don't deep copy, just copy reference | ||||
".=" => 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]; | |||
}, | }, | |||
'bool' => sub { | ||||
return 0 if $_[0]->isnull; | ||||
confess("multielement ndarray in conditional expression (see PDL::FAQ ques | ||||
tions 6-10 and 6-11)") | ||||
unless $_[0]->nelem == 1; | ||||
$_[0]->clump(-1)->at(0); | ||||
}, | ||||
'++' => sub { $_[0] += 1 }, | '++' => sub { $_[0] += 1 }, | |||
'--' => sub { $_[0] -= 1 }, | '--' => sub { $_[0] -= 1 }, | |||
; | ; | |||
} | } | |||
EOF | EOF | |||
pp_done(); | pp_done(); | |||
End of changes. 4 change blocks. | ||||
10 lines changed or deleted | 1 lines changed or added |