Questions tagged [pdl]

PDL ("Perl Data Language") gives standard Perl the ability to compactly store and speedily manipulate the large N-dimensional data arrays which are the bread and butter of scientific computing.

PDL turns Perl in to a free, array-oriented, numerical language similar to (but, we believe, better than) such commerical packages as IDL and MatLab. One can write simple perl expressions to manipulate entire numerical arrays all at once. Simple interactive shells, pdl2 and perldl, are provided for use from the command line along with the PDL module for use in Perl scripts.

61 questions
10
votes
2 answers

Is there an equivalent to the perl debugger 'x' in pdl2 (or Devel::REPL)?

I am using pdl2 (the PDL shell) also as a my default Perl interactive shell (it loads all the nice plugins for Devel::REPL). But I am missing the x dumper-printing alias. p is nice for piddles but it does not work for a normal array ref or hash ref.…
Pablo Marin-Garcia
  • 4,151
  • 2
  • 32
  • 50
9
votes
1 answer

Point limitation for PDL Gnuplot and QT terminal using replot

While using PDL::Graphics::Gnuplot to plot data, I came across a strange effect. It seems, only a limited number of points is plotted at a time using replot. Consider the following example (15 lines with 101 points): use strict; use warnings; use…
Nemesis
  • 2,324
  • 13
  • 23
8
votes
7 answers

C-like arrays in perl

I want to create and manipulate large arrays of (4 byte) integers in-memory. By large, I mean on the order of hundreds of million. Each cell in the array will act as a counter for a position on a chromosome. All I need is for it to fit in memory,…
user1481
  • 849
  • 1
  • 5
  • 15
7
votes
2 answers

Store a Moose object that has a PDL as an attribute

I am new to Moose and doing quite well until I have hit a snag using a PDL as a property. I want to be able to write an object to a file (I have been using use MooseX::Storage; with Storage('io' => 'StorableFile');, and this object has a PDL as a…
Joel Berger
  • 20,180
  • 5
  • 49
  • 104
5
votes
2 answers

convert PDL scalar to Perl scalar

I have a function that uses PDL. The final step is a dot product so it returns a scalar. However, when I try to print this scalar, it is clearly still a piddle and prints like this on screen: [ [ 3 ] ] I'm wondering how I can convert it back to…
Zhang18
  • 4,800
  • 10
  • 50
  • 67
5
votes
3 answers

Use Perl PDL to rotate a matrix

I would like to use Perl and PDL to achieve a rotation of a 3x3 matrix (if possible) I.e original matrix [ 1, 2, 3 ] [ 4, 5, 6 ] [ 7, 8, 9 ] I would like to rotate, around 5, so it becomes new matrix [ 3, 6, 9 ] [ 2, 5, 8 ] [ 1, 4, 7 ] Effectively…
4
votes
3 answers

Perl PDL - getting the 80% lowest values in a vector

Is there an elegant PDL function which receives a list of values and returns a list of 80% of the original values which are the lowest? For example: If I have a list like so: (9, 4, 1, 2, 7, 8, 3, 5, 6, 10) I would like to get (1, 2, 3, 4, 5, 6, 7,…
N.M
  • 685
  • 1
  • 9
  • 22
4
votes
5 answers

how to create sequences with pdl?

I trying to translate part of my R code to perl with pdl, and I would like to know if pdl has any syntax for creating sequences (besides the trivial my $xx=pdl(1..20)) something like having a vector ['a','b'] rep 20 => a,b,a,b,a,b.... 20…
Pablo Marin-Garcia
  • 4,151
  • 2
  • 32
  • 50
4
votes
1 answer

Transpose in Perl's PDL::Complex

I am considering the complex extension of the Perl Data Language (PDL 2.19.0) for complex matrix operations, but operations as easy as transpose do not work as I would expect. use strict; use warnings; use PDL; use PDL::Complex; my $m = cplx pdl…
4
votes
2 answers

How to iterate through a Perl PDL piddle?

The closest I got to was something like use PDL; my $u = pdl [1,2,3,4]; my $dim = 4; for(my $i=0; $i<$dim; $i++) { print $u->flat->index($i), "\n"; } Also as I can convert [1,2,3,4] to piddle $u, can I get back a list (or a list of lists for a…
arrac
  • 597
  • 1
  • 5
  • 15
4
votes
2 answers

How can I use PDL rcols in a subroutine with pass-by-reference?

Specifically, I want to use rcols with the PERLCOLS option. Here's what I want to do: my @array; getColumn(\@array, $file, 4); # get the fourth column from file I can do it if I use \@array, but for backward compatibility I'd prefer not to do…
flies
  • 2,017
  • 2
  • 24
  • 37
4
votes
2 answers

Perform regular expression on a PERL PDL variable

Is it possible to perform a regular expression on a n-dimension PDL variable? For example I can add 100 to all the elements by doing $a1 = pdl [1,2]; print $a1 + 100; However what if my array was a bunch of strings that I would like to perform…
Ahdee
  • 4,679
  • 4
  • 34
  • 58
3
votes
3 answers

Is there a signal processing module for PDL?

Is there a module for the Perl Data Language that is similar to the Matlab signal processing toolbox? I'm aware of PDL::FFT(W), but can't find any functions for filter construction or estimation of statistical properties.
Tim
  • 13,904
  • 10
  • 69
  • 101
3
votes
2 answers

Best practice for accessing data in PDL objects

I have a 2 dimensional pdl,for example: my $data = random(4,4); and I want to compute the sum of the 0,0 and the 1,0 element outside of the pdl context. (Not like, for example $data->slice('0,0') + $data->slice('1,0), which still returns a pdl…
Indiano
  • 684
  • 5
  • 19
3
votes
2 answers

Difference between PDL::Core and PDL::Core ':Internal'

I just started using PDL and saw in the documentation that there are 2 possible ways of importing PDL's core function: use PDL::Core; use PDL::Core ':Internal'; What exactly is the difference here? The documentation makes a comment on the second…
Indiano
  • 684
  • 5
  • 19
1
2 3 4 5