PDL (short for English. P erl D ata L anguage ) is a set of vector extensions for the Perl programming language version 5. Designed for scientific calculations and other tasks associated with processing large amounts of data, including: image processing , computer simulation of physical systems.
| Perl Data Language (PDL) | |
|---|---|
| Language class | vector ( en: Array programming ) |
| Appeared in | 1996 |
| Author | Karl Glazebrook, Charles Brinchmann, Thomas Lucca and Christian Soller |
| Developer | |
| Release | 2.4.11 (May 20, 2012) |
| Experienced influence | APL , IDL , Perl |
| License | GNU General Public License , Artistic License |
| Site | pdl.perl.org |
PDL connects to the Perl program using: use PDL;
Content
Language Design
PDL is a vector language: the syntax of expressions is similar to the standard mathematical notation for operations on vectors of multidimensional matrices. In this respect, PDL is similar to the APL programming language and is often compared to MATLAB , Interactive Data Language , NumPy, and Octave . Unlike MATLAB and IDL, the PDL language allows for more flexible indexing and vectorization, for example, if a three-dimensional file is applied to a function that processes two-dimensional matrices, the function will be applied in layers to each layer of the cube.
At the beginning of 2005, functionality similar to PDL was planned to be included in the sixth version of the language ( Perl 6 ).
Graphics
PDL provides interfaces to several modules for creating graphs. NetPBM is used for image I / O; PLplot , PGPLOT and Karma are used for 2D graphics. For 3D graphics, the OpenGL interface is used.
Input / Output
PDL provides the ability to read and write data in various formats, including JPEG , PNG , GIF , PPM , MPEG , FITS , NetCDF , GRIB , binary files, CSV .
perldl
Along with PDL, the perldl interactive interpreter is usually installed, which allows you to perform simple calculations without the need to create files with program text. Example of working with perldl:
perldl> $ x = pdl [[1, 2], [3, 4]]; perldl> $ y = pdl [[5, 6, 7], [8, 9, 0]]; perldl> $ z = $ xx $ y; perldl> p $ z; [ [21 24 7] [47 54 21] ]
In this example, two matrices are created and then, using the overloaded operator x , matrix multiplication is performed. The p command is an abbreviation for print .
Implementation
The PDL core is implemented in C language. Much of the functionality is implemented in PP , the PDL metalanguage. Some modules are written in FORTRAN , with an interface to C or PP. PP makes it easy to write C language extensions to PDL.
The PDL implementation uses Perl's object-oriented features: PDL defines a new scalar object of type “PDL” (often denoted piddle , behaves like scalar types) containing arrays of arbitrary dimension. All standard language operators are overloaded to transparently support piddle objects. Unlike standard language arrays, piddle was originally designed for efficient numerical processing.
Literature
- Games, diversions, and Perl culture: best of the Perl journal. Jon Orwant. Chapter 11 "PDL: The Perl Data Language"
Links
- PDL - The Perl Data Language - the main site of the project
- PDL Quick Reference - Introduction to PDL
- PDL Book Draft (PDL-2.4.10)