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

`equivalence(`

`e1`, `e2`)

Returns equivalence classes. In arrays

and
`e1`

(which are transformed to type `e2``long`

) the user
specifies which elements of a given set belong to the same equivalence
class: elements

and `e1`(`i`)

are in the same equivalence class for all `e2`(`i`)

. The result of
this function is an array with the same dimensional structure as
`i`

in which each element contains the lowest element number
in the class that the current element is in.
`e1`

For example, if `e1 = [2,4,6,3]`

and `e2 = [3,5,7,6]`

, then
`equivalence(e1, e2)`

returns `[2,4,2,2]`

, indicating that
elements 2, 3, 6, and 7 belong to one equivalence class (with element 2
having the smallest element number) and elements 4 and 5 to another
(with element 4 the smallest).