Added partition (Issue #1)
Made nub inline
Added elem_index and elem_indices (Issue #1)