Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b38d2da330d1936e5ab1307c039c4941 > files > 534

octave-doc-3.6.4-3.mga4.noarch.rpm

<html lang="en">
<head>
<title>Vectorization and Faster Code Execution - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Linear-Algebra.html#Linear-Algebra" title="Linear Algebra">
<link rel="next" href="Nonlinear-Equations.html#Nonlinear-Equations" title="Nonlinear Equations">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Vectorization-and-Faster-Code-Execution"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Nonlinear-Equations.html#Nonlinear-Equations">Nonlinear Equations</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Linear-Algebra.html#Linear-Algebra">Linear Algebra</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="chapter">19 Vectorization and Faster Code Execution</h2>

<p><a name="index-vectorization-2123"></a><a name="index-vectorize-2124"></a>
Vectorization is a programming technique that uses vector operations
instead of element-by-element loop-based operations.  Besides frequently
producing more succinct Octave code, vectorization also allows for better
optimization in the subsequent implementation.  The optimizations may occur
either in Octave's own Fortran, C, or C++ internal implementation, or even at a
lower level depending on the compiler and external numerical libraries used to
build Octave.  The ultimate goal is to make use of your hardware's vector
instructions if possible or to perform other optimizations in software.

   <p>Vectorization is not a concept unique to Octave, but it is particularly
important because Octave is a matrix-oriented language.  Vectorized
Octave code will see a dramatic speed up (10X&ndash;100X) in most cases.

   <p>This chapter discusses vectorization and other techniques for writing faster
code.

<ul class="menu">
<li><a accesskey="1" href="Basic-Vectorization.html#Basic-Vectorization">Basic Vectorization</a>:         Basic techniques for code optimization
<li><a accesskey="2" href="Broadcasting.html#Broadcasting">Broadcasting</a>:                Broadcasting operations
<li><a accesskey="3" href="Function-Application.html#Function-Application">Function Application</a>:        Applying functions to arrays, cells, and structs
<li><a accesskey="4" href="Accumulation.html#Accumulation">Accumulation</a>:                Accumulation functions
<li><a accesskey="5" href="Miscellaneous-Techniques.html#Miscellaneous-Techniques">Miscellaneous Techniques</a>:    Other techniques for speeding up code
<li><a accesskey="6" href="Examples.html#Examples">Examples</a>
</ul>

   </body></html>