How do I make the chi2rnd(size) Matlab function faster for big matrices?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jorge
le 11 Juil 2015
Commenté : Jorge
le 14 Juil 2015
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?
0 commentaires
Réponse acceptée
Alfonso Nieto-Castanon
le 12 Juil 2015
Modifié(e) : Alfonso Nieto-Castanon
le 12 Juil 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)
Plus de réponses (1)
Walter Roberson
le 11 Juil 2015
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.
0 commentaires
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!