Added permuteDim(...) and dimDXarray(...) helper functions.