Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / compute / doc / html / boost / compute / exclusive_scan.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Function exclusive_scan</title>
5 <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.Compute">
8 <link rel="up" href="../../boost_compute/reference.html#header.boost.compute.algorithm.exclusive_scan_hpp" title="Header &lt;boost/compute/algorithm/exclusive_scan.hpp&gt;">
9 <link rel="prev" href="equal_range.html" title="Function template equal_range">
10 <link rel="next" href="fill.html" title="Function template fill">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="equal_range.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_compute/reference.html#header.boost.compute.algorithm.exclusive_scan_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="fill.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="refentry">
26 <a name="boost.compute.exclusive_scan"></a><div class="titlepage"></div>
27 <div class="refnamediv">
28 <h2><span class="refentrytitle">Function exclusive_scan</span></h2>
29 <p>boost::compute::exclusive_scan</p>
30 </div>
31 <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
32 <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../boost_compute/reference.html#header.boost.compute.algorithm.exclusive_scan_hpp" title="Header &lt;boost/compute/algorithm/exclusive_scan.hpp&gt;">boost/compute/algorithm/exclusive_scan.hpp</a>&gt;
33
34 </span>
35 <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> InputIterator<span class="special">,</span> <span class="keyword">typename</span> OutputIterator<span class="special">,</span> <span class="keyword">typename</span> T<span class="special">,</span> 
36          <span class="keyword">typename</span> BinaryOperator<span class="special">&gt;</span> 
37   <span class="identifier">OutputIterator</span> 
38   <span class="identifier">exclusive_scan</span><span class="special">(</span><span class="identifier">InputIterator</span> first<span class="special">,</span> <span class="identifier">InputIterator</span> last<span class="special">,</span> 
39                  <span class="identifier">OutputIterator</span> result<span class="special">,</span> <span class="identifier">T</span> init<span class="special">,</span> <span class="identifier">BinaryOperator</span> binary_op<span class="special">,</span> 
40                  <span class="identifier">command_queue</span> <span class="special">&amp;</span> queue <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">default_queue</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
41 <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> InputIterator<span class="special">,</span> <span class="keyword">typename</span> OutputIterator<span class="special">,</span> <span class="keyword">typename</span> T<span class="special">&gt;</span> 
42   <span class="identifier">OutputIterator</span> 
43   <span class="identifier">exclusive_scan</span><span class="special">(</span><span class="identifier">InputIterator</span> first<span class="special">,</span> <span class="identifier">InputIterator</span> last<span class="special">,</span> 
44                  <span class="identifier">OutputIterator</span> result<span class="special">,</span> <span class="identifier">T</span> init<span class="special">,</span> 
45                  <span class="identifier">command_queue</span> <span class="special">&amp;</span> queue <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">default_queue</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
46 <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> InputIterator<span class="special">,</span> <span class="keyword">typename</span> OutputIterator<span class="special">&gt;</span> 
47   <span class="identifier">OutputIterator</span> 
48   <span class="identifier">exclusive_scan</span><span class="special">(</span><span class="identifier">InputIterator</span> first<span class="special">,</span> <span class="identifier">InputIterator</span> last<span class="special">,</span> 
49                  <span class="identifier">OutputIterator</span> result<span class="special">,</span> 
50                  <span class="identifier">command_queue</span> <span class="special">&amp;</span> queue <span class="special">=</span> <span class="identifier">system</span><span class="special">::</span><span class="identifier">default_queue</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre></div>
51 <div class="refsect1">
52 <a name="idm46113334255056"></a><h2>Description</h2>
53 <p>Performs an exclusive scan of the elements in the range [<code class="computeroutput">first</code>, <code class="computeroutput">last</code>) and stores the results in the range beginning at <code class="computeroutput">result</code>.</p>
54 <p>Each element in the output is assigned to the sum of all the previous values in the input.</p>
55 <p>
56
57 The default operation is to add the elements up.</p>
58 <pre class="programlisting"></pre>
59 <p> But different associative operation can be specified as <code class="computeroutput">binary_op</code> instead (e.g., multiplication, maximum, minimum). Also value used to initialized the scan sequence can be specified.</p>
60 <pre class="programlisting"></pre>
61 <p> Space complexity on GPUs: \Omega(n)<br>
62  Space complexity on GPUs when <code class="computeroutput">first</code> == <code class="computeroutput">result:</code> \Omega(2n)<br>
63  Space complexity on CPUs: \Omega(1)</p>
64 <p><span class="bold"><strong>See Also:</strong></span></p>
65 <p>inclusive_scan() </p>
66 <p>
67 </p>
68 <p>
69 </p>
70 <div class="variablelist"><table border="0" class="variablelist compact">
71 <colgroup>
72 <col align="left" valign="top">
73 <col>
74 </colgroup>
75 <tbody>
76 <tr>
77 <td><p><span class="term">Parameters:</span></p></td>
78 <td><div class="variablelist"><table border="0" class="variablelist compact">
79 <colgroup>
80 <col align="left" valign="top">
81 <col>
82 </colgroup>
83 <tbody>
84 <tr>
85 <td><p><span class="term"><code class="computeroutput">binary_op</code></span></p></td>
86 <td><p>associative binary operator </p></td>
87 </tr>
88 <tr>
89 <td><p><span class="term"><code class="computeroutput">first</code></span></p></td>
90 <td><p>first element in the range to scan </p></td>
91 </tr>
92 <tr>
93 <td><p><span class="term"><code class="computeroutput">init</code></span></p></td>
94 <td><p>value used to initialize the scan sequence </p></td>
95 </tr>
96 <tr>
97 <td><p><span class="term"><code class="computeroutput">last</code></span></p></td>
98 <td><p>last element in the range to scan </p></td>
99 </tr>
100 <tr>
101 <td><p><span class="term"><code class="computeroutput">queue</code></span></p></td>
102 <td><p>command queue to perform the operation</p></td>
103 </tr>
104 <tr>
105 <td><p><span class="term"><code class="computeroutput">result</code></span></p></td>
106 <td><p>first element in the result range </p></td>
107 </tr>
108 </tbody>
109 </table></div></td>
110 </tr>
111 <tr>
112 <td><p><span class="term">Returns:</span></p></td>
113 <td><p><code class="computeroutput">OutputIterator</code> to the end of the result range</p></td>
114 </tr>
115 </tbody>
116 </table></div>
117 </div>
118 </div>
119 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
120 <td align="left"></td>
121 <td align="right"><div class="copyright-footer">Copyright &#169; 2013, 2014 Kyle Lutz<p>
122         Distributed under the Boost Software License, Version 1.0. (See accompanying
123         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
124       </p>
125 </div></td>
126 </tr></table>
127 <hr>
128 <div class="spirit-nav">
129 <a accesskey="p" href="equal_range.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_compute/reference.html#header.boost.compute.algorithm.exclusive_scan_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="fill.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
130 </div>
131 </body>
132 </html>