Added enum_matrix function to replace apply_along_axis calls in `topics` etc.