Le 27/09/2016 à 09:08, paul.carr...@free.fr a écrit :
Hi All
Is the vectorization possible for the example herebellow? everything I
tried failed !
if a is a vector, it is quite straight forward: sum(matrix(a,w,-1),1).'
k=100;a=rand(k,1);w=5;n=k/w;
tmp = zeros(n,1);
for i = 1 : n
tmp(i,1) = sum
Hello,
> De : paul.carr...@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
= zeros(n,1);
tmp = sum(matrix(a,w,n),'r')';
duree_vectorization = toc()
max_error = max(abs(tmp - tmp2))
- Mail original -
De: "ol.bond"
À: users@lists.scilab.org
Envoyé: Mardi 27 Septembre 2016 09:59:12
Objet: Re: [Scilab-users] is vectorization possible
As just m
gt;
> > ----- Mail original -
> > De: "Tim Wescott" <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4034644&i=1>>
> > À: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4034644&i=2>
> > Envoyé: Mardi 2
On 2016-09-27 00:48, Samuel Gougeon wrote:
> Le 27/09/2016 09:17, Tim Wescott a écrit :
>
>> .../...
>>
>> Or sum(..., 'r'). I can't remember which is which. One makes a row,
>> the other makes a column, but I can never remember if it's "sum all
>> columns" or "sum into a column".
> :)
> Neve
ans 'column' and 'r' means row => for
matrix operations
- Mail original -
De: "Tim Wescott"
À: users@lists.scilab.org
Envoyé: Mardi 27 Septembre 2016 09:17:30
Objet: Re: [Scilab-users] is vectorization possible
tmp = sum(a( [1 + (i-1)*n : i*n],:), 'c'
Le 27/09/2016 09:17, Tim Wescott a écrit :
.../...
Or sum(..., 'r'). I can't remember which is which. One makes a row,
the other makes a column, but I can never remember if it's "sum all
columns" or "sum into a column".
:)
Never did i, until i realized that operating *across* Rows yields a Ro
pb: in my understanding, 'c' means 'column' and 'r' means row => for matrix
operations
- Mail original -
De: "Tim Wescott"
À: users@lists.scilab.org
Envoyé: Mardi 27 Septembre 2016 09:17:30
Objet: Re: [Scilab-users] is vectorization possib
tmp = sum(a( [1 + (i-1)*n : i*n],:), 'c')
Or sum(..., 'r'). I can't remember which is which. One makes a row,
the other makes a column, but I can never remember if it's "sum all
columns" or "sum into a column".
On Tue, 2016-09-27 at 09:08 +0200, paul.carr...@free.fr wrote:
> Hi All
>
> Is the
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);
//
10 matches
Mail list logo