/ concept-collection / math-webgpu-sandbox
concept-collection / math-webgpu-sandbox
math-webgpu-sandbox / examples / logistic_ensemble.m
13 lines · 390 BBlameHistoryRaw
1% Two million logistic maps x <- r x (1 - x) iterated 4000 times in
2% lockstep (8 billion updates). The loop body compiles once and replays.
3n = 2000000;
4niter = 4000;
5r = 3.5 + 0.5*rand(n, 1);
6x = rand(n, 1);
7tic;
8for k = 1:niter
9 x = r .* x .* (1 - x);
10end
11t = toc;
12fprintf('%.0f million map-updates/sec\n', niter*n/1e6/t);
13fprintf('mean x after %d iterations: %.4f\n', niter, mean(x));