[matlab] performance for-loops vs. vectorization vs. bsxfun
From time to time I explain my students certain concepts. To archive those and as an extended memory, I share them here. We also recently had some discussion on vectorization in our research group. e.g. in python and matlab. With the second link claiming for-loops in matlab are performing much better than before. Goal Show that for-loops are still quite slow in matlab. Compare bsxfun against vectorized arithmetic expansion in matlab against bsxfun The contenders good old for-loop: Easy to understand, can be found everywhere, slow arithmetic expansion: medium difficulty, should be general used, fast bsxfun: somewhat difficult to…