We present a simple $\mathcal{O}\left( n^2 \frac{ \log N }{ \log \log N } + N \right)$ enumeration algorithm for solving a problem from mathematical and computational music analysis where, given a strictly increasing integer sequence, $S$, with $n$ entries and maximum value $N$, the task is to enumerate all $m$ $\textit{inclusion-maximal arithmetic progressions (IMAPs)}$ in this sequence. An IMAP is a subsequence, $S' \subseteq S$ with $k>2$ integers, in which (i) the difference between any two consecutive integers is the same number, $d$ (i.e., $S'$ is an $\textit{arithmetic progression}$), (ii) $S'$ cannot be further extended to the left or to the right with any additional integers from $S$ while still remaining an arithmetic progression (i.e., $S'$ is a $\textit{maximal}$ arithmetic progression), and (iii) there is no other maximal arithmetic progression, $S'' \subseteq S$, which $\textit{properly}$ contains $S'$ (i.e., $S'$ is an $\textit{inclusion-maximal}$ arithmetic progression). We further provide proofs for the expected number of IMAPs in random integer sequences, $S$, and a bound on their order of growth. Finally, we provide empirical experiments comparing both (a) the practical running time performance of the proposed algorithm against that of a previously known algorithm which has higher time complexity $\mathcal{O}(N^{2+o(1)}n)$, and (b) the actual enumerated number of IMAPs to that of their mathematically expected number. Notably, the proposed algorithm demonstrates a significant improvement in running time over the previously known algorithm, and in immediate practical applications, will allow for more efficient analysis of large and rhythmically complex musical pieces.
翻译:我们提出一种简单的 $\mathcal{O}\left( n^2 \frac{ \log N }{ \log \log N } + N \right)$ 枚举算法,用于解决数学与计算音乐分析中的一个问题:给定一个严格递增的整数序列 $S$,包含 $n$ 个元素且最大值为 $N$,任务是在该序列中枚举所有 $m$ 个 **包含极大等差数列 (IMAPs)**。一个 IMAP 是子序列 $S' \subseteq S$,包含 $k>2$ 个整数,满足:(i) 任意两个连续整数的差为相同常数 $d$(即 $S'$ 是一个 **等差数列**);(ii) 无法通过添加 $S$ 中的其他整数向左或向右延伸 $S'$,同时保持其为等差数列(即 $S'$ 是一个 **极大** 等差数列);(iii) 不存在其他极大等差数列 $S'' \subseteq S$ **真包含** $S'$(即 $S'$ 是一个 **包含极大** 等差数列)。我们进一步给出了随机整数序列 $S$ 中 IMAPs 的期望数量及其增长阶的界限证明。最后,我们通过实证实验比较了:(a) 所提出算法与先前已知时间复杂度更高的 $\mathcal{O}(N^{2+o(1)}n)$ 算法的实际运行时间性能;以及 (b) 实际枚举的 IMAPs 数量与其数学期望值。值得注意的是,所提出算法在运行时间上较先前已知算法有显著提升,并且在直接实际应用中,将能够更高效地分析大型且节奏复杂的音乐作品。