IDL programming language
|
IDL, short for interactive data language, is a programming language which is a popular data analysis language among scientists. IDL is often confused, at the acronym level, with another (unrelated) "IDL": the Interface description language.
Contents |
Overview
IDL is vectorized, numerical, interactive, Fortran-like, and is commonly used for interactive processing of large amounts of data (including image processing), right from the keyboard.
IDL originated from early VAX/VMS/Fortran, and its syntax still shows its heritage:
x = findgen(100)/10 y = sin(x)/x plot,x,y
Note that the operation in the second line applies in a vectorized manner to the whole 100-element array created in the first line, analogous to the way general-purpose array programming languages (such as APL or J) would do it.
As most other array programming languages, IDL is very fast doing vector operations (sometimes as fast as a well-coded custom loop in FORTRAN or C) but quite slow if elements need processing one-by-one. Hence part of the art of using IDL (or any other array programming language, for that matter) for numerically heavy computations is to make use of the inbuilt vector operations.
Features
As a computer language, IDL:
- is dynamically typed
- has a single namespace
- was originally single threaded but now has many multi-threaded functions and procedures
- has all function arguments passed by reference ("IN-OUT")
- does not require variables to be predeclared
- provides only COMMON block declarations to share global values among routines
- provides a basic form of object-oriented programming, somewhat similar to Smalltalk
- compiles to an interpreted, stack-based intermediate p-code (à la Java VM)
- provides a simple and efficient index slice syntax to extract data from large arrays
- provides various integer sizes, as well as single and double precision floating point real and complex numbers
- provides composite data types such as character strings, homogeneous-type arrays, and simple (non-hierarchical) record structures of mixed data types
Problems
Some of these features, which make IDL very simple to use interactively, also cause difficulties when building large programs. The single namespace is particularly problematic in those cases. IDL also lacks empty arrays, variable-sized dynamic arrays (lists), and nested arrays (that is, arrays of arrays are not permitted). The object-oriented features of the language require that the programmer be responsible for managing memory allocation/deallocation. The vectorization is rather primitive, working only along a single axis at a time.
Many historical irregularities survive from the early heritage of the language. Dynamic typing does not include automatic promotion-on-overflow; one consequence is that (for loops) built in the usual way may fail on the 32,768th iteration. The solution is to define the default type for all integers to 32-bit unsigned (this can be done at startup, or embedded in source code). Array indexing and subroutine entry can both be carried out with exactly the same syntax; this ambiguity, coupled with the single namespace for all variables and subroutines, can cause code to stop working when newly defined subroutines or language extensions conflict with local variable names. IDL programmers can avoid many of these problems by using square brackets for array indexing, thereby avoiding conflicts with function names which use parenetheses.
Examples
The following graphics were created with IDL (source code included):
- Image of random data plus trend, with best-fit line and different smoothings
- Plots of delta-o-18 against age and depth (from EPICA and Vostok)
See also
- GNU data language (GDL) - a GNU IDL clone
External link
- Research Systems (http://www.researchsystems.com)
- GDL (GNU data language) web page (http://gnudatalanguage.sourceforge.net/)fi:IDL-ohjelmointikieli