"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "GENERATED/PDL/Primitive.pm" between
PDL-2.075.tar.gz and PDL-2.076.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

Primitive.pm  (PDL-2.075):Primitive.pm  (PDL-2.076)
# #
# GENERATED WITH PDL::PP! Don't modify! # GENERATED WITH PDL::PP! Don't modify!
# #
package PDL::Primitive; package PDL::Primitive;
our @EXPORT_OK = qw(inner outer matmult matmult innerwt inner2 inner2d inner2t c rossp norm indadd conv1d in uniq uniqind uniqvec hclip lclip clip clip wtstat st atsover stats histogram whistogram histogram2d whistogram2d fibonacci append axi svalues srand random randsym grandom vsearch vsearch_sample vsearch_insert_leftm ost vsearch_insert_rightmost vsearch_match vsearch_bin_inclusive vsearch_bin_exc lusive interpolate interpol interpND one2nd which which_both where whereND which ND setops intersect ); our @EXPORT_OK = qw(inner outer matmult innerwt inner2 inner2d inner2t crossp no rm indadd conv1d in uniq uniqind uniqvec hclip lclip clip clip wtstat statsover stats histogram whistogram histogram2d whistogram2d fibonacci append axisvalues srand random randsym grandom vsearch vsearch_sample vsearch_insert_leftmost vsea rch_insert_rightmost vsearch_match vsearch_bin_inclusive vsearch_bin_exclusive i nterpolate interpol interpND one2nd which which_both where whereND whichND setop s intersect );
our %EXPORT_TAGS = (Func=>\@EXPORT_OK); our %EXPORT_TAGS = (Func=>\@EXPORT_OK);
use PDL::Core; use PDL::Core;
use PDL::Exporter; use PDL::Exporter;
use DynaLoader; use DynaLoader;
our @ISA = ( 'PDL::Exporter','DynaLoader' ); our @ISA = ( 'PDL::Exporter','DynaLoader' );
push @PDL::Core::PP, __PACKAGE__; push @PDL::Core::PP, __PACKAGE__;
bootstrap PDL::Primitive ; bootstrap PDL::Primitive ;
skipping to change at line 140 skipping to change at line 140
PDL overloads the C<x> operator (normally the repeat operator) for PDL overloads the C<x> operator (normally the repeat operator) for
matrix multiplication. The number of columns (size of the 0 matrix multiplication. The number of columns (size of the 0
dimension) in the left-hand argument must normally equal the number of dimension) in the left-hand argument must normally equal the number of
rows (size of the 1 dimension) in the right-hand argument. rows (size of the 1 dimension) in the right-hand argument.
Row vectors are represented as (N x 1) two-dimensional PDLs, or you Row vectors are represented as (N x 1) two-dimensional PDLs, or you
may be sloppy and use a one-dimensional PDL. Column vectors are may be sloppy and use a one-dimensional PDL. Column vectors are
represented as (1 x N) two-dimensional PDLs. represented as (1 x N) two-dimensional PDLs.
Threading occurs in the usual way, but as both the 0 and 1 dimension Broadcasting occurs in the usual way, but as both the 0 and 1 dimension
(if present) are included in the operation, you must be sure that (if present) are included in the operation, you must be sure that
you don't try to broadcast over either of those dims. you don't try to broadcast over either of those dims.
Of note, due to how Perl v5.14.0 and above implement operator overloading of Of note, due to how Perl v5.14.0 and above implement operator overloading of
the C<x> operator, the use of parentheses for the left operand creates a list the C<x> operator, the use of parentheses for the left operand creates a list
context, that is context, that is
pdl> ( $x * $y ) x $z pdl> ( $x * $y ) x $z
ERROR: Argument "..." isn't numeric in repeat (x) ... ERROR: Argument "..." isn't numeric in repeat (x) ...
skipping to change at line 210 skipping to change at line 210
[3 6] [3 6]
[4 8] [4 8]
] ]
INTERNALS INTERNALS
The mechanics of the multiplication are carried out by the The mechanics of the multiplication are carried out by the
L</matmult> method. L</matmult> method.
=cut =cut
#line 248 "Primitive.pm" #line 247 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 matmult =head2 matmult
=for sig =for sig
Signature: (a(t,h); b(w,t); [o]c(w,h)) Signature: (a(t,h); b(w,t); [o]c(w,h))
=for ref =for ref
skipping to change at line 241 skipping to change at line 241
footprint within cache as long as possible on most modern CPUs. footprint within cache as long as possible on most modern CPUs.
For usage, see L</x>, a description of the overloaded 'x' operator For usage, see L</x>, a description of the overloaded 'x' operator
=for bad =for bad
matmult ignores the bad-value flag of the input ndarrays. matmult ignores the bad-value flag 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. 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 286 "Primitive.pm" #line 285 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub PDL::matmult { sub PDL::matmult {
my ($x,$y,$c) = @_; my ($x,$y,$c) = @_;
$y = PDL->topdl($y);
$y = pdl($y) unless eval { $y->isa('PDL') }; $c = PDL->null unless do { local $@; eval { $c->isa('PDL') } };
$c = PDL->null unless eval { $c->isa('PDL') };
while($x->getndims < 2) {$x = $x->dummy(-1)} while($x->getndims < 2) {$x = $x->dummy(-1)}
while($y->getndims < 2) {$y = $y->dummy(-1)} while($y->getndims < 2) {$y = $y->dummy(-1)}
return ($c .= $x * $y) if( ($x->dim(0)==1 && $x->dim(1)==1) || return ($c .= $x * $y) if( ($x->dim(0)==1 && $x->dim(1)==1) ||
($y->dim(0)==1 && $y->dim(1)==1) ); ($y->dim(0)==1 && $y->dim(1)==1) );
if($y->dim(1) != $x->dim(0)) { barf sprintf 'Dim mismatch in matmult of [%1$dx%2$d] x [%3$dx%4$d]: %1$d !=
barf(sprintf("Dim mismatch in matmult of [%dx%d] x [%dx%d]: %d != %d",$x %4$d',$x->dim(0),$x->dim(1),$y->dim(0),$y->dim(1)
->dim(0),$x->dim(1),$y->dim(0),$y->dim(1),$x->dim(0),$y->dim(1))); if $y->dim(1) != $x->dim(0);
}
PDL::_matmult_int($x,$y,$c); PDL::_matmult_int($x,$y,$c);
$c; $c;
} }
#line 309 "Primitive.pm" #line 304 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*matmult = \&PDL::matmult; *matmult = \&PDL::matmult;
#line 316 "Primitive.pm" #line 311 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 innerwt =head2 innerwt
=for sig =for sig
Signature: (a(n); b(n); c(n); [o]d()) Signature: (a(n); b(n); c(n); [o]d())
=for ref =for ref
skipping to change at line 289 skipping to change at line 285
Weighted (i.e. triple) inner product Weighted (i.e. triple) inner product
d = sum_i a(i) b(i) c(i) d = sum_i a(i) b(i) c(i)
=for bad =for bad
innerwt processes bad values. innerwt 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 347 "Primitive.pm" #line 342 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*innerwt = \&PDL::innerwt; *innerwt = \&PDL::innerwt;
#line 354 "Primitive.pm" #line 349 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 inner2 =head2 inner2
=for sig =for sig
Signature: (a(n); b(n,m); c(m); [o]d()) Signature: (a(n); b(n,m); c(m); [o]d())
=for ref =for ref
skipping to change at line 319 skipping to change at line 315
Note that you should probably not broadcast over C<a> and C<c> since that would be Note that you should probably not broadcast over C<a> and C<c> since that would be
very wasteful. Instead, you should use a temporary for C<b*c>. very wasteful. Instead, you should use a temporary for C<b*c>.
=for bad =for bad
inner2 processes bad values. inner2 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 386 "Primitive.pm" #line 381 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*inner2 = \&PDL::inner2; *inner2 = \&PDL::inner2;
#line 393 "Primitive.pm" #line 388 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 inner2d =head2 inner2d
=for sig =for sig
Signature: (a(n,m); b(n,m); [o]c()) Signature: (a(n,m); b(n,m); [o]c())
=for ref =for ref
skipping to change at line 348 skipping to change at line 344
Equivalent to Equivalent to
$c = inner($x->clump(2), $y->clump(2)) $c = inner($x->clump(2), $y->clump(2))
=for bad =for bad
inner2d processes bad values. inner2d 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 426 "Primitive.pm" #line 421 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*inner2d = \&PDL::inner2d; *inner2d = \&PDL::inner2d;
#line 433 "Primitive.pm" #line 428 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 inner2t =head2 inner2t
=for sig =for sig
Signature: (a(j,n); b(n,m); c(m,k); [t]tmp(n,k); [o]d(j,k))) Signature: (a(j,n); b(n,m); c(m,k); [t]tmp(n,k); [o]d(j,k)))
=for ref =for ref
skipping to change at line 385 skipping to change at line 381
It is hoped that things like this could be taken care of as a kind of It is hoped that things like this could be taken care of as a kind of
closures at some point. closures at some point.
=for bad =for bad
inner2t processes bad values. inner2t 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 474 "Primitive.pm" #line 469 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*inner2t = \&PDL::inner2t; *inner2t = \&PDL::inner2t;
#line 481 "Primitive.pm" #line 476 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 crossp =head2 crossp
=for sig =for sig
Signature: (a(tri=3); b(tri); [o] c(tri)) Signature: (a(tri=3); b(tri); [o] c(tri))
=for ref =for ref
skipping to change at line 419 skipping to change at line 415
the inner product C<$c*$x> and C<$c*$y> will be zero, i.e. C<$c> is the inner product C<$c*$x> and C<$c*$y> will be zero, i.e. C<$c> is
orthogonal to C<$x> and C<$y> orthogonal to C<$x> and C<$y>
=for bad =for bad
crossp does not process bad values. crossp 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 518 "Primitive.pm" #line 513 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*crossp = \&PDL::crossp; *crossp = \&PDL::crossp;
#line 525 "Primitive.pm" #line 520 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 norm =head2 norm
=for sig =for sig
Signature: (vec(n); [o] norm(n)) Signature: (vec(n); [o] norm(n))
=for ref =for ref
Normalises a vector to unit Euclidean length Normalises a vector to unit Euclidean length
=for bad =for bad
norm processes bad values. norm 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 550 "Primitive.pm" #line 545 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*norm = \&PDL::norm; *norm = \&PDL::norm;
#line 557 "Primitive.pm" #line 552 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 indadd =head2 indadd
=for sig =for sig
Signature: (a(n); indx ind(n); [o] sum(m)) Signature: (a(n); indx ind(n); [o] sum(m))
=for ref =for ref
skipping to change at line 494 skipping to change at line 490
#Result: ( 1, 2, and 3 added to elements 1,4,6 $sum) #Result: ( 1, 2, and 3 added to elements 1,4,6 $sum)
# [0 1 0 0 2 0 3 0 0 0] # [0 1 0 0 2 0 3 0 0 0]
=for bad =for bad
=for bad =for bad
The routine barfs if any of the indices are bad. The routine barfs if any of the indices are bad.
=cut =cut
#line 612 "Primitive.pm" #line 607 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*indadd = \&PDL::indadd; *indadd = \&PDL::indadd;
#line 619 "Primitive.pm" #line 614 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 conv1d =head2 conv1d
=for sig =for sig
Signature: (a(m); kern(p); [o]b(m); int reflect) Signature: (a(m); kern(p); [o]b(m); int reflect)
=for ref =for ref
skipping to change at line 565 skipping to change at line 561
the numeric value of C<< $pdl->badvalue >> so it is not the numeric value of C<< $pdl->badvalue >> so it is not
recommended for processing pdls with bad values in them recommended for processing pdls with bad values in them
unless special care is taken. unless special care is taken.
=for bad =for bad
conv1d ignores the bad-value flag of the input ndarrays. conv1d ignores the bad-value flag 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. 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 694 "Primitive.pm" #line 689 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub PDL::conv1d { sub PDL::conv1d {
my $opt = pop @_ if ref($_[$#_]) eq 'HASH'; my $opt = pop @_ if ref($_[$#_]) eq 'HASH';
die 'Usage: conv1d( a(m), kern(p), [o]b(m), {Options} )' die 'Usage: conv1d( a(m), kern(p), [o]b(m), {Options} )'
if $#_<1 || $#_>2; if $#_<1 || $#_>2;
my($x,$kern) = @_; my($x,$kern) = @_;
my $c = $#_ == 2 ? $_[2] : PDL->null; my $c = $#_ == 2 ? $_[2] : PDL->null;
PDL::_conv1d_int($x,$kern,$c, PDL::_conv1d_int($x,$kern,$c,
!(defined $opt && exists $$opt{Boundary}) ? 0 : !(defined $opt && exists $$opt{Boundary}) ? 0 :
lc $$opt{Boundary} eq "reflect"); lc $$opt{Boundary} eq "reflect");
return $c; return $c;
} }
#line 713 "Primitive.pm" #line 708 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*conv1d = \&PDL::conv1d; *conv1d = \&PDL::conv1d;
#line 720 "Primitive.pm" #line 715 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 in =head2 in
=for sig =for sig
Signature: (a(); b(n); [o] c()) Signature: (a(); b(n); [o] c())
=for ref =for ref
skipping to change at line 620 skipping to change at line 616
However, C<in> doesn't create a (potentially large) intermediate However, C<in> doesn't create a (potentially large) intermediate
and is generally faster. and is generally faster.
=for bad =for bad
in does not process bad values. in 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 763 "Primitive.pm" #line 758 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*in = \&PDL::in; *in = \&PDL::in;
#line 770 "Primitive.pm" #line 765 "Primitive.pm"
#line 784 "primitive.pd" #line 770 "primitive.pd"
=head2 uniq =head2 uniq
=for ref =for ref
return all unique elements of an ndarray return all unique elements of an ndarray
The unique elements are returned in ascending order. The unique elements are returned in ascending order.
=for example =for example
skipping to change at line 685 skipping to change at line 681
my $uniq = ($srt->nelem > 0) ? $srt->where($srt != $srt->rotate(-1)) : $srt; my $uniq = ($srt->nelem > 0) ? $srt->where($srt != $srt->rotate(-1)) : $srt;
# make sure we return something if there is only one value # make sure we return something if there is only one value
my $answ = $nans; # NaN values always uniq my $answ = $nans; # NaN values always uniq
if ( $uniq->nelem > 0 ) { if ( $uniq->nelem > 0 ) {
$answ = $uniq->append($answ); $answ = $uniq->append($answ);
} else { } else {
$answ = ( ($srt->nelem == 0) ? $srt : PDL::pdl( ref($srt), [$srt->index(0 )] ) )->append($answ); $answ = ( ($srt->nelem == 0) ? $srt : PDL::pdl( ref($srt), [$srt->index(0 )] ) )->append($answ);
} }
return $answ; return $answ;
} }
#line 832 "Primitive.pm" #line 827 "Primitive.pm"
#line 844 "primitive.pd" #line 830 "primitive.pd"
=head2 uniqind =head2 uniqind
=for ref =for ref
Return the indices of all unique elements of an ndarray Return the indices of all unique elements of an ndarray
The order is in the order of the values to be consistent The order is in the order of the values to be consistent
with uniq. C<NaN> values never compare equal with any with uniq. C<NaN> values never compare equal with any
other value and so are always unique. This follows the other value and so are always unique. This follows the
Matlab usage. Matlab usage.
skipping to change at line 749 skipping to change at line 745
} }
# Now map back to the original space # Now map back to the original space
my $ansind = $nanind; my $ansind = $nanind;
if ( $uniqind->nelem > 0 ) { if ( $uniqind->nelem > 0 ) {
$ansind = ($good->index($i_srt->index($uniqind)))->append($ansind); $ansind = ($good->index($i_srt->index($uniqind)))->append($ansind);
} else { } else {
$ansind = $uniqind->append($ansind); $ansind = $uniqind->append($ansind);
} }
return $ansind; return $ansind;
} }
#line 899 "Primitive.pm" #line 894 "Primitive.pm"
#line 910 "primitive.pd" #line 896 "primitive.pd"
=head2 uniqvec =head2 uniqvec
=for ref =for ref
Return all unique vectors out of a collection Return all unique vectors out of a collection
NOTE: If any vectors in the input ndarray have NaN values NOTE: If any vectors in the input ndarray have NaN values
they are returned at the end of the non-NaN ones. This is they are returned at the end of the non-NaN ones. This is
because, by definition, NaN values never compare equal with because, by definition, NaN values never compare equal with
skipping to change at line 825 skipping to change at line 821
my $uniq = $srtdice->nelem > 0 my $uniq = $srtdice->nelem > 0
? ($srtdice != $srtdice->rotate(-1))->mv(0,-1)->orover->which ? ($srtdice != $srtdice->rotate(-1))->mv(0,-1)->orover->which
: $srtdice->orover->which; : $srtdice->orover->which;
my $ans = $uniq->nelem > 0 ? $srtdice->dice($uniq) : my $ans = $uniq->nelem > 0 ? $srtdice->dice($uniq) :
($srtdice->nelem > 0) ? $srtdice->slice("0,:") : ($srtdice->nelem > 0) ? $srtdice->slice("0,:") :
$srtdice; $srtdice;
return $ans->append($somebad)->append($nanvec->mv(0,-1))->mv(0,-1); return $ans->append($somebad)->append($nanvec->mv(0,-1))->mv(0,-1);
} }
#line 977 "Primitive.pm" #line 972 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 hclip =head2 hclip
=for sig =for sig
Signature: (a(); b(); [o] c()) Signature: (a(); b(); [o] c())
=for ref =for ref
clip (threshold) C<$a> by C<$b> (C<$b> is upper bound) clip (threshold) C<$a> by C<$b> (C<$b> is upper bound)
=for bad =for bad
hclip processes bad values. hclip 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 1002 "Primitive.pm" #line 997 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub PDL::hclip { sub PDL::hclip {
my ($x,$y) = @_; my ($x,$y) = @_;
my $c; my $c;
if ($x->is_inplace) { if ($x->is_inplace) {
$x->set_inplace(0); $c = $x; $x->set_inplace(0); $c = $x;
} elsif ($#_ > 1) {$c=$_[2]} else {$c=PDL->nullcreate($x)} } elsif ($#_ > 1) {$c=$_[2]} else {$c=PDL->nullcreate($x)}
PDL::_hclip_int($x,$y,$c); PDL::_hclip_int($x,$y,$c);
return $c; return $c;
} }
#line 1017 "Primitive.pm" #line 1012 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*hclip = \&PDL::hclip; *hclip = \&PDL::hclip;
#line 1024 "Primitive.pm" #line 1019 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 lclip =head2 lclip
=for sig =for sig
Signature: (a(); b(); [o] c()) Signature: (a(); b(); [o] c())
=for ref =for ref
clip (threshold) C<$a> by C<$b> (C<$b> is lower bound) clip (threshold) C<$a> by C<$b> (C<$b> is lower bound)
=for bad =for bad
lclip processes bad values. lclip 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 1049 "Primitive.pm" #line 1044 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub PDL::lclip { sub PDL::lclip {
my ($x,$y) = @_; my ($x,$y) = @_;
my $c; my $c;
if ($x->is_inplace) { if ($x->is_inplace) {
$x->set_inplace(0); $c = $x; $x->set_inplace(0); $c = $x;
} elsif ($#_ > 1) {$c=$_[2]} else {$c=PDL->nullcreate($x)} } elsif ($#_ > 1) {$c=$_[2]} else {$c=PDL->nullcreate($x)}
PDL::_lclip_int($x,$y,$c); PDL::_lclip_int($x,$y,$c);
return $c; return $c;
} }
#line 1064 "Primitive.pm" #line 1059 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*lclip = \&PDL::lclip; *lclip = \&PDL::lclip;
#line 1071 "Primitive.pm" #line 1066 "Primitive.pm"
#line 1027 "primitive.pd" #line 1013 "primitive.pd"
=head2 clip =head2 clip
=for ref =for ref
Clip (threshold) an ndarray by (optional) upper or lower bounds. Clip (threshold) an ndarray by (optional) upper or lower bounds.
=for usage =for usage
$y = $x->clip(0,3); $y = $x->clip(0,3);
$c = $x->clip(undef, $x); $c = $x->clip(undef, $x);
=for bad =for bad
clip handles bad values since it is just a clip handles bad values since it is just a
wrapper around L</hclip> and wrapper around L</hclip> and
L</lclip>. L</lclip>.
=cut =cut
#line 1095 "Primitive.pm" #line 1090 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 clip =head2 clip
=for sig =for sig
Signature: (a(); l(); h(); [o] c()) Signature: (a(); l(); h(); [o] c())
=for ref =for ref
info not available info not available
=for bad =for bad
clip processes bad values. clip 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 1122 "Primitive.pm" #line 1117 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
*clip = \&PDL::clip; *clip = \&PDL::clip;
sub PDL::clip { sub PDL::clip {
my($x, $l, $h) = @_; my($x, $l, $h) = @_;
my $d; my $d;
unless(defined($l) || defined($h)) { unless(defined($l) || defined($h)) {
# Deal with pathological case # Deal with pathological case
if($x->is_inplace) { if($x->is_inplace) {
skipping to change at line 980 skipping to change at line 976
} elsif( defined($l) ) { } elsif( defined($l) ) {
PDL::_lclip_int($x,$l,$d); PDL::_lclip_int($x,$l,$d);
} elsif( defined($h) ) { } elsif( defined($h) ) {
PDL::_hclip_int($x,$h,$d); PDL::_hclip_int($x,$h,$d);
} else { } else {
die "This can't happen (clip contingency) - file a bug"; die "This can't happen (clip contingency) - file a bug";
} }
return $d; return $d;
} }
#line 1161 "Primitive.pm" #line 1156 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*clip = \&PDL::clip; *clip = \&PDL::clip;
#line 1168 "Primitive.pm" #line 1163 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 wtstat =head2 wtstat
=for sig =for sig
Signature: (a(n); wt(n); avg(); [o]b(); int deg) Signature: (a(n); wt(n); avg(); [o]b(); int deg)
=for ref =for ref
skipping to change at line 1012 skipping to change at line 1008
b() = (sum_i wt_i * (a_i ** degree - avg)) / (sum_i wt_i) b() = (sum_i wt_i * (a_i ** degree - avg)) / (sum_i wt_i)
=for bad =for bad
=for bad =for bad
Bad values are ignored in any calculation; C<$b> will only Bad values are ignored in any calculation; C<$b> will only
have its bad flag set if the output contains any bad data. have its bad flag set if the output contains any bad data.
=cut =cut
#line 1202 "Primitive.pm" #line 1197 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*wtstat = \&PDL::wtstat; *wtstat = \&PDL::wtstat;
#line 1209 "Primitive.pm" #line 1204 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 statsover =head2 statsover
=for sig =for sig
Signature: (a(n); w(n); float+ [o]avg(); float+ [o]prms(); int+ [o]median(); i nt+ [o]min(); int+ [o]max(); float+ [o]adev(); float+ [o]rms()) Signature: (a(n); w(n); float+ [o]avg(); float+ [o]prms(); int+ [o]median(); i nt+ [o]min(); int+ [o]max(); float+ [o]adev(); float+ [o]rms())
=for ref =for ref
skipping to change at line 1089 skipping to change at line 1085
use C<clump(-1)> directly on the ndarray or call C<stats>. use C<clump(-1)> directly on the ndarray or call C<stats>.
=for bad =for bad
=for bad =for bad
Bad values are simply ignored in the calculation, effectively reducing Bad values are simply ignored in the calculation, effectively reducing
the sample size. If all data are bad then the output data are marked bad. the sample size. If all data are bad then the output data are marked bad.
=cut =cut
#line 1291 "Primitive.pm" #line 1286 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub PDL::statsover { sub PDL::statsover {
barf('Usage: ($mean,[$prms, $median, $min, $max, $adev, $rms]) = statsover($d ata,[$weights])') if $#_>1; barf('Usage: ($mean,[$prms, $median, $min, $max, $adev, $rms]) = statsover($d ata,[$weights])') if $#_>1;
my ($data, $weights) = @_; my ($data, $weights) = @_;
$weights = $data->ones() if !defined($weights); $weights = $data->ones() if !defined($weights);
my $median = $data->medover(); my $median = $data->medover();
my $mean = PDL->nullcreate($data); my $mean = PDL->nullcreate($data);
my $rms = PDL->nullcreate($data); my $rms = PDL->nullcreate($data);
my $min = PDL->nullcreate($data); my $min = PDL->nullcreate($data);
my $max = PDL->nullcreate($data); my $max = PDL->nullcreate($data);
my $adev = PDL->nullcreate($data); my $adev = PDL->nullcreate($data);
my $prms = PDL->nullcreate($data); my $prms = PDL->nullcreate($data);
PDL::_statsover_int($data, $weights, $mean, $prms, $median, $min, $max, $adev , $rms); PDL::_statsover_int($data, $weights, $mean, $prms, $median, $min, $max, $adev , $rms);
return $mean unless wantarray; return $mean unless wantarray;
return ($mean, $prms, $median, $min, $max, $adev, $rms); return ($mean, $prms, $median, $min, $max, $adev, $rms);
} }
#line 1316 "Primitive.pm" #line 1311 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*statsover = \&PDL::statsover; *statsover = \&PDL::statsover;
#line 1323 "Primitive.pm" #line 1318 "Primitive.pm"
#line 1335 "primitive.pd" #line 1321 "primitive.pd"
=head2 stats =head2 stats
=for ref =for ref
Calculates useful statistics on an ndarray Calculates useful statistics on an ndarray
=for usage =for usage
($mean,$prms,$median,$min,$max,$adev,$rms) = stats($ndarray,[$weights]); ($mean,$prms,$median,$min,$max,$adev,$rms) = stats($ndarray,[$weights]);
skipping to change at line 1161 skipping to change at line 1157
if( ($weights->ndims != $data->ndims) or if( ($weights->ndims != $data->ndims) or
(pdl($weights->dims) != pdl($data->dims))->or (pdl($weights->dims) != pdl($data->dims))->or
) { ) {
$weights = $weights + zeroes($data) $weights = $weights + zeroes($data)
} }
$weights = $weights->flat; $weights = $weights->flat;
} }
return PDL::statsover($data->flat,$weights); return PDL::statsover($data->flat,$weights);
} }
#line 1371 "Primitive.pm" #line 1366 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 histogram =head2 histogram
=for sig =for sig
Signature: (in(n); int+[o] hist(m); double step; double min; int msize => m) Signature: (in(n); int+[o] hist(m); double step; double min; int msize => m)
=for ref =for ref
skipping to change at line 1205 skipping to change at line 1201
pdl> p histogram(pdl(1,1,2),1,0,3) pdl> p histogram(pdl(1,1,2),1,0,3)
[0 2 1] [0 2 1]
=for bad =for bad
histogram processes bad values. histogram 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 1423 "Primitive.pm" #line 1418 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*histogram = \&PDL::histogram; *histogram = \&PDL::histogram;
#line 1430 "Primitive.pm" #line 1425 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 whistogram =head2 whistogram
=for sig =for sig
Signature: (in(n); float+ wt(n);float+[o] hist(m); double step; double min; in t msize => m) Signature: (in(n); float+ wt(n);float+[o] hist(m); double step; double min; in t msize => m)
=for ref =for ref
skipping to change at line 1252 skipping to change at line 1248
pdl> p whistogram(pdl(1,1,2), pdl(0.1,0.1,0.5), 1, 0, 4) pdl> p whistogram(pdl(1,1,2), pdl(0.1,0.1,0.5), 1, 0, 4)
[0 0.2 0.5 0] [0 0.2 0.5 0]
=for bad =for bad
whistogram processes bad values. whistogram 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 1479 "Primitive.pm" #line 1474 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*whistogram = \&PDL::whistogram; *whistogram = \&PDL::whistogram;
#line 1486 "Primitive.pm" #line 1481 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 histogram2d =head2 histogram2d
=for sig =for sig
Signature: (ina(n); inb(n); int+[o] hist(ma,mb); double stepa; double mina; in t masize => ma; Signature: (ina(n); inb(n); int+[o] hist(ma,mb); double stepa; double mina; in t masize => ma;
double stepb; double minb; int mbsize => mb;) double stepb; double minb; int mbsize => mb;)
skipping to change at line 1304 skipping to change at line 1300
[0 2 2] [0 2 2]
[0 1 0] [0 1 0]
] ]
=for bad =for bad
histogram2d processes bad values. histogram2d 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 1540 "Primitive.pm" #line 1535 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*histogram2d = \&PDL::histogram2d; *histogram2d = \&PDL::histogram2d;
#line 1547 "Primitive.pm" #line 1542 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 whistogram2d =head2 whistogram2d
=for sig =for sig
Signature: (ina(n); inb(n); float+ wt(n);float+[o] hist(ma,mb); double stepa; double mina; int masize => ma; Signature: (ina(n); inb(n); float+ wt(n);float+[o] hist(ma,mb); double stepa; double mina; int masize => ma;
double stepb; double minb; int mbsize => mb;) double stepb; double minb; int mbsize => mb;)
skipping to change at line 1356 skipping to change at line 1352
[ 0 0.5 0.9] [ 0 0.5 0.9]
[ 0 0.1 0] [ 0 0.1 0]
] ]
=for bad =for bad
whistogram2d processes bad values. whistogram2d 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 1601 "Primitive.pm" #line 1596 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*whistogram2d = \&PDL::whistogram2d; *whistogram2d = \&PDL::whistogram2d;
#line 1608 "Primitive.pm" #line 1603 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 fibonacci =head2 fibonacci
=for sig =for sig
Signature: (i(n); indx [o]x(n)) Signature: (i(n); indx [o]x(n))
=for ref =for ref
Constructor - a vector with Fibonacci's sequence Constructor - a vector with Fibonacci's sequence
=for bad =for bad
fibonacci does not process bad values. fibonacci 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 1633 "Primitive.pm" #line 1628 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub fibonacci { ref($_[0]) && ref($_[0]) ne 'PDL::Type' ? $_[0]->fibonacci : PDL ->fibonacci(@_) } sub fibonacci { ref($_[0]) && ref($_[0]) ne 'PDL::Type' ? $_[0]->fibonacci : PDL ->fibonacci(@_) }
sub PDL::fibonacci{ sub PDL::fibonacci{
my $x = &PDL::Core::_construct; my $x = &PDL::Core::_construct;
my $is_inplace = $x->is_inplace; my $is_inplace = $x->is_inplace;
my ($in, $out) = $x->clump(-1); my ($in, $out) = $x->clump(-1);
$out = $is_inplace ? $in->inplace : PDL->null; $out = $is_inplace ? $in->inplace : PDL->null;
PDL::_fibonacci_int($in, $out); PDL::_fibonacci_int($in, $out);
$out; $out;
} }
#line 1648 "Primitive.pm" #line 1643 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
#line 1653 "Primitive.pm" #line 1648 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 append =head2 append
=for sig =for sig
Signature: (a(n); b(m); [o] c(mn)) Signature: (a(n); b(m); [o] c(mn))
=for ref =for ref
skipping to change at line 1433 skipping to change at line 1429
than two ndarrays along an arbitrary dimension, and than two ndarrays along an arbitrary dimension, and
L<cat|PDL::Core/cat>, which can append more than two ndarrays that all L<cat|PDL::Core/cat>, which can append more than two ndarrays that all
have the same sized dimensions. have the same sized dimensions.
=for bad =for bad
append does not process bad values. append 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 1696 "Primitive.pm" #line 1691 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
#line 1649 "primitive.pd" #line 1632 "primitive.pd"
sub PDL::append { sub PDL::append {
my ($i1, $i2, $o) = map PDL->topdl($_), @_; my ($i1, $i2, $o) = map PDL->topdl($_), @_;
if (grep $_->isempty, $i1, $i2) { if (grep $_->isempty, $i1, $i2) {
if (!defined $o) { if (!defined $o) {
return $i2->isnull ? PDL->zeroes(0) : $i2->copy if $i1->isempty; return $i2->isnull ? PDL->zeroes(0) : $i2->copy if $i1->isempty;
return $i1->isnull ? PDL->zeroes(0) : $i1->copy; return $i1->isnull ? PDL->zeroes(0) : $i1->copy;
} else { } else {
$o .= $i2->isnull ? PDL->zeroes(0) : $i2, return $o if $i1->isempty; $o .= $i2->isnull ? PDL->zeroes(0) : $i2, return $o if $i1->isempty;
$o .= $i1->isnull ? PDL->zeroes(0) : $i1, return $o; $o .= $i1->isnull ? PDL->zeroes(0) : $i1, return $o;
} }
} }
$o //= PDL->null; $o //= PDL->null;
PDL::_append_int($i1, $i2->convert($i1->type), $o); PDL::_append_int($i1, $i2->convert($i1->type), $o);
$o; $o;
} }
#line 1079 "../../blib/lib/PDL/PP.pm" #line 1079 "../../blib/lib/PDL/PP.pm"
#line 1722 "Primitive.pm" #line 1717 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*append = \&PDL::append; *append = \&PDL::append;
#line 1729 "Primitive.pm" #line 1724 "Primitive.pm"
#line 1701 "primitive.pd" #line 1679 "primitive.pd"
=head2 glue =head2 glue
=for usage =for usage
$c = $x->glue(<dim>,$y,...) $c = $x->glue(<dim>,$y,...)
=for ref =for ref
Glue two or more PDLs together along an arbitrary dimension Glue two or more PDLs together along an arbitrary dimension
skipping to change at line 1540 skipping to change at line 1536
next unless(defined $y && $y->nelem); next unless(defined $y && $y->nelem);
while($dim >= $y->ndims) { while($dim >= $y->ndims) {
$y = $y->dummy(-1,1); $y = $y->dummy(-1,1);
} }
$y = $y->xchg(0,$dim); $y = $y->xchg(0,$dim);
$x = $x->append($y); $x = $x->append($y);
} }
$x->xchg(0,$dim); $x->xchg(0,$dim);
} }
#line 1810 "Primitive.pm" #line 1805 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*axisvalues = \&PDL::axisvalues; *axisvalues = \&PDL::axisvalues;
#line 1817 "Primitive.pm" #line 1812 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 srand =head2 srand
=for sig =for sig
Signature: (a()) Signature: (a())
=for ref =for ref
skipping to change at line 1572 skipping to change at line 1568
srand(); # uses current time srand(); # uses current time
srand(5); # fixed number e.g. for testing srand(5); # fixed number e.g. for testing
=for bad =for bad
srand does not process bad values. srand 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 1851 "Primitive.pm" #line 1846 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
*srand = \&PDL::srand; *srand = \&PDL::srand;
sub PDL::srand { PDL::_srand_int($_[0] // PDL::Core::seed()) } sub PDL::srand { PDL::_srand_int($_[0] // PDL::Core::seed()) }
#line 1859 "Primitive.pm" #line 1854 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*srand = \&PDL::srand; *srand = \&PDL::srand;
#line 1866 "Primitive.pm" #line 1861 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 random =head2 random
=for sig =for sig
Signature: (a()) Signature: (a())
=for ref =for ref
skipping to change at line 1618 skipping to change at line 1614
You can use the PDL function L</srand> to seed the random generator. You can use the PDL function L</srand> to seed the random generator.
If it has not been called yet, it will be with the current time. If it has not been called yet, it will be with the current time.
=for bad =for bad
random does not process bad values. random 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 1907 "Primitive.pm" #line 1902 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub random { ref($_[0]) && ref($_[0]) ne 'PDL::Type' ? $_[0]->random : PDL->rand om(@_) } sub random { ref($_[0]) && ref($_[0]) ne 'PDL::Type' ? $_[0]->random : PDL->rand om(@_) }
sub PDL::random { sub PDL::random {
my $class = shift; my $class = shift;
my $x = scalar(@_)? $class->new_from_specification(@_) : $class->new_or_inpla ce; my $x = scalar(@_)? $class->new_from_specification(@_) : $class->new_or_inpla ce;
PDL::_random_int($x); PDL::_random_int($x);
return $x; return $x;
} }
#line 1920 "Primitive.pm" #line 1915 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
#line 1925 "Primitive.pm" #line 1920 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 randsym =head2 randsym
=for sig =for sig
Signature: (a()) Signature: (a())
=for ref =for ref
skipping to change at line 1666 skipping to change at line 1662
You can use the PDL function L</srand> to seed the random generator. You can use the PDL function L</srand> to seed the random generator.
If it has not been called yet, it will be with the current time. If it has not been called yet, it will be with the current time.
=for bad =for bad
randsym does not process bad values. randsym 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 1965 "Primitive.pm" #line 1960 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub randsym { ref($_[0]) && ref($_[0]) ne 'PDL::Type' ? $_[0]->randsym : PDL->ra ndsym(@_) } sub randsym { ref($_[0]) && ref($_[0]) ne 'PDL::Type' ? $_[0]->randsym : PDL->ra ndsym(@_) }
sub PDL::randsym { sub PDL::randsym {
my $class = shift; my $class = shift;
my $x = scalar(@_)? $class->new_from_specification(@_) : $class->new_or_inpla ce; my $x = scalar(@_)? $class->new_from_specification(@_) : $class->new_or_inpla ce;
PDL::_randsym_int($x); PDL::_randsym_int($x);
return $x; return $x;
} }
#line 1978 "Primitive.pm" #line 1973 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
#line 1983 "Primitive.pm" #line 1978 "Primitive.pm"
#line 1925 "primitive.pd" #line 1903 "primitive.pd"
=head2 grandom =head2 grandom
=for ref =for ref
Constructor which returns ndarray of Gaussian random numbers Constructor which returns ndarray of Gaussian random numbers
=for usage =for usage
$x = grandom([type], $nx, $ny, $nz,...); $x = grandom([type], $nx, $ny, $nz,...);
skipping to change at line 1714 skipping to change at line 1710
=cut =cut
sub grandom { ref($_[0]) && ref($_[0]) ne 'PDL::Type' ? $_[0]->grandom : PDL->gr andom(@_) } sub grandom { ref($_[0]) && ref($_[0]) ne 'PDL::Type' ? $_[0]->grandom : PDL->gr andom(@_) }
sub PDL::grandom { sub PDL::grandom {
my $class = shift; my $class = shift;
my $x = scalar(@_)? $class->new_from_specification(@_) : $class->new_or_inpla ce; my $x = scalar(@_)? $class->new_from_specification(@_) : $class->new_or_inpla ce;
use PDL::Math 'ndtri'; use PDL::Math 'ndtri';
$x .= ndtri(randsym($x)); $x .= ndtri(randsym($x));
return $x; return $x;
} }
#line 2019 "Primitive.pm" #line 2014 "Primitive.pm"
#line 1969 "primitive.pd" #line 1947 "primitive.pd"
=head2 vsearch =head2 vsearch
=for sig =for sig
Signature: ( vals(); xs(n); [o] indx(); [\%options] ) Signature: ( vals(); xs(n); [o] indx(); [\%options] )
=for ref =for ref
Efficiently search for values in a sorted ndarray, returning indices. Efficiently search for values in a sorted ndarray, returning indices.
skipping to change at line 1862 skipping to change at line 1858
$mode eq 'sample' ? \&vsearch_sample $mode eq 'sample' ? \&vsearch_sample
: $mode eq 'insert_leftmost' ? \&vsearch_insert_leftmost : $mode eq 'insert_leftmost' ? \&vsearch_insert_leftmost
: $mode eq 'insert_rightmost' ? \&vsearch_insert_rightmost : $mode eq 'insert_rightmost' ? \&vsearch_insert_rightmost
: $mode eq 'match' ? \&vsearch_match : $mode eq 'match' ? \&vsearch_match
: $mode eq 'bin_inclusive' ? \&vsearch_bin_inclusive : $mode eq 'bin_inclusive' ? \&vsearch_bin_inclusive
: $mode eq 'bin_exclusive' ? \&vsearch_bin_exclusive : $mode eq 'bin_exclusive' ? \&vsearch_bin_exclusive
: croak( "unknown vsearch mode: $mode\n" ); : croak( "unknown vsearch mode: $mode\n" );
} }
*PDL::vsearch = \&vsearch; *PDL::vsearch = \&vsearch;
#line 2170 "Primitive.pm" #line 2165 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 vsearch_sample =head2 vsearch_sample
=for sig =for sig
Signature: (vals(); x(n); indx [o]idx()) Signature: (vals(); x(n); indx [o]idx())
=for ref =for ref
skipping to change at line 1930 skipping to change at line 1926
$c = vsearch_sample($y, $x); # Now, $c will have the appropriate distr. $c = vsearch_sample($y, $x); # Now, $c will have the appropriate distr.
It is possible to use the L<cumusumover|PDL::Ufunc/cumusumover> It is possible to use the L<cumusumover|PDL::Ufunc/cumusumover>
function to obtain cumulative probabilities from absolute probabilities. function to obtain cumulative probabilities from absolute probabilities.
=for bad =for bad
needs major (?) work to handles bad values needs major (?) work to handles bad values
=cut =cut
#line 2264 "Primitive.pm" #line 2259 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*vsearch_sample = \&PDL::vsearch_sample; *vsearch_sample = \&PDL::vsearch_sample;
#line 2271 "Primitive.pm" #line 2266 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 vsearch_insert_leftmost =head2 vsearch_insert_leftmost
=for sig =for sig
Signature: (vals(); x(n); indx [o]idx()) Signature: (vals(); x(n); indx [o]idx())
=for ref =for ref
skipping to change at line 1999 skipping to change at line 1995
i = 0 i = 0
If C<$x> contains duplicated elements, I<I> is the index of the If C<$x> contains duplicated elements, I<I> is the index of the
leftmost (by index in array) duplicate if I<V> matches. leftmost (by index in array) duplicate if I<V> matches.
=for bad =for bad
needs major (?) work to handles bad values needs major (?) work to handles bad values
=cut =cut
#line 2361 "Primitive.pm" #line 2356 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*vsearch_insert_leftmost = \&PDL::vsearch_insert_leftmost; *vsearch_insert_leftmost = \&PDL::vsearch_insert_leftmost;
#line 2368 "Primitive.pm" #line 2363 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 vsearch_insert_rightmost =head2 vsearch_insert_rightmost
=for sig =for sig
Signature: (vals(); x(n); indx [o]idx()) Signature: (vals(); x(n); indx [o]idx())
=for ref =for ref
skipping to change at line 2068 skipping to change at line 2064
i = $x->nelem - 1 i = $x->nelem - 1
If C<$x> contains duplicated elements, I<I> is the index of the If C<$x> contains duplicated elements, I<I> is the index of the
leftmost (by index in array) duplicate if I<V> matches. leftmost (by index in array) duplicate if I<V> matches.
=for bad =for bad
needs major (?) work to handles bad values needs major (?) work to handles bad values
=cut =cut
#line 2458 "Primitive.pm" #line 2453 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*vsearch_insert_rightmost = \&PDL::vsearch_insert_rightmost; *vsearch_insert_rightmost = \&PDL::vsearch_insert_rightmost;
#line 2465 "Primitive.pm" #line 2460 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 vsearch_match =head2 vsearch_match
=for sig =for sig
Signature: (vals(); x(n); indx [o]idx()) Signature: (vals(); x(n); indx [o]idx())
=for ref =for ref
skipping to change at line 2106 skipping to change at line 2102
index of that element, otherwise it is I<-( insertion_point + 1 )>, index of that element, otherwise it is I<-( insertion_point + 1 )>,
where I<insertion_point> is an index in C<$x> where I<V> may be where I<insertion_point> is an index in C<$x> where I<V> may be
inserted while maintaining the order in C<$x>. If C<$x> has inserted while maintaining the order in C<$x>. If C<$x> has
duplicated values, I<I> may refer to any of them. duplicated values, I<I> may refer to any of them.
=for bad =for bad
needs major (?) work to handles bad values needs major (?) work to handles bad values
=cut =cut
#line 2513 "Primitive.pm" #line 2508 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*vsearch_match = \&PDL::vsearch_match; *vsearch_match = \&PDL::vsearch_match;
#line 2520 "Primitive.pm" #line 2515 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 vsearch_bin_inclusive =head2 vsearch_bin_inclusive
=for sig =for sig
Signature: (vals(); x(n); indx [o]idx()) Signature: (vals(); x(n); indx [o]idx())
=for ref =for ref
skipping to change at line 2173 skipping to change at line 2169
i = $x->nelem - 1 i = $x->nelem - 1
If C<$x> contains duplicated elements, I<I> is the index of the If C<$x> contains duplicated elements, I<I> is the index of the
righmost (by index in array) duplicate if I<V> matches. righmost (by index in array) duplicate if I<V> matches.
=for bad =for bad
needs major (?) work to handles bad values needs major (?) work to handles bad values
=cut =cut
#line 2608 "Primitive.pm" #line 2603 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*vsearch_bin_inclusive = \&PDL::vsearch_bin_inclusive; *vsearch_bin_inclusive = \&PDL::vsearch_bin_inclusive;
#line 2615 "Primitive.pm" #line 2610 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 vsearch_bin_exclusive =head2 vsearch_bin_exclusive
=for sig =for sig
Signature: (vals(); x(n); indx [o]idx()) Signature: (vals(); x(n); indx [o]idx())
=for ref =for ref
skipping to change at line 2240 skipping to change at line 2236
i = $x->nelem - 1 i = $x->nelem - 1
If C<$x> contains duplicated elements, I<I> is the index of the If C<$x> contains duplicated elements, I<I> is the index of the
righmost (by index in array) duplicate if I<V> matches. righmost (by index in array) duplicate if I<V> matches.
=for bad =for bad
needs major (?) work to handles bad values needs major (?) work to handles bad values
=cut =cut
#line 2703 "Primitive.pm" #line 2698 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*vsearch_bin_exclusive = \&PDL::vsearch_bin_exclusive; *vsearch_bin_exclusive = \&PDL::vsearch_bin_exclusive;
#line 2710 "Primitive.pm" #line 2705 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 interpolate =head2 interpolate
=for sig =for sig
Signature: (xi(); x(n); y(n); [o] yi(); int [o] err()) Signature: (xi(); x(n); y(n); [o] yi(); int [o] err())
=for ref =for ref
skipping to change at line 2286 skipping to change at line 2282
See also L</interpol>, which uses the same routine, See also L</interpol>, which uses the same routine,
differing only in the handling of extrapolation - an error message differing only in the handling of extrapolation - an error message
is printed rather than returning an error ndarray. is printed rather than returning an error ndarray.
=for bad =for bad
needs major (?) work to handles bad values needs major (?) work to handles bad values
=cut =cut
#line 2758 "Primitive.pm" #line 2753 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*interpolate = \&PDL::interpolate; *interpolate = \&PDL::interpolate;
#line 2765 "Primitive.pm" #line 2760 "Primitive.pm"
#line 2645 "primitive.pd" #line 2623 "primitive.pd"
=head2 interpol =head2 interpol
=for sig =for sig
Signature: (xi(); x(n); y(n); [o] yi()) Signature: (xi(); x(n); y(n); [o] yi())
=for ref =for ref
routine for 1D linear interpolation routine for 1D linear interpolation
skipping to change at line 2334 skipping to change at line 2330
else { $yi = PDL->null; } else { $yi = PDL->null; }
interpolate( $xi, $x, $y, $yi, my $err = PDL->null ); interpolate( $xi, $x, $y, $yi, my $err = PDL->null );
print "some values had to be extrapolated\n" print "some values had to be extrapolated\n"
if any $err; if any $err;
return $yi if $#_ == -1; return $yi if $#_ == -1;
} # sub: interpol() } # sub: interpol()
*PDL::interpol = \&interpol; *PDL::interpol = \&interpol;
#line 2810 "Primitive.pm" #line 2805 "Primitive.pm"
#line 2689 "primitive.pd" #line 2667 "primitive.pd"
=head2 interpND =head2 interpND
=for ref =for ref
Interpolate values from an N-D ndarray, with switchable method Interpolate values from an N-D ndarray, with switchable method
=for example =for example
$source = 10*xvals(10,10) + yvals(10,10); $source = 10*xvals(10,10) + yvals(10,10);
skipping to change at line 2541 skipping to change at line 2537
); );
# "Collapse" the subpixel offset... # "Collapse" the subpixel offset...
$y = $y->slice(":,($i)"); $y = $y->slice(":,($i)");
} }
return $samp; return $samp;
} elsif($method =~ m/^f(ft|ourier)?/i) { } elsif($method =~ m/^f(ft|ourier)?/i) {
local $@;
eval "use PDL::FFT;"; eval "use PDL::FFT;";
my $fftref = $opt->{fft}; my $fftref = $opt->{fft};
$fftref = [] unless(ref $fftref eq 'ARRAY'); $fftref = [] unless(ref $fftref eq 'ARRAY');
if(@$fftref != 2) { if(@$fftref != 2) {
my $x = $source->copy; my $x = $source->copy;
my $y = zeroes($source); my $y = zeroes($source);
fftnd($x,$y); fftnd($x,$y);
$fftref->[0] = sqrt($x*$x+$y*$y) / $x->nelem; $fftref->[0] = sqrt($x*$x+$y*$y) / $x->nelem;
$fftref->[1] = - atan2($y,$x); $fftref->[1] = - atan2($y,$x);
} }
skipping to change at line 2577 skipping to change at line 2574
$mag = $mag->dummy(-1,$index->dim($i)); $mag = $mag->dummy(-1,$index->dim($i));
} }
my $out = cos($phase + $phref ) * $mag; my $out = cos($phase + $phref ) * $mag;
$out = $out->clump($source->ndims)->sumover; $out = $out->clump($source->ndims)->sumover;
return $out; return $out;
} else { } else {
barf("interpND: unknown method '$method'; valid ones are 'linear' and 'samp le'.\n"); barf("interpND: unknown method '$method'; valid ones are 'linear' and 'samp le'.\n");
} }
} }
#line 3056 "Primitive.pm" #line 3052 "Primitive.pm"
#line 2938 "primitive.pd" #line 2917 "primitive.pd"
=head2 one2nd =head2 one2nd
=for ref =for ref
Converts a one dimensional index ndarray to a set of ND coordinates Converts a one dimensional index ndarray to a set of ND coordinates
=for usage =for usage
@coords=one2nd($x, $indices) @coords=one2nd($x, $indices)
skipping to change at line 2627 skipping to change at line 2624
my @dimension=$x->dims; my @dimension=$x->dims;
$ind = indx($ind); $ind = indx($ind);
my(@index); my(@index);
my $count=0; my $count=0;
foreach (@dimension) { foreach (@dimension) {
$index[$count++]=$ind % $_; $index[$count++]=$ind % $_;
$ind /= $_; $ind /= $_;
} }
return @index; return @index;
} }
#line 3108 "Primitive.pm" #line 3104 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 which =head2 which
=for sig =for sig
Signature: (mask(n); indx [o] inds(m)) Signature: (mask(n); indx [o] inds(m))
=for ref =for ref
skipping to change at line 2682 skipping to change at line 2679
[0 1 2 3 4 5 6 7 8 9] [0 1 2 3 4 5 6 7 8 9]
pdl> $indx = which($x>6); p $indx pdl> $indx = which($x>6); p $indx
[7 8 9] [7 8 9]
=for bad =for bad
which processes bad values. which 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 3171 "Primitive.pm" #line 3167 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub which { my ($this,$out) = @_; sub which { my ($this,$out) = @_;
$this = $this->flat; $this = $this->flat;
$out = $this->nullcreate unless defined $out; $out = $this->nullcreate unless defined $out;
PDL::_which_int($this,$out); PDL::_which_int($this,$out);
return $out; return $out;
} }
*PDL::which = \&which; *PDL::which = \&which;
#line 3184 "Primitive.pm" #line 3180 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*which = \&PDL::which; *which = \&PDL::which;
#line 3191 "Primitive.pm" #line 3187 "Primitive.pm"
#line 1058 "../../blib/lib/PDL/PP.pm" #line 1058 "../../blib/lib/PDL/PP.pm"
=head2 which_both =head2 which_both
=for sig =for sig
Signature: (mask(n); indx [o] inds(m); indx [o]notinds(q)) Signature: (mask(n); indx [o] inds(m); indx [o]notinds(q))
=for ref =for ref
skipping to change at line 2733 skipping to change at line 2730
pdl> ($small, $big) = which_both ($x >= 5); p "$small\n $big" pdl> ($small, $big) = which_both ($x >= 5); p "$small\n $big"
[5 6 7 8 9] [5 6 7 8 9]
[0 1 2 3 4] [0 1 2 3 4]
=for bad =for bad
which_both processes bad values. which_both 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 3234 "Primitive.pm" #line 3230 "Primitive.pm"
#line 1059 "../../blib/lib/PDL/PP.pm" #line 1059 "../../blib/lib/PDL/PP.pm"
sub which_both { my ($this,$outi,$outni) = @_; sub which_both { my ($this,$outi,$outni) = @_;
$this = $this->flat; $this = $this->flat;
$outi = $this->nullcreate unless defined $outi; $outi = $this->nullcreate unless defined $outi;
$outni = $this->nullcreate unless defined $outni; $outni = $this->nullcreate unless defined $outni;
PDL::_which_both_int($this,$outi,$outni); PDL::_which_both_int($this,$outi,$outni);
return wantarray ? ($outi,$outni) : $outi; return wantarray ? ($outi,$outni) : $outi;
} }
*PDL::which_both = \&which_both; *PDL::which_both = \&which_both;
#line 3248 "Primitive.pm" #line 3244 "Primitive.pm"
#line 1060 "../../blib/lib/PDL/PP.pm" #line 1060 "../../blib/lib/PDL/PP.pm"
*which_both = \&PDL::which_both; *which_both = \&PDL::which_both;
#line 3255 "Primitive.pm" #line 3251 "Primitive.pm"
#line 3142 "primitive.pd" #line 3120 "primitive.pd"
=head2 where =head2 where
=for ref =for ref
Use a mask to select values from one or more data PDLs Use a mask to select values from one or more data PDLs
C<where> accepts one or more data ndarrays and a mask ndarray. It C<where> accepts one or more data ndarrays and a mask ndarray. It
returns a list of output ndarrays, corresponding to the input data returns a list of output ndarrays, corresponding to the input data
ndarrays. Each output ndarray is a 1-dimensional list of values in its ndarrays. Each output ndarray is a 1-dimensional list of values in its
skipping to change at line 2818 skipping to change at line 2815
if($_[-1]->getndims > 1) { if($_[-1]->getndims > 1) {
my $mask = $_[-1]->clump(-1)->which; my $mask = $_[-1]->clump(-1)->which;
return map {$_->clump(-1)->index($mask)} @_[0..$#_-1]; return map {$_->clump(-1)->index($mask)} @_[0..$#_-1];
} else { } else {
my $mask = $_[-1]->which; my $mask = $_[-1]->which;
return map {$_->index($mask)} @_[0..$#_-1]; return map {$_->index($mask)} @_[0..$#_-1];
} }
} }
} }
*where = \&PDL::where; *where = \&PDL::where;
#line 3325 "Primitive.pm" #line 3321 "Primitive.pm"
#line 3212 "primitive.pd" #line 3190 "primitive.pd"
=head2 whereND =head2 whereND
=for ref =for ref
C<where> with support for ND masks and broadcasting C<where> with support for ND masks and broadcasting
C<whereND> accepts one or more data ndarrays and a C<whereND> accepts one or more data ndarrays and a
mask ndarray. It returns a list of output ndarrays, mask ndarray. It returns a list of output ndarrays,
corresponding to the input data ndarrays. The values corresponding to the input data ndarrays. The values
skipping to change at line 2907 skipping to change at line 2904
foreach my $id ($n, @idims[0..($#idims-1)]) { foreach my $id ($n, @idims[0..($#idims-1)]) {
$where_sub_i = $where_sub_i->splitdim($ndim++,$id) if $n>0; $where_sub_i = $where_sub_i->splitdim($ndim++,$id) if $n>0;
} }
push @to_return, $where_sub_i; push @to_return, $where_sub_i;
} }
return (@to_return == 1) ? $to_return[0] : @to_return; return (@to_return == 1) ? $to_return[0] : @to_return;
} }
*whereND = \&PDL::whereND; *whereND = \&PDL::whereND;
#line 3416 "Primitive.pm" #line 3412 "Primitive.pm"
#line 3303 "primitive.pd" #line 3281 "primitive.pd"
=head2 whichND =head2 whichND
=for ref =for ref
Return the coordinates of non-zero values in a mask. Return the coordinates of non-zero values in a mask.
=for usage =for usage
WhichND returns the N-dimensional coordinates of each nonzero value in WhichND returns the N-dimensional coordinates of each nonzero value in
skipping to change at line 3012 skipping to change at line 3009
} }
for my $i (0..$#mdims) { for my $i (0..$#mdims) {
my($s) = $ind->index($i); my($s) = $ind->index($i);
$s /= $mult->index($i); $s /= $mult->index($i);
$s %= $mdims[$i]; $s %= $mdims[$i];
} }
return $ind; return $ind;
} }
#line 3524 "Primitive.pm" #line 3520 "Primitive.pm"
#line 3416 "primitive.pd" #line 3394 "primitive.pd"
=head2 setops =head2 setops
=for ref =for ref
Implements simple set operations like union and intersection Implements simple set operations like union and intersection
=for usage =for usage
Usage: $set = setops($x, <OPERATOR>, $y); Usage: $set = setops($x, <OPERATOR>, $y);
skipping to change at line 3194 skipping to change at line 3191
# Make ordered list of set union. # Make ordered list of set union.
my $union = append($x, $y)->qsort; my $union = append($x, $y)->qsort;
return $union->where($union == rotate($union, -1)); return $union->where($union == rotate($union, -1));
} else { } else {
print "The operation $op is not known!"; print "The operation $op is not known!";
return -1; return -1;
} }
} }
#line 3709 "Primitive.pm" #line 3705 "Primitive.pm"
#line 3600 "primitive.pd" #line 3578 "primitive.pd"
=head2 intersect =head2 intersect
=for ref =for ref
Calculate the intersection of two ndarrays Calculate the intersection of two ndarrays
=for usage =for usage
Usage: $set = intersect($x, $y); Usage: $set = intersect($x, $y);
skipping to change at line 3231 skipping to change at line 3228
=cut =cut
*intersect = \&PDL::intersect; *intersect = \&PDL::intersect;
sub PDL::intersect { sub PDL::intersect {
return setops($_[0], 'AND', $_[1]); return setops($_[0], 'AND', $_[1]);
} }
#line 3748 "Primitive.pm" #line 3744 "Primitive.pm"
#line 3639 "primitive.pd" #line 3617 "primitive.pd"
=head1 AUTHOR =head1 AUTHOR
Copyright (C) Tuomas J. Lukka 1997 (lukka@husc.harvard.edu). Contributions Copyright (C) Tuomas J. Lukka 1997 (lukka@husc.harvard.edu). Contributions
by Christian Soeller (c.soeller@auckland.ac.nz), Karl Glazebrook by Christian Soeller (c.soeller@auckland.ac.nz), Karl Glazebrook
(kgb@aaoepp.aao.gov.au), Craig DeForest (deforest@boulder.swri.edu) (kgb@aaoepp.aao.gov.au), Craig DeForest (deforest@boulder.swri.edu)
and Jarle Brinchmann (jarle@astro.up.pt) and Jarle Brinchmann (jarle@astro.up.pt)
All rights reserved. There is no warranty. You are allowed All rights reserved. There is no warranty. You are allowed
to redistribute this software / documentation under certain to redistribute this software / documentation under certain
conditions. For details, see the file COPYING in the PDL conditions. For details, see the file COPYING in the PDL
distribution. If this file is separated from the PDL distribution, distribution. If this file is separated from the PDL distribution,
the copyright notice should be included in the file. the copyright notice should be included in the file.
Updated for CPAN viewing compatibility by David Mertens. Updated for CPAN viewing compatibility by David Mertens.
=cut =cut
#line 3772 "Primitive.pm" #line 3768 "Primitive.pm"
# Exit with OK status # Exit with OK status
1; 1;
 End of changes. 122 change blocks. 
127 lines changed or deleted 124 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)