NAME

Axis specification - OADL array axis numbering

SYNOPSIS

arr.meth(... AXIS)

APPLIES TO

All array methods which can take an axis specifier

DESCRIPTION

Several array methods take an axis specifier, such as .reduce() and .accum(). OADL axes are numbered from 0, and correspond to the axis'th entry of the array shape. If the axis specifier is omittited, typically the last axis of the array is used. If the axis specifier is negative, then it indicates that the actual axis to be used is the array rank plus the given axis. Therefore, an axis of -1 typically corresponds to the default (omitted) axis specification.

EXAMPLE

    a = [2,3,4].iterate()
    a
 0  1  2  3
 4  5  6  7
 8  9 10 11

12 13 14 15
16 17 18 19
20 21 22 23

    // Default is across the last axis - the columns
    a.accum(`+)
 0  1  3  6
 4  9 15 22
 8 17 27 38

12 25 39 54
16 33 51 70
20 41 63 86

    // Accumulate across axis 0 - the slices
    a.accum(`+,0)
 0  1  2  3
 4  5  6  7
 8  9 10 11

12 14 16 18
20 22 24 26
28 30 32 34

    // Accumulate across axis 1 - the rows
    a.accum(`+,1)
 0  1  2  3
 4  6  8 10
12 15 18 21

12 13 14 15
28 30 32 34
48 51 54 57


    a.accum(`+) == a.accum(`+,2)
true

    a.accum(`+)== a.accum(`+,-1)
true

SEE ALSO

shape
rank
accum
drop
enclose
laminate
ravel
reduce
replicate
reverse
rotate
take