How do I make the chi2rnd(size) Matlab function faster for big matrices?
2 views (last 30 days)
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?
Alfonso Nieto-Castanon on 12 Jul 2015
Edited: Alfonso Nieto-Castanon on 12 Jul 2015
storing the chi2rnd(2048, 1000000) results require about 16Gb of memory, perhaps the extra time is due to memory-swapping rather than actually computing these values? (I suggest to evaluate whether your code actually needs the entire matrix being computed in a single step)