伴随矩阵复杂度

发布于 2024-07-16 07:58:55 字数 618 浏览 3 评论 0原文

我知道这更像是一个复杂性理论问题,而不是一个编程问题,希望我在这里写的时候没有做错事,如果写错了,请向我道歉,但我希望你们中有人能找到答案。 它甚至在某种程度上通过复杂性理论问题与编程相关。

我正在研究线性循环序列,并且我读到为了获得序列的第 n 个值,您需要获得伴随矩阵的一些幂,我想知道是否有一种已知的算法来获得幂 我无法给出编码示例,但我会尽力为您

提供更多解释:

齐次线性循环序列的 k 阶:
s(n+k)=a(k-1)s(n+k-1)+a(k-2)s(n+k-2)+...+a(0)
对于 n=0,1,..,其中 s(i) 是序列的第 i 个值,a(i) 是代数域中的系数。

A 是上述序列的伴随矩阵,如果它是:
( 0 0 0 0 ... 0 a(0) )
( 1 0 0 0 ... 0 a(1) )
( 0 1 0 0 ... 0 a(2) )
(.. .. .. .. .. .. .. .. ..)
( 0 0 0 0 ... 1 a(k-1) )
此外,理论指出,对于序列的状态向量,我们有:
s(n) = s(0)A^n 对于 n=0,1,..
就是这样,谢谢你的帮助。

I know this is more a complexity theory question than a programming question, hope I'm not doing the wrong thing writing here, apologize me if it's the wrong place but I hope someone of you have the answer. And it's even someway programmin related by being a complexity theory qestion.

I'm studying Linear Recurring Sequences, and I read that in order to obtain the n-th value of the sequence it popped out that you need to get some power of a companion matrix, I was wondering if there's a known algorithm to get powers of this kind of matrix in a fast way..

I can't give coding example, but I shall try to get you some more explanation:

Homogeneous Linear Recurring Sequence of k-th order:
s(n+k)=a(k-1)s(n+k-1)+a(k-2)s(n+k-2)+...+a(0)
for n=0,1,.. where s(i) is the i-th value of the sequence, and the a(i) are coefficients in an Algebraic Field.

A is the companion matrix of the above sequence if it's:
( 0 0 0 0 ... 0 a(0) )
( 1 0 0 0 ... 0 a(1) )
( 0 1 0 0 ... 0 a(2) )
( .. .. .. .. .. .. .. .. ..)
( 0 0 0 0 ... 1 a(k-1) )
Moreover Theory states that for the state vectors of the sequence we have:
s(n) = s(0)A^n for n=0,1,..
That's it, thanks for the help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

明月松间行 2024-07-23 07:58:55

快速求矩阵幂的常用策略是将其对角化(执行特征向量分解):

A = P-1 DP

,其中 D 是对角矩阵。 计算 A 的 n 次方,

然后,您可以通过计算An = P-1 Dn P

其中 Dn 计算速度很快,因为它是一个对角矩阵,因此您只需分别获取每个元素的幂即可。

然而,并非所有矩阵都是可对角化的——我不知道你的伴生矩阵是否可以。 无论如何,您可能会发现这篇维基百科文章很有帮助。

The usual strategy for finding powers of a matrix quickly is to diagonalise it (perform eigenvector decomposition):

A = P-1 D P

where D is a diagonal matrix. You can then raise A to the power n by calculating

An = P-1 Dn P

where Dn is fast to compute because it's a diagonal matrix, so you just take the powers of each element separately.

However not all matrices are diagonalisable -- I don't know if your companion matrix will be or not. You might find this Wikipedia article helpful in any case.

我的黑色迷你裙 2024-07-23 07:58:55

您可以使用 O(log n) 矩阵乘积计算矩阵 Mn 次方:

  • 如果 n=0 code>,
  • 如果 n 为偶数,则返回 I,计算 N=Mn/2 并返回 N*N
  • 如果 n 为奇数,则计算 N=Mn-1 并返回M*N

You can compute the nth power of a matrix M using O(log n) matrix products:

  • if n=0, return I
  • if n is even, compute N=Mn/2 and return N*N
  • if n is odd, compute N=Mn-1 and return M*N
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文