Counting integer points inside a sphere of radius R and dimension D

前端 未结 3 1268
心在旅途
心在旅途 2021-01-03 15:29

I am trying to write an efficient algorithm that counts the number of points inside a Sphere of Radius R and Dimension D. The sphere is always at the origin. Suppose we have

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-03 16:16

    An approach similar to that described by MBo, including source code, can be found at https://monsiterdex.wordpress.com/2013/04/05/integer-lattice-in-n-dimensional-sphere-count-of-points-with-integer-coordinates-using-parallel-programming-part-i/.

    The approach consists in finding partitions of the radius, and then for each partition in the sphere compute the number of ways it can be represented in the sphere by both permuting coordinates and flipping the signs of nonzero coordinates.

提交回复
热议问题