Perl Data Language

From Wikipedia, the free encyclopedia

PDL (short for Perl Data Language) is a set of Array programming extensions to the Perl programming language.

PDL is an extension to Perl v5, intended for scientific and other data intensive programming tasks. Perl's data structures are intended for small to medium sized analysis tasks: they embody simple data structures and include considerable behind-the-scenes magic for type conversion, variable size, and the like. Numerical tasks such as image processing and computer modeling of physical systems require more structured data, and PDL supplies this need by including more traditional array constructs. On a computer with both Perl and PDL installed, any Perl script can use the PDL functionality by declaring "use PDL;".

Like Perl, PDL is free software.

Contents

PDL is a vectorized array programming language: the expression syntax is a variation on standard mathematical vector notation, so that the user can combine and operate on large arrays with simple expressions. In this respect, PDL follows in the footsteps of the APL programming language, and it has been compared to commercial languages such as MATLAB and Interactive Data Language, and to other free languages such as Numerical Python and Octave. Unlike MATLAB and IDL, PDL allows great flexibility in indexing and vectorization: for example, if a subroutine normally operates on a 2-D matrix array, passing it a 3-D data cube will generally cause the same operation to happen to each 2-D layer of the cube.

PDL borrows from perl all three basic types of program structure: imperative programming, functional programming, and pipeline programming forms may be combined. Subroutines may be loaded either via a built-in autoload mechanism or via the usual Perl module mechanism.

As of early 2005, PDL-like functionality is being included in the Perl 6 language design.

A plot generated using PDL
A plot generated using PDL

True to the glue language roots of Perl, PDL borrows from several different modules for graphics and plotting support. NetPBM provides image file I/O (though FITS is supported natively). PLPlot, PGPLOT, and Karma modules are all supported for 2-D graphics and plotting applications, and an interface to GL is available for 3-D plotting and rendering.

PDL provides facilities to read and write many open data formats, including JPEG, PNG, GIF, PPM, MPEG, FITS, NetCDF, GRIB, raw binary files, and delimited ASCII tables. Because of legal threats from Kodak, the owners of IDL, PDL cannot read or write IDL data files.

An installation of PDL usually comes with an interactive shell known as perldl, which can be used to perform simple calculations without requiring to create a perl program file. A typical session of perldl would look something like the following:

 perldl> $x = pdl [[1, 2], [3, 4]];
 
 perldl> $y = pdl [[5, 6, 7], [8, 9, 0]];
 
 perldl> $z = $x x $y;
 
 perldl> p $z;
 
 [
  [21 24  7]
  [47 54 21]
 ]

The commands used in the shell are perl statements that can be used in a program with PDL module included. x is an overloaded operator for matrix multiplication, and p in the last command is a shortcut for print.

The core of PDL is written in C. Most of the functionality is written in PP, a PDL-specific metalanguage that handles the vectorization of simple C snippets and interfaces them with the perl host language via Perl's XS compiler. Some modules are written in FORTRAN, with a C/PP interface layer. Many of the supplied functions are written in PDL itself. PP is available to the user to write C-language extensions to PDL.

The PDL API uses the basic Perl 5 object-oriented functionality: PDL defines a new type of perl scalar object (eponymously called a "PDL") that acts as a Perl scalar, but that contains a conventional typed array of numeric or character values. All of the standard Perl operators are overloaded so that they can be used on PDL objects transparently, and PDLs can be mixed-and-matched with normal Perl scalars. Several hundred object methods for operating on PDLs are supplied by the core modules.

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.