Welcome to AE Resources
Converted document

Array Operations

The built in operations for arrays are fairly extensive. This section will discuss the effects of the main math operators on arrays as well as describe some of the more important intrinsic functions for array operations. The basic operators (+-*/) act on the individual elements of an array. This means that if you have the following two arrays...
A= 1 2   &  B= 5 6
   3 4         7 8     
and if you were to add, subtract, multiply, or divide ’A’ and ’B’, the results would be respectively...
      3  8
      10 12
     ______
     -4  -4
     -4  -4
     ______
      5   12
      21  32
     ______
     .20 .33
     .43 .50
The intrinsic functions allow you to carry out the more common operations on arrays, such as matrix multiplication, and Inverting. The following is a list of a select set of intrinsic functions for Arrays.
TRANSPOSE(arr)  Transposes (flips) the array ’arr’ along the diagonal. Note: assignment variable must be of the transposed array’s shape (e.g. a 2x4 matrix transposed must be assigned to a 4x2 dimension variable.
ALL(MASK, dim)  Returns a .TRUE. if all the values in the MASK are true. The ’dim’ causes the ALL to only check along the dimension specified. The ’dim’ is either 1, 2, or 3 representing row, column, or layer respectively. The result with the use of ’dim’ is a series of ’T’s or ’F’s describing .TRUE. or .FALSE. for each row, column or layer.
ANY(MASK, dim)  Similar to ALL this intrinsic asks whether there are any .TRUE. values in the array and if the ’dim’ option is present, in the specified dimension.
MAXVAL(arr)  Returns the maximum value in the array.
MINVAL(arr)  Returns the maximum value in the array.
PRODUCT(arr)  Calculates the product of all the values in the array.
SUM(arr)  Sums all the values in an array.
SHAPE(arr)  Returns the shape of an array in the form # of rows, # of columns, # of layers
SIZE(arr, dim)  Returns the total number of items in an array. The ’dim’ option will cause the intrinsic to return the number of rows, columns or layers as well
DOT_PRODUCT(Vec_1, Vec_2)  Returns the dot product of two vectors.
MATMUL(Mat_1, Mat_2)  Multiplies two matrices. This is different from the regular multiply symbol (*) which multiplies the individual elements.
MAXLOC(arr, MASK)  Returns the location of the maximum value in the array. If the mask is present it only checks those that fulfill the MASK’s requirements.
MINLOC(arr, MASK)  Similar to MAXLOC except the minimum instead.
← Previous Page
← Previous Page