Next: , Previous: , Up: Internal Routines   [Contents][Index]

15.5.638 tolookup

tolookup, src, list, index

Determines a lookup table for src in list such that list contains no duplicate members, and index contains an index to the member of list that corresponds to each member of src.

If src has only one dimension, then index has the same number of elements as src, and list has the number of elements equal to the number of unique members of src. In that case, list(index) is an exact copy of src.

If src has more than one dimension, then its last dimension is taken to contain the numbers that define each member, and the remaining dimensions select the different members. In that case, list gets two dimensions: the first one loops over all unique members, the second one contains the defining numbers for each member (and has the same dimension as the last dimension of list). Then, index gets all but the last dimension of src.

For example, if src is a 2 by 3 by 4 array, then it is taken to contain six (2 times 3) individual members which are each characterized by 4 numbers (e.g., the second member is src(1,0,*)). If there are three unique 4-element members in src, then tolookup,src,list,index yields list as a 3 by 4 array and index as a 2 by 3 array. In that case, src(0,0,*) is equal to list(index(0,0)), and src(1,2,*) to list(index(1,2)), and in general src equal to list(index,*).