]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/numeric/ublas/doc/vector_proxy.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / numeric / ublas / doc / vector_proxy.html
CommitLineData
7c673cae
FG
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5<meta name="generator" content=
6"HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
7<meta http-equiv="Content-Type" content=
8"text/html; charset=us-ascii" />
9<link rel="stylesheet" href="../../../../boost.css" type="text/css"/>
10<link rel="stylesheet" href="ublas.css" type="text/css" />
11<script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script>
12<script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script>
13<title>Vector Proxies</title>
14</head>
15<body>
16<h1><img src="../../../../boost.png" align="middle" />Vector Proxies</h1>
17<div class="toc" id="toc"></div>
18<h2><a name="vector_range"></a>Vector Range</h2>
19<h4>Description</h4>
20<p>The templated class <code>vector_range&lt;V&gt;</code> allows
21addressing a sub-range of a vector's element.</p>
22<h4>Example</h4>
23<pre>
24#include &lt;boost/numeric/ublas/vector.hpp&gt;
25#include &lt;boost/numeric/ublas/vector_proxy.hpp&gt;
26#include &lt;boost/numeric/ublas/io.hpp&gt;
27
28int main () {
29 using namespace boost::numeric::ublas;
30 vector&lt;double&gt; v (3);
31 vector_range&lt;vector&lt;double&gt; &gt; vr (v, range (0, 3));
32 for (unsigned i = 0; i &lt; vr.size (); ++ i)
33 vr (i) = i;
34 std::cout &lt;&lt; vr &lt;&lt; std::endl;
35}
36</pre>
37<h4>Definition</h4>
38<p>Defined in the header vector_proxy.hpp.</p>
39<h4>Template parameters</h4>
40<table border="1" summary="parameters">
41<tbody>
42<tr>
43<th>Parameter</th>
44<th>Description</th>
45<th>Default</th>
46</tr>
47<tr>
48<td><code>V</code></td>
49<td>The type of vector referenced.</td>
50<td></td>
51</tr>
52</tbody>
53</table>
54<h4>Model of</h4>
55<p><a href="expression_concept.html#vector_expression">Vector Expression</a>
56.</p>
57<p>If the specified range falls outside that of the index range of
58the vector, then the <code>vector_range</code> is not a well formed
59Vector Expression. That is, access to an element which is outside
60of index range of the vector is <i>undefined</i>.</p>
61<h4>Type requirements</h4>
62<p>None, except for those imposed by the requirements of <a href=
63"expression_concept.html#vector_expression">Vector Expression</a> .</p>
64<h4>Public base classes</h4>
65<p><code>vector_expression&lt;vector_range&lt;V&gt; &gt;</code></p>
66<h4>Members</h4>
67<table border="1" summary="members">
68<tbody>
69<tr>
70<th>Member</th>
71<th>Description</th>
72</tr>
73<tr>
74<td><code>vector_range (vector_type &amp;data, const range
75&amp;r)</code></td>
76<td>Constructs a sub vector.</td>
77</tr>
78<tr>
79<td><code>size_type start () const</code></td>
80<td>Returns the start of the sub vector.</td>
81</tr>
82<tr>
83<td><code>size_type size () const</code></td>
84<td>Returns the size of the sub vector.</td>
85</tr>
86<tr>
87<td><code>const_reference operator () (size_type i)
88const</code></td>
89<td>Returns the value of the <code>i</code>-th element.</td>
90</tr>
91<tr>
92<td><code>reference operator () (size_type i)</code></td>
93<td>Returns a reference of the <code>i</code>-th element.</td>
94</tr>
95<tr>
96<td><code>const_reference operator [] (size_type i)
97const</code></td>
98<td>Returns the value of the <code>i</code>-th element.</td>
99</tr>
100<tr>
101<td><code>reference operator [] (size_type i)</code></td>
102<td>Returns a reference of the <code>i</code>-th element.</td>
103</tr>
104<tr>
105<td><code>vector_range &amp;operator = (const vector_range
106&amp;vr)</code></td>
107<td>The assignment operator.</td>
108</tr>
109<tr>
110<td><code>vector_range &amp;assign_temporary (vector_range
111&amp;vr)</code></td>
112<td>Assigns a temporary. May change the vector range
113<code>vr</code> .</td>
114</tr>
115<tr>
116<td><code>template&lt;class AE&gt;<br />
117vector_range &amp;operator = (const vector_expression&lt;AE&gt;
118&amp;ae)</code></td>
119<td>The extended assignment operator.</td>
120</tr>
121<tr>
122<td><code>template&lt;class AE&gt;<br />
123vector_range &amp;assign (const vector_expression&lt;AE&gt;
124&amp;ae)</code></td>
125<td>Assigns a vector expression to the sub vector. Left and right
126hand side of the assignment should be independent.</td>
127</tr>
128<tr>
129<td><code>template&lt;class AE&gt;<br />
130vector_range &amp;operator += (const vector_expression&lt;AE&gt;
131&amp;ae)</code></td>
132<td>A computed assignment operator. Adds the vector expression to
133the sub vector.</td>
134</tr>
135<tr>
136<td><code>template&lt;class AE&gt;<br />
137vector_range &amp;plus_assign (const vector_expression&lt;AE&gt;
138&amp;ae)</code></td>
139<td>Adds a vector expression to the sub vector. Left and right hand
140side of the assignment should be independent.</td>
141</tr>
142<tr>
143<td><code>template&lt;class AE&gt;<br />
144vector_range &amp;operator -= (const vector_expression&lt;AE&gt;
145&amp;ae)</code></td>
146<td>A computed assignment operator. Subtracts the vector expression
147from the sub vector.</td>
148</tr>
149<tr>
150<td><code>template&lt;class AE&gt;<br />
151vector_range &amp;minus_assign (const vector_expression&lt;AE&gt;
152&amp;ae)</code></td>
153<td>Subtracts a vector expression from the sub vector. Left and
154right hand side of the assignment should be independent.</td>
155</tr>
156<tr>
157<td><code>template&lt;class AT&gt;<br />
158vector_range &amp;operator *= (const AT &amp;at)</code></td>
159<td>A computed assignment operator. Multiplies the sub vector with
160a scalar.</td>
161</tr>
162<tr>
163<td><code>template&lt;class AT&gt;<br />
164vector_range &amp;operator /= (const AT &amp;at)</code></td>
165<td>A computed assignment operator. Divides the sub vector through
166a scalar.</td>
167</tr>
168<tr>
169<td><code>void swap (vector_range &amp;vr)</code></td>
170<td>Swaps the contents of the sub vectors.</td>
171</tr>
172<tr>
173<td><code>const_iterator begin () const</code></td>
174<td>Returns a <code>const_iterator</code> pointing to the beginning
175of the <code>vector_range</code>.</td>
176</tr>
177<tr>
178<td><code>const_iterator end () const</code></td>
179<td>Returns a <code>const_iterator</code> pointing to the end of
180the <code>vector_range</code>.</td>
181</tr>
182<tr>
183<td><code>iterator begin ()</code></td>
184<td>Returns a <code>iterator</code> pointing to the beginning of
185the <code>vector_range</code>.</td>
186</tr>
187<tr>
188<td><code>iterator end ()</code></td>
189<td>Returns a <code>iterator</code> pointing to the end of the
190<code>vector_range</code>.</td>
191</tr>
192<tr>
193<td><code>const_reverse_iterator rbegin () const</code></td>
194<td>Returns a <code>const_reverse_iterator</code> pointing to the
195beginning of the reversed <code>vector_range</code>.</td>
196</tr>
197<tr>
198<td><code>const_reverse_iterator rend () const</code></td>
199<td>Returns a <code>const_reverse_iterator</code> pointing to the
200end of the reversed <code>vector_range</code>.</td>
201</tr>
202<tr>
203<td><code>reverse_iterator rbegin ()</code></td>
204<td>Returns a <code>reverse_iterator</code> pointing to the
205beginning of the reversed <code>vector_range</code>.</td>
206</tr>
207<tr>
208<td><code>reverse_iterator rend ()</code></td>
209<td>Returns a <code>reverse_iterator</code> pointing to the end of
210the reversed <code>vector_range</code>.</td>
211</tr>
212</tbody>
213</table>
214<h3>Simple Projections</h3>
215<h4>Description</h4>
216<p>The free <code>subrange</code> functions support the construction
217of vector ranges.</p>
218<h4>Prototypes</h4>
219<pre><code>
220 template&lt;class V&gt;
221 vector_range&lt;V&gt; subrange (V &amp;data,
222 V::size_type start, V::size_type stop);
223 template&lt;class V&gt;
224 const vector_range&lt;const V&gt; subrange (const V &amp;data,
225 V::size_type start, V::size_type stop);
226</code></pre>
227<h3>Generic Projections</h3>
228<h4>Description</h4>
229<p>The free <code>project</code> functions support the construction
230of vector ranges. Existing <code>matrix_range</code>'s can be composed with a further range. The resulting range is computed using this existing range's <code>compose</code> function.</p>
231<h4>Prototypes</h4>
232<pre><code>
233 template&lt;class V&gt;
234 vector_range&lt;V&gt; project (V &amp;data, const range &amp;r);
235 template&lt;class V&gt;
236 const vector_range&lt;const V&gt; project (const V &amp;data, const range &amp;r);
237 template&lt;class V&gt;
238 vector_range&lt;V&gt; project (vector_range&lt;V&gt; &amp;data, const range &amp;r);
239 template&lt;class V&gt;
240 const vector_range&lt;V&gt; project (const vector_range&lt;V&gt; &amp;data, const range &amp;r);
241</code></pre>
242<h4>Definition</h4>
243<p>Defined in the header vector_proxy.hpp.</p>
244<h4>Type requirements</h4>
245<ul>
246<li><code>V</code> is a model of <a href=
247"expression_concept.html#vector_expression">Vector Expression</a> .</li>
248</ul>
249<h4>Complexity</h4>
250<p>Linear depending from the size of the range.</p>
251<h4>Examples</h4>
252<pre>
253#include &lt;boost/numeric/ublas/vector.hpp&gt;
254#include &lt;boost/numeric/ublas/vector_proxy.hpp&gt;
255#include &lt;boost/numeric/ublas/io.hpp&gt;
256
257int main () {
258 using namespace boost::numeric::ublas;
259 vector&lt;double&gt; v (3);
260 for (int i = 0; i &lt; 3; ++ i)
261 project (v, range (0, 3)) (i) = i;
262 std::cout &lt;&lt; project (v, range (0, 3)) &lt;&lt; std::endl;
263}
264</pre>
265<h2><a name="vector_slice"></a>Vector Slice</h2>
266<h4>Description</h4>
267<p>The templated class <code>vector_slice&lt;V&gt;</code> allows
268addressing a slice of a vector.</p>
269<h4>Example</h4>
270<pre>
271#include &lt;boost/numeric/ublas/vector.hpp&gt;
272#include &lt;boost/numeric/ublas/vector_proxy.hpp&gt;
273#include &lt;boost/numeric/ublas/io.hpp&gt;
274
275int main () {
276 using namespace boost::numeric::ublas;
277 vector&lt;double&gt; v (3);
278 vector_slice&lt;vector&lt;double&gt; &gt; vs (v, slice (0, 1, 3));
279 for (unsigned i = 0; i &lt; vs.size (); ++ i)
280 vs (i) = i;
281 std::cout &lt;&lt; vs &lt;&lt; std::endl;
282}
283</pre>
284<h4>Definition</h4>
285<p>Defined in the header vector_proxy.hpp.</p>
286<h4>Template parameters</h4>
287<table border="1" summary="parameters">
288<tbody>
289<tr>
290<th>Parameter</th>
291<th>Description</th>
292<th>Default</th>
293</tr>
294<tr>
295<td><code>V</code></td>
296<td>The type of vector referenced.</td>
297<td></td>
298</tr>
299</tbody>
300</table>
301<h4>Model of</h4>
302<p><a href="expression_concept.html#vector_expression">Vector Expression</a>
303.</p>
304<p>If the specified slice falls outside that of the index range of
305the vector, then the <code>vector_slice</code> is not a well formed
306Vector Expression. That is, access to an element which is outside
307of index range of the vector is <i>undefined</i>.</p>
308<h4>Type requirements</h4>
309<p>None, except for those imposed by the requirements of <a href=
310"expression_concept.html#vector_expression">Vector Expression</a> .</p>
311<h4>Public base classes</h4>
312<p><code>vector_expression&lt;vector_slice&lt;V&gt; &gt;</code></p>
313<h4>Members</h4>
314<table border="1" summary="members">
315<tbody>
316<tr>
317<th>Member</th>
318<th>Description</th>
319</tr>
320<tr>
321<td><code>vector_slice (vector_type &amp;data, const slice
322&amp;s)</code></td>
323<td>Constructs a sub vector.</td>
324</tr>
325<tr>
326<td><code>size_type size () const</code></td>
327<td>Returns the size of the sub vector.</td>
328</tr>
329<tr>
330<td><code>const_reference operator () (size_type i)
331const</code></td>
332<td>Returns the value of the <code>i</code>-th element.</td>
333</tr>
334<tr>
335<td><code>reference operator () (size_type i)</code></td>
336<td>Returns a reference of the <code>i</code>-th element.</td>
337</tr>
338<tr>
339<td><code>const_reference operator [] (size_type i)
340const</code></td>
341<td>Returns the value of the <code>i</code>-th element.</td>
342</tr>
343<tr>
344<td><code>reference operator [] (size_type i)</code></td>
345<td>Returns a reference of the <code>i</code>-th element.</td>
346</tr>
347<tr>
348<td><code>vector_slice &amp;operator = (const vector_slice
349&amp;vs)</code></td>
350<td>The assignment operator.</td>
351</tr>
352<tr>
353<td><code>vector_slice &amp;assign_temporary (vector_slice
354&amp;vs)</code></td>
355<td>Assigns a temporary. May change the vector slice
356<code>vs</code> .</td>
357</tr>
358<tr>
359<td><code>template&lt;class AE&gt;<br />
360vector_slice &amp;operator = (const vector_expression&lt;AE&gt;
361&amp;ae)</code></td>
362<td>The extended assignment operator.</td>
363</tr>
364<tr>
365<td><code>template&lt;class AE&gt;<br />
366vector_slice &amp;assign (const vector_expression&lt;AE&gt;
367&amp;ae)</code></td>
368<td>Assigns a vector expression to the sub vector. Left and right
369hand side of the assignment should be independent.</td>
370</tr>
371<tr>
372<td><code>template&lt;class AE&gt;<br />
373vector_slice &amp;operator += (const vector_expression&lt;AE&gt;
374&amp;ae)</code></td>
375<td>A computed assignment operator. Adds the vector expression to
376the sub vector.</td>
377</tr>
378<tr>
379<td><code>template&lt;class AE&gt;<br />
380vector_slice &amp;plus_assign (const vector_expression&lt;AE&gt;
381&amp;ae)</code></td>
382<td>Adds a vector expression to the sub vector. Left and right hand
383side of the assignment should be independent.</td>
384</tr>
385<tr>
386<td><code>template&lt;class AE&gt;<br />
387vector_slice &amp;operator -= (const vector_expression&lt;AE&gt;
388&amp;ae)</code></td>
389<td>A computed assignment operator. Subtracts the vector expression
390from the sub vector.</td>
391</tr>
392<tr>
393<td><code>template&lt;class AE&gt;<br />
394vector_slice &amp;minus_assign (const vector_expression&lt;AE&gt;
395&amp;ae)</code></td>
396<td>Subtracts a vector expression from the sub vector. Left and
397right hand side of the assignment should be independent.</td>
398</tr>
399<tr>
400<td><code>template&lt;class AT&gt;<br />
401vector_slice &amp;operator *= (const AT &amp;at)</code></td>
402<td>A computed assignment operator. Multiplies the sub vector with
403a scalar.</td>
404</tr>
405<tr>
406<td><code>template&lt;class AT&gt;<br />
407vector_slice &amp;operator /= (const AT &amp;at)</code></td>
408<td>A computed assignment operator. Divides the sub vector through
409a scalar.</td>
410</tr>
411<tr>
412<td><code>void swap (vector_slice &amp;vs)</code></td>
413<td>Swaps the contents of the sub vectors.</td>
414</tr>
415<tr>
416<td><code>const_iterator begin () const</code></td>
417<td>Returns a <code>const_iterator</code> pointing to the beginning
418of the <code>vector_slice</code>.</td>
419</tr>
420<tr>
421<td><code>const_iterator end () const</code></td>
422<td>Returns a <code>const_iterator</code> pointing to the end of
423the <code>vector_slice</code>.</td>
424</tr>
425<tr>
426<td><code>iterator begin ()</code></td>
427<td>Returns a <code>iterator</code> pointing to the beginning of
428the <code>vector_slice</code>.</td>
429</tr>
430<tr>
431<td><code>iterator end ()</code></td>
432<td>Returns a <code>iterator</code> pointing to the end of the
433<code>vector_slice</code>.</td>
434</tr>
435<tr>
436<td><code>const_reverse_iterator rbegin () const</code></td>
437<td>Returns a <code>const_reverse_iterator</code> pointing to the
438beginning of the reversed <code>vector_slice</code>.</td>
439</tr>
440<tr>
441<td><code>const_reverse_iterator rend () const</code></td>
442<td>Returns a <code>const_reverse_iterator</code> pointing to the
443end of the reversed <code>vector_slice</code>.</td>
444</tr>
445<tr>
446<td><code>reverse_iterator rbegin ()</code></td>
447<td>Returns a <code>reverse_iterator</code> pointing to the
448beginning of the reversed <code>vector_slice</code>.</td>
449</tr>
450<tr>
451<td><code>reverse_iterator rend ()</code></td>
452<td>Returns a <code>reverse_iterator</code> pointing to the end of
453the reversed <code>vector_slice</code>.</td>
454</tr>
455</tbody>
456</table>
457<h3>Simple Projections</h3>
458<h4>Description</h4>
459<p>The free <code>subslice</code> functions support the construction
460of vector slices.</p>
461<h4>Prototypes</h4>
462<pre><code>
463 template&lt;class V&gt;
464 vector_slice&lt;V&gt; subslice (V &amp;data,
465 V::size_type start, V::difference_type stride, V::size_type size);
466 template&lt;class V&gt;
467 const vector_slice&lt;const V&gt; subslice (const V &amp;data,
468 V::size_type start, V::difference_type stride, V::size_type size);
469</code></pre>
470<h3>Generic Projections</h3>
471<h4>Description</h4>
472<p>The free <code>project</code> functions support the construction
473of vector slices. Existing <code>vector_slice</code>'s can be composed with a further range or slices. The resulting slice is computed using this existing slices's <code>compose</code> function.</p>
474<h4>Prototypes</h4>
475<pre><code>
476 template&lt;class V&gt;
477 vector_slice&lt;V&gt; project (V &amp;data, const slice &amp;s);
478 template&lt;class V&gt;
479 const vector_slice&lt;const V&gt; project (const V &amp;data, const slice &amp;s);
480 template&lt;class V&gt;
481 vector_slice&lt;V&gt; project (vector_slice&lt;V&gt; &amp;data, const range &amp;r);
482 template&lt;class V&gt;
483 const vector_slice&lt;V&gt; project (const vector_slice&lt;V&gt; &amp;data, const range &amp;r);
484 template&lt;class V&gt;
485 vector_slice&lt;V&gt; project (vector_slice&lt;V&gt; &amp;data, const slice &amp;s);
486 template&lt;class V&gt;
487 const vector_slice&lt;V&gt; project (const vector_slice&lt;V&gt; &amp;data, const slice &amp;s);
488</code></pre>
489<h4>Definition</h4>
490<p>Defined in the header vector_proxy.hpp.</p>
491<h4>Type requirements</h4>
492<ul>
493<li><code>V</code> is a model of <a href=
494"expression_concept.html#vector_expression">Vector Expression</a> .</li>
495</ul>
496<h4>Complexity</h4>
497<p>Linear depending from the size of the slice.</p>
498<h4>Examples</h4>
499<pre>
500#include &lt;boost/numeric/ublas/vector.hpp&gt;
501#include &lt;boost/numeric/ublas/vector_proxy.hpp&gt;
502#include &lt;boost/numeric/ublas/io.hpp&gt;
503
504int main () {
505 using namespace boost::numeric::ublas;
506 vector&lt;double&gt; v (3);
507 for (int i = 0; i &lt; 3; ++ i)
508 project (v, slice (0, 1, 3)) (i) = i;
509 std::cout &lt;&lt; project (v, slice (0, 1, 3)) &lt;&lt; std::endl;
510}
511</pre>
512<hr />
513<p>Copyright (&copy;) 2000-2002 Joerg Walter, Mathias Koch<br />
514 Use, modification and distribution are subject to the
515 Boost Software License, Version 1.0.
516 (See accompanying file LICENSE_1_0.txt
517 or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
518 http://www.boost.org/LICENSE_1_0.txt
519 </a>).
520</p>
521<script type="text/javascript">
522(function($) {
523 $('#toc').toc();
524})(jQuery);
525</script>
526</body>
527</html>