This method has two typical-use cases. The first case is to convert sublists of a list E to their corresponding indices. For technical reasons, the accepted input is a list L of sublists of E, and the output is a list of sets of indices, one set for each sublist in L. Note that the order of elements in the sublist is lost, when viewed as a set.
i1 : indicesOf(toList(a..z) | toList(0..9), {{m,a,c,a,u,l,a,y,2},{i,s},{f,u,n}}) o1 = {set {0, 2, 11, 12, 20, 24, 28}, set {8, 18}, set {5, 13, 20}} o1 : List |
The second case is with a matroid as input. Here the ambient list E is taken as the ground set of the matroid (i.e. E = M_*), and L should be a list of elements of M (not a list of lists); in this case the inverse of this method is given by taking subscripts with respect to M.
i2 : M = matroid({a,b,c,d},{{a,b},{a,c}}) o2 = a matroid of rank 2 on 4 elements o2 : Matroid |
i3 : B = {a, c} o3 = {a, c} o3 : List |
i4 : S = indicesOf(M, B) o4 = {0, 2} o4 : List |
i5 : M_S == B o5 = true |
In this case, if L is not a sublist of M_*, then a warning is printed, and L itself is returned. This is done so that if a user inputs a list of indices, then it will be interpreted as a set of indices. For more on this, cf. groundSet.
The object indicesOf is a method function.