matrix to the power of a large number

9 vues (au cours des 30 derniers jours)
Martin Thomas
Martin Thomas le 19 Août 2015
Commenté : Walter Roberson le 22 Août 2015
Hi, I want to calculate a Matrix like 1000 x 1000 (or 10000 x 10000) to the power of a large number like 10^6 /10^7. The Matrix consists of, for example 3 (2-8, case dependent) different vectors with 1000 (or 10000) entries, which are shifted 3 rows down for each vector block. The structure stays the same if I calculate Matrix^n; so instead of 1000^2 unknowns, I only have 3*1000; can I use the Matrix structure somehow?
Thanks a lot in advance! :)
A1 B1 C1 A(N-2) B(N-2) ....
A2 B2 C2 A(N-1) B(N-1)
A3 B3 C3 A(N) B(N)
A4 B4 C4 A1 B1 ...

Réponses (3)

Harsha Medikonda
Harsha Medikonda le 21 Août 2015
I understand that you wish to calculate matrix to the power of a large number.
"mpower" function can be used to calculate matrix to the power of a number. Refer to the following documentation links for "mpower" and "power"

John D'Errico
John D'Errico le 21 Août 2015
You do realize that you are probably wasting your time in this task?
If your matrix has elements in it that are as large as 2, that 2^1e7 is a number with 3 million plus decimal digits. Even in floating point format as a double, numbers of that size are not stored in MATLAB, except as inf. The result will overflow, and do so for even rather small exponents.
At best, you can use tools like my own HPF toolbox, or the symbolic toolbox.
If you insist on doing so, then it is easy enough to do. Of course, I assume you mean an element-wise power, since it makes no sense to raise a matrix that is not square to a power.
A = [1 2 3;4 5 6];
A.^100
A.^500
ans =
1 3.2734e+150 3.636e+238
1.0715e+301 Inf Inf
See that even a power as large as 500 is large enough to overflow some of those entries. The dynamic range of a double precision number is quite limited in this respect.
  1 commentaire
Walter Roberson
Walter Roberson le 21 Août 2015
They are using a square matrix with elements shifted along between the rows like toeplitz so I think they do want matrix power.

Connectez-vous pour commenter.


Walter Roberson
Walter Roberson le 21 Août 2015
Remember if you need to you can svd and raise the diagonal to the power.
  2 commentaires
Martin Thomas
Martin Thomas le 21 Août 2015
Hi, Here is the Matrix in. For this size it takes 0 seconds to calculate MMM^245760. the maximum value is below 1 and the biggest eigenvalue is 1.
As a "human" knowing of the Matrix structure I can reduce the number of calculations I need by 127/128 ~ so about 99 %. Can I somehow tell Matlab to use this structure? Calculating only the first 3 columns and then reassembling the Matrix in a for loop takes a lot longer than calculating all Matrix elements.
I tried svd [U,S,V] = svd(MMM) and MMM^245760 = U*S^245760*V'
but it does not work.
mpower is not faster than MMM^245760.
Walter Roberson
Walter Roberson le 22 Août 2015
You neglected to attach the matrix.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by