help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with vectorization of update rule


From: John W. Eaton
Subject: Re: help with vectorization of update rule
Date: Thu, 21 Oct 2010 16:00:17 -0400

On 21-Oct-2010, James Sherman Jr. wrote:

| On Thu, Oct 21, 2010 at 11:48 AM, grg <address@hidden> wrote:
| 
| I believe that it is because the vectorization in this case takes many
| more multiplications and additions than the non-vectorized version.  Your
| initial implementation takes one matrix multiplication (s by s times s by 20)
| per "it" (T of them in this case).
| 
| The vectorized version essentially calculates the matrix exponential at every
| time instant independently of each other, so for say it = 3, it calculates A^3
| then multiplies it by x0 (2 multiplications of s by s, then one of s by s
| times s by 20).  Then for it = 4, it calculates A^4 then multiplies it by x0. 
| (3 multiplications of s by s, then one of s by s times s by 20)   So you have
| many more calculations to perform.
| 
| Thats my semi-informed guess of why the vectorization in this case takes much
| longer.

Also, the loop is only from 1:20.  Try setting T to something like
5000 and then compare.

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]