Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Can't figure out simple transformation with PDL

by wanna_code_perl (Friar)
on Mar 18, 2013 at 01:42 UTC ( [id://1023967]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # Set up initial 4x4 matrix with some arbitrary data
    pdl> p $b = pdl (10..25)->reshape(4,4);
    ...
    pdl> p $b->indexND($pos + $xfrm, 'truncate');
    [20 17 0 25]
    # $b->range($pos + $xfrm, 1, 'truncate') gives similar results
    
  2. or download this
    pdl> p $indicies = $b->indexND($pos + $xfrm, 'truncate')->which($b % 2
    +);
    # Returns: empty
    #
    ...
    #  [3 3]   # 25
    # ]
    # N.b. [2 2] would be omitted (value = 20, even), as would [4 2] (inde
    +x out of bounds)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1023967]
Approved by Crackers2
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2024-04-24 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found