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