How do I make the chi2rnd(size) Matlab function faster for big matrices?
显示 更早的评论
I'm running a program a couple thousand times, and the bottleneck of it is just creating the chi-squared noise matrix. It has size 2048 by 100,000 and it takes more than 80% of each iteration (I'm doing 'chi2rnd(2048, 1000,000)) Is there anyway to make this function faster? Or to code my own?
采纳的回答
更多回答(1 个)
Walter Roberson
2015-7-11
1 个投票
chi2rnd() appears to be coded in terms of gamrnd(), so you could speed things up by calling gamrnd() directly; that would reduce the error checking overhead.
类别
在 帮助中心 和 File Exchange 中查找有关 Binomial Distribution 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!