Ops.pm (PDL-2.076) | : | Ops.pm (PDL-2.077) | ||
---|---|---|---|---|
skipping to change at line 1723 | skipping to change at line 1723 | |||
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 }, | |||
; | ; | |||
} | } | |||
#line 2144 "Ops.pm" | #line 2136 "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 2163 "Ops.pm" | #line 2155 "Ops.pm" | |||
# Exit with OK status | # Exit with OK status | |||
1; | 1; | |||
End of changes. 6 change blocks. | ||||
12 lines changed or deleted | 3 lines changed or added |