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