Utility functions for dealing with array (vectorizing, indexing, checking consistency...).