矢量化编程

From Ufldl

Jump to: navigation, search
Line 49: Line 49:
----
----
【原文】:More generally, a good rule-of-thumb for coding Matlab/Octave is:
【原文】:More generally, a good rule-of-thumb for coding Matlab/Octave is:
-
'''Whenever possible, avoid using explicit for-loops in your code.'''
+
::'''Whenever possible, avoid using explicit for-loops in your code.'''
----
----
-
【初译】:通常,一个良好的编写Matlab/Octave程序的窍门就是:'''在编写代码时尽可能的避免使用明显的for循环。'''
+
【初译】:通常,一个良好的编写Matlab/Octave程序的窍门就是:
 +
::'''在编写代码时尽可能的避免使用明显的for循环。'''
----
----
-
【一审】:通常,一个良好的编写Matlab/Octave程序的窍门是:'''代码中尽可能避免显式的for循环。'''
+
【一审】:通常,一个良好的编写Matlab/Octave程序的窍门是:
 +
::'''代码中尽可能避免显式的for循环。'''
----
----
【原文】:In particular, the first code example used an explicit for loop. By implementing the same functionality without the for loop, we sped it up significantly. A large part of vectorizing our Matlab/Octave code will focus on getting rid of for loops, since this lets Matlab/Octave extract more parallelism from your code, while also incurring less computational overhead from the interpreter.
【原文】:In particular, the first code example used an explicit for loop. By implementing the same functionality without the for loop, we sped it up significantly. A large part of vectorizing our Matlab/Octave code will focus on getting rid of for loops, since this lets Matlab/Octave extract more parallelism from your code, while also incurring less computational overhead from the interpreter.

Revision as of 12:23, 7 March 2013

Personal tools