Jump to content

Addition-chain exponentiation: Difference between revisions

m
m (→‎{{header|Go}}: bug fix.)
Line 440:
 
=={{header|MATLAB}} / {{header|Octave}}==
I assume that Matlab and Octave have about such optimization already included. On a single core of an "Pentium(R) Dual-Core CPU E5200 @ 2.50GHz", the computation of 100000 repetitions of the matrix exponentiation A^<sup>27182</sup> and A^<sup>31415</sup> take about 2 and 2.2 seconds, resp.
<lang Matlab>x = sqrt(.5);
A = [x,0,x,0,0,0;0,x,0,x,0,0; 0,x,0,-x,0,0;-x,0,x,0,0,0;0,0,0,0,0,1; 0,0,0,0,1,0];A
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.