Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added boost

File size: 18.3 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>Banded Matrix</title>
11</head>
12<body>
13<h1><img src="../../../../boost.png" align="middle" />
14Banded Matrix</h1>
15<h2><a name="banded_matrix" id="banded_matrix"></a>Banded Matrix</h2>
16<h4>Description</h4>
17<p>The templated class <code>banded_matrix&lt;T, F, A&gt;</code> is
18the base container adaptor for banded matrices. For a <em>(m x
19n</em>)-dimensional banded matrix with <em>l</em> lower and
20<em>u</em> upper diagonals and <em>0 &lt;= i &lt; m</em>, <em>0
21&lt;= j &lt; n</em> holds <em>b</em><sub><em>i, j</em></sub> <em>=
220</em>, if <em>i &gt; j + l</em> or <em>i &lt; j - u</em>. The
23storage of banded matrices is packed.</p>
24<h4>Example</h4>
25<pre>
26#include &lt;boost/numeric/ublas/banded.hpp&gt;
27#include &lt;boost/numeric/ublas/io.hpp&gt;
28
29int main () {
30    using namespace boost::numeric::ublas;
31    banded_matrix&lt;double&gt; m (3, 3, 1, 1);
32    for (signed i = 0; i &lt; signed (m.size1 ()); ++ i)
33        for (signed j = std::max (i - 1, 0); j &lt; std::min (i + 2, signed (m.size2 ())); ++ j)
34            m (i, j) = 3 * i + j;
35    std::cout &lt;&lt; m &lt;&lt; std::endl;
36}
37</pre>
38<h4>Definition</h4>
39<p>Defined in the header banded.hpp.</p>
40<h4>Template parameters</h4>
41<table border="1" summary="parameters">
42<tbody>
43<tr>
44<th>Parameter</th>
45<th>Description</th>
46<th>Default</th>
47</tr>
48<tr>
49<td><code>T</code></td>
50<td>The type of object stored in the matrix.</td>
51<td></td>
52</tr>
53<tr>
54<td><code>F</code></td>
55<td>Functor describing the storage organization. <a href=
56"#banded_matrix_1">[1]</a></td>
57<td><code>row_major</code></td>
58</tr>
59<tr>
60<td><code>A</code></td>
61<td>The type of the adapted array. <a href=
62"#banded_matrix_2">[2]</a></td>
63<td><code>unbounded_array&lt;T&gt;</code></td>
64</tr>
65</tbody>
66</table>
67<h4>Model of</h4>
68<p><a href="container_concept.htm#matrix">Matrix</a> .</p>
69<h4>Type requirements</h4>
70<p>None, except for those imposed by the requirements of <a href=
71"container_concept.htm#matrix">Matrix</a> .</p>
72<h4>Public base classes</h4>
73<p><code>matrix_container&lt;banded_matrix&lt;T, F, A&gt;
74&gt;</code></p>
75<h4>Members</h4>
76<table border="1" summary="members">
77<tbody>
78<tr>
79<th>Member</th>
80<th>Description</th>
81</tr>
82<tr>
83<td><code>banded_matrix ()</code></td>
84<td>Allocates an uninitialized <code>banded_matrix</code> that
85holds zero rows of zero elements.</td>
86</tr>
87<tr>
88<td><code>banded_matrix (size_type size1, size_type size2,
89size_type lower = 0, size_type upper = 0)</code></td>
90<td>Allocates an uninitialized <code>banded_matrix</code> that
91holds <code>(lower + 1 + upper)</code> diagonals around the main
92diagonal of a matrix with <code>size1</code> rows of
93<code>size2</code> elements.</td>
94</tr>
95<tr>
96<td><code>banded_matrix (const banded_matrix &amp;m)</code></td>
97<td>The copy constructor.</td>
98</tr>
99<tr>
100<td><code>template&lt;class AE&gt;<br />
101banded_matrix (const matrix_expression&lt;AE&gt;
102&amp;ae)</code></td>
103<td>The extended copy constructor.</td>
104</tr>
105<tr>
106<td><code>void resize (size_type size1, size_type size2, size_type
107lower = 0, size_type upper = 0, bool preserve = true)</code></td>
108<td>Reallocates a <code>banded_matrix</code> to hold <code>(lower +
1091 + upper)</code> diagonals around the main diagonal of a matrix
110with <code>size1</code> rows of <code>size2</code> elements. The
111existing elements of the <code>banded_matrix</code> are preseved
112when specified.</td>
113</tr>
114<tr>
115<td><code>size_type size1 () const</code></td>
116<td>Returns the number of rows.</td>
117</tr>
118<tr>
119<td><code>size_type size2 () const</code></td>
120<td>Returns the number of columns.</td>
121</tr>
122<tr>
123<td><code>size_type lower () const</code></td>
124<td>Returns the number of diagonals below the main diagonal.</td>
125</tr>
126<tr>
127<td><code>size_type upper () const</code></td>
128<td>Returns the number of diagonals above the main diagonal.</td>
129</tr>
130<tr>
131<td><code>const_reference operator () (size_type i, size_type j)
132const</code></td>
133<td>Returns a <code>const</code> reference of the <code>j</code>
134-th element in the <code>i</code>-th row.</td>
135</tr>
136<tr>
137<td><code>reference operator () (size_type i, size_type
138j)</code></td>
139<td>Returns a reference of the <code>j</code>-th element in the
140<code>i</code>-th row.</td>
141</tr>
142<tr>
143<td><code>banded_matrix &amp;operator = (const banded_matrix
144&amp;m)</code></td>
145<td>The assignment operator.</td>
146</tr>
147<tr>
148<td><code>banded_matrix &amp;assign_temporary (banded_matrix
149&amp;m)</code></td>
150<td>Assigns a temporary. May change the banded matrix
151<code>m</code> .</td>
152</tr>
153<tr>
154<td><code>template&lt;class AE&gt;<br />
155banded_matrix &amp;operator = (const matrix_expression&lt;AE&gt;
156&amp;ae)</code></td>
157<td>The extended assignment operator.</td>
158</tr>
159<tr>
160<td><code>template&lt;class AE&gt;<br />
161banded_matrix &amp;assign (const matrix_expression&lt;AE&gt;
162&amp;ae)</code></td>
163<td>Assigns a matrix expression to the banded matrix. Left and
164right hand side of the assignment should be independent.</td>
165</tr>
166<tr>
167<td><code>template&lt;class AE&gt;<br />
168banded_matrix &amp;operator += (const matrix_expression&lt;AE&gt;
169&amp;ae)</code></td>
170<td>A computed assignment operator. Adds the matrix expression to
171the banded matrix.</td>
172</tr>
173<tr>
174<td><code>template&lt;class AE&gt;<br />
175banded_matrix &amp;plus_assign (const matrix_expression&lt;AE&gt;
176&amp;ae)</code></td>
177<td>Adds a matrix expression to the banded matrix. Left and right
178hand side of the assignment should be independent.</td>
179</tr>
180<tr>
181<td><code>template&lt;class AE&gt;<br />
182banded_matrix &amp;operator -= (const matrix_expression&lt;AE&gt;
183&amp;ae)</code></td>
184<td>A computed assignment operator. Subtracts the matrix expression
185from the banded matrix.</td>
186</tr>
187<tr>
188<td><code>template&lt;class AE&gt;<br />
189banded_matrix &amp;minus_assign (const matrix_expression&lt;AE&gt;
190&amp;ae)</code></td>
191<td>Subtracts a matrix expression from the banded matrix. Left and
192right hand side of the assignment should be independent.</td>
193</tr>
194<tr>
195<td><code>template&lt;class AT&gt;<br />
196banded_matrix &amp;operator *= (const AT &amp;at)</code></td>
197<td>A computed assignment operator. Multiplies the banded matrix
198with a scalar.</td>
199</tr>
200<tr>
201<td><code>template&lt;class AT&gt;<br />
202banded_matrix &amp;operator /= (const AT &amp;at)</code></td>
203<td>A computed assignment operator. Divides the banded matrix
204through a scalar.</td>
205</tr>
206<tr>
207<td><code>void swap (banded_matrix &amp;m)</code></td>
208<td>Swaps the contents of the banded matrices.</td>
209</tr>
210<tr>
211<td><code>void insert (size_type i, size_type j, const_reference
212t)</code></td>
213<td>Inserts the value <code>t</code> at the <code>j</code>-th
214element of the <code>i</code>-th row.</td>
215</tr>
216<tr>
217<td><code>void erase (size_type i, size_type j)</code></td>
218<td>Erases the value at the <code>j</code>-th elemenst of the
219<code>i</code>-th row.</td>
220</tr>
221<tr>
222<td><code>void clear ()</code></td>
223<td>Clears the matrix.</td>
224</tr>
225<tr>
226<td><code>const_iterator1 begin1 () const</code></td>
227<td>Returns a <code>const_iterator1</code> pointing to the
228beginning of the <code>banded_matrix</code>.</td>
229</tr>
230<tr>
231<td><code>const_iterator1 end1 () const</code></td>
232<td>Returns a <code>const_iterator1</code> pointing to the end of
233the <code>banded_matrix</code>.</td>
234</tr>
235<tr>
236<td><code>iterator1 begin1 ()</code></td>
237<td>Returns a <code>iterator1</code> pointing to the beginning of
238the <code>banded_matrix</code>.</td>
239</tr>
240<tr>
241<td><code>iterator1 end1 ()</code></td>
242<td>Returns a <code>iterator1</code> pointing to the end of the
243<code>banded_matrix</code>.</td>
244</tr>
245<tr>
246<td><code>const_iterator2 begin2 () const</code></td>
247<td>Returns a <code>const_iterator2</code> pointing to the
248beginning of the <code>banded_matrix</code>.</td>
249</tr>
250<tr>
251<td><code>const_iterator2 end2 () const</code></td>
252<td>Returns a <code>const_iterator2</code> pointing to the end of
253the <code>banded_matrix</code>.</td>
254</tr>
255<tr>
256<td><code>iterator2 begin2 ()</code></td>
257<td>Returns a <code>iterator2</code> pointing to the beginning of
258the <code>banded_matrix</code>.</td>
259</tr>
260<tr>
261<td><code>iterator2 end2 ()</code></td>
262<td>Returns a <code>iterator2</code> pointing to the end of the
263<code>banded_matrix</code>.</td>
264</tr>
265<tr>
266<td><code>const_reverse_iterator1 rbegin1 () const</code></td>
267<td>Returns a <code>const_reverse_iterator1</code> pointing to the
268beginning of the reversed <code>banded_matrix</code>.</td>
269</tr>
270<tr>
271<td><code>const_reverse_iterator1 rend1 () const</code></td>
272<td>Returns a <code>const_reverse_iterator1</code> pointing to the
273end of the reversed <code>banded_matrix</code>.</td>
274</tr>
275<tr>
276<td><code>reverse_iterator1 rbegin1 ()</code></td>
277<td>Returns a <code>reverse_iterator1</code> pointing to the
278beginning of the reversed <code>banded_matrix</code>.</td>
279</tr>
280<tr>
281<td><code>reverse_iterator1 rend1 ()</code></td>
282<td>Returns a <code>reverse_iterator1</code> pointing to the end of
283the reversed <code>banded_matrix</code>.</td>
284</tr>
285<tr>
286<td><code>const_reverse_iterator2 rbegin2 () const</code></td>
287<td>Returns a <code>const_reverse_iterator2</code> pointing to the
288beginning of the reversed <code>banded_matrix</code>.</td>
289</tr>
290<tr>
291<td><code>const_reverse_iterator2 rend2 () const</code></td>
292<td>Returns a <code>const_reverse_iterator2</code> pointing to the
293end of the reversed <code>banded_matrix</code>.</td>
294</tr>
295<tr>
296<td><code>reverse_iterator2 rbegin2 ()</code></td>
297<td>Returns a <code>reverse_iterator2</code> pointing to the
298beginning of the reversed <code>banded_matrix</code>.</td>
299</tr>
300<tr>
301<td><code>reverse_iterator2 rend2 ()</code></td>
302<td>Returns a <code>reverse_iterator2</code> pointing to the end of
303the reversed <code>banded_matrix</code>.</td>
304</tr>
305</tbody>
306</table>
307<h4>Notes</h4>
308<p><a name="banded_matrix_1" id="banded_matrix_1">[1]</a> Supported
309parameters for the storage organization are <code>row_major</code>
310and <code>column_major</code>.</p>
311<p><a name="banded_matrix_2" id="banded_matrix_2">[2]</a> Supported
312parameters for the adapted array are
313<code>unbounded_array&lt;T&gt;</code> ,
314<code>bounded_array&lt;T&gt;</code> and
315<code>std::vector&lt;T&gt;</code> .</p>
316<h2><a name="banded_adaptor" id="banded_adaptor"></a>Banded Adaptor</h2>
317<h4>Description</h4>
318<p>The templated class <code>banded_adaptor&lt;M&gt;</code> is a
319banded matrix adaptor for other matrices.</p>
320<h4>Example</h4>
321<pre>
322#include &lt;boost/numeric/ublas/banded.hpp&gt;
323#include &lt;boost/numeric/ublas/io.hpp&gt;
324
325int main () {
326    using namespace boost::numeric::ublas;
327    matrix&lt;double&gt; m (3, 3);
328    banded_adaptor&lt;matrix&lt;double&gt; &gt; ba (m, 1, 1);
329    for (signed i = 0; i &lt; signed (ba.size1 ()); ++ i)
330        for (signed j = std::max (i - 1, 0); j &lt; std::min (i + 2, signed (ba.size2 ())); ++ j)
331            ba (i, j) = 3 * i + j;
332    std::cout &lt;&lt; ba &lt;&lt; std::endl;
333}
334</pre>
335<h4>Definition</h4>
336<p>Defined in the header banded.hpp.</p>
337<h4>Template parameters</h4>
338<table border="1" summary="parameters">
339<tbody>
340<tr>
341<th>Parameter</th>
342<th>Description</th>
343<th>Default</th>
344</tr>
345<tr>
346<td><code>M</code></td>
347<td>The type of the adapted matrix.</td>
348<td></td>
349</tr>
350</tbody>
351</table>
352<h4>Model of</h4>
353<p><a href="expression_concept.htm#matrix_expression">Matrix Expression</a>
354.</p>
355<h4>Type requirements</h4>
356<p>None, except for those imposed by the requirements of <a href=
357"expression_concept.htm#matrix_expression">Matrix Expression</a> .</p>
358<h4>Public base classes</h4>
359<p><code>matrix_expression&lt;banded_adaptor&lt;M&gt;
360&gt;</code></p>
361<h4>Members</h4>
362<table border="1" summary="members">
363<tbody>
364<tr>
365<th>Member</th>
366<th>Description</th>
367</tr>
368<tr>
369<td><code>banded_adaptor (matrix_type &amp;data, size_type lower =
3700, size_type upper = 0)</code></td>
371<td>Constructs a <code>banded_adaptor</code> that holds
372<code>(lower + 1 + upper)</code> diagonals around the main diagonal
373of a matrix.</td>
374</tr>
375<tr>
376<td><code>banded_adaptor (const banded_adaptor &amp;m)</code></td>
377<td>The copy constructor.</td>
378</tr>
379<tr>
380<td><code>template&lt;class AE&gt;<br />
381banded_adaptor (const matrix_expression&lt;AE&gt;
382&amp;ae)</code></td>
383<td>The extended copy constructor.</td>
384</tr>
385<tr>
386<td><code>size_type size1 () const</code></td>
387<td>Returns the number of rows.</td>
388</tr>
389<tr>
390<td><code>size_type size2 () const</code></td>
391<td>Returns the number of columns.</td>
392</tr>
393<tr>
394<td><code>size_type lower () const</code></td>
395<td>Returns the number of diagonals below the main diagonal.</td>
396</tr>
397<tr>
398<td><code>size_type upper () const</code></td>
399<td>Returns the number of diagonals above the main diagonal.</td>
400</tr>
401<tr>
402<td><code>const_reference operator () (size_type i, size_type j)
403const</code></td>
404<td>Returns a <code>const</code> reference of the <code>j</code>
405-th element in the <code>i</code>-th row.</td>
406</tr>
407<tr>
408<td><code>reference operator () (size_type i, size_type
409j)</code></td>
410<td>Returns a reference of the <code>j</code>-th element in the
411<code>i</code>-th row.</td>
412</tr>
413<tr>
414<td><code>banded_adaptor &amp;operator = (const banded_adaptor
415&amp;m)</code></td>
416<td>The assignment operator.</td>
417</tr>
418<tr>
419<td><code>banded_adaptor &amp;assign_temporary (banded_adaptor
420&amp;m)</code></td>
421<td>Assigns a temporary. May change the banded adaptor
422<code>m</code> .</td>
423</tr>
424<tr>
425<td><code>template&lt;class AE&gt;<br />
426banded_adaptor &amp;operator = (const matrix_expression&lt;AE&gt;
427&amp;ae)</code></td>
428<td>The extended assignment operator.</td>
429</tr>
430<tr>
431<td><code>template&lt;class AE&gt;<br />
432banded_adaptor &amp;assign (const matrix_expression&lt;AE&gt;
433&amp;ae)</code></td>
434<td>Assigns a matrix expression to the banded adaptor. Left and
435right hand side of the assignment should be independent.</td>
436</tr>
437<tr>
438<td><code>template&lt;class AE&gt;<br />
439banded_adaptor &amp;operator += (const matrix_expression&lt;AE&gt;
440&amp;ae)</code></td>
441<td>A computed assignment operator. Adds the matrix expression to
442the banded adaptor.</td>
443</tr>
444<tr>
445<td><code>template&lt;class AE&gt;<br />
446banded_adaptor &amp;plus_assign (const matrix_expression&lt;AE&gt;
447&amp;ae)</code></td>
448<td>Adds a matrix expression to the banded adaptor. Left and right
449hand side of the assignment should be independent.</td>
450</tr>
451<tr>
452<td><code>template&lt;class AE&gt;<br />
453banded_adaptor &amp;operator -= (const matrix_expression&lt;AE&gt;
454&amp;ae)</code></td>
455<td>A computed assignment operator. Subtracts the matrix expression
456from the banded adaptor.</td>
457</tr>
458<tr>
459<td><code>template&lt;class AE&gt;<br />
460banded_adaptor &amp;minus_assign (const matrix_expression&lt;AE&gt;
461&amp;ae)</code></td>
462<td>Subtracts a matrix expression from the banded adaptor. Left and
463right hand side of the assignment should be independent.</td>
464</tr>
465<tr>
466<td><code>template&lt;class AT&gt;<br />
467banded_adaptor &amp;operator *= (const AT &amp;at)</code></td>
468<td>A computed assignment operator. Multiplies the banded adaptor
469with a scalar.</td>
470</tr>
471<tr>
472<td><code>template&lt;class AT&gt;<br />
473banded_adaptor &amp;operator /= (const AT &amp;at)</code></td>
474<td>A computed assignment operator. Divides the banded adaptor
475through a scalar.</td>
476</tr>
477<tr>
478<td><code>void swap (banded_adaptor &amp;m)</code></td>
479<td>Swaps the contents of the banded adaptors.</td>
480</tr>
481<tr>
482<td><code>const_iterator1 begin1 () const</code></td>
483<td>Returns a <code>const_iterator1</code> pointing to the
484beginning of the <code>banded_adaptor</code>.</td>
485</tr>
486<tr>
487<td><code>const_iterator1 end1 () const</code></td>
488<td>Returns a <code>const_iterator1</code> pointing to the end of
489the <code>banded_adaptor</code>.</td>
490</tr>
491<tr>
492<td><code>iterator1 begin1 ()</code></td>
493<td>Returns a <code>iterator1</code> pointing to the beginning of
494the <code>banded_adaptor</code>.</td>
495</tr>
496<tr>
497<td><code>iterator1 end1 ()</code></td>
498<td>Returns a <code>iterator1</code> pointing to the end of the
499<code>banded_adaptor</code>.</td>
500</tr>
501<tr>
502<td><code>const_iterator2 begin2 () const</code></td>
503<td>Returns a <code>const_iterator2</code> pointing to the
504beginning of the <code>banded_adaptor</code>.</td>
505</tr>
506<tr>
507<td><code>const_iterator2 end2 () const</code></td>
508<td>Returns a <code>const_iterator2</code> pointing to the end of
509the <code>banded_adaptor</code>.</td>
510</tr>
511<tr>
512<td><code>iterator2 begin2 ()</code></td>
513<td>Returns a <code>iterator2</code> pointing to the beginning of
514the <code>banded_adaptor</code>.</td>
515</tr>
516<tr>
517<td><code>iterator2 end2 ()</code></td>
518<td>Returns a <code>iterator2</code> pointing to the end of the
519<code>banded_adaptor</code>.</td>
520</tr>
521<tr>
522<td><code>const_reverse_iterator1 rbegin1 () const</code></td>
523<td>Returns a <code>const_reverse_iterator1</code> pointing to the
524beginning of the reversed <code>banded_adaptor</code>.</td>
525</tr>
526<tr>
527<td><code>const_reverse_iterator1 rend1 () const</code></td>
528<td>Returns a <code>const_reverse_iterator1</code> pointing to the
529end of the reversed <code>banded_adaptor</code>.</td>
530</tr>
531<tr>
532<td><code>reverse_iterator1 rbegin1 ()</code></td>
533<td>Returns a <code>reverse_iterator1</code> pointing to the
534beginning of the reversed <code>banded_adaptor</code>.</td>
535</tr>
536<tr>
537<td><code>reverse_iterator1 rend1 ()</code></td>
538<td>Returns a <code>reverse_iterator1</code> pointing to the end of
539the reversed <code>banded_adaptor</code>.</td>
540</tr>
541<tr>
542<td><code>const_reverse_iterator2 rbegin2 () const</code></td>
543<td>Returns a <code>const_reverse_iterator2</code> pointing to the
544beginning of the reversed <code>banded_adaptor</code>.</td>
545</tr>
546<tr>
547<td><code>const_reverse_iterator2 rend2 () const</code></td>
548<td>Returns a <code>const_reverse_iterator2</code> pointing to the
549end of the reversed <code>banded_adaptor</code>.</td>
550</tr>
551<tr>
552<td><code>reverse_iterator2 rbegin2 ()</code></td>
553<td>Returns a <code>reverse_iterator2</code> pointing to the
554beginning of the reversed <code>banded_adaptor</code>.</td>
555</tr>
556<tr>
557<td><code>reverse_iterator2 rend2 ()</code></td>
558<td>Returns a <code>reverse_iterator2</code> pointing to the end of
559the reversed <code>banded_adaptor</code>.</td>
560</tr>
561</tbody>
562</table>
563<hr />
564<p>Copyright (&copy;) 2000-2002 Joerg Walter, Mathias Koch<br />
565Permission to copy, use, modify, sell and distribute this document
566is granted provided this copyright notice appears in all copies.
567This document is provided ``as is'' without express or implied
568warranty, and with no claim as to its suitability for any
569purpose.</p>
570</body>
571</html>
Note: See TracBrowser for help on using the repository browser.