Thursday, February 02, 2017

Symmetric Dirichlet in d dimensions

function res=dirchrnd(alpha,d)
res = zeros(d,1);
for i=1:d
res(i)=gamrnd(alpha,1);
end
res=res/sum(res);
end

No comments:

Python Terminal Animation for Waiting

A nice small tool for terminal animations from yaspin import yaspin with yaspin(): do_stuff()