Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

RFC: Getting Started with PDL (the Perl Data Language)

by lin0 (Curate)
on Feb 02, 2007 at 20:06 UTC ( #598007=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perldl>? inv
    
  2. or download this
    Module  PDL::MatrixOps
      inv
    ...
           performed, if any of the matrices in your threaded collection
           are singular, they receive NaN entries.
    
  3. or download this
    perldl>?? inverse
    
  4. or download this
    perldl> ?? inverse
    PDL::Transform::unmap ...
    ...
                          (2-D/3-D; with inverse)
    t_spherical     Convert Cartesian to spherical coordinates.
                          (3-D; with inverse)
    
  5. or download this
    perldl>?? invert
    
  6. or download this
    inv             Invert a square matrix.
    invert          Apply an inverse transformation to some
                    input coordinates.
    
  7. or download this
    perldl>demo
    
  8. or download this
    perldl>demo PDL
    
  9. or download this
    ----
    
    ...
            in the demos by just retyping them at the perldl
            command prompt.
    ---- (press enter)
    
  10. or download this
    perldl> $scalar_piddle = pdl 42
    perldl> $one_dimensional_piddle = pdl(1,2,3)
    perldl> $two_dimensional_piddle = pdl([1,2,3],[4,5,6])
    
  11. or download this
    perldl> ? vars
    
  12. or download this
    PDL variables in package main::
    
    ...
    $scalar_piddle Double D []                   P            0.01Kb
    $one_dimensional_piddle Double D [3]         P            0.02Kb
    $two_dimensional_piddle Double D [3,2]       P            0.05Kb
    
  13. or download this
    perldl> $pdl_of_zeroes = zeroes(10,2)
    perldl> p $pdl_of_zeroes
    ...
     [0 0 1 0]
     [0 0 0 1]
    ]
    
  14. or download this
    perldl>$new_pdl_of_zeroes  = zeroes(byte, 10, 2)
    
  15. or download this
    perldl> ? vars
    PDL variables in package main::
    ...
    $pdl_of_zeroes Double D [10,2]               P            0.16Kb
    $new_pdl_of_zeroes   Byte D [10,2]           P            0.02Kb
    
  16. or download this
    +    -    *    /    **    >    <
    >=   <=   ==   !=   <<    >>   &
    |    ^    +=   -=   *=    /=   %=
    **=  >>=  <<=  &=   |=    ^= 
    <=>  !    %    ++   -- 
    
  17. or download this
    abs  acos  acosh asin asinh
    atan atan2 atanh cos  cosh
    sin  sinh  tan   tanh sqrt
    ceil floor rint  exp  log log1
    
  18. or download this
    perldl>$pdl_of_zeroes = null;
    
  19. or download this
    perldl>$n = nelem($new_pdl_of_zeroes);
    
  20. or download this
    perldl>$n = $new_pdl_of_zeroes->nelem();
    
  21. or download this
    perldl>@dims = dims($new_pdl_of_zeroes);
    
  22. or download this
    perldl>@dims = $new_pdl_of_zeroes->dims;
    
  23. or download this
    perldl>$info = $new_pdl_of_zeroes->info;
    
  24. or download this
        T      Type</li>
        D      Formatted Dimensions
    ...
        C      Class of this piddle, i.e. "ref $pdl"
        A      Address of the piddle struct as a unique identifier
        M      Calculated memory consumption of this piddle's data area
    
  25. or download this
    perldl> p $new_pdl_of_zeroes->info("Mem : %M");
    
  26. or download this
    Mem :   0.02Kb
    
  27. or download this
    perldl> p $piddle = sequence(10,12);
    
  28. or download this
    [
     [  0   1   2   3   4   5   6   7   8   9]
    ...
     [100 101 102 103 104 105 106 107 108 109]
     [110 111 112 113 114 115 116 117 118 119]
    ]
    
  29. or download this
    perldl> p at($piddle, 5,3);
    
  30. or download this
    perldl> p $piddle->at(5,3);
    
  31. or download this
    perldl> p $slice_1a = slice($piddle, "0:2,-1");
    
  32. or download this
    [
     [110 111 112]
    ]
    
  33. or download this
    perldl> p $slice_1b = $piddle->slice("0:2,-1");
    
  34. or download this
    [
     [110 111 112]
    ]
    
  35. or download this
    perldl> p $slice_2a = slice($piddle,"-1:-2,:");
    
  36. or download this
    [
     [  9   8]
    ...
     [109 108]
     [119 118]
    ]
    
  37. or download this
    perldl> p $slice_2b = $piddle->slice("-1:-2,:");
    
  38. or download this
    [
     [  9   8]
    ...
     [109 108]
     [119 118]
    ]
    
  39. or download this
    perldl> p $second_column = $piddle(1,:);
    
  40. or download this
    [
     [  1]
    ...
     [101]
     [111]
    ]
    
  41. or download this
    perldl> p $second_row = $piddle(:,1);
    
  42. or download this
    [
     [10 11 12 13 14 15 16 17 18 19]
    ]
    
  43. or download this
    perldl> p $first_to_third_columns = $piddle(0:2,:);
    
  44. or download this
    [
     [  0   1   2]
    ...
     [100 101 102]
     [110 111 112]
    ]
    
  45. or download this
    perldl> p $even_columns = $piddle(0:-1:2,:);
    
  46. or download this
    [
     [  0   2   4   6   8]
    ...
     [100 102 104 106 108]
     [110 112 114 116 118]
    ]
    
  47. or download this
    perldl> p $odd_columns = $piddle(1:-1:2,:);
    
  48. or download this
    [
     [  1   3   5   7   9]
    ...
     [101 103 105 107 109]
     [111 113 115 117 119]
    ]
    
  49. or download this
    perldl> p $even_rows = $piddle(:,0:-1:2);
    
  50. or download this
    [
     [  0   1   2   3   4   5   6   7   8   9]
    ...
     [ 80  81  82  83  84  85  86  87  88  89]
     [100 101 102 103 104 105 106 107 108 109]
    ]
    
  51. or download this
    perldl> p $odd_rows = $piddle(:,1:-1:2);
    
  52. or download this
    [
     [ 10  11  12  13  14  15  16  17  18  19]
    ...
     [ 90  91  92  93  94  95  96  97  98  99]
     [110 111 112 113 114 115 116 117 118 119]
    ]
    
  53. or download this
    perldl> p $one_element_slice = $piddle(5,5);
    
  54. or download this
    [
     [55]
    ]
    
  55. or download this
    perldl> p $dice1 = dice($piddle, [1,3],[0,7]);
    
  56. or download this
    [
     [ 1  3]
     [71 73]
    ]
    
  57. or download this
    perldl> p $dice2 = $piddle->dice(X,[0,1,8]);
    
  58. or download this
    [
     [ 0  1  2  3  4  5  6  7  8  9]
     [10 11 12 13 14 15 16 17 18 19]
     [80 81 82 83 84 85 86 87 88 89]
    ]
    
  59. or download this
    perldl> p $dice2 .= -99;
    
  60. or download this
    [
     [-99 -99 -99 -99 -99 -99 -99 -99 -99 -99]
     [-99 -99 -99 -99 -99 -99 -99 -99 -99 -99]
     [-99 -99 -99 -99 -99 -99 -99 -99 -99 -99]
    ]
    
  61. or download this
    perldl> p $piddle
    
    ...
     [100 101 102 103 104 105 106 107 108 109]
     [110 111 112 113 114 115 116 117 118 119]
    ]
    
  62. or download this
    perldl> p $indx = intersect( which($piddle>43), which($piddle<72) );
    
  63. or download this
    [44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
    67 68 69 70 71]
    
  64. or download this
    p $piddle->flat->index( $indx ) .= 255; #assigning the new values
    
  65. or download this
    [255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
    255 255 255 255 255 255 255 255 255 255 255]
    
  66. or download this
    perldl> p $piddle
    
    ...
     [100 101 102 103 104 105 106 107 108 109]
     [110 111 112 113 114 115 116 117 118 119]
    ]
    
  67. or download this
    #!/usr/bin/perl
    use warnings;
    ...
    
    $win2->close();
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://598007]
Approved by liverpole
Front-paged by liverpole
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2015-07-29 01:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls