Perl Data Language

Short description: Array programming library for Perl

Perl Data Language (PDL)Paradigm| Array

|

Developer| Karl Glazebrook, Jarle Brinchmann, Tuomas Lukka, and Christian Soeller
First appeared| 1996 (1996)
OS| Cross-platform
License| GNU General Public License, Artistic License
Website| pdl.perl.org
Influenced by
APL, IDL, Perl

Perl Data Language (abbreviated PDL) is a set of free software array programming extensions to the Perl programming language. PDL extends the data structures built into Perl, to include large multidimensional arrays, and adds functionality to manipulate those arrays as vector objects. It also provides tools for image processing, machine learning, computer modeling of physical systems, and graphical plotting and presentation. Simple operations are automatically vectorized across complete arrays, and higher-dimensional operations (such as matrix multiplication) are supported.

## Contents

* 1 Language design
* 2 Graphics
* 3 I/O
* 4 Machine learning
* 5 perldl
* 6 Implementation
* 7 See also
* 8 References
* 9 External links

## Language design

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 NumPy and Octave.[1] 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.[2]

PDL borrows from Perl at least 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.

## Graphics

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). Gnuplot, PLplot, PGPLOT, and Prima modules are supported for 2-D graphics and plotting applications, and Gnuplot and OpenGL are supported for 3-D plotting and rendering.

## I/O

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. PDL programmers can use the CPAN Perl I/O libraries to read and write data in hundreds of standard and niche file formats.

## Machine learning

PDL can be used for machine learning. It includes modules that are used to perform classic k-means clustering or general and generalized linear modeling methods such as ANOVA, linear regression, PCA, and logistic regression. Examples of PDL usage for regression modelling tasks include evaluating association between education attainment and ancestry differences of parents,[3] comparison of RNA-protein interaction profiles that needs regression-based normalization[4] and analysis of spectra of galaxies.[5]

## perldl

An installation of PDL usually comes with an interactive shell known as perldl, which can be used to perform simple calculations without requiring the user 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`.

## Implementation

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. There is also an Inline module (Inline::Pdlpp) that allows PP function definitions to be inserted directly into a Perl script; the relevant code is low-level compiled and made available as a Perl subroutine.

The PDL API uses the basic Perl 5 object-oriented functionality: PDL defines a new type of Perl scalar object (eponymously called a "PDL", or "ndarray") 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.

## See also

* Comparison of numerical-analysis software
* List of numerical-analysis software

## References

1. ↑ "Putting Perl Back on Top in the Fields of Scientific and Financial Computing". http://blogs.perl.org/users/lhermida/2011/03/hi-everyone-as-a-bioinformatician.html.
2. ↑ "PDL online documentation (PDL::Threading section)". http://pdl.perl.org/?docs=Threading&title=PDL::Threading.
3. ↑ "Educational Attainment Influences Levels of Homozygosity through Migration and Assortative Mating". PLOS ONE 10 (3): e0118935. Mar 2015. doi:10.1371/journal.pone.0118935. PMID 25734509. Bibcode: 2015PLoSO..1018935A.
4. ↑ "dCLIP: a computational approach for comparative CLIP-seq analyses". Genome Biology 15 (1): R11. Jan 2014. doi:10.1186/gb-2014-15-1-r11. PMID 24398258.
5. ↑ "Pipe3D, a pipeline to analyze Integral Field Spectroscopy Data: I. New fitting philosophy of FIT3D". Revista Mexicana de Astronomía y Astrofísica 52: 21–53. April 2016. Bibcode: 2016RMxAA..52...21S.

## External links

* PDL Quick Reference PDL Intro & resources
* Tutorial lecture on PDL
* Draft release of the PDL Book for PDL-2.006
* Example of PDL usage in the scientific literature

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Perl Data Language. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Perl_Data_Language&oldid=3385490"