[Scilab-users] is vectorization possible

Dang Ngoc Chan, Christophe Christophe.Dang at sidel.com
Tue Sep 27 10:16:13 CEST 2016


Hello,

> De :  paul.carrico at free.fr
> Envoyé : mardi 27 septembre 2016 09:08
>
> for i = 1 : n
>     tmp(i,1) = sum(a( [1 + (i-1)*w : i*w],:));
> end

So you want to sum on a window which width is w, isn't it?

Not full vectorization,
but you might loop on w (=5) instead of n (=20),
something like

for i = 1:w
   tmp = tmp + a(i : n-w-1 + i)
end

It might be faster.

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


More information about the users mailing list