[Scilab-users] is vectorization possible
paul.carrico at free.fr
paul.carrico at free.fr
Tue Sep 27 09:08:15 CEST 2016
Hi All
Is the vectorization possible for the example herebellow? everything I tried failed !
Thanks for any help
Paul
##################################################################
mode(0)
k = 100;
a = rand(k,1);
w = 5;
n = (k/w);
i = [1 : n]';
tmp = zeros(n,1);
// using vectorization
tmp(i,1) = sum(a( [1 + (i-1)*n : i*n],:)
abort
// same using a loop
for i = 1 : n
tmp(i,1) = sum(a( [1 + (i-1)*w : i*w],:));
end
tmp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160927/78109da1/attachment.htm>
More information about the users
mailing list