def arrayPermutation(permutation):
 assert (permutation.ndim == 1), 'Only one dimensional permutaton arrays are supported'
 def permute(arr):
  assert (arr.ndim == 1), 'Only one dimensional arrays are supported'
  assert (arr.shape == permutation.shape), "Array shapes don't match"
  return array([arr[i] for i in permutation])
 return permute

def arrayPermutation ( permutation ) : assert ( permutation . ndim == 1 ) , 'Only one dimensional permutaton arrays are supported' def permute ( arr ) : assert ( arr . ndim == 1 ) , 'Only one dimensional arrays are supported' assert ( arr . shape == permutation . shape ) , "Array shapes don't match" return array ( [ arr [ i ] for i in permutation ] ) return permute
return a permutation function .