Array programming |
Array programming languages (also known as vector or multidimensional languages) generalize operations on scalars to apply transparently to vector (spatial)s, Matrix (mathematics), and higher dimensional arrays.
APL programming language, by Kenneth E. Iverson, was the first programming language to provide Array Programming capabilities. Today, Fortran 95 and MATLAB are probably the most widely used compiled and interpreted array programming languages.
The fundamental idea behind Array Programming is that operations apply at once to an entire set of values. This makes it a high-level programming model as it allows the programmer to think and operate on whole aggregates of data, without having to resort to explicit loops of individual scalar operations.
Array Programming primitives concisely express broad ideas about data manipulation. The level of conciseness can be dramatic in certain cases: it is not uncommon to find array programming language one-liner program that require more than a couple of pages of Java code.
Array Programming is very well suited to implicit parallelization; a topic of much research nowadays.
reduce the dimensionality of an input data array by one or more dimensions. For example, summing over elements collapses the input array by 1 dimension.
=Overview=
In scalar languages like FORTRAN 77, C, Pascal, Ada, etc. operations apply only to single values, so a+b expresses the addition of two numbers. In such languages adding two arrays requires indexing and looping:
FORTRAN 77 DO 10 I = 1, N DO 10 J = 1, N 10 A(I,J) = A(I,J) + B(I,J)
C for ( i=0; i|
|