in reply to Using vec to search an array
If I understand your problem correctly, it sounds formally similar to the one discussed in this thread. I think Roy Johnson's solution may be of particular interest to you.
the lowliest monk