Hi, 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.