Re: [Scilab-users] vector operation replacing for loop

2018-11-08 Thread Heinz Nabielek
Thanks > On 08.11.2018, at 21:04, Samuel Gougeon wrote: > > Le 08/11/2018 à 20:24, Heinz Nabielek a écrit : >> Great. Thanks. Should have thought of it myself... >> >> Still: is there a vector way? > > Didn't you read Guylaine's answer? > She proposes a tricky algorithm. Unfortunately, it

Re: [Scilab-users] vector operation replacing for loop

2018-11-08 Thread Samuel Gougeon
Le 08/11/2018 à 20:24, Heinz Nabielek a écrit : Great. Thanks. Should have thought of it myself... Still: is there a vector way? Didn't you read Guylaine's answer? She proposes a tricky algorithm. Unfortunately, it cannot be used for very long Z input, due to memory considerations. I am

Re: [Scilab-users] vector operation replacing for loop

2018-11-08 Thread Heinz Nabielek
Great. Thanks. Should have thought of it myself... Still: is there a vector way? Heinz > On 07.11.2018, at 21:06, kjubo wrote: > > > > Hello, > > precalculate the know values, I gain 40% faster execution time. > Hope helps a bit... > > BR > > clc, clear, mode(0) > > n=1e6 >

Re: [Scilab-users] vector operation replacing for loop

2018-11-07 Thread kjubo
Hello, precalculate the know values, I gain 40% faster execution time. Hope helps a bit... BR clc, clear, mode(0) n=1e6 Z=grand(1,n,'nor',0,1); Z=Z(:); r=0.9; tic() V1=Z; for ii=2:n; V1(ii)=r*V1(ii-1)+sqrt(1-r^2)*Z(ii); end; toc() tic() V2 = Z; k1 = sqrt(1-r^2).*Z; for ii=2:n;

Re: [Scilab-users] vector operation replacing for loop

2018-11-01 Thread Samuel Gougeon
Le 01/11/2018 à 13:40, Samuel Gougeon a écrit : Hello, Le 01/11/2018 à 09:27, Heinz Nabielek a écrit : Sorry, Scilab friends, I am still not fluid with vector operations. Can someone rewrite the for loop for me into something much more efficient? n=1000; Z=grand(1,n,'nor',0,1); r=0.9; V=Z;

Re: [Scilab-users] vector operation replacing for loop

2018-11-01 Thread Samuel Gougeon
Hello, Le 01/11/2018 à 09:27, Heinz Nabielek a écrit : Sorry, Scilab friends, I am still not fluid with vector operations. Can someone rewrite the for loop for me into something much more efficient? n=1000; Z=grand(1,n,'nor',0,1); r=0.9; V=Z; for i=2:n; V(i)=r*V(i-1)+sqrt(1-r^2)*Z(i);

Re: [Scilab-users] vector operation replacing for loop

2018-11-01 Thread Collewet Guylaine
-r^2)*mat*Z(2:$)'; Guylaine -Message d'origine- De : users [mailto:users-boun...@lists.scilab.org] De la part de Heinz Nabielek Envoyé : jeudi 1 novembre 2018 09:27 À : Users mailing list for Scilab Objet : [Scilab-users] vector operation replacing for loop Sorry, Scilab friends, I am

[Scilab-users] vector operation replacing for loop

2018-11-01 Thread Heinz Nabielek
Sorry, Scilab friends, I am still not fluid with vector operations. Can someone rewrite the for loop for me into something much more efficient? n=1000; Z=grand(1,n,'nor',0,1); r=0.9; V=Z; for i=2:n; V(i)=r*V(i-1)+sqrt(1-r^2)*Z(i); end; The transformation generates an autocorrelated (here