查看单个帖子
旧 2021-04-24, 17:42   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 Once and for All - Loren on the Art of MATLAB


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...
poster 当前离线   回复时引用此帖