arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.22456cs.CG
收藏

在正方形网格中近线性时间内计算所有格点矩形

Counting All Lattice Rectangles in the Square Grid in Near-Linear Time

France(法国)

Dmitry Babichev, Sergey Babichev

AI总结:

研究正方形网格中所有格点矩形的精确计数问题,提出多种复杂度递减的算法,包括O(n²)扫描、O(n^{3/2}log n)和O(n^{4/3}log n)分解,以及O(n log³n)和O(n log²n)的算法,并给出计算F(1)到F(N)的O(N^{3/2})算法。

摘要:

我们研究正方形[0,n)×[0,n)中所有格点矩形的精确计数问题,包括非轴对齐的矩形。从标准参数化方法出发,推导出几种精确算法:经典的O(n²)扫描算法、复杂度为O(n^{3/2}log n)和O(n^{4/3}log n)的分解算法、复杂度为O(n log³n)的十矩形加权地板和减少算法,以及复杂度为O(n log²n)的除数层算法。我们还给出了一个计算F(1),…,F(N)的算法,其复杂度为O(N^{3/2})。近线性单值算法的核心思想是将几何求和转化为常数大小的加权地板和族,该族在欧几里得式仿射和反向变换下封闭。除了精确算法结果外,我们还推导出一个双项渐进行为,F(n)= (4log2-1)/π² n⁴ logn + Bn⁴ + o(n⁴),其中B有显式公式,为算法生成的大n数值数据提供独立一致性检查。

英文摘要:

We study the exact counting problem for all lattice rectangles contained in the square $[0,n)\times[0,n)$, including non-axis-parallel ones. Starting from the standard parametrization by a primitive direction $(u,v)$ and two side lengths, we derive several exact algorithms: the classical $O(n^2)$ sweep, decompositions of complexity $O(n^{3/2}\log n)$ and $O(n^{4/3}\log n)$, a ten-moment weighted-floor-sum reduction of complexity $O(n\log^3 n)$, and a divisor-layer algorithm with the complexity $O(n\log^2 n)$. We also give an all-values algorithm that computes $F(1),\ldots,F(N)$ in $O(N^{3/2})$ arithmetic operations. The main idea behind the near-linear one-value algorithms is to reduce the geometric summation to constant-size families of weighted floor sums closed under Euclidean-style affine and reciprocal transformations. Besides the exact algorithmic results, we derive a two-term asymptotic expansion, $F(n)=\frac{4\log 2-1}{π^2}n^4\log n+B\,n^4+o(n^4)$ with the explicit formula for $B$, which provides an independent consistency check for the large-$n$ numerical data produced by the algorithms.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑