PDL 2.007 Released!

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 into a free, array-oriented, numerical language similar to (but, we believe, better than) such commercial 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.

As a frequent PDL user and occasional contributor, I am happy to pass along this note from Chris Marshall and the whole PDL team. Read the entire release message here.

It is with great pleasure that the PDL development team announces the release of the latest version of the PDL Data Language with 64bit platform support.

This release would not have been possible without the contributions of developersChris Marshall, Craig DeForest, Derek Lamb, Dima Kogan, Rob/Sisyphus, David Mertens, Diab Jerius, William Parker, and Henning Glawe.

A special thanks also to those who helped with bug reports, problem discussions, and, of course, participation in CPAN Testers which has helped to make the best tested PDL release ever!

Enjoy and Happy PDL-ing! The PDL Development Team


I think PDL is only graphing and data manipulating tool in Perl world.

But most people tend to concern numpy, scipy in python and R language.

PDL is good, but I think problem is API interface. I think R language API interface is smart and clean.

What do you think about my opinion?

Hurray! Thanks Joel for posting this! 64-bit support FTW! chm++

@Yuki -

Yes, when most people have a problem to solve for which PDL would be well suited, they think of Matlab, numpy, R, or XS/C. Why not PDL? I’m not sure. But (since you asked) I think your opinion about API being the problem is incorrect, not based on any experience with any of these libraries. Do you mean the low-level C API codified in PDL::PP? Do you mean slicing and dicing methods and syntax? Perhaps you are referring to the various data manipulation methods and routines? Or do you mean library support? Do you mean that it’s hard to write a CPAN distribution that relies on PDL? (Hint: it’s not hard.)

I would argue that there are two problems with PDL. The first is a community issue: most Perl programmers don’t use it. I’m really not sure why more Perl programmers don’t use PDL, but I suspect that the vector-oriented approach doesn’t sit well in many people’s heads; they’d rather write for-loops. Also, Perl’s niches don’t rely on serious number crunching, so most Perl programmers don’t find a need for PDL. Once, long long ago, PDL had trouble installing on Windows, but these days PDL installs damn near everywhere, and it has for years thanks to the monumental efforts of Chris Marshall and Sisyphus. If more Perl programmers used it, maybe people would start to realize we have a cutting-edge tool for this kind of work, of the same caliber as the others you listed. PDL’s ability to represent and manipulate multi-dimensional data (not categorical data, but multidimensional data) is better than anything out there except J-lang.

The second issue with PDL is that the deep internals are simultaneously brilliant and horrifying. There’s a quote from Brian Kernighan that I include at the bottom of my Perl emails: “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” There is far too much cleverness in PDL’s deep internals, and although it works wonderfully, it is mind-bogglingly complex. If this is what you mean by API, you may have a point.

At any rate, I love PDL and I’m glad to see this new release!

This PDL release was the driving force behind File::Map fixing some 64-bit related issues, so thank you Chris and Rob :-)

Why not PDL? I’m not sure.

I’m an Octave (i.e. Matlab) and Perl user who has tried PDL several times. I want to like PDL, because the Matlab/Octave language is terrible, and the implementation is mediocre. But Octave is interactive, so common things should be quick, and even basic things are different, wordy, and/or non-obvious in PDL. Want an identity matrix? Octave: “eye(n)”. PDL:

sub eye
    push @_, $_[0] if @_ diagonal(0,1) .= 1;

How about a diagonal matrix? Octave: “diag(vector)”. PDL:

sub diag
    my $n = @_;
    my $pdl = zeroes($n,$n);
    $pdl->diagonal(0,1) .= pdl @_;

It goes on. A few dozen such utility functions for Octave/Matlab users would help a lot, e.g. eye, diag, mean, var, std, horzcat, repmat, the index-returning behavior of max, min, and hist.

(Ugh, formatting…)

sub eye
    push @_, $_[0] if @_ < 2;
    my $pdl = zeroes(@_);
    $pdl->diagonal(0,1) .= 1;

PDL is not bad, but in the world, numpy and R become most famous tool of statistics.

People tend to think about R and numpy in other language statistics tool.

R is good and simple language to start statistics. PDL is a little difficult to understand and use it.

numpy have clean API and documentation.

For example: http://pdl.perl.org/?page=reference

How to calculate standard deviation? standard deviation is most basic concept in statistics. But it is difficult to find topic of standard deviation in PDL document.

http://docs.scipy.org/doc/numpy/reference/routines.statistics.html This is numpy document. This document is created for people who want to do statistics. This is very understandable to find the way to calculate standard deviation.

People tend to seek clean and simple API. People like Any::Event than POE. People like cpanm than cpan.

@Yuki, I’m a Perl programmer, but I’ve never used PDL. In about 30 seconds I found this in the PDL documentation using the Google search box at the top of this page:


I use MATLAB for research too. I’d like to use more PDL, but there aren’t enough tools in PDL to make prototyping biomedical image analysis quick and easy enough yet. I plan on fixing this, but it all comes down to time (as it always does).

PDL has all the basic functions for n-d data manipulation, but it uses different names. It’s like that with any tool, but PDL could ease the transition with a small layer to map MATLAB-like calls to PDL. That has the drawback of increasing the complexity for programmers that read the code, but it seems that Perl doesn’t always shy away from that (which is a good thing). :-)

You might want to check out this list of MATLAB functions and their PDL equivalents. I see that eye (identity) and diag (stretcher) aren’t there. I’ll fix that shortly.

Leave a comment

About Joel Berger

user-pic As I delve into the deeper Perl magic I like to share what I can.