Multidimensional algorithm working on hypersferical section of an array