![]() I subtract one row from either a subset (first 50 rows, dashed line) or all rows of an matrix with n= and m =. Therefore, I decided to systematically compare those. ![]() The same is true for different array sizes. While demonstrating this to my student, I noticed that subsetting an array has interesting effects on the performance differences. bsxfun: somewhat difficult to understand, I use it regularily, fast (often).arithmetic expansion: medium difficulty, should be general used, fast.good old for-loop: Easy to understand, can be found everywhere, slow. ![]() Compare bsxfun against vectorized arithmetic expansion in matlab against bsxfun The contenders Show that for-loops are still quite slow in matlab. With the second link claiming for-loops in matlab are performing much better than before. We also recently had some discussion on vectorization in our research group. To archive those and as an extended memory, I share them here. From time to time I explain my students certain concepts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |