preprocessings function

Few useful functions for preprocessing arrays