Computes A^p
B = linalg_pow ( A , p )
a n-by-n matrix of doubles. May be dense, real, complex or sparse.
a 1-by-1 matrix of doubles, real, integer value.
a n-by-n matrix of doubles, B=A^p
Uses a binary algorithm to compute the power of the matrix A. This algorithm requires generally log2(p) iterations, which is (much) faster that Scilab v5 power algorithm for real matrices. It is based on a macro.
A = [ 5. 4. 3. 2. 1. 4. 4. 3. 2. 1. 0. 3. 3. 2. 1. 0. 0. 2. 2. 1. 0. 0. 0. 1. 1. ]; B = linalg_pow(A,5) E = [ 37721. 47455. 45750. 34540. 18160. 33940. 42751. 41245. 31150. 16380. 15420. 19695. 19156. 14525. 7650. 3720. 5010. 5020. 3861. 2045. 360. 570. 620. 495. 266. ]; // With a complex matrix A = (3 - 2 * %i ) * testmatrix("frk",5) A^6 linalg_pow(A,6) | ![]() | ![]() |
D. Knuth, "The Art of Computer Programming", Vol. 2, "Seminumerical Algorithms"
http://bugzilla.scilab.org/show_bug.cgi?id=8428