Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/numeric/ublas/doc/matrix_proxy.htm @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 45.9 KB
Line 
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 href="ublas.css" type="text/css" />
10<title>Matrix Proxies</title>
11</head>
12<body>
13<h1><img src="../../../../boost.png" align="middle" />
14Matrix Proxies</h1>
15<h2><a name="matrix_row" id="matrix_row"></a>Matrix Row</h2>
16<h4>Description</h4>
17<p>The templated class <code>matrix_row&lt;M&gt;</code> allows
18addressing a row of a matrix.</p>
19<h4>Example</h4>
20<pre>
21#include &lt;boost/numeric/ublas/matrix.hpp&gt;
22#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
23#include &lt;boost/numeric/ublas/io.hpp&gt;
24
25int main () {
26    using namespace boost::numeric::ublas;
27    matrix&lt;double&gt; m (3, 3);
28    for (unsigned i = 0; i &lt; m.size1 (); ++ i) {
29        matrix_row&lt;matrix&lt;double&gt; &gt; mr (m, i);
30        for (unsigned j = 0; j &lt; mr.size (); ++ j)
31            mr (j) = 3 * i + j;
32        std::cout &lt;&lt; mr &lt;&lt; std::endl;
33    }
34}
35</pre>
36<h4>Definition</h4>
37<p>Defined in the header matrix_proxy.hpp.</p>
38<h4>Template parameters</h4>
39<table border="1" summary="parameters">
40<tbody>
41<tr>
42<th>Parameter</th>
43<th>Description</th>
44<th>Default</th>
45</tr>
46<tr>
47<td><code>M</code></td>
48<td>The type of matrix referenced.</td>
49<td></td>
50</tr>
51</tbody>
52</table>
53<h4>Model of</h4>
54<p><a href="expression_concept.htm#vector_expression">Vector Expression</a>
55.</p>
56<p>If the specified row falls outside that of the row index range
57of the matrix, then the <code>matrix_row</code> is not a well
58formed Vector Expression. That is, access to an element which is
59outside of the matrix is <i>undefined</i>.</p>
60<h4>Type requirements</h4>
61<p>None, except for those imposed by the requirements of <a href=
62"expression_concept.htm#vector_expression">Vector Expression</a> .</p>
63<h4>Public base classes</h4>
64<p><code>vector_expression&lt;matrix_row&lt;M&gt; &gt;</code></p>
65<h4>Members</h4>
66<table border="1" summary="members">
67<tbody>
68<tr>
69<th>Member</th>
70<th>Description</th>
71</tr>
72<tr>
73<td><code>matrix_row (matrix_type &amp;data, size_type
74i)</code></td>
75<td>Constructs a sub vector.</td>
76</tr>
77<tr>
78<td><code>size_type size () const</code></td>
79<td>Returns the size of the sub vector.</td>
80</tr>
81<tr>
82<td><code>const_reference operator () (size_type i)
83const</code></td>
84<td>Returns the value of the <code>i</code>-th element.</td>
85</tr>
86<tr>
87<td><code>reference operator () (size_type i)</code></td>
88<td>Returns a reference of the <code>i</code>-th element.</td>
89</tr>
90<tr>
91<td><code>matrix_row &amp;operator = (const matrix_row
92&amp;mr)</code></td>
93<td>The assignment operator.</td>
94</tr>
95<tr>
96<td><code>matrix_row &amp;assign_temporary (matrix_row
97&amp;mr)</code></td>
98<td>Assigns a temporary. May change the matrix row <code>mr</code>
99.</td>
100</tr>
101<tr>
102<td><code>template&lt;class AE&gt;<br />
103matrix_row &amp;operator = (const vector_expression&lt;AE&gt;
104&amp;ae)</code></td>
105<td>The extended assignment operator.</td>
106</tr>
107<tr>
108<td><code>template&lt;class AE&gt;<br />
109matrix_row &amp;assign (const vector_expression&lt;AE&gt;
110&amp;ae)</code></td>
111<td>Assigns a vector expression to the sub vector. Left and right
112hand side of the assignment should be independent.</td>
113</tr>
114<tr>
115<td><code>template&lt;class AE&gt;<br />
116matrix_row &amp;operator += (const vector_expression&lt;AE&gt;
117&amp;ae)</code></td>
118<td>A computed assignment operator. Adds the vector expression to
119the sub vector.</td>
120</tr>
121<tr>
122<td><code>template&lt;class AE&gt;<br />
123matrix_row &amp;plus_assign (const vector_expression&lt;AE&gt;
124&amp;ae)</code></td>
125<td>Adds a vector expression to the sub vector. Left and right hand
126side of the assignment should be independent.</td>
127</tr>
128<tr>
129<td><code>template&lt;class AE&gt;<br />
130matrix_row &amp;operator -= (const vector_expression&lt;AE&gt;
131&amp;ae)</code></td>
132<td>A computed assignment operator. Subtracts the vector expression
133from the sub vector.</td>
134</tr>
135<tr>
136<td><code>template&lt;class AE&gt;<br />
137matrix_row &amp;minus_assign (const vector_expression&lt;AE&gt;
138&amp;ae)</code></td>
139<td>Subtracts a vector expression from the sub vector. Left and
140right hand side of the assignment should be independent.</td>
141</tr>
142<tr>
143<td><code>template&lt;class AT&gt;<br />
144matrix_row &amp;operator *= (const AT &amp;at)</code></td>
145<td>A computed assignment operator. Multiplies the sub vector with
146a scalar.</td>
147</tr>
148<tr>
149<td><code>template&lt;class AT&gt;<br />
150matrix_row &amp;operator /= (const AT &amp;at)</code></td>
151<td>A computed assignment operator. Divides the sub vector through
152a scalar.</td>
153</tr>
154<tr>
155<td><code>void swap (matrix_row &amp;mr)</code></td>
156<td>Swaps the contents of the sub vectors.</td>
157</tr>
158<tr>
159<td><code>const_iterator begin () const</code></td>
160<td>Returns a <code>const_iterator</code> pointing to the beginning
161of the <code>matrix_row</code>.</td>
162</tr>
163<tr>
164<td><code>const_iterator end () const</code></td>
165<td>Returns a <code>const_iterator</code> pointing to the end of
166the <code>matrix_row</code>.</td>
167</tr>
168<tr>
169<td><code>iterator begin ()</code></td>
170<td>Returns a <code>iterator</code> pointing to the beginning of
171the <code>matrix_row</code>.</td>
172</tr>
173<tr>
174<td><code>iterator end ()</code></td>
175<td>Returns a <code>iterator</code> pointing to the end of the
176<code>matrix_row</code>.</td>
177</tr>
178<tr>
179<td><code>const_reverse_iterator rbegin () const</code></td>
180<td>Returns a <code>const_reverse_iterator</code> pointing to the
181beginning of the reversed <code>matrix_row</code>.</td>
182</tr>
183<tr>
184<td><code>const_reverse_iterator rend () const</code></td>
185<td>Returns a <code>const_reverse_iterator</code> pointing to the
186end of the reversed <code>matrix_row</code>.</td>
187</tr>
188<tr>
189<td><code>reverse_iterator rbegin ()</code></td>
190<td>Returns a <code>reverse_iterator</code> pointing to the
191beginning of the reversed <code>matrix_row</code>.</td>
192</tr>
193<tr>
194<td><code>reverse_iterator rend ()</code></td>
195<td>Returns a <code>reverse_iterator</code> pointing to the end of
196the reversed <code>matrix_row</code>.</td>
197</tr>
198</tbody>
199</table>
200<h3>Projections</h3>
201<h4>Description</h4>
202<p>The free <code>row</code> functions support the construction of
203matrix rows.</p>
204<h4>Prototypes</h4>
205<pre><code>
206    template&lt;class M&gt;
207    matrix_row&lt;M&gt; row (M &amp;data, std::size_t i);
208    template&lt;class M&gt;
209    const matrix_row&lt;const M&gt; row (const M &amp;data, std::size_t i);
210</code></pre>
211<h4>Definition</h4>
212<p>Defined in the header matrix_proxy.hpp.</p>
213<h4>Type requirements</h4>
214<ul>
215<li><code>M</code> is a model of <a href=
216"expression_concept.htm#matrix_expression">Matrix Expression</a> .</li>
217</ul>
218<h4>Complexity</h4>
219<p>Linear depending from the size of the row.</p>
220<h4>Examples</h4>
221<pre>
222#include &lt;boost/numeric/ublas/matrix.hpp&gt;
223#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
224#include &lt;boost/numeric/ublas/io.hpp&gt;
225
226int main () {
227    using namespace boost::numeric::ublas;
228    matrix&lt;double&gt; m (3, 3);
229    for (unsigned i = 0; i &lt; m.size1 (); ++ i) {
230        for (unsigned j = 0; j &lt; m.size2 (); ++ j)
231            row (m, i) (j) = 3 * i + j;
232        std::cout &lt;&lt; row (m, i) &lt;&lt; std::endl;
233    }
234}
235</pre>
236<h2><a name="matrix_column" id="matrix_column"></a>Matrix Column</h2>
237<h4>Description</h4>
238<p>The templated class <code>matrix_column&lt;M&gt;</code> allows
239addressing a column of a matrix.</p>
240<h4>Example</h4>
241<pre>
242#include &lt;boost/numeric/ublas/matrix.hpp&gt;
243#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
244#include &lt;boost/numeric/ublas/io.hpp&gt;
245
246int main () {
247    using namespace boost::numeric::ublas;
248    matrix&lt;double&gt; m (3, 3);
249    for (unsigned j = 0; j &lt; m.size2 (); ++ j) {
250        matrix_column&lt;matrix&lt;double&gt; &gt; mc (m, j);
251        for (unsigned i = 0; i &lt; mc.size (); ++ i)
252            mc (i) = 3 * i + j;
253        std::cout &lt;&lt; mc &lt;&lt; std::endl;
254    }
255}
256</pre>
257<h4>Definition</h4>
258<p>Defined in the header matrix_proxy.hpp.</p>
259<h4>Template parameters</h4>
260<table border="1" summary="parameters">
261<tbody>
262<tr>
263<th>Parameter</th>
264<th>Description</th>
265<th>Default</th>
266</tr>
267<tr>
268<td><code>M</code></td>
269<td>The type of matrix referenced.</td>
270<td></td>
271</tr>
272</tbody>
273</table>
274<h4>Model of</h4>
275<p><a href="expression_concept.htm#vector_expression">Vector Expression</a>
276.</p>
277<p>If the specified row falls outside that of the column index
278range of the matrix, then the <code>matrix_column</code> is not a
279well formed Vector Expression. That is, access to an element which
280is outside of the matrix is <i>undefined</i>.</p>
281<h4>Type requirements</h4>
282<p>None, except for those imposed by the requirements of <a href=
283"expression_concept.htm#vector_expression">Vector Expression</a> .</p>
284<h4>Public base classes</h4>
285<p><code>vector_expression&lt;matrix_column&lt;M&gt;
286&gt;</code></p>
287<h4>Members</h4>
288<table border="1" summary="members">
289<tbody>
290<tr>
291<th>Member</th>
292<th>Description</th>
293</tr>
294<tr>
295<td><code>matrix_column (matrix_type &amp;data, size_type
296j)</code></td>
297<td>Constructs a sub vector.</td>
298</tr>
299<tr>
300<td><code>size_type size () const</code></td>
301<td>Returns the size of the sub vector.</td>
302</tr>
303<tr>
304<td><code>const_reference operator () (size_type i)
305const</code></td>
306<td>Returns the value of the <code>i</code>-th element.</td>
307</tr>
308<tr>
309<td><code>reference operator () (size_type i)</code></td>
310<td>Returns a reference of the <code>i</code>-th element.</td>
311</tr>
312<tr>
313<td><code>matrix_column &amp;operator = (const matrix_column
314&amp;mc)</code></td>
315<td>The assignment operator.</td>
316</tr>
317<tr>
318<td><code>matrix_column &amp;assign_temporary (matrix_column
319&amp;mc)</code></td>
320<td>Assigns a temporary. May change the matrix column
321<code>mc</code> .</td>
322</tr>
323<tr>
324<td><code>template&lt;class AE&gt;<br />
325matrix_column &amp;operator = (const vector_expression&lt;AE&gt;
326&amp;ae)</code></td>
327<td>The extended assignment operator.</td>
328</tr>
329<tr>
330<td><code>template&lt;class AE&gt;<br />
331matrix_column &amp;assign (const vector_expression&lt;AE&gt;
332&amp;ae)</code></td>
333<td>Assigns a vector expression to the sub vector. Left and right
334hand side of the assignment should be independent.</td>
335</tr>
336<tr>
337<td><code>template&lt;class AE&gt;<br />
338matrix_column &amp;operator += (const vector_expression&lt;AE&gt;
339&amp;ae)</code></td>
340<td>A computed assignment operator. Adds the vector expression to
341the sub vector.</td>
342</tr>
343<tr>
344<td><code>template&lt;class AE&gt;<br />
345matrix_column &amp;plus_assign (const vector_expression&lt;AE&gt;
346&amp;ae)</code></td>
347<td>Adds a vector expression to the sub vector. Left and right hand
348side of the assignment should be independent.</td>
349</tr>
350<tr>
351<td><code>template&lt;class AE&gt;<br />
352matrix_column &amp;operator -= (const vector_expression&lt;AE&gt;
353&amp;ae)</code></td>
354<td>A computed assignment operator. Subtracts the vector expression
355from the sub vector.</td>
356</tr>
357<tr>
358<td><code>template&lt;class AE&gt;<br />
359matrix_column &amp;minus_assign (const vector_expression&lt;AE&gt;
360&amp;ae)</code></td>
361<td>Subtracts a vector expression from the sub vector. Left and
362right hand side of the assignment should be independent.</td>
363</tr>
364<tr>
365<td><code>template&lt;class AT&gt;<br />
366matrix_column &amp;operator *= (const AT &amp;at)</code></td>
367<td>A computed assignment operator. Multiplies the sub vector with
368a scalar.</td>
369</tr>
370<tr>
371<td><code>template&lt;class AT&gt;<br />
372matrix_column &amp;operator /= (const AT &amp;at)</code></td>
373<td>A computed assignment operator. Divides the sub vector through
374a scalar.</td>
375</tr>
376<tr>
377<td><code>void swap (matrix_column &amp;mc)</code></td>
378<td>Swaps the contents of the sub vectors.</td>
379</tr>
380<tr>
381<td><code>const_iterator begin () const</code></td>
382<td>Returns a <code>const_iterator</code> pointing to the beginning
383of the <code>matrix_column</code>.</td>
384</tr>
385<tr>
386<td><code>const_iterator end () const</code></td>
387<td>Returns a <code>const_iterator</code> pointing to the end of
388the <code>matrix_column</code>.</td>
389</tr>
390<tr>
391<td><code>iterator begin ()</code></td>
392<td>Returns a <code>iterator</code> pointing to the beginning of
393the <code>matrix_column</code>.</td>
394</tr>
395<tr>
396<td><code>iterator end ()</code></td>
397<td>Returns a <code>iterator</code> pointing to the end of the
398<code>matrix_column</code>.</td>
399</tr>
400<tr>
401<td><code>const_reverse_iterator rbegin () const</code></td>
402<td>Returns a <code>const_reverse_iterator</code> pointing to the
403beginning of the reversed <code>matrix_column</code>.</td>
404</tr>
405<tr>
406<td><code>const_reverse_iterator rend () const</code></td>
407<td>Returns a <code>const_reverse_iterator</code> pointing to the
408end of the reversed <code>matrix_column</code>.</td>
409</tr>
410<tr>
411<td><code>reverse_iterator rbegin ()</code></td>
412<td>Returns a <code>reverse_iterator</code> pointing to the
413beginning of the reversed <code>matrix_column</code>.</td>
414</tr>
415<tr>
416<td><code>reverse_iterator rend ()</code></td>
417<td>Returns a <code>reverse_iterator</code> pointing to the end of
418the reversed <code>matrix_column</code>.</td>
419</tr>
420</tbody>
421</table>
422<h3>Projections</h3>
423<h4>Description</h4>
424<p>The free <code>column</code> functions support the construction
425of matrix columns.</p>
426<h4>Prototypes</h4>
427<pre><code>
428    template&lt;class M&gt;
429    matrix_column&lt;M&gt; column (M &amp;data, std::size_t j);
430    template&lt;class M&gt;
431    const matrix_column&lt;const M&gt; column (const M &amp;data, std::size_t j);
432</code></pre>
433<h4>Definition</h4>
434<p>Defined in the header matrix_proxy.hpp.</p>
435<h4>Type requirements</h4>
436<ul>
437<li><code>M</code> is a model of <a href=
438"expression_concept.htm#matrix_expression">Matrix Expression</a> .</li>
439</ul>
440<h4>Complexity</h4>
441<p>Linear depending from the size of the column.</p>
442<h4>Examples</h4>
443<pre>
444#include &lt;boost/numeric/ublas/matrix.hpp&gt;
445#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
446#include &lt;boost/numeric/ublas/io.hpp&gt;
447
448int main () {
449    using namespace boost::numeric::ublas;
450    matrix&lt;double&gt; m (3, 3);
451    for (unsigned j = 0; j &lt; m.size2 (); ++ j) {
452        for (unsigned i = 0; i &lt; m.size1 (); ++ i)
453            column (m, j) (i) = 3 * i + j;
454        std::cout &lt;&lt; column (m, j) &lt;&lt; std::endl;
455    }
456}
457</pre>
458<h2><a name="vector_range" id="vector_range"></a>Vector Range</h2>
459<h4>Description</h4>
460<p>The templated class <code>matrix_vector_range&lt;M&gt;</code>
461allows addressing a sub vector of a matrix.</p>
462<h4>Example</h4>
463<pre>
464#include &lt;boost/numeric/ublas/matrix.hpp&gt;
465#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
466#include &lt;boost/numeric/ublas/io.hpp&gt;
467
468int main () {
469    using namespace boost::numeric::ublas;
470    matrix&lt;double&gt; m (3, 3);
471    for (unsigned i = 0; i &lt; m.size1 (); ++ i)
472        for (unsigned j = 0; j &lt; m.size2 (); ++ j)
473            m (i, j) = 3 * i + j;
474
475    matrix_vector_range&lt;matrix&lt;double&gt; &gt; mvr (m, range (0, 3), range (0, 3));
476    std::cout &lt;&lt; mvr &lt;&lt; std::endl;
477}
478</pre>
479<h4>Definition</h4>
480<p>Defined in the header matrix_proxy.hpp.</p>
481<h4>Template parameters</h4>
482<table border="1" summary="parameters">
483<tbody>
484<tr>
485<th>Parameter</th>
486<th>Description</th>
487<th>Default</th>
488</tr>
489<tr>
490<td><code>M</code></td>
491<td>The type of matrix referenced.</td>
492<td></td>
493</tr>
494</tbody>
495</table>
496<h4>Model of</h4>
497<p><a href="expression_concept.htm#vector_expression">Vector Expression</a>
498.</p>
499<p>If the specified ranges fall outside that of the index range of
500the matrix, then the <code>matrix_vector_range</code> is not a well
501formed Vector Expression. That is, access to an element which is
502outside of the matrix is <i>undefined</i>.</p>
503<h4>Type requirements</h4>
504<p>None, except for those imposed by the requirements of <a href=
505"expression_concept.htm#vector_expression">Vector Expression</a> .</p>
506<h4>Public base classes</h4>
507<p><code>vector_expression&lt;matrix_vector_range&lt;M&gt;
508&gt;</code></p>
509<h4>Members</h4>
510<table border="1" summary="members">
511<tbody>
512<tr>
513<th>Member</th>
514<th>Description</th>
515</tr>
516<tr>
517<td><code>matrix_vector_range (matrix_type &amp;data,<br />
518const range &amp;r1, const range &amp;r2)</code></td>
519<td>Constructs a sub vector.</td>
520</tr>
521<tr>
522<td><code>size_type size () const</code></td>
523<td>Returns the size of the sub vector.</td>
524</tr>
525<tr>
526<td><code>const_reference operator () (size_type i)
527const</code></td>
528<td>Returns the value of the <code>i</code>-th element.</td>
529</tr>
530<tr>
531<td><code>reference operator () (size_type i)</code></td>
532<td>Returns a reference of the <code>i</code>-th element.</td>
533</tr>
534<tr>
535<td><code>matrix_vector_range &amp;operator = (const
536matrix_vector_range &amp;mvr)</code></td>
537<td>The assignment operator.</td>
538</tr>
539<tr>
540<td><code>matrix_vector_range &amp;assign_temporary
541(matrix_vector_range &amp;mvr)</code></td>
542<td>Assigns a temporary. May change the matrix vector range
543<code>mvr</code>.</td>
544</tr>
545<tr>
546<td><code>template&lt;class AE&gt;<br />
547matrix_vector_range &amp;operator = (const
548vector_expression&lt;AE&gt; &amp;ae)</code></td>
549<td>The extended assignment operator.</td>
550</tr>
551<tr>
552<td><code>template&lt;class AE&gt;<br />
553matrix_vector_range &amp;assign (const vector_expression&lt;AE&gt;
554&amp;ae)</code></td>
555<td>Assigns a vector expression to the sub vector. Left and right
556hand side of the assignment should be independent.</td>
557</tr>
558<tr>
559<td><code>template&lt;class AE&gt;<br />
560matrix_vector_range &amp;operator += (const
561vector_expression&lt;AE&gt; &amp;ae)</code></td>
562<td>A computed assignment operator. Adds the vector expression to
563the sub vector.</td>
564</tr>
565<tr>
566<td><code>template&lt;class AE&gt;<br />
567matrix_vector_range &amp;plus_assign (const
568vector_expression&lt;AE&gt; &amp;ae)</code></td>
569<td>Adds a vector expression to the sub vector. Left and right hand
570side of the assignment should be independent.</td>
571</tr>
572<tr>
573<td><code>template&lt;class AE&gt;<br />
574matrix_vector_range &amp;operator -= (const
575vector_expression&lt;AE&gt; &amp;ae)</code></td>
576<td>A computed assignment operator. Subtracts the vector expression
577from the sub vector.</td>
578</tr>
579<tr>
580<td><code>template&lt;class AE&gt;<br />
581matrix_vector_range &amp;minus_assign (const
582vector_expression&lt;AE&gt; &amp;ae)</code></td>
583<td>Subtracts a vector expression from the sub vector. Left and
584right hand side of the assignment should be independent.</td>
585</tr>
586<tr>
587<td><code>template&lt;class AT&gt;<br />
588matrix_vector_range &amp;operator *= (const AT &amp;at)</code></td>
589<td>A computed assignment operator. Multiplies the sub vector with
590a scalar.</td>
591</tr>
592<tr>
593<td><code>template&lt;class AT&gt;<br />
594matrix_vector_range &amp;operator /= (const AT &amp;at)</code></td>
595<td>A computed assignment operator. Divides the sub vector through
596a scalar.</td>
597</tr>
598<tr>
599<td><code>void swap (matrix_vector_range &amp;mvr)</code></td>
600<td>Swaps the contents of the sub vectors.</td>
601</tr>
602<tr>
603<td><code>const_iterator begin () const</code></td>
604<td>Returns a <code>const_iterator</code> pointing to the beginning
605of the <code>matrix_vector_range</code>.</td>
606</tr>
607<tr>
608<td><code>const_iterator end () const</code></td>
609<td>Returns a <code>const_iterator</code> pointing to the end of
610the <code>matrix_vector_range</code>.</td>
611</tr>
612<tr>
613<td><code>iterator begin ()</code></td>
614<td>Returns a <code>iterator</code> pointing to the beginning of
615the <code>matrix_vector_range</code>.</td>
616</tr>
617<tr>
618<td><code>iterator end ()</code></td>
619<td>Returns a <code>iterator</code> pointing to the end of the
620<code>matrix_vector_range</code>.</td>
621</tr>
622<tr>
623<td><code>const_reverse_iterator rbegin () const</code></td>
624<td>Returns a <code>const_reverse_iterator</code> pointing to the
625beginning of the <code>matrix_vector_range</code>.</td>
626</tr>
627<tr>
628<td><code>const_reverse_iterator rend () const</code></td>
629<td>Returns a <code>const_reverse_iterator</code> pointing to the
630end of the reversed <code>matrix_vector_range</code>.</td>
631</tr>
632<tr>
633<td><code>reverse_iterator rbegin ()</code></td>
634<td>Returns a <code>reverse_iterator</code> pointing to the
635beginning of the reversed <code>matrix_vector_range</code>.</td>
636</tr>
637<tr>
638<td><code>reverse_iterator rend ()</code></td>
639<td>Returns a <code>reverse_iterator</code> pointing to the end of
640the reversed <code>matrix_vector_range</code>.</td>
641</tr>
642</tbody>
643</table>
644<h2><a name="vector_slice" id="vector_slice"></a>Vector Slice</h2>
645<h4>Description</h4>
646<p>The templated class <code>matrix_vector_slice&lt;M&gt;</code>
647allows addressing a sliced sub vector of a matrix.</p>
648<h4>Example</h4>
649<pre>
650#include &lt;boost/numeric/ublas/matrix.hpp&gt;
651#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
652#include &lt;boost/numeric/ublas/io.hpp&gt;
653
654int main () {
655    using namespace boost::numeric::ublas;
656    matrix&lt;double&gt; m (3, 3);
657    for (unsigned i = 0; i &lt; m.size1 (); ++ i)
658        for (unsigned j = 0; j &lt; m.size2 (); ++ j)
659            m (i, j) = 3 * i + j;
660
661    matrix_vector_slice&lt;matrix&lt;double&gt; &gt; mvs (m, slice (0, 1, 3), slice (0, 1, 3));
662    std::cout &lt;&lt; mvs &lt;&lt; std::endl;
663}
664</pre>
665<h4>Definition</h4>
666<p>Defined in the header matrix_proxy.hpp.</p>
667<h4>Template parameters</h4>
668<table border="1" summary="parameters">
669<tbody>
670<tr>
671<th>Parameter</th>
672<th>Description</th>
673<th>Default</th>
674</tr>
675<tr>
676<td><code>M</code></td>
677<td>The type of matrix referenced.</td>
678<td></td>
679</tr>
680</tbody>
681</table>
682<h4>Model of</h4>
683<p><a href="expression_concept.htm#vector_expression">Vector Expression</a>
684.</p>
685<p>If the specified slices fall outside that of the index range of
686the matrix, then the <code>matrix_vector_slice</code> is not a well
687formed Vector Expression. That is, access to an element which is
688outside of the matrix is <i>undefined</i>.</p>
689<h4>Type requirements</h4>
690<p>None, except for those imposed by the requirements of <a href=
691"expression_concept.htm#vector_expression">Vector Expression</a> .</p>
692<h4>Public base classes</h4>
693<p><code>vector_expression&lt;matrix_vector_slice&lt;M&gt;
694&gt;</code></p>
695<h4>Members</h4>
696<table border="1" summary="members">
697<tbody>
698<tr>
699<th>Member</th>
700<th>Description</th>
701</tr>
702<tr>
703<td><code>matrix_vector_slice (matrix_type &amp;data,<br />
704const slice &amp;s1, const slice &amp;s2)</code></td>
705<td>Constructs a sub vector.</td>
706</tr>
707<tr>
708<td><code>size_type size () const</code></td>
709<td>Returns the size of the sub vector.</td>
710</tr>
711<tr>
712<td><code>const_reference operator () (size_type i)
713const</code></td>
714<td>Returns the value of the <code>i</code>-th element.</td>
715</tr>
716<tr>
717<td><code>reference operator () (size_type i)</code></td>
718<td>Returns a reference of the <code>i</code>-th element.</td>
719</tr>
720<tr>
721<td><code>matrix_vector_slice &amp;operator = (const
722matrix_vector_slice &amp;mvs)</code></td>
723<td>The assignment operator.</td>
724</tr>
725<tr>
726<td><code>matrix_vector_slice &amp;assign_temporary
727(matrix_vector_slice &amp;mvs)</code></td>
728<td>Assigns a temporary. May change the matrix vector slice
729<code>vs</code>.</td>
730</tr>
731<tr>
732<td><code>template&lt;class AE&gt;<br />
733matrix_vector_slice &amp;operator = (const
734vector_expression&lt;AE&gt; &amp;ae)</code></td>
735<td>The extended assignment operator.</td>
736</tr>
737<tr>
738<td><code>template&lt;class AE&gt;<br />
739matrix_vector_slice &amp;assign (const vector_expression&lt;AE&gt;
740&amp;ae)</code></td>
741<td>Assigns a vector expression to the sub vector. Left and right
742hand side of the assignment should be independent.</td>
743</tr>
744<tr>
745<td><code>template&lt;class AE&gt;<br />
746matrix_vector_slice &amp;operator += (const
747vector_expression&lt;AE&gt; &amp;ae)</code></td>
748<td>A computed assignment operator. Adds the vector expression to
749the sub vector.</td>
750</tr>
751<tr>
752<td><code>template&lt;class AE&gt;<br />
753matrix_vector_slice &amp;plus_assign (const
754vector_expression&lt;AE&gt; &amp;ae)</code></td>
755<td>Adds a vector expression to the sub vector. Left and right hand
756side of the assignment should be independent.</td>
757</tr>
758<tr>
759<td><code>template&lt;class AE&gt;<br />
760matrix_vector_slice &amp;operator -= (const
761vector_expression&lt;AE&gt; &amp;ae)</code></td>
762<td>A computed assignment operator. Subtracts the vector expression
763from the sub vector.</td>
764</tr>
765<tr>
766<td><code>template&lt;class AE&gt;<br />
767matrix_vector_slice &amp;minus_assign (const
768vector_expression&lt;AE&gt; &amp;ae)</code></td>
769<td>Subtracts a vector expression from the sub vector. Left and
770right hand side of the assignment should be independent.</td>
771</tr>
772<tr>
773<td><code>template&lt;class AT&gt;<br />
774matrix_vector_slice &amp;operator *= (const AT &amp;at)</code></td>
775<td>A computed assignment operator. Multiplies the sub vector with
776a scalar.</td>
777</tr>
778<tr>
779<td><code>template&lt;class AT&gt;<br />
780matrix_vector_slice &amp;operator /= (const AT &amp;at)</code></td>
781<td>A computed assignment operator. Divides the sub vector through
782a scalar.</td>
783</tr>
784<tr>
785<td><code>void swap (matrix_vector_slice &amp;mvs)</code></td>
786<td>Swaps the contents of the sub vectors.</td>
787</tr>
788<tr>
789<td><code>const_iterator begin () const</code></td>
790<td>Returns a <code>const_iterator</code> pointing to the beginning
791of the <code>matrix_vector_slice</code>.</td>
792</tr>
793<tr>
794<td><code>const_iterator end () const</code></td>
795<td>Returns a <code>const_iterator</code> pointing to the end of
796the <code>matrix_vector_slice</code>.</td>
797</tr>
798<tr>
799<td><code>iterator begin ()</code></td>
800<td>Returns a <code>iterator</code> pointing to the beginning of
801the <code>matrix_vector_slice</code>.</td>
802</tr>
803<tr>
804<td><code>iterator end ()</code></td>
805<td>Returns a <code>iterator</code> pointing to the end of the
806<code>matrix_vector_slice</code>.</td>
807</tr>
808<tr>
809<td><code>const_reverse_iterator rbegin () const</code></td>
810<td>Returns a <code>const_reverse_iterator</code> pointing to the
811beginning of the reversed <code>matrix_vector_slice</code>.</td>
812</tr>
813<tr>
814<td><code>const_reverse_iterator rend () const</code></td>
815<td>Returns a <code>const_reverse_iterator</code> pointing to the
816end of the reversed <code>matrix_vector_slice</code>.</td>
817</tr>
818<tr>
819<td><code>reverse_iterator rbegin ()</code></td>
820<td>Returns a <code>reverse_iterator</code> pointing to the
821beginning of the reversed <code>matrix_vector_slice</code>.</td>
822</tr>
823<tr>
824<td><code>reverse_iterator rend ()</code></td>
825<td>Returns a <code>reverse_iterator</code> pointing to the end of
826the reversed <code>matrix_vector_slice</code>.</td>
827</tr>
828</tbody>
829</table>
830<h2><a name="matrix_range" id="matrix_range"></a>Matrix Range</h2>
831<h4>Description</h4>
832<p>The templated class <code>matrix_range&lt;M&gt;</code> allows
833addressing a sub matrix of a matrix.</p>
834<h4>Example</h4>
835<pre>
836#include &lt;boost/numeric/ublas/matrix.hpp&gt;
837#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
838#include &lt;boost/numeric/ublas/io.hpp&gt;
839
840int main () {
841    using namespace boost::numeric::ublas;
842    matrix&lt;double&gt; m (3, 3);
843    matrix_range&lt;matrix&lt;double&gt; &gt; mr (m, range (0, 3), range (0, 3));
844    for (unsigned i = 0; i &lt; mr.size1 (); ++ i)
845        for (unsigned j = 0; j &lt; mr.size2 (); ++ j)
846            mr (i, j) = 3 * i + j;
847    std::cout &lt;&lt; mr &lt;&lt; std::endl;
848}
849</pre>
850<h4>Definition</h4>
851<p>Defined in the header matrix_proxy.hpp.</p>
852<h4>Template parameters</h4>
853<table border="1" summary="parameters">
854<tbody>
855<tr>
856<th>Parameter</th>
857<th>Description</th>
858<th>Default</th>
859</tr>
860<tr>
861<td><code>M</code></td>
862<td>The type of matrix referenced.</td>
863<td></td>
864</tr>
865</tbody>
866</table>
867<h4>Model of</h4>
868<p><a href="expression_concept.htm#matrix_expression">Matrix Expression</a>
869.</p>
870<p>If the specified ranges fall outside that of the index range of
871the matrix, then the <code>matrix_range</code> is not a well formed
872Matrix Expression. That is, access to an element which is outside
873of the matrix is <i>undefined</i>.</p>
874<h4>Type requirements</h4>
875<p>None, except for those imposed by the requirements of <a href=
876"expression_concept.htm#matrix_expression">Matrix Expression</a> .</p>
877<h4>Public base classes</h4>
878<p><code>matrix_expression&lt;matrix_range&lt;M&gt; &gt;</code></p>
879<h4>Members</h4>
880<table border="1" summary="members">
881<tbody>
882<tr>
883<th>Member</th>
884<th>Description</th>
885</tr>
886<tr>
887<td><code>matrix_range (matrix_type &amp;data,<br />
888const range &amp;r1, const range &amp;r2)</code></td>
889<td>Constructs a sub matrix.</td>
890</tr>
891<tr>
892<td><code>size_type start1 () const</code></td>
893<td>Returns the index of the first row.</td>
894</tr>
895<tr>
896<td><code>size_type size1 () const</code></td>
897<td>Returns the number of rows.</td>
898</tr>
899<tr>
900<td><code>size_type start2 () const</code></td>
901<td>Returns the index of the first column.</td>
902</tr>
903<tr>
904<td><code>size_type size2 () const</code></td>
905<td>Returns the number of columns.</td>
906</tr>
907<tr>
908<td><code>const_reference operator () (size_type i, size_type j)
909const</code></td>
910<td>Returns the value of the <code>j</code>-th element in the
911<code>i</code>-th row.</td>
912</tr>
913<tr>
914<td><code>reference operator () (size_type i, size_type
915j)</code></td>
916<td>Returns a reference of the <code>j</code>-th element in the
917<code>i</code>-th row.</td>
918</tr>
919<tr>
920<td><code>matrix_range &amp;operator = (const matrix_range
921&amp;mr)</code></td>
922<td>The assignment operator.</td>
923</tr>
924<tr>
925<td><code>matrix_range &amp;assign_temporary (matrix_range
926&amp;mr)</code></td>
927<td>Assigns a temporary. May change the matrix range
928<code>mr</code> .</td>
929</tr>
930<tr>
931<td><code>template&lt;class AE&gt;<br />
932matrix_range &amp;operator = (const matrix_expression&lt;AE&gt;
933&amp;ae)</code></td>
934<td>The extended assignment operator.</td>
935</tr>
936<tr>
937<td><code>template&lt;class AE&gt;<br />
938matrix_range &amp;assign (const matrix_expression&lt;AE&gt;
939&amp;ae)</code></td>
940<td>Assigns a matrix expression to the sub matrix. Left and right
941hand side of the assignment should be independent.</td>
942</tr>
943<tr>
944<td><code>template&lt;class AE&gt;<br />
945matrix_range &amp;operator += (const matrix_expression&lt;AE&gt;
946&amp;ae)</code></td>
947<td>A computed assignment operator. Adds the matrix expression to
948the sub matrix.</td>
949</tr>
950<tr>
951<td><code>template&lt;class AE&gt;<br />
952matrix_range &amp;plus_assign (const matrix_expression&lt;AE&gt;
953&amp;ae)</code></td>
954<td>Adds a matrix expression to the sub matrix. Left and right hand
955side of the assignment should be independent.</td>
956</tr>
957<tr>
958<td><code>template&lt;class AE&gt;<br />
959matrix_range &amp;operator -= (const matrix_expression&lt;AE&gt;
960&amp;ae)</code></td>
961<td>A computed assignment operator. Subtracts the matrix expression
962from the sub matrix.</td>
963</tr>
964<tr>
965<td><code>template&lt;class AE&gt;<br />
966matrix_range &amp;minus_assign (const matrix_expression&lt;AE&gt;
967&amp;ae)</code></td>
968<td>Subtracts a matrix expression from the sub matrix. Left and
969right hand side of the assignment should be independent.</td>
970</tr>
971<tr>
972<td><code>template&lt;class AT&gt;<br />
973matrix_range &amp;operator *= (const AT &amp;at)</code></td>
974<td>A computed assignment operator. Multiplies the sub matrix with
975a scalar.</td>
976</tr>
977<tr>
978<td><code>template&lt;class AT&gt;<br />
979matrix_range &amp;operator /= (const AT &amp;at)</code></td>
980<td>A computed assignment operator. Divides the sub matrix through
981a scalar.</td>
982</tr>
983<tr>
984<td><code>void swap (matrix_range &amp;mr)</code></td>
985<td>Swaps the contents of the sub matrices.</td>
986</tr>
987<tr>
988<td><code>const_iterator1 begin1 () const</code></td>
989<td>Returns a <code>const_iterator1</code> pointing to the
990beginning of the <code>matrix_range</code>.</td>
991</tr>
992<tr>
993<td><code>const_iterator1 end1 () const</code></td>
994<td>Returns a <code>const_iterator1</code> pointing to the end of
995the <code>matrix_range</code>.</td>
996</tr>
997<tr>
998<td><code>iterator1 begin1 ()</code></td>
999<td>Returns a <code>iterator1</code> pointing to the beginning of
1000the <code>matrix_range</code>.</td>
1001</tr>
1002<tr>
1003<td><code>iterator1 end1 ()</code></td>
1004<td>Returns a <code>iterator1</code> pointing to the end of the
1005<code>matrix_range</code>.</td>
1006</tr>
1007<tr>
1008<td><code>const_iterator2 begin2 () const</code></td>
1009<td>Returns a <code>const_iterator2</code> pointing to the
1010beginning of the <code>matrix_range</code>.</td>
1011</tr>
1012<tr>
1013<td><code>const_iterator2 end2 () const</code></td>
1014<td>Returns a <code>const_iterator2</code> pointing to the end of
1015the <code>matrix_range</code>.</td>
1016</tr>
1017<tr>
1018<td><code>iterator2 begin2 ()</code></td>
1019<td>Returns a <code>iterator2</code> pointing to the beginning of
1020the <code>matrix_range</code>.</td>
1021</tr>
1022<tr>
1023<td><code>iterator2 end2 ()</code></td>
1024<td>Returns a <code>iterator2</code> pointing to the end of the
1025<code>matrix_range</code>.</td>
1026</tr>
1027<tr>
1028<td><code>const_reverse_iterator1 rbegin1 () const</code></td>
1029<td>Returns a <code>const_reverse_iterator1</code> pointing to the
1030beginning of the reversed <code>matrix_range</code>.</td>
1031</tr>
1032<tr>
1033<td><code>const_reverse_iterator1 rend1 () const</code></td>
1034<td>Returns a <code>const_reverse_iterator1</code> pointing to the
1035end of the reversed <code>matrix_range</code>.</td>
1036</tr>
1037<tr>
1038<td><code>reverse_iterator1 rbegin1 ()</code></td>
1039<td>Returns a <code>reverse_iterator1</code> pointing to the
1040beginning of the reversed <code>matrix_range</code>.</td>
1041</tr>
1042<tr>
1043<td><code>reverse_iterator1 rend1 ()</code></td>
1044<td>Returns a <code>reverse_iterator1</code> pointing to the end of
1045the reversed <code>matrix_range</code>.</td>
1046</tr>
1047<tr>
1048<td><code>const_reverse_iterator2 rbegin2 () const</code></td>
1049<td>Returns a <code>const_reverse_iterator2</code> pointing to the
1050beginning of the reversed <code>matrix_range</code>.</td>
1051</tr>
1052<tr>
1053<td><code>const_reverse_iterator2 rend2 () const</code></td>
1054<td>Returns a <code>const_reverse_iterator2</code> pointing to the
1055end of the reversed <code>matrix_range</code>.</td>
1056</tr>
1057<tr>
1058<td><code>reverse_iterator2 rbegin2 ()</code></td>
1059<td>Returns a <code>reverse_iterator2</code> pointing to the
1060beginning of the reversed <code>matrix_range</code>.</td>
1061</tr>
1062<tr>
1063<td><code>reverse_iterator2 rend2 ()</code></td>
1064<td>Returns a <code>reverse_iterator2</code> pointing to the end of
1065reversed the <code>matrix_range</code>.</td>
1066</tr>
1067</tbody>
1068</table>
1069<h3>Simple Projections</h3>
1070<h4>Description</h4>
1071<p>The free <code>subrange</code> functions support the construction
1072of matrix ranges.</p>
1073<h4>Prototypes</h4>
1074<pre><code>
1075    template&lt;class M&gt;
1076    matrix_range&lt;M&gt; subrange (M &amp;data,
1077       M::size_type start1, M::size_type stop1, M::size_type start2, M::size_type, stop2);
1078    template&lt;class M&gt;
1079    const matrix_range&lt;const M&gt; subrange (const M &amp;data,
1080       M::size_type start1, M::size_type stop1, M::size_type start2, M::size_type, stop2);
1081</code></pre>
1082<h3>Generic Projections</h3>
1083<h4>Description</h4>
1084<p>The free <code>project</code> functions support the construction
1085of matrix ranges. Existing <code>matrix_range</code>'s can be composed with further ranges. The resulting ranges are computed using this existing ranges' <code>compose</code> function.</p>
1086<h4>Prototypes</h4>
1087<pre><code>
1088    template&lt;class M&gt;
1089    matrix_range&lt;M&gt; project (M &amp;data, const range &amp;r1, const range &amp;r2);
1090    template&lt;class M&gt;
1091    const matrix_range&lt;const M&gt; project (const M &amp;data, const range &amp;r1, const range &amp;r2);
1092    template&lt;class M&gt;
1093    matrix_range&lt;M&gt; project (matrix_range&lt;M&gt; &amp;data, const range &amp;r1, const range &amp;r2);
1094    template&lt;class M&gt;
1095    const matrix_range&lt;M&gt; project (const matrix_range&lt;M&gt; &amp;data, const range &amp;r1, const range &amp;r2);
1096</code></pre>
1097<h4>Definition</h4>
1098<p>Defined in the header matrix_proxy.hpp.</p>
1099<h4>Type requirements</h4>
1100<ul>
1101<li><code>M</code> is a model of <a href=
1102"expression_concept.htm#matrix_expression">Matrix Expression</a> .</li>
1103</ul>
1104<h4>Complexity</h4>
1105<p>Quadratic depending from the size of the ranges.</p>
1106<h4>Examples</h4>
1107<pre>
1108#include &lt;boost/numeric/ublas/matrix.hpp&gt;
1109#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
1110#include &lt;boost/numeric/ublas/io.hpp&gt;
1111
1112int main () {
1113    using namespace boost::numeric::ublas;
1114    matrix&lt;double&gt; m (3, 3);
1115    for (unsigned i = 0; i &lt; m.size1 (); ++ i)
1116        for (unsigned j = 0; j &lt; m.size2 (); ++ j)
1117            project (m, range (0, 3), range (0, 3)) (i, j) = 3 * i + j;
1118    std::cout &lt;&lt; project (m, range (0, 3), range (0, 3)) &lt;&lt; std::endl;
1119}
1120</pre>
1121<h2><a name="matrix_slice" id="matrix_slice"></a>Matrix Slice</h2>
1122<h4>Description</h4>
1123<p>The templated class <code>matrix_slice&lt;M&gt;</code> allows
1124addressing a sliced sub matrix of a matrix.</p>
1125<h4>Example</h4>
1126<pre>
1127#include &lt;boost/numeric/ublas/matrix.hpp&gt;
1128#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
1129#include &lt;boost/numeric/ublas/io.hpp&gt;
1130
1131int main () {
1132    using namespace boost::numeric::ublas;
1133    matrix&lt;double&gt; m (3, 3);
1134    matrix_slice&lt;matrix&lt;double&gt; &gt; ms (m, slice (0, 1, 3), slice (0, 1, 3));
1135    for (unsigned i = 0; i &lt; ms.size1 (); ++ i)
1136        for (unsigned j = 0; j &lt; ms.size2 (); ++ j)
1137            ms (i, j) = 3 * i + j;
1138    std::cout &lt;&lt; ms &lt;&lt; std::endl;
1139}
1140</pre>
1141<h4>Definition</h4>
1142<p>Defined in the header matrix_proxy.hpp.</p>
1143<h4>Template parameters</h4>
1144<table border="1" summary="parameters">
1145<tbody>
1146<tr>
1147<th>Parameter</th>
1148<th>Description</th>
1149<th>Default</th>
1150</tr>
1151<tr>
1152<td><code>M</code></td>
1153<td>The type of matrix referenced.</td>
1154<td></td>
1155</tr>
1156</tbody>
1157</table>
1158<h4>Model of</h4>
1159<p><a href="expression_concept.htm#matrix_expression">Matrix Expression</a>
1160.</p>
1161<p>If the specified slices fall outside that of the index range of
1162the matrix, then the <code>matrix_slice</code> is not a well formed
1163Matrix Expression. That is, access to an element which is outside
1164of the matrix is <i>undefined</i>.</p>
1165<h4>Type requirements</h4>
1166<p>None, except for those imposed by the requirements of <a href=
1167"expression_concept.htm#matrix_expression">Matrix Expression</a> .</p>
1168<h4>Public base classes</h4>
1169<p><code>matrix_expression&lt;matrix_slice&lt;M&gt; &gt;</code></p>
1170<h4>Members</h4>
1171<table border="1" summary="members">
1172<tbody>
1173<tr>
1174<th>Member</th>
1175<th>Description</th>
1176</tr>
1177<tr>
1178<td><code>matrix_slice (matrix_type &amp;data,<br />
1179const slice &amp;s1, const slice &amp;s2)</code></td>
1180<td>Constructs a sub matrix.</td>
1181</tr>
1182<tr>
1183<td><code>size_type size1 () const</code></td>
1184<td>Returns the number of rows.</td>
1185</tr>
1186<tr>
1187<td><code>size_type size2 () const</code></td>
1188<td>Returns the number of columns.</td>
1189</tr>
1190<tr>
1191<td><code>const_reference operator () (size_type i, size_type j)
1192const</code></td>
1193<td>Returns the value of the <code>j</code>-th element in the
1194<code>i</code>-th row.</td>
1195</tr>
1196<tr>
1197<td><code>reference operator () (size_type i, size_type
1198j)</code></td>
1199<td>Returns a reference of the <code>j</code>-th element in the
1200<code>i</code>-th row.</td>
1201</tr>
1202<tr>
1203<td><code>matrix_slice &amp;operator = (const matrix_slice
1204&amp;ms)</code></td>
1205<td>The assignment operator.</td>
1206</tr>
1207<tr>
1208<td><code>matrix_slice &amp;assign_temporary (matrix_slice
1209&amp;ms)</code></td>
1210<td>Assigns a temporary. May change the matrix slice
1211<code>ms</code> .</td>
1212</tr>
1213<tr>
1214<td><code>template&lt;class AE&gt;<br />
1215matrix_slice &amp;operator = (const matrix_expression&lt;AE&gt;
1216&amp;ae)</code></td>
1217<td>The extended assignment operator.</td>
1218</tr>
1219<tr>
1220<td><code>template&lt;class AE&gt;<br />
1221matrix_slice &amp;assign (const matrix_expression&lt;AE&gt;
1222&amp;ae)</code></td>
1223<td>Assigns a matrix expression to the sub matrix. Left and right
1224hand side of the assignment should be independent.</td>
1225</tr>
1226<tr>
1227<td><code>template&lt;class AE&gt;<br />
1228matrix_slice &amp;operator += (const matrix_expression&lt;AE&gt;
1229&amp;ae)</code></td>
1230<td>A computed assignment operator. Adds the matrix expression to
1231the sub matrix.</td>
1232</tr>
1233<tr>
1234<td><code>template&lt;class AE&gt;<br />
1235matrix_slice &amp;plus_assign (const matrix_expression&lt;AE&gt;
1236&amp;ae)</code></td>
1237<td>Adds a matrix expression to the sub matrix. Left and right hand
1238side of the assignment should be independent.</td>
1239</tr>
1240<tr>
1241<td><code>template&lt;class AE&gt;<br />
1242matrix_slice &amp;operator -= (const matrix_expression&lt;AE&gt;
1243&amp;ae)</code></td>
1244<td>A computed assignment operator. Subtracts the matrix expression
1245from the sub matrix.</td>
1246</tr>
1247<tr>
1248<td><code>template&lt;class AE&gt;<br />
1249matrix_slice &amp;minus_assign (const matrix_expression&lt;AE&gt;
1250&amp;ae)</code></td>
1251<td>Subtracts a matrix expression from the sub matrix. Left and
1252right hand side of the assignment should be independent.</td>
1253</tr>
1254<tr>
1255<td><code>template&lt;class AT&gt;<br />
1256matrix_slice &amp;operator *= (const AT &amp;at)</code></td>
1257<td>A computed assignment operator. Multiplies the sub matrix with
1258a scalar.</td>
1259</tr>
1260<tr>
1261<td><code>template&lt;class AT&gt;<br />
1262matrix_slice &amp;operator /= (const AT &amp;at)</code></td>
1263<td>A computed assignment operator. Multiplies the sub matrix
1264through a scalar.</td>
1265</tr>
1266<tr>
1267<td><code>void swap (matrix_slice &amp;ms)</code></td>
1268<td>Swaps the contents of the sub matrices.</td>
1269</tr>
1270<tr>
1271<td><code>const_iterator1 begin1 () const</code></td>
1272<td>Returns a <code>const_iterator1</code> pointing to the
1273beginning of the <code>matrix_slice</code>.</td>
1274</tr>
1275<tr>
1276<td><code>const_iterator1 end1 () const</code></td>
1277<td>Returns a <code>const_iterator1</code> pointing to the end of
1278the <code>matrix_slice</code>.</td>
1279</tr>
1280<tr>
1281<td><code>iterator1 begin1 ()</code></td>
1282<td>Returns a <code>iterator1</code> pointing to the beginning of
1283the <code>matrix_slice</code>.</td>
1284</tr>
1285<tr>
1286<td><code>iterator1 end1 ()</code></td>
1287<td>Returns a <code>iterator1</code> pointing to the end of the
1288<code>matrix_slice</code>.</td>
1289</tr>
1290<tr>
1291<td><code>const_iterator2 begin2 () const</code></td>
1292<td>Returns a <code>const_iterator2</code> pointing to the
1293beginning of the <code>matrix_slice</code>.</td>
1294</tr>
1295<tr>
1296<td><code>const_iterator2 end2 () const</code></td>
1297<td>Returns a <code>const_iterator2</code> pointing to the end of
1298the <code>matrix_slice</code>.</td>
1299</tr>
1300<tr>
1301<td><code>iterator2 begin2 ()</code></td>
1302<td>Returns a <code>iterator2</code> pointing to the beginning of
1303the <code>matrix_slice</code>.</td>
1304</tr>
1305<tr>
1306<td><code>iterator2 end2 ()</code></td>
1307<td>Returns a <code>iterator2</code> pointing to the end of the
1308<code>matrix_slice</code>.</td>
1309</tr>
1310<tr>
1311<td><code>const_reverse_iterator1 rbegin1 () const</code></td>
1312<td>Returns a <code>const_reverse_iterator1</code> pointing to the
1313beginning of the reversed <code>matrix_slice</code>.</td>
1314</tr>
1315<tr>
1316<td><code>const_reverse_iterator1 rend1 () const</code></td>
1317<td>Returns a <code>const_reverse_iterator1</code> pointing to the
1318end of the reversed <code>matrix_slice</code>.</td>
1319</tr>
1320<tr>
1321<td><code>reverse_iterator1 rbegin1 ()</code></td>
1322<td>Returns a <code>reverse_iterator1</code> pointing to the
1323beginning of the reversed <code>matrix_slice</code>.</td>
1324</tr>
1325<tr>
1326<td><code>reverse_iterator1 rend1 ()</code></td>
1327<td>Returns a <code>reverse_iterator1</code> pointing to the end of
1328the reversed <code>matrix_slice</code>.</td>
1329</tr>
1330<tr>
1331<td><code>const_reverse_iterator2 rbegin2 () const</code></td>
1332<td>Returns a <code>const_reverse_iterator2</code> pointing to the
1333beginning of the reversed <code>matrix_slice</code>.</td>
1334</tr>
1335<tr>
1336<td><code>const_reverse_iterator2 rend2 () const</code></td>
1337<td>Returns a <code>const_reverse_iterator2</code> pointing to the
1338end of the reversed <code>matrix_slice</code>.</td>
1339</tr>
1340<tr>
1341<td><code>reverse_iterator2 rbegin2 ()</code></td>
1342<td>Returns a <code>reverse_iterator2</code> pointing to the
1343beginning of the reversed <code>matrix_slice</code>.</td>
1344</tr>
1345<tr>
1346<td><code>reverse_iterator2 rend2 ()</code></td>
1347<td>Returns a <code>reverse_iterator2</code> pointing to the end of
1348the reversed <code>matrix_slice</code>.</td>
1349</tr>
1350</tbody>
1351</table>
1352<h3>Simple Projections</h3>
1353<h4>Description</h4>
1354<p>The free <code>subslice</code> functions support the construction
1355of matrix slices.</p>
1356<h4>Prototypes</h4>
1357<pre><code>
1358    template&lt;class M&gt;
1359    matrix_slice&lt;M&gt; subslice (M &amp;data,
1360       M::size_type start1, M::difference_type stride1, M::size_type size1,
1361       M::size_type start2, M::difference_type stride2, M::size_type size2);
1362    template&lt;class M&gt;
1363    const matrix_slice&lt;const M&gt; subslice (const M &amp;data,
1364       M::size_type start1, M::difference_type stride1, M::size_type size1,
1365       M::size_type start2, M::difference_type stride2, M::size_type size2);
1366</code></pre>
1367<h3>Generic Projections</h3>
1368<h4>Description</h4>
1369<p>The free <code>project</code> functions support the construction
1370of matrix slices. Existing <code>matrix_slice</code>'s can be composed with further ranges or slices. The resulting slices are computed using this existing slices' <code>compose</code> function.</p>
1371<h4>Prototypes</h4>
1372<pre><code>
1373    template&lt;class M&gt;
1374    matrix_slice&lt;M&gt; project (M &amp;data, const slice &amp;s1, const slice &amp;s2);
1375    template&lt;class M&gt;
1376    const matrix_slice&lt;const M&gt; project (const M &amp;data, const slice &amp;s1, const slice &amp;s2);
1377    template&lt;class M&gt;
1378    matrix_slice&lt;M&gt; project (matrix_slice&lt;M&gt; &amp;data, const range &amp;r1, const range &amp;r2);
1379    template&lt;class M&gt;
1380    const matrix_slice&lt;M&gt; project (const matrix_slice&lt;M&gt; &amp;data, const range &amp;r1, const range &amp;r2);
1381    template&lt;class M&gt;
1382    matrix_slice&lt;M&gt; project (matrix_slice&lt;M&gt; &amp;data, const slice &amp;s1, const slice &amp;s2);
1383    template&lt;class M&gt;
1384    const matrix_slice&lt;M&gt; project (const matrix_slice&lt;M&gt; &amp;data, const slice &amp;s1, const slice &amp;s2);
1385</code></pre>
1386<h4>Definition</h4>
1387<p>Defined in the header matrix_proxy.hpp.</p>
1388<h4>Type requirements</h4>
1389<ul>
1390<li><code>M</code> is a model of <a href=
1391"expression_concept.htm#matrix_expression">Matrix Expression</a> .</li>
1392</ul>
1393<h4>Complexity</h4>
1394<p>Quadratic depending from the size of the slices.</p>
1395<h4>Examples</h4>
1396<pre>
1397#include &lt;boost/numeric/ublas/matrix.hpp&gt;
1398#include &lt;boost/numeric/ublas/matrix_proxy.hpp&gt;
1399#include &lt;boost/numeric/ublas/io.hpp&gt;
1400
1401int main () {
1402    using namespace boost::numeric::ublas;
1403    matrix&lt;double&gt; m (3, 3);
1404    for (unsigned i = 0; i &lt; m.size1 (); ++ i)
1405        for (unsigned j = 0; j &lt; m.size2 (); ++ j)
1406            project (m, slice (0, 1, 3), slice (0, 1, 3)) (i, j) = 3 * i + j;
1407    std::cout &lt;&lt; project (m, slice (0, 1, 3), slice (0, 1, 3)) &lt;&lt; std::endl;
1408}
1409</pre>
1410<hr />
1411<p>Copyright (&copy;) 2000-2002 Joerg Walter, Mathias Koch<br />
1412Permission to copy, use, modify, sell and distribute this document
1413is granted provided this copyright notice appears in all copies.
1414This document is provided ``as is'' without express or implied
1415warranty, and with no claim as to its suitability for any
1416purpose.</p>
1417</body>
1418</html>
Note: See TracBrowser for help on using the repository browser.