Array programming: Difference between revisions

Content deleted Content added
Jon Awbrey (talk | contribs)
m puncs, decaps
Line 1:
'''Array programming languages''' (also known as '''vector''' or '''multidimensional''' languages) generalize operations on [[scalar]]s to apply transparently to [[vector (spatial)|vector]]s, [[Matrixmatrix (mathematics)|matrices]], and higher dimensional arrays.
 
[[APL programming language|APL]], designed by [[Kenneth E. Iverson|Ken Iverson]], was the first [[programming language]] to provide Arrayarray Programmingprogramming capabilities.
 
The fundamental idea behind Arrayarray Programmingprogramming 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 Programmingprogramming 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|one-liners]] that require more than a couple of pages of Java code.
 
Array Programmingprogramming is very well suited to implicit parallelization; a topic of much research nowadays.
 
[[Function rank]] is an important concept to array programming languages in general, by analogy to [[tensor]] rank in mathematics: functions that operate on data may be classified by the number of dimensions they act on. Ordinary multiplication, for example, is a scalar ranked function because it operates on zero-dimensional data (individual numbers). The [[cross product]] operation is an example of a vector rank function because it operates on vectors, not scalars. [[Matrix multiplication]] is an example of a 2-rank function, because it operates on 2-dimensional objects (matrices). [[Collapse operators]] 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'''