@ahojnnes I am not sure if there is some numpy trickery that we can apply instead of `for` loops for non-integer factors. Another problem that intersects with the above problem is to make the function scalable to nD arrays for any n. Please let me know if you know something that might come in handy.