Monday, August 27, 2012

Rank Part I

For a multidimensional array, we can say the shape of the array is the 1D array made from concatenating the lengths of each axis. For example:


a =: i. 3 3 2
   a
 0  1
 2  3
 4  5
 6  7
 8  9
10 11
12 13
14 15
16 17

Here "a" is a 3 dimensional array with axes of length 3, 3 and 2. We can get the shape of the array by using the "$" monadic verb.
  $a3 3 2


The rank of an array is essentially the dimensionality of the array. For example, still using "a":


#$a
3

Here we used the "#" verb to get the size of the array. Of course, it is 3 dimensional.

The rank is very important as it determines how verbs act on an array.
But not only arrays (nouns) can have ranks. Verbs (operators) also have rank.

In part II we will look at verb ranks.







No comments:

Post a Comment