Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    PDL::NiceSlice 2.4.3

    Download button

    No screenshots available
    Downloads: 276  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Christian Soeller | More programs
    Perl Artistic License / FREE
    June 30th, 2007, 06:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    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



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    PDL slicing | slicing syntax | Perl module | PDL::NiceSlice | PDL | slicing

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM