Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
>n=1000; m=100; x=random(1,n);
|
||||
>x10=fold(x,ones(1,m)/m);
|
||||
>x10=fftfold(x,ones(1,m)/m)[m:n]; // more efficient
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
>function store (x:number, v:vector, n:index) ...
|
||||
$if cols(v)<n then return v|x;
|
||||
$else
|
||||
$ v=rotleft(v); v[-1]=x;
|
||||
$ return v;
|
||||
$endif;
|
||||
$endfunction
|
||||
>v=zeros(1,0); for k=1:20; v=store(k,v,10); mean(v), end;
|
||||
1
|
||||
1.5
|
||||
2
|
||||
2.5
|
||||
3
|
||||
3.5
|
||||
4
|
||||
4.5
|
||||
5
|
||||
5.5
|
||||
6.5
|
||||
7.5
|
||||
8.5
|
||||
9.5
|
||||
10.5
|
||||
11.5
|
||||
12.5
|
||||
13.5
|
||||
14.5
|
||||
15.5
|
||||
>v
|
||||
[ 11 12 13 14 15 16 17 18 19 20 ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue