Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]() ![]() I was talking to my long-time colleague, Mike Croucher, who joined MathWorks team recently (yay!). About a bunch of interesting topics, some of which could be good fodder for a blog post. Today I want to talk about for-loops.Table of ContentsNested LoopsStraight-forward Loop Solution, Inner Loop RowsStraight-forward Loop Solution, Inner Loop ColumnsVectorized SolutionAnalysisOrder MattersYour Thoughts?Nested LoopsIn my old Fortran programming days (yes, long gone), I learned early on that my code ran faster if I arranged my nested for-loops optimally. In Fortran, if I were computing one element at a time in a matrix, it meant making sure I filled the elements sequentially, which meant looping over each row, 1 ...read more >> More... |
![]() |
![]() |