This comparison of programming languages (array) compares the features of array data structures or matrix processing for various computer programming languages.
The following list contains syntax examples of how to determine the dimensions (index of the first element, the last element or the size in elements).
Some languages index from zero. Some index from one. Some carry no such restriction, or even allow indexing by any enumerated type, not only integers.
2 UPB nameetc.
NSArray *
The following list contains syntax examples of how to access a single element of an array.
The following list contains syntax examples of how a range of element of an array can be accessed.
In the following table:
table.move(name, first, last, 1, {})
$[
Some compiled languages such as Ada and Fortran, and some scripting languages such as IDL, MATLAB, and S-Lang, have native support for vectorized operations on arrays. For example, to perform an element by element sum of two arrays, a and b to produce a third c, it is only necessary to write
c = a + b
In addition to support for vectorized arithmetic and relational operations, these languages also vectorize common mathematical functions such as sine. For example, if x is an array, then
y = sin (x)
will result in an array y whose elements are sine of the corresponding elements of the array x.
Vectorized index operations are also supported. As an example,
even = x(2::2); odd = x(::2);
is how one would use Fortran to create arrays from the even and odd entries of an array. Another common use of vectorized indices is a filtering operation. Consider a clipping operation of a sine wave where amplitudes larger than 0.5 are to be set to 0.5. Using S-Lang, this can be done by
y = sin(x); y[where(abs(y)>0.5)] = 0.5;
m←dims⍴x11 x12 ...
-.×m
⍉m
m[i;j]
i j⌷m
m[;j]
j⌷[2]m
j⌷⍤1⊢m
j⌷⍉m
m[i;]
i⌷m
⌹⍠1⊢m
m = RESHAPE([x11, x12, ...], SHAPE(m))
TRANSPOSE(m)
m(i,j)
m(:,j)
m(i,:)
m = {...
determinant(m)
transpose(m)
m[i-1][j-1]
shape(m,0)
shape(m,1)
eigen(output, m, NULL)
LinearAlgebra
m = [1 2; 3 4]
m = [ 1 2 3 4 ]
det(m)
m' for real matrices
m'
m[i, j]
m[:, j]
m[i, :]
eigen(m).values
{{x11, x12, ...}, ...}
Det[m]
Transpose[m]
m[[i,j]]
m[[;;,j]]
m[[i]]
Eigenvalues[m]
m = [...]
m.'
eig(m)
m = mat(...)
linalg.det(m)
m.T
m[i-1,j-1]
m[:,j-1]
m[i-1,:]
linalg.eigvals(m)
m <- matrix(...)
m <- array(...)
t(m)
m[, j]
m[i, ]
eigen(m)
m = reshape([x11, x12, ...], [new-dims])
m = transpose(m)
m[i,j]
m[*,j]
m[j,*]
m = Matrix(...)
m.det()
m.col(j-1)
m.row(i-1)
m.eigenvals()
first:last:step
array[indices]
indices
[0,9,3,4]
A[[[0:3]],7,9,[11:2:-3]]]
list