PDL::NiceSlice

PDL::NiceSlice Perl module contains a nicer slicing syntax for PDL.
Download

PDL::NiceSlice Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Christian Soeller
  • Publisher web site:
  • http://search.cpan.org/~hbiersma/MQSeries-1.28-b/MQSeries/QueueManager.pm

PDL::NiceSlice Tags


PDL::NiceSlice Description

PDL::NiceSlice Perl module contains a nicer slicing syntax for PDL. PDL::NiceSlice Perl module contains a nicer slicing syntax for PDL.SYNOPSYS use PDL::NiceSlice; $a(1:4) .= 2; # concise syntax for ranges print $b((0),1:$end); # use variables in the slice expression $a->xchg(0,1)->(($pos-1)) .= 0; # default method syntax $idx = long 1, 7, 3, 0; # a piddle of indices $a(-3:2:2,$idx) += 3; # mix explicit indexing and ranges $a->clump(1,2)->(0:30); # 'default method' syntax $a(myfunc(0,$var),1:4)++; # when using functions in slice expressions # use parentheses around args! $b = $a(*3); # Add dummy dimension of order 3 # modifiers are specified in a ;-separated trailing block $a($a!=3;?)++; # short for $a->where($a!=3)++ $a(0:1114;_) .= 0; # short for $a->flat->(0:1114) $b = $a(0:-1:3;|); # short for $a(0:-1:3)->sever $n = sequence 3,1,4,1; $b = $n(;-); # drop all dimensions of size 1 (AKA squeeze) $b = $n(0,0;-|); # squeeze *and* sever $c = $a(0,3,0;-); # more compact way of saying $a((0),(3),(0)) # Use with perldl versions < v1.31 (or include these lines in .perldlrc) perldl> use PDL::NiceSlice; # next one is required, see below perldl> $PERLDL::PREPROCESS = &PDL::NiceSlice::perldlpp; perldl> $a(4:5) .= xvals(2);Slicing is a basic, extremely common operation, and PDL's slice method would be cumbersome to use in many cases. PDL::NiceSlice rectifies that by incorporating new slicing syntax directly into the language via a perl source filter (see the perlfilter man page). NiceSlice adds no new functionality, only convenient syntax.NiceSlice is loaded automatically in the perldl shell, but (to avoid conflicts with other modules) must be loaded automatically in standalone perl/PDL scripts (see below). If you prefer not to use a prefilter on your standalone scripts, you can use the slice method in those scripts, rather than the more compact NiceSlice constructs.Requirements:· Perl Requirements: · Perl


PDL::NiceSlice Related Software