"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "GENERATED/PDL/Slices.pm" between
PDL-2.081.tar.gz and PDL-2.082.tar.gz

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

Slices.pm  (PDL-2.081):Slices.pm  (PDL-2.082)
skipping to change at line 87 skipping to change at line 87
use strict; use strict;
use warnings; use warnings;
use PDL::Core ':Internal'; use PDL::Core ':Internal';
use Scalar::Util 'blessed'; use Scalar::Util 'blessed';
#line 91 "Slices.pm" #line 91 "Slices.pm"
=head1 FUNCTIONS =head1 FUNCTIONS
=cut =cut
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 index =head2 index
=for sig =for sig
Signature: (a(n); indx ind(); [oca] c()) Signature: (a(n); indx ind(); [oca] c())
=for ref =for ref
C<index>, C<index1d>, and C<index2d> provide rudimentary index indirection. C<index>, C<index1d>, and C<index2d> provide rudimentary index indirection.
skipping to change at line 164 skipping to change at line 164
columns from an array in one operation, see L</dice> or columns from an array in one operation, see L</dice> or
L</indexND>. L</indexND>.
=for bad =for bad
index barfs if any of the index values are bad. index barfs if any of the index values are bad.
=cut =cut
#line 184 "Slices.pm" #line 184 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*index = \&PDL::index; *index = \&PDL::index;
#line 191 "Slices.pm" #line 191 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 index1d =head2 index1d
=for sig =for sig
Signature: (a(n); indx ind(m); [oca] c(m)) Signature: (a(n); indx ind(m); [oca] c(m))
=for ref =for ref
C<index>, C<index1d>, and C<index2d> provide rudimentary index indirection. C<index>, C<index1d>, and C<index2d> provide rudimentary index indirection.
skipping to change at line 246 skipping to change at line 246
columns from an array in one operation, see L</dice> or columns from an array in one operation, see L</dice> or
L</indexND>. L</indexND>.
=for bad =for bad
index1d propagates BAD index elements to the output variable. index1d propagates BAD index elements to the output variable.
=cut =cut
#line 274 "Slices.pm" #line 274 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*index1d = \&PDL::index1d; *index1d = \&PDL::index1d;
#line 281 "Slices.pm" #line 281 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 index2d =head2 index2d
=for sig =for sig
Signature: (a(na,nb); indx inda(); indx indb(); [oca] c()) Signature: (a(na,nb); indx inda(); indx indb(); [oca] c())
=for ref =for ref
C<index>, C<index1d>, and C<index2d> provide rudimentary index indirection. C<index>, C<index1d>, and C<index2d> provide rudimentary index indirection.
skipping to change at line 328 skipping to change at line 328
columns from an array in one operation, see L</dice> or columns from an array in one operation, see L</dice> or
L</indexND>. L</indexND>.
=for bad =for bad
index2d barfs if either of the index values are bad. index2d barfs if either of the index values are bad.
=cut =cut
#line 364 "Slices.pm" #line 364 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*index2d = \&PDL::index2d; *index2d = \&PDL::index2d;
#line 371 "Slices.pm" #line 371 "Slices.pm"
#line 241 "slices.pd" #line 241 "slices.pd"
=head2 indexNDb =head2 indexNDb
=for ref =for ref
skipping to change at line 425 skipping to change at line 425
elsif($bound !~ m/^[0123ftepx]+$/ && $bound =~ m/^([0123ftepx])/i ) { elsif($bound !~ m/^[0123ftepx]+$/ && $bound =~ m/^([0123ftepx])/i ) {
$bound = $1; $bound = $1;
} }
} }
no warnings; # shut up about passing undef into rangeb no warnings; # shut up about passing undef into rangeb
$source->rangeb($index,$size,$bound); $source->rangeb($index,$size,$bound);
} }
#line 471 "Slices.pm" #line 471 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 rangeb =head2 rangeb
=for sig =for sig
Signature: (P(); C(); pdl *ind_pdl; SV *size; SV *boundary_sv) Signature: (P(); C(); pdl *ind_pdl; SV *size; SV *boundary_sv)
=for ref =for ref
Engine for L</range> Engine for L</range>
skipping to change at line 699 skipping to change at line 699
to tease out the algorithm. to tease out the algorithm.
=for bad =for bad
rangeb processes bad values. rangeb 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 752 "Slices.pm" #line 752 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*rangeb = \&PDL::rangeb; *rangeb = \&PDL::rangeb;
#line 759 "Slices.pm" #line 759 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 rld =head2 rld
=for sig =for sig
Signature: (indx a(n); b(n); [o]c(m)) Signature: (indx a(n); b(n); [o]c(m))
=for ref =for ref
Run-length decode a vector Run-length decode a vector
skipping to change at line 731 skipping to change at line 731
rld($x,$y,$c=null); rld($x,$y,$c=null);
=for bad =for bad
rld does not process bad values. rld 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 793 "Slices.pm" #line 793 "Slices.pm"
#line 950 "../../blib/lib/PDL/PP.pm" #line 959 "../../blib/lib/PDL/PP.pm"
sub PDL::rld { sub PDL::rld {
my ($x,$y) = @_; my ($x,$y) = @_;
my ($c); my ($c);
if ($#_ == 2) { if ($#_ == 2) {
$c = $_[2]; $c = $_[2];
} else { } else {
# XXX Need to improve emulation of broadcasting in auto-generating c # XXX Need to improve emulation of broadcasting in auto-generating c
my ($size) = $x->sumover->max->sclr; my ($size) = $x->sumover->max->sclr;
my (@dims) = $x->dims; my (@dims) = $x->dims;
shift @dims; shift @dims;
$c = $y->zeroes($size,@dims); $c = $y->zeroes($size,@dims);
} }
&PDL::_rld_int($x,$y,$c); &PDL::_rld_int($x,$y,$c);
$c; $c;
} }
#line 814 "Slices.pm" #line 814 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*rld = \&PDL::rld; *rld = \&PDL::rld;
#line 821 "Slices.pm" #line 821 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 rle =head2 rle
=for sig =for sig
Signature: (c(n); indx [o]a(m); [o]b(m)) Signature: (c(n); indx [o]a(m); [o]b(m))
=for ref =for ref
Run-length encode a vector Run-length encode a vector
skipping to change at line 808 skipping to change at line 808
$z = cat($x1, 1 / $yprob1x**$nrolls)->transpose; $z = cat($x1, 1 / $yprob1x**$nrolls)->transpose;
=for bad =for bad
rle does not process bad values. rle 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 881 "Slices.pm" #line 881 "Slices.pm"
#line 950 "../../blib/lib/PDL/PP.pm" #line 959 "../../blib/lib/PDL/PP.pm"
sub PDL::rle { sub PDL::rle {
my $c = shift; my $c = shift;
my ($x,$y) = @_==2 ? @_ : (null,null); my ($x,$y) = @_==2 ? @_ : (null,null);
PDL::_rle_int($c,$x,$y); PDL::_rle_int($c,$x,$y);
my $max_ind = ($c->ndims<2) ? ($x!=0)->sumover-1 : my $max_ind = ($c->ndims<2) ? ($x!=0)->sumover-1 :
($x!=0)->clump(1..$x->ndims-1)->sumover->max->sc lr-1; ($x!=0)->clump(1..$x->ndims-1)->sumover->max->sc lr-1;
return ($x->slice("0:$max_ind"),$y->slice("0:$max_ind")); return ($x->slice("0:$max_ind"),$y->slice("0:$max_ind"));
} }
#line 895 "Slices.pm" #line 895 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*rle = \&PDL::rle; *rle = \&PDL::rle;
#line 902 "Slices.pm" #line 902 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 rlevec =head2 rlevec
=for sig =for sig
Signature: (c(M,N); indx [o]a(N); [o]b(M,N)) Signature: (c(M,N); indx [o]a(N); [o]b(M,N))
=for ref =for ref
Run-length encode a set of vectors. Run-length encode a set of vectors.
skipping to change at line 859 skipping to change at line 859
Contributed by Bryan Jurish E<lt>moocow@cpan.orgE<gt>. Contributed by Bryan Jurish E<lt>moocow@cpan.orgE<gt>.
=for bad =for bad
rlevec does not process bad values. rlevec 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 943 "Slices.pm" #line 943 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*rlevec = \&PDL::rlevec; *rlevec = \&PDL::rlevec;
#line 950 "Slices.pm" #line 950 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 rldvec =head2 rldvec
=for sig =for sig
Signature: (indx a(N); b(M,N); [o]c(M,N)) Signature: (indx a(N); b(M,N); [o]c(M,N))
=for ref =for ref
Run-length decode a set of vectors, akin to a higher-order rld(). Run-length decode a set of vectors, akin to a higher-order rld().
skipping to change at line 892 skipping to change at line 892
Contributed by Bryan Jurish E<lt>moocow@cpan.orgE<gt>. Contributed by Bryan Jurish E<lt>moocow@cpan.orgE<gt>.
=for bad =for bad
rldvec does not process bad values. rldvec 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 984 "Slices.pm" #line 984 "Slices.pm"
#line 950 "../../blib/lib/PDL/PP.pm" #line 959 "../../blib/lib/PDL/PP.pm"
sub PDL::rldvec { sub PDL::rldvec {
my ($a,$b,$c) = @_; my ($a,$b,$c) = @_;
if (!defined($c)) { if (!defined($c)) {
# XXX Need to improve emulation of threading in auto-generating c # XXX Need to improve emulation of threading in auto-generating c
my ($rowlen) = $b->dim(0); my ($rowlen) = $b->dim(0);
my ($size) = $a->sumover->max; my ($size) = $a->sumover->max;
my (@dims) = $a->dims; my (@dims) = $a->dims;
shift(@dims); shift(@dims);
$c = $b->zeroes($b->type,$rowlen,$size,@dims); $c = $b->zeroes($b->type,$rowlen,$size,@dims);
} }
&PDL::_rldvec_int($a,$b,$c); &PDL::_rldvec_int($a,$b,$c);
return $c; return $c;
} }
#line 1003 "Slices.pm" #line 1003 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*rldvec = \&PDL::rldvec; *rldvec = \&PDL::rldvec;
#line 1010 "Slices.pm" #line 1010 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 rleseq =head2 rleseq
=for sig =for sig
Signature: (c(N); indx [o]a(N); [o]b(N)) Signature: (c(N); indx [o]a(N); [o]b(N))
=for ref =for ref
Run-length encode a vector of subsequences. Run-length encode a vector of subsequences.
skipping to change at line 942 skipping to change at line 942
Contributed by Bryan Jurish E<lt>moocow@cpan.orgE<gt>. Contributed by Bryan Jurish E<lt>moocow@cpan.orgE<gt>.
=for bad =for bad
rleseq does not process bad values. rleseq 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 1044 "Slices.pm" #line 1044 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*rleseq = \&PDL::rleseq; *rleseq = \&PDL::rleseq;
#line 1051 "Slices.pm" #line 1051 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 rldseq =head2 rldseq
=for sig =for sig
Signature: (indx a(N); b(N); [o]c(M)) Signature: (indx a(N); b(N); [o]c(M))
=for ref =for ref
Run-length decode a subsequence vector. Run-length decode a subsequence vector.
skipping to change at line 978 skipping to change at line 978
Contributed by Bryan Jurish E<lt>moocow@cpan.orgE<gt>. Contributed by Bryan Jurish E<lt>moocow@cpan.orgE<gt>.
=for bad =for bad
rldseq does not process bad values. rldseq 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 1088 "Slices.pm" #line 1088 "Slices.pm"
#line 950 "../../blib/lib/PDL/PP.pm" #line 959 "../../blib/lib/PDL/PP.pm"
sub PDL::rldseq { sub PDL::rldseq {
my ($a,$b,$c) = @_; my ($a,$b,$c) = @_;
if (!defined($c)) { if (!defined($c)) {
my $size = $a->sumover->max; my $size = $a->sumover->max;
my (@dims) = $a->dims; my (@dims) = $a->dims;
shift(@dims); shift(@dims);
$c = $b->zeroes($b->type,$size,@dims); $c = $b->zeroes($b->type,$size,@dims);
} }
&PDL::_rldseq_int($a,$b,$c); &PDL::_rldseq_int($a,$b,$c);
return $c; return $c;
} }
#line 1105 "Slices.pm" #line 1105 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*rldseq = \&PDL::rldseq; *rldseq = \&PDL::rldseq;
#line 1112 "Slices.pm" #line 1112 "Slices.pm"
#line 1346 "slices.pd" #line 1346 "slices.pd"
=head2 rleND =head2 rleND
=for sig =for sig
skipping to change at line 1079 skipping to change at line 1079
$data = zeroes($elts->type, @vdimsN, @countdims); $data = zeroes($elts->type, @vdimsN, @countdims);
} }
##-- guts: call rldvec() ##-- guts: call rldvec()
rldvec($counts, $elts->clump($#vdimsN), $data->clump($#vdimsN)); rldvec($counts, $elts->clump($#vdimsN), $data->clump($#vdimsN));
return $data; return $data;
} }
#line 1195 "Slices.pm" #line 1195 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*_clump_int = \&PDL::_clump_int; *_clump_int = \&PDL::_clump_int;
#line 1202 "Slices.pm" #line 1202 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 xchg =head2 xchg
=for sig =for sig
Signature: (P(); C(); PDL_Indx n1; PDL_Indx n2) Signature: (P(); C(); PDL_Indx n1; PDL_Indx n2)
=for ref =for ref
exchange two dimensions exchange two dimensions
skipping to change at line 1117 skipping to change at line 1117
$y->at(5,3,2,8) == $x->at(5,3,8,2) $y->at(5,3,2,8) == $x->at(5,3,8,2)
=for bad =for bad
xchg does not process bad values. xchg 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 1242 "Slices.pm" #line 1242 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*xchg = \&PDL::xchg; *xchg = \&PDL::xchg;
#line 1249 "Slices.pm" #line 1249 "Slices.pm"
#line 1502 "slices.pd" #line 1502 "slices.pd"
=head2 reorder =head2 reorder
=for ref =for ref
skipping to change at line 1244 skipping to change at line 1244
} }
} }
# Checking that they are all present and also not duplicated is done by broadcast() [I think] # Checking that they are all present and also not duplicated is done by broadcast() [I think]
# a quicker way to do the reorder # a quicker way to do the reorder
return $pdl->broadcast(@newDimOrder)->unbroadcast(0); return $pdl->broadcast(@newDimOrder)->unbroadcast(0);
} }
#line 1374 "Slices.pm" #line 1374 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 mv =head2 mv
=for sig =for sig
Signature: (P(); C(); PDL_Indx n1; PDL_Indx n2) Signature: (P(); C(); PDL_Indx n1; PDL_Indx n2)
=for ref =for ref
move a dimension to another position move a dimension to another position
skipping to change at line 1278 skipping to change at line 1278
Negative dimension indices count from the end. Negative dimension indices count from the end.
=for bad =for bad
mv does not process bad values. mv 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 1414 "Slices.pm" #line 1414 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*mv = \&PDL::mv; *mv = \&PDL::mv;
#line 1421 "Slices.pm" #line 1421 "Slices.pm"
#line 1675 "slices.pd" #line 1675 "slices.pd"
=head2 using =head2 using
=for ref =for ref
skipping to change at line 1315 skipping to change at line 1315
sub PDL::using { sub PDL::using {
my ($x,@ind)=@_; my ($x,@ind)=@_;
@ind = list $ind[0] if (blessed($ind[0]) && $ind[0]->isa('PDL')); @ind = list $ind[0] if (blessed($ind[0]) && $ind[0]->isa('PDL'));
foreach (@ind) { foreach (@ind) {
$_ = $x->slice("($_)"); $_ = $x->slice("($_)");
} }
@ind; @ind;
} }
#line 1456 "Slices.pm" #line 1456 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 diagonal =head2 diagonal
=for sig =for sig
Signature: (P(); C(); PDL_Indx whichdims[]) Signature: (P(); C(); PDL_Indx whichdims[])
=for ref =for ref
Returns the multidimensional diagonal over the specified dimensions. Returns the multidimensional diagonal over the specified dimensions.
skipping to change at line 1375 skipping to change at line 1375
] ]
=for bad =for bad
diagonal does not process bad values. diagonal 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 1522 "Slices.pm" #line 1522 "Slices.pm"
#line 950 "../../blib/lib/PDL/PP.pm" #line 959 "../../blib/lib/PDL/PP.pm"
sub PDL::diagonal { shift->_diagonal_int(my $o=PDL->null, \@_); $o } sub PDL::diagonal { shift->_diagonal_int(my $o=PDL->null, \@_); $o }
#line 1529 "Slices.pm" #line 1529 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*diagonal = \&PDL::diagonal; *diagonal = \&PDL::diagonal;
#line 1536 "Slices.pm" #line 1536 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 lags =head2 lags
=for sig =for sig
Signature: (P(); C(); PDL_Indx nthdim;PDL_Indx step;PDL_Indx n) Signature: (P(); C(); PDL_Indx nthdim;PDL_Indx step;PDL_Indx n)
=for ref =for ref
Returns an ndarray of lags to parent. Returns an ndarray of lags to parent.
skipping to change at line 1433 skipping to change at line 1433
in the usual way (-1 = last dim). in the usual way (-1 = last dim).
=for bad =for bad
lags does not process bad values. lags 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 1590 "Slices.pm" #line 1590 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*lags = \&PDL::lags; *lags = \&PDL::lags;
#line 1597 "Slices.pm" #line 1597 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 splitdim =head2 splitdim
=for sig =for sig
Signature: (P(); C(); PDL_Indx nthdim;PDL_Indx nsp) Signature: (P(); C(); PDL_Indx nthdim;PDL_Indx nsp)
=for ref =for ref
Splits a dimension in the parent ndarray (opposite of L<clump|PDL::Core/clump>). Splits a dimension in the parent ndarray (opposite of L<clump|PDL::Core/clump>).
skipping to change at line 1472 skipping to change at line 1472
is always true (C<m> has to be less than 3). is always true (C<m> has to be less than 3).
=for bad =for bad
splitdim does not process bad values. splitdim 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 1637 "Slices.pm" #line 1637 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*splitdim = \&PDL::splitdim; *splitdim = \&PDL::splitdim;
#line 1644 "Slices.pm" #line 1644 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 rotate =head2 rotate
=for sig =for sig
Signature: (x(n); indx shift(); [oca]y(n)) Signature: (x(n); indx shift(); [oca]y(n))
=for ref =for ref
Shift vector elements along with wrap. Flows data back&forth. Shift vector elements along with wrap. Flows data back&forth.
=for bad =for bad
rotate does not process bad values. rotate 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 1670 "Slices.pm" #line 1670 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*rotate = \&PDL::rotate; *rotate = \&PDL::rotate;
#line 1677 "Slices.pm" #line 1677 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 broadcastI =head2 broadcastI
=for sig =for sig
Signature: (P(); C(); PDL_Indx id; PDL_Indx whichdims[]) Signature: (P(); C(); PDL_Indx id; PDL_Indx whichdims[])
=for ref =for ref
internal internal
skipping to change at line 1528 skipping to change at line 1528
$y = $x->broadcastI(0,1,5); # broadcast over dims 1,5 in id 1 $y = $x->broadcastI(0,1,5); # broadcast over dims 1,5 in id 1
=for bad =for bad
broadcastI does not process bad values. broadcastI 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 1710 "Slices.pm" #line 1710 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*broadcastI = \&PDL::broadcastI; *broadcastI = \&PDL::broadcastI;
#line 1717 "Slices.pm" #line 1717 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 unbroadcast =head2 unbroadcast
=for sig =for sig
Signature: (P(); C(); PDL_Indx atind) Signature: (P(); C(); PDL_Indx atind)
=for ref =for ref
All broadcasted dimensions are made real again. All broadcasted dimensions are made real again.
skipping to change at line 1555 skipping to change at line 1555
See [TBD Doc] for details and examples. See [TBD Doc] for details and examples.
=for bad =for bad
unbroadcast does not process bad values. unbroadcast 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 1745 "Slices.pm" #line 1745 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*unbroadcast = \&PDL::unbroadcast; *unbroadcast = \&PDL::unbroadcast;
#line 1752 "Slices.pm" #line 1752 "Slices.pm"
#line 2110 "slices.pd" #line 2110 "slices.pd"
=head2 dice =head2 dice
=for ref =for ref
skipping to change at line 1712 skipping to change at line 1712
sub PDL::dice_axis { sub PDL::dice_axis {
my($self,$axis,$idx) = @_; my($self,$axis,$idx) = @_;
my $ix = PDL->topdl($idx); my $ix = PDL->topdl($idx);
barf("dice_axis: index must be <=1D") if $ix->getndims > 1; barf("dice_axis: index must be <=1D") if $ix->getndims > 1;
return $self->mv($axis,0)->index1d($ix)->mv(0,$axis); return $self->mv($axis,0)->index1d($ix)->mv(0,$axis);
} }
*dice_axis = \&PDL::dice_axis; *dice_axis = \&PDL::dice_axis;
#line 1907 "Slices.pm" #line 1907 "Slices.pm"
#line 949 "../../blib/lib/PDL/PP.pm" #line 958 "../../blib/lib/PDL/PP.pm"
=head2 slice =head2 slice
=for sig =for sig
Signature: (P(); C(); pdl_slice_args *arglist) Signature: (P(); C(); pdl_slice_args *arglist)
=for usage =for usage
$slice = $data->slice([2,3],'x',[2,2,0],"-1:1:-1", "*3"); $slice = $data->slice([2,3],'x',[2,2,0],"-1:1:-1", "*3");
skipping to change at line 1883 skipping to change at line 1883
$x->slice([-2,1]); $x->slice([-2,1]);
=for bad =for bad
slice does not process bad values. slice 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 2085 "Slices.pm" #line 2085 "Slices.pm"
#line 950 "../../blib/lib/PDL/PP.pm" #line 959 "../../blib/lib/PDL/PP.pm"
sub PDL::slice { sub PDL::slice {
my ($source, @others) = @_; my ($source, @others) = @_;
for my $i(0..$#others) { for my $i(0..$#others) {
my $idx = $others[$i]; my $idx = $others[$i];
if (ref $idx eq 'ARRAY') { if (ref $idx eq 'ARRAY') {
my @arr = map UNIVERSAL::isa($_, 'PDL') ? $_->flat->at(0) : $_, @{$other s[$i]}; my @arr = map UNIVERSAL::isa($_, 'PDL') ? $_->flat->at(0) : $_, @{$other s[$i]};
$others[$i] = \@arr; $others[$i] = \@arr;
next; next;
} }
skipping to change at line 1923 skipping to change at line 1923
else { else {
#### Zero elements -- force an extended empty. #### Zero elements -- force an extended empty.
$others[$i] = "1:0:1"; $others[$i] = "1:0:1";
} }
} }
PDL::_slice_int($source,my $o=$source->initialize,\@others); PDL::_slice_int($source,my $o=$source->initialize,\@others);
$o; $o;
} }
#line 2127 "Slices.pm" #line 2127 "Slices.pm"
#line 951 "../../blib/lib/PDL/PP.pm" #line 960 "../../blib/lib/PDL/PP.pm"
*slice = \&PDL::slice; *slice = \&PDL::slice;
#line 2134 "Slices.pm" #line 2134 "Slices.pm"
#line 2599 "slices.pd" #line 2599 "slices.pd"
=head1 BUGS =head1 BUGS
For the moment, you can't slice one of the zero-length dims of an For the moment, you can't slice one of the zero-length dims of an
empty ndarray. It is not clear how to implement this in a way that makes empty ndarray. It is not clear how to implement this in a way that makes
 End of changes. 45 change blocks. 
45 lines changed or deleted 45 lines changed or added

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