Brian Silverman | dc6866b | 2018-08-05 00:18:23 -0700 | [diff] [blame^] | 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>Matrix</title> |
| 14 | </head> |
| 15 | <body> |
| 16 | <h1><img src="../../../../boost.png" align="middle" />Matrix</h1> |
| 17 | <div class="toc" id="toc"></div> |
| 18 | <h2><a name="matrix"></a>Matrix</h2> |
| 19 | <h4>Description</h4> |
| 20 | <p>The templated class <code>matrix<T, F, A></code> is the |
| 21 | base container adaptor for dense matrices. For a <em>(m x |
| 22 | n</em>)-dimensional matrix and <em>0 <= i < m</em>, <em>0 |
| 23 | <= j < n</em> every element <em>m</em><sub><em>i, |
| 24 | j</em></sub> is mapped to the <em>(i x n + j)-</em>th element of |
| 25 | the container for row major orientation or the <em>(i + j x |
| 26 | m)-</em>th element of the container for column major |
| 27 | orientation.</p> |
| 28 | <h4>Example</h4> |
| 29 | <pre> |
| 30 | #include <boost/numeric/ublas/matrix.hpp> |
| 31 | #include <boost/numeric/ublas/io.hpp> |
| 32 | |
| 33 | int main () { |
| 34 | using namespace boost::numeric::ublas; |
| 35 | matrix<double> m (3, 3); |
| 36 | for (unsigned i = 0; i < m.size1 (); ++ i) |
| 37 | for (unsigned j = 0; j < m.size2 (); ++ j) |
| 38 | m (i, j) = 3 * i + j; |
| 39 | std::cout << m << std::endl; |
| 40 | } |
| 41 | </pre> |
| 42 | <h4>Definition</h4> |
| 43 | <p>Defined in the header matrix.hpp.</p> |
| 44 | <h4>Template parameters</h4> |
| 45 | <table border="1" summary="parameters"> |
| 46 | <tbody> |
| 47 | <tr> |
| 48 | <th>Parameter</th> |
| 49 | <th>Description</th> |
| 50 | <th>Default</th> |
| 51 | </tr> |
| 52 | <tr> |
| 53 | <td><code>T</code></td> |
| 54 | <td>The type of object stored in the matrix.</td> |
| 55 | <td></td> |
| 56 | </tr> |
| 57 | <tr> |
| 58 | <td><code>F</code></td> |
| 59 | <td>Functor describing the storage organization. <a href= |
| 60 | "#matrix_1">[1]</a></td> |
| 61 | <td><code>row_major</code></td> |
| 62 | </tr> |
| 63 | <tr> |
| 64 | <td><code>A</code></td> |
| 65 | <td>The type of the <a href="storage_concept.html">Storage</a> array. <a href="#matrix_2">[2]</a></td> |
| 66 | <td><code>unbounded_array<T></code></td> |
| 67 | </tr> |
| 68 | </tbody> |
| 69 | </table> |
| 70 | <h4>Model of</h4> |
| 71 | <p><a href="container_concept.html#matrix">Matrix</a> .</p> |
| 72 | <h4>Type requirements</h4> |
| 73 | <p>None, except for those imposed by the requirements of <a href= |
| 74 | "container_concept.html#matrix">Matrix</a> .</p> |
| 75 | <h4>Public base classes</h4> |
| 76 | <p><code>matrix_container<matrix<T, F, A> ></code></p> |
| 77 | <h4>Members</h4> |
| 78 | <table border="1" summary="members"> |
| 79 | <tbody> |
| 80 | <tr> |
| 81 | <th>Member</th> |
| 82 | <th>Description</th> |
| 83 | </tr> |
| 84 | <tr> |
| 85 | <td><code>matrix ()</code></td> |
| 86 | <td>Allocates an uninitialized <code>matrix</code> that holds zero |
| 87 | rows of zero elements.</td> |
| 88 | </tr> |
| 89 | <tr> |
| 90 | <td><code>matrix (size_type size1, size_type size2)</code></td> |
| 91 | <td>Allocates an uninitialized <code>matrix</code> that holds |
| 92 | <code>size1</code> rows of <code>size2</code> elements.</td> |
| 93 | </tr> |
| 94 | <tr> |
| 95 | <td><code>matrix (const matrix &m)</code></td> |
| 96 | <td>The copy constructor.</td> |
| 97 | </tr> |
| 98 | <tr> |
| 99 | <td><code>template<class AE><br /> |
| 100 | matrix (const matrix_expression<AE> &ae)</code></td> |
| 101 | <td>The extended copy constructor.</td> |
| 102 | </tr> |
| 103 | <tr> |
| 104 | <td><code>void resize (size_type size1, size_type size2, bool |
| 105 | preserve = true)</code></td> |
| 106 | <td>Reallocates a <code>matrix</code> to hold <code>size1</code> |
| 107 | rows of <code>size2</code> elements. The existing elements of the |
| 108 | <code>matrix</code> are preseved when specified.</td> |
| 109 | </tr> |
| 110 | <tr> |
| 111 | <td><code>size_type size1 () const</code></td> |
| 112 | <td>Returns the number of rows.</td> |
| 113 | </tr> |
| 114 | <tr> |
| 115 | <td><code>size_type size2 () const</code></td> |
| 116 | <td>Returns the number of columns.</td> |
| 117 | </tr> |
| 118 | <tr> |
| 119 | <td><code>const array_type& data () const</code></td> |
| 120 | <td></td> |
| 121 | </tr> |
| 122 | <tr> |
| 123 | <td><code>array_type& data ()</code></td> |
| 124 | <td></td> |
| 125 | </tr> |
| 126 | <tr> |
| 127 | <td><code>const_reference operator () (size_type i, size_type j) |
| 128 | const</code></td> |
| 129 | <td>Returns a <code>const</code> reference of the <code>j</code> |
| 130 | -th element in the <code>i</code>-th row.</td> |
| 131 | </tr> |
| 132 | <tr> |
| 133 | <td><code>reference operator () (size_type i, size_type |
| 134 | j)</code></td> |
| 135 | <td>Returns a reference of the <code>j</code>-th element in the |
| 136 | <code>i</code>-th row.</td> |
| 137 | </tr> |
| 138 | <tr> |
| 139 | <td><code>matrix &operator = (const matrix &m)</code></td> |
| 140 | <td>The assignment operator.</td> |
| 141 | </tr> |
| 142 | <tr> |
| 143 | <td><code>matrix &assign_temporary (matrix &m)</code></td> |
| 144 | <td>Assigns a temporary. May change the matrix <code>m</code>.</td> |
| 145 | </tr> |
| 146 | <tr> |
| 147 | <td><code>template<class AE><br /> |
| 148 | matrix &operator = (const matrix_expression<AE> |
| 149 | &ae)</code></td> |
| 150 | <td>The extended assignment operator.</td> |
| 151 | </tr> |
| 152 | <tr> |
| 153 | <td><code>template<class AE><br /> |
| 154 | matrix &assign (const matrix_expression<AE> |
| 155 | &ae)</code></td> |
| 156 | <td>Assigns a matrix expression to the matrix. Left and right hand |
| 157 | side of the assignment should be independent.</td> |
| 158 | </tr> |
| 159 | <tr> |
| 160 | <td><code>template<class AE><br /> |
| 161 | matrix &operator += (const matrix_expression<AE> |
| 162 | &ae)</code></td> |
| 163 | <td>A computed assignment operator. Adds the matrix expression to |
| 164 | the matrix.</td> |
| 165 | </tr> |
| 166 | <tr> |
| 167 | <td><code>template<class AE><br /> |
| 168 | matrix &plus_assign (const matrix_expression<AE> |
| 169 | &ae)</code></td> |
| 170 | <td>Adds a matrix expression to the matrix. Left and right hand |
| 171 | side of the assignment should be independent.</td> |
| 172 | </tr> |
| 173 | <tr> |
| 174 | <td><code>template<class AE><br /> |
| 175 | matrix &operator -= (const matrix_expression<AE> |
| 176 | &ae)</code></td> |
| 177 | <td>A computed assignment operator. Subtracts the matrix expression |
| 178 | from the matrix.</td> |
| 179 | </tr> |
| 180 | <tr> |
| 181 | <td><code>template<class AE><br /> |
| 182 | matrix &minus_assign (const matrix_expression<AE> |
| 183 | &ae)</code></td> |
| 184 | <td>Subtracts a matrix expression from the matrix. Left and right |
| 185 | hand side of the assignment should be independent.</td> |
| 186 | </tr> |
| 187 | <tr> |
| 188 | <td><code>template<class AT><br /> |
| 189 | matrix &operator *= (const AT &at)</code></td> |
| 190 | <td>A computed assignment operator. Multiplies the matrix with a |
| 191 | scalar.</td> |
| 192 | </tr> |
| 193 | <tr> |
| 194 | <td><code>template<class AT><br /> |
| 195 | matrix &operator /= (const AT &at)</code></td> |
| 196 | <td>A computed assignment operator. Divides the matrix through a |
| 197 | scalar.</td> |
| 198 | </tr> |
| 199 | <tr> |
| 200 | <td><code>void swap (matrix &m)</code></td> |
| 201 | <td>Swaps the contents of the matrices.</td> |
| 202 | </tr> |
| 203 | <tr> |
| 204 | <td><code>void insert_element (size_type i, size_type j, const_reference |
| 205 | t)</code></td> |
| 206 | <td>Inserts the value <code>t</code> at the <code>j</code>-th |
| 207 | element of the <code>i</code>-th row.</td> |
| 208 | </tr> |
| 209 | <tr> |
| 210 | <td><code>void erase_element (size_type i, size_type j)</code></td> |
| 211 | <td>Erases the value at the <code>j</code>-th element of the |
| 212 | <code>i</code>-th row.</td> |
| 213 | </tr> |
| 214 | <tr> |
| 215 | <td><code>void clear ()</code></td> |
| 216 | <td>Clears the matrix.</td> |
| 217 | </tr> |
| 218 | <tr> |
| 219 | <td><code>const_iterator1 begin1 () const</code></td> |
| 220 | <td>Returns a <code>const_iterator1</code> pointing to the |
| 221 | beginning of the <code>matrix</code>.</td> |
| 222 | </tr> |
| 223 | <tr> |
| 224 | <td><code>const_iterator1 end1 () const</code></td> |
| 225 | <td>Returns a <code>const_iterator1</code> pointing to the end of |
| 226 | the <code>matrix</code>.</td> |
| 227 | </tr> |
| 228 | <tr> |
| 229 | <td><code>iterator1 begin1 ()</code></td> |
| 230 | <td>Returns a <code>iterator1</code> pointing to the beginning of |
| 231 | the <code>matrix</code>.</td> |
| 232 | </tr> |
| 233 | <tr> |
| 234 | <td><code>iterator1 end1 ()</code></td> |
| 235 | <td>Returns a <code>iterator1</code> pointing to the end of the |
| 236 | <code>matrix</code>.</td> |
| 237 | </tr> |
| 238 | <tr> |
| 239 | <td><code>const_iterator2 begin2 () const</code></td> |
| 240 | <td>Returns a <code>const_iterator2</code> pointing to the |
| 241 | beginning of the <code>matrix</code>.</td> |
| 242 | </tr> |
| 243 | <tr> |
| 244 | <td><code>const_iterator2 end2 () const</code></td> |
| 245 | <td>Returns a <code>const_iterator2</code> pointing to the end of |
| 246 | the <code>matrix</code>.</td> |
| 247 | </tr> |
| 248 | <tr> |
| 249 | <td><code>iterator2 begin2 ()</code></td> |
| 250 | <td>Returns a <code>iterator2</code> pointing to the beginning of |
| 251 | the <code>matrix</code>.</td> |
| 252 | </tr> |
| 253 | <tr> |
| 254 | <td><code>iterator2 end2 ()</code></td> |
| 255 | <td>Returns a <code>iterator2</code> pointing to the end of the |
| 256 | <code>matrix</code>.</td> |
| 257 | </tr> |
| 258 | <tr> |
| 259 | <td><code>const_reverse_iterator1 rbegin1 () const</code></td> |
| 260 | <td>Returns a <code>const_reverse_iterator1</code> pointing to the |
| 261 | beginning of the reversed <code>matrix</code>.</td> |
| 262 | </tr> |
| 263 | <tr> |
| 264 | <td><code>const_reverse_iterator1 rend1 () const</code></td> |
| 265 | <td>Returns a <code>const_reverse_iterator1</code> pointing to the |
| 266 | end of the reversed <code>matrix</code>.</td> |
| 267 | </tr> |
| 268 | <tr> |
| 269 | <td><code>reverse_iterator1 rbegin1 ()</code></td> |
| 270 | <td>Returns a <code>reverse_iterator1</code> pointing to the |
| 271 | beginning of the reversed <code>matrix</code>.</td> |
| 272 | </tr> |
| 273 | <tr> |
| 274 | <td><code>reverse_iterator1 rend1 ()</code></td> |
| 275 | <td>Returns a <code>reverse_iterator1</code> pointing to the end of |
| 276 | the reversed <code>matrix</code>.</td> |
| 277 | </tr> |
| 278 | <tr> |
| 279 | <td><code>const_reverse_iterator2 rbegin2 () const</code></td> |
| 280 | <td>Returns a <code>const_reverse_iterator2</code> pointing to the |
| 281 | beginning of the reversed <code>matrix</code>.</td> |
| 282 | </tr> |
| 283 | <tr> |
| 284 | <td><code>const_reverse_iterator2 rend2 () const</code></td> |
| 285 | <td>Returns a <code>const_reverse_iterator2</code> pointing to the |
| 286 | end of the reversed <code>matrix</code>.</td> |
| 287 | </tr> |
| 288 | <tr> |
| 289 | <td><code>reverse_iterator2 rbegin2 ()</code></td> |
| 290 | <td>Returns a <code>reverse_iterator2</code> pointing to the |
| 291 | beginning of the reversed <code>matrix</code>.</td> |
| 292 | </tr> |
| 293 | <tr> |
| 294 | <td><code>reverse_iterator2 rend2 ()</code></td> |
| 295 | <td>Returns a <code>reverse_iterator2</code> pointing to the end of |
| 296 | the reversed <code>matrix</code>.</td> |
| 297 | </tr> |
| 298 | </tbody> |
| 299 | </table> |
| 300 | <h4>Notes</h4> |
| 301 | <p><a name="matrix_1">[1]</a> Supported parameters |
| 302 | for the storage organization are <code>row_major</code> and |
| 303 | <code>column_major</code>.</p> |
| 304 | <p><a name="matrix_2">[2]</a> Common parameters |
| 305 | for the storage array are <code>unbounded_array<T></code> , |
| 306 | <code>bounded_array<T></code> and |
| 307 | <code>std::vector<T></code> .</p> |
| 308 | <h2><a name="identity_matrix"></a>Identity Matrix</h2> |
| 309 | <h4>Description</h4> |
| 310 | <p>The templated class <code>identity_matrix<T, ALLOC></code> |
| 311 | represents identity matrices. For a <em>(m x n</em>)-dimensional |
| 312 | identity matrix and <em>0 <= i < m</em>, <em>0 <= j < |
| 313 | n</em> holds <em>id</em><sub><em>i, j</em></sub> <em>= 0</em>, if |
| 314 | <em>i <> j</em>, and <em>id</em><sub><em>i, i</em></sub><em>= |
| 315 | 1</em>.</p> |
| 316 | <h4>Example</h4> |
| 317 | <pre> |
| 318 | #include <boost/numeric/ublas/matrix.hpp> |
| 319 | #include <boost/numeric/ublas/io.hpp> |
| 320 | |
| 321 | int main () { |
| 322 | using namespace boost::numeric::ublas; |
| 323 | identity_matrix<double> m (3); |
| 324 | std::cout << m << std::endl; |
| 325 | } |
| 326 | </pre> |
| 327 | <h4>Definition</h4> |
| 328 | <p>Defined in the header matrix.hpp.</p> |
| 329 | <h4>Template parameters</h4> |
| 330 | <table border="1" summary="parameters"> |
| 331 | <tbody> |
| 332 | <tr> |
| 333 | <th>Parameter</th> |
| 334 | <th>Description</th> |
| 335 | <th>Default</th> |
| 336 | </tr> |
| 337 | <tr> |
| 338 | <td><code>T</code></td> |
| 339 | <td>The type of object stored in the matrix.</td> |
| 340 | <td><code>int</code></td> |
| 341 | </tr> |
| 342 | <tr> |
| 343 | <td><code>ALLOC</code></td> |
| 344 | <td>An STL Allocator for size_type and difference_type.</td> |
| 345 | <td>std::allocator</td> |
| 346 | </tr> |
| 347 | </tbody> |
| 348 | </table> |
| 349 | <h4>Model of</h4> |
| 350 | <p><a href="container_concept.html#matrix">Matrix</a> .</p> |
| 351 | <h4>Type requirements</h4> |
| 352 | <p>None, except for those imposed by the requirements of |
| 353 | <a href="container_concept.html#matrix">Matrix</a> .</p> |
| 354 | <h4>Public base classes</h4> |
| 355 | <p><code>matrix_container<identity_matrix<T> |
| 356 | ></code></p> |
| 357 | <h4>Members</h4> |
| 358 | <table border="1" summary="members"> |
| 359 | <tbody> |
| 360 | <tr> |
| 361 | <th>Member</th> |
| 362 | <th>Description</th> |
| 363 | </tr> |
| 364 | <tr> |
| 365 | <td><code>identity_matrix ()</code></td> |
| 366 | <td>Constructs an <code>identity_matrix</code> that holds zero rows |
| 367 | of zero elements.</td> |
| 368 | </tr> |
| 369 | <tr> |
| 370 | <td><code>identity_matrix (size_type size)</code></td> |
| 371 | <td>Constructs an <code>identity_matrix</code> that holds |
| 372 | <code>size</code> rows of <code>size</code> elements.</td> |
| 373 | </tr> |
| 374 | <tr> |
| 375 | <td><code>identity_matrix (const identity_matrix |
| 376 | &m)</code></td> |
| 377 | <td>The copy constructor.</td> |
| 378 | </tr> |
| 379 | <tr> |
| 380 | <td><code>void resize (size_type size, bool preserve = |
| 381 | true)</code></td> |
| 382 | <td>Resizes a <code>identity_matrix</code> to hold |
| 383 | <code>size</code> rows of <code>size</code> elements. Therefore the |
| 384 | existing elements of the <code>itendity_matrix</code> are always |
| 385 | preseved.</td> |
| 386 | </tr> |
| 387 | <tr> |
| 388 | <td><code>size_type size1 () const</code></td> |
| 389 | <td>Returns the number of rows.</td> |
| 390 | </tr> |
| 391 | <tr> |
| 392 | <td><code>size_type size2 () const</code></td> |
| 393 | <td>Returns the number of columns.</td> |
| 394 | </tr> |
| 395 | <tr> |
| 396 | <td><code>const_reference operator () (size_type i, size_type j) |
| 397 | const</code></td> |
| 398 | <td>Returns the value of the <code>j</code>-th element in the |
| 399 | <code>i</code>-th row.</td> |
| 400 | </tr> |
| 401 | <tr> |
| 402 | <td><code>identity_matrix &operator = (const identity_matrix |
| 403 | &m)</code></td> |
| 404 | <td>The assignment operator.</td> |
| 405 | </tr> |
| 406 | <tr> |
| 407 | <td><code>identity_matrix &assign_temporary (identity_matrix |
| 408 | &m)</code></td> |
| 409 | <td>Assigns a temporary. May change the identity matrix |
| 410 | <code>m</code> .</td> |
| 411 | </tr> |
| 412 | <tr> |
| 413 | <td><code>void swap (identity_matrix &m)</code></td> |
| 414 | <td>Swaps the contents of the identity matrices.</td> |
| 415 | </tr> |
| 416 | <tr> |
| 417 | <td><code>const_iterator1 begin1 () const</code></td> |
| 418 | <td>Returns a <code>const_iterator1</code> pointing to the |
| 419 | beginning of the <code>identity_matrix</code>.</td> |
| 420 | </tr> |
| 421 | <tr> |
| 422 | <td><code>const_iterator1 end1 () const</code></td> |
| 423 | <td>Returns a <code>const_iterator1</code> pointing to the end of |
| 424 | the <code>identity_matrix</code>.</td> |
| 425 | </tr> |
| 426 | <tr> |
| 427 | <td><code>const_iterator2 begin2 () const</code></td> |
| 428 | <td>Returns a <code>const_iterator2</code> pointing to the |
| 429 | beginning of the <code>identity_matrix</code>.</td> |
| 430 | </tr> |
| 431 | <tr> |
| 432 | <td><code>const_iterator2 end2 () const</code></td> |
| 433 | <td>Returns a <code>const_iterator2</code> pointing to the end of |
| 434 | the <code>identity_matrix</code>.</td> |
| 435 | </tr> |
| 436 | <tr> |
| 437 | <td><code>const_reverse_iterator1 rbegin1 () const</code></td> |
| 438 | <td>Returns a <code>const_reverse_iterator1</code> pointing to the |
| 439 | beginning of the reversed <code>identity_matrix</code>.</td> |
| 440 | </tr> |
| 441 | <tr> |
| 442 | <td><code>const_reverse_iterator1 rend1 () const</code></td> |
| 443 | <td>Returns a <code>const_reverse_iterator1</code> pointing to the |
| 444 | end of the reversed <code>identity_matrix</code>.</td> |
| 445 | </tr> |
| 446 | <tr> |
| 447 | <td><code>const_reverse_iterator2 rbegin2 () const</code></td> |
| 448 | <td>Returns a <code>const_reverse_iterator2</code> pointing to the |
| 449 | beginning of the reversed <code>identity_matrix</code>.</td> |
| 450 | </tr> |
| 451 | <tr> |
| 452 | <td><code>const_reverse_iterator2 rend2 () const</code></td> |
| 453 | <td>Returns a <code>const_reverse_iterator2</code> pointing to the |
| 454 | end of the reversed <code>identity_matrix</code>.</td> |
| 455 | </tr> |
| 456 | </tbody> |
| 457 | </table> |
| 458 | <h2><a name="zero_matrix"></a>Zero Matrix</h2> |
| 459 | <h4>Description</h4> |
| 460 | <p>The templated class <code>zero_matrix<T, ALLOC></code> represents |
| 461 | zero matrices. For a <em>(m x n</em>)-dimensional zero matrix and |
| 462 | <em>0 <= i < m</em>, <em>0 <= j < n</em> holds |
| 463 | <em>z</em><sub><em>i, j</em></sub> <em>= 0</em>.</p> |
| 464 | <h4>Example</h4> |
| 465 | <pre> |
| 466 | #include <boost/numeric/ublas/matrix.hpp> |
| 467 | #include <boost/numeric/ublas/io.hpp> |
| 468 | |
| 469 | int main () { |
| 470 | using namespace boost::numeric::ublas; |
| 471 | zero_matrix<double> m (3, 3); |
| 472 | std::cout << m << std::endl; |
| 473 | } |
| 474 | </pre> |
| 475 | <h4>Definition</h4> |
| 476 | <p>Defined in the header matrix.hpp.</p> |
| 477 | <h4>Template parameters</h4> |
| 478 | <table border="1" summary="parameters"> |
| 479 | <tbody> |
| 480 | <tr> |
| 481 | <th>Parameter</th> |
| 482 | <th>Description</th> |
| 483 | <th>Default</th> |
| 484 | </tr> |
| 485 | <tr> |
| 486 | <td><code>T</code></td> |
| 487 | <td>The type of object stored in the matrix.</td> |
| 488 | <td><code>int</code></td> |
| 489 | </tr> |
| 490 | <tr> |
| 491 | <td><code>ALLOC</code></td> |
| 492 | <td>An STL Allocator for size_type and difference_type.</td> |
| 493 | <td>std::allocator</td> |
| 494 | </tr> |
| 495 | </tbody> |
| 496 | </table> |
| 497 | <h4>Model of</h4> |
| 498 | <p><a href="container_concept.html#matrix">Matrix</a> .</p> |
| 499 | <h4>Type requirements</h4> |
| 500 | <p>None, except for those imposed by the requirements of |
| 501 | <a href="container_concept.html#matrix">Matrix</a> .</p> |
| 502 | <h4>Public base classes</h4> |
| 503 | <p><code>matrix_container<zero_matrix<T> ></code></p> |
| 504 | <h4>Members</h4> |
| 505 | <table border="1" summary="members"> |
| 506 | <tbody> |
| 507 | <tr> |
| 508 | <th>Member</th> |
| 509 | <th>Description</th> |
| 510 | </tr> |
| 511 | <tr> |
| 512 | <td><code>zero_matrix ()</code></td> |
| 513 | <td>Constructs a <code>zero_matrix</code> that holds zero rows of |
| 514 | zero elements.</td> |
| 515 | </tr> |
| 516 | <tr> |
| 517 | <td><code>zero_matrix (size_type size1, size_type |
| 518 | size2)</code></td> |
| 519 | <td>Constructs a <code>zero_matrix</code> that holds |
| 520 | <code>size1</code> rows of <code>size2</code> elements.</td> |
| 521 | </tr> |
| 522 | <tr> |
| 523 | <td><code>zero_matrix (const zero_matrix &m)</code></td> |
| 524 | <td>The copy constructor.</td> |
| 525 | </tr> |
| 526 | <tr> |
| 527 | <td><code>void resize (size_type size1, size_type size2, bool |
| 528 | preserve = true)</code></td> |
| 529 | <td>Resizes a <code>zero_matrix</code> to hold <code>size1</code> |
| 530 | rows of <code>size2</code> elements. Therefore the existing |
| 531 | elements of the <code>zero_matrix</code> are always preseved.</td> |
| 532 | </tr> |
| 533 | <tr> |
| 534 | <td><code>size_type size1 () const</code></td> |
| 535 | <td>Returns the number of rows.</td> |
| 536 | </tr> |
| 537 | <tr> |
| 538 | <td><code>size_type size2 () const</code></td> |
| 539 | <td>Returns the number of columns.</td> |
| 540 | </tr> |
| 541 | <tr> |
| 542 | <td><code>const_reference operator () (size_type i, size_type j) |
| 543 | const</code></td> |
| 544 | <td>Returns the value of the <code>j</code>-th element in the |
| 545 | <code>i</code>-th row.</td> |
| 546 | </tr> |
| 547 | <tr> |
| 548 | <td><code>zero_matrix &operator = (const zero_matrix |
| 549 | &m)</code></td> |
| 550 | <td>The assignment operator.</td> |
| 551 | </tr> |
| 552 | <tr> |
| 553 | <td><code>zero_matrix &assign_temporary (zero_matrix |
| 554 | &m)</code></td> |
| 555 | <td>Assigns a temporary. May change the zero matrix <code>m</code> |
| 556 | .</td> |
| 557 | </tr> |
| 558 | <tr> |
| 559 | <td><code>void swap (zero_matrix &m)</code></td> |
| 560 | <td>Swaps the contents of the zero matrices.</td> |
| 561 | </tr> |
| 562 | <tr> |
| 563 | <td><code>const_iterator1 begin1 () const</code></td> |
| 564 | <td>Returns a <code>const_iterator1</code> pointing to the |
| 565 | beginning of the <code>zero_matrix</code>.</td> |
| 566 | </tr> |
| 567 | <tr> |
| 568 | <td><code>const_iterator1 end1 () const</code></td> |
| 569 | <td>Returns a <code>const_iterator1</code> pointing to the end of |
| 570 | the <code>zero_matrix</code>.</td> |
| 571 | </tr> |
| 572 | <tr> |
| 573 | <td><code>const_iterator2 begin2 () const</code></td> |
| 574 | <td>Returns a <code>const_iterator2</code> pointing to the |
| 575 | beginning of the <code>zero_matrix</code>.</td> |
| 576 | </tr> |
| 577 | <tr> |
| 578 | <td><code>const_iterator2 end2 () const</code></td> |
| 579 | <td>Returns a <code>const_iterator2</code> pointing to the end of |
| 580 | the <code>zero_matrix</code>.</td> |
| 581 | </tr> |
| 582 | <tr> |
| 583 | <td><code>const_reverse_iterator1 rbegin1 () const</code></td> |
| 584 | <td>Returns a <code>const_reverse_iterator1</code> pointing to the |
| 585 | beginning of the reversed <code>zero_matrix</code>.</td> |
| 586 | </tr> |
| 587 | <tr> |
| 588 | <td><code>const_reverse_iterator1 rend1 () const</code></td> |
| 589 | <td>Returns a <code>const_reverse_iterator1</code> pointing to the |
| 590 | end of the reversed <code>zero_matrix</code>.</td> |
| 591 | </tr> |
| 592 | <tr> |
| 593 | <td><code>const_reverse_iterator2 rbegin2 () const</code></td> |
| 594 | <td>Returns a <code>const_reverse_iterator2</code> pointing to the |
| 595 | beginning of the reversed <code>zero_matrix</code>.</td> |
| 596 | </tr> |
| 597 | <tr> |
| 598 | <td><code>const_reverse_iterator2 rend2 () const</code></td> |
| 599 | <td>Returns a <code>const_reverse_iterator2</code> pointing to the |
| 600 | end of the reversed <code>zero_matrix</code>.</td> |
| 601 | </tr> |
| 602 | </tbody> |
| 603 | </table> |
| 604 | <h2><a name="scalar_matrix"></a>Scalar Matrix</h2> |
| 605 | <h4>Description</h4> |
| 606 | <p>The templated class <code>scalar_matrix<T, ALLOC></code> |
| 607 | represents scalar matrices. For a <em>(m x n</em>)-dimensional |
| 608 | scalar matrix and <em>0 <= i < m</em>, <em>0 <= j < |
| 609 | n</em> holds <em>z</em><sub><em>i, j</em></sub> <em>= s</em>.</p> |
| 610 | <h4>Example</h4> |
| 611 | <pre> |
| 612 | #include <boost/numeric/ublas/matrix.hpp> |
| 613 | #include <boost/numeric/ublas/io.hpp> |
| 614 | |
| 615 | int main () { |
| 616 | using namespace boost::numeric::ublas; |
| 617 | scalar_matrix<double> m (3, 3); |
| 618 | std::cout << m << std::endl; |
| 619 | } |
| 620 | </pre> |
| 621 | <h4>Definition</h4> |
| 622 | <p>Defined in the header matrix.hpp.</p> |
| 623 | <h4>Template parameters</h4> |
| 624 | <table border="1" summary="parameters"> |
| 625 | <tbody> |
| 626 | <tr> |
| 627 | <th>Parameter</th> |
| 628 | <th>Description</th> |
| 629 | <th>Default</th> |
| 630 | </tr> |
| 631 | <tr> |
| 632 | <td><code>T</code></td> |
| 633 | <td>The type of object stored in the matrix.</td> |
| 634 | <td><code>int</code></td> |
| 635 | </tr> |
| 636 | <tr> |
| 637 | <td><code>ALLOC</code></td> |
| 638 | <td>An STL Allocator for size_type and difference_type.</td> |
| 639 | <td>std::allocator</td> |
| 640 | </tr> |
| 641 | </tbody> |
| 642 | </table> |
| 643 | <h4>Model of</h4> |
| 644 | <p><a href="container_concept.html#matrix">Matrix</a> .</p> |
| 645 | <h4>Type requirements</h4> |
| 646 | <p>None, except for those imposed by the requirements of |
| 647 | <a href="container_concept.html#matrix">Matrix</a> .</p> |
| 648 | <h4>Public base classes</h4> |
| 649 | <p><code>matrix_container<scalar_matrix<T> |
| 650 | ></code></p> |
| 651 | <h4>Members</h4> |
| 652 | <table border="1" summary="members"> |
| 653 | <tbody> |
| 654 | <tr> |
| 655 | <th>Member</th> |
| 656 | <th>Description</th> |
| 657 | </tr> |
| 658 | <tr> |
| 659 | <td><code>scalar_matrix ()</code></td> |
| 660 | <td>Constructs a <code>scalar_matrix</code> that holds scalar rows |
| 661 | of zero elements.</td> |
| 662 | </tr> |
| 663 | <tr> |
| 664 | <td><code>scalar_matrix (size_type size1, size_type size2, const |
| 665 | value_type &value)</code></td> |
| 666 | <td>Constructs a <code>scalar_matrix</code> that holds |
| 667 | <code>size1</code> rows of <code>size2</code> elements each of the |
| 668 | specified value.</td> |
| 669 | </tr> |
| 670 | <tr> |
| 671 | <td><code>scalar_matrix (const scalar_matrix &m)</code></td> |
| 672 | <td>The copy constructor.</td> |
| 673 | </tr> |
| 674 | <tr> |
| 675 | <td><code>void resize (size_type size1, size_type size2, bool |
| 676 | preserve = true)</code></td> |
| 677 | <td>Resizes a <code>scalar_matrix</code> to hold <code>size1</code> |
| 678 | rows of <code>size2</code> elements. Therefore the existing |
| 679 | elements of the <code>scalar_matrix</code> are always |
| 680 | preseved.</td> |
| 681 | </tr> |
| 682 | <tr> |
| 683 | <td><code>size_type size1 () const</code></td> |
| 684 | <td>Returns the number of rows.</td> |
| 685 | </tr> |
| 686 | <tr> |
| 687 | <td><code>size_type size2 () const</code></td> |
| 688 | <td>Returns the number of columns.</td> |
| 689 | </tr> |
| 690 | <tr> |
| 691 | <td><code>const_reference operator () (size_type i, size_type j) |
| 692 | const</code></td> |
| 693 | <td>Returns the value of the <code>j</code>-th element in the |
| 694 | <code>i</code>-th row.</td> |
| 695 | </tr> |
| 696 | <tr> |
| 697 | <td><code>scalar_matrix &operator = (const scalar_matrix |
| 698 | &m)</code></td> |
| 699 | <td>The assignment operator.</td> |
| 700 | </tr> |
| 701 | <tr> |
| 702 | <td><code>scalar_matrix &assign_temporary (scalar_matrix |
| 703 | &m)</code></td> |
| 704 | <td>Assigns a temporary. May change the scalar matrix |
| 705 | <code>m</code> .</td> |
| 706 | </tr> |
| 707 | <tr> |
| 708 | <td><code>void swap (scalar_matrix &m)</code></td> |
| 709 | <td>Swaps the contents of the scalar matrices.</td> |
| 710 | </tr> |
| 711 | <tr> |
| 712 | <td><code>const_iterator1 begin1 () const</code></td> |
| 713 | <td>Returns a <code>const_iterator1</code> pointing to the |
| 714 | beginning of the <code>scalar_matrix</code>.</td> |
| 715 | </tr> |
| 716 | <tr> |
| 717 | <td><code>const_iterator1 end1 () const</code></td> |
| 718 | <td>Returns a <code>const_iterator1</code> pointing to the end of |
| 719 | the <code>scalar_matrix</code>.</td> |
| 720 | </tr> |
| 721 | <tr> |
| 722 | <td><code>const_iterator2 begin2 () const</code></td> |
| 723 | <td>Returns a <code>const_iterator2</code> pointing to the |
| 724 | beginning of the <code>scalar_matrix</code>.</td> |
| 725 | </tr> |
| 726 | <tr> |
| 727 | <td><code>const_iterator2 end2 () const</code></td> |
| 728 | <td>Returns a <code>const_iterator2</code> pointing to the end of |
| 729 | the <code>scalar_matrix</code>.</td> |
| 730 | </tr> |
| 731 | <tr> |
| 732 | <td><code>const_reverse_iterator1 rbegin1 () const</code></td> |
| 733 | <td>Returns a <code>const_reverse_iterator1</code> pointing to the |
| 734 | beginning of the reversed <code>scalar_matrix</code>.</td> |
| 735 | </tr> |
| 736 | <tr> |
| 737 | <td><code>const_reverse_iterator1 rend1 () const</code></td> |
| 738 | <td>Returns a <code>const_reverse_iterator1</code> pointing to the |
| 739 | end of the reversed <code>scalar_matrix</code>.</td> |
| 740 | </tr> |
| 741 | <tr> |
| 742 | <td><code>const_reverse_iterator2 rbegin2 () const</code></td> |
| 743 | <td>Returns a <code>const_reverse_iterator2</code> pointing to the |
| 744 | beginning of the reversed <code>scalar_matrix</code>.</td> |
| 745 | </tr> |
| 746 | <tr> |
| 747 | <td><code>const_reverse_iterator2 rend2 () const</code></td> |
| 748 | <td>Returns a <code>const_reverse_iterator2</code> pointing to the |
| 749 | end of the reversed <code>scalar_matrix</code>.</td> |
| 750 | </tr> |
| 751 | </tbody> |
| 752 | </table> |
| 753 | <hr /> |
| 754 | <p>Copyright (©) 2000-2002 Joerg Walter, Mathias Koch<br /> |
| 755 | Use, modification and distribution are subject to the |
| 756 | Boost Software License, Version 1.0. |
| 757 | (See accompanying file LICENSE_1_0.txt |
| 758 | or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> |
| 759 | http://www.boost.org/LICENSE_1_0.txt |
| 760 | </a>). |
| 761 | </p> |
| 762 | <script type="text/javascript"> |
| 763 | (function($) { |
| 764 | $('#toc').toc(); |
| 765 | })(jQuery); |
| 766 | </script> |
| 767 | </body> |
| 768 | </html> |