PDL 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.

I wanted to make a test of how to plot a graph with PDL.

This is the test script and the plot result:


The script is like this:

use strict;
use warnings;

use PDL;
use PDL::Graphics::PGPLOT;
use PDL::Complex;


my $z50 = zeroes(50);
my $c = $z50->xlinvals(0,7)+i*$z50->xlinvals(2,4);
line im sin $c; hold;      # the imaginary part
line re sin $c;            # real
line abs sin $c; release;

Lines 10 and 11 are needed for create graphical server for see the graphic.

PDL is well suited for matrix computations, general handling of multidimensional data, image processing, general scientific computation, numerical applications. It supports I/O for many popular image and data formats, 1D (line plots), 2D (images) and 3D (volume visualization, surface plots via OpenGL – for instance implemented using Mesa or video card OpenGL drivers), graphics display capabilities and implements many numerical and semi-numerical algorithms.

It provides tons of useful functionality for scientific and numeric analysis.

For readers familiar with other scientific data evaluation packages it may be helpful to add that PDL is in many respects similar to IDL, MATLAB and similar packages. However, it tries to improve on a number of issues which were perceived (by the authors of PDL) as shortcomings of those existing packages.

For more information on PDL please visit its website at http://pdl.perl.org.

Good Perl!