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 http-equiv="Content-Type" content="text/html; charset=us-ascii" /> 6<link rel="stylesheet" href="../../../../boost.css" type="text/css"/> 7<link rel="stylesheet" href="ublas.css" type="text/css" /> 8<script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script> 9<script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script> 10<title>Expression Concepts</title> 11</head> 12<body> 13<h1><img src="../../../../boost.png" align="middle" />Expression Concepts</h1> 14<div class="toc" id="toc"></div> 15<h2><a name="scalar_expression"></a>Scalar Expression</h2> 16<h4>Description</h4> 17<p>A Scalar Expression is an expression convertible to a scalar 18type.</p> 19<h4>Refinement of</h4> 20<p>Default Constructible.</p> 21<h4>Associated types</h4> 22<table border="1" summary="associated types"> 23<tbody> 24<tr> 25<td>Public base</td> 26<td>scaler_expression<S></td> 27<td>S must be derived from this public base type.</td> 28</tr> 29<tr> 30<td>Value type</td> 31<td><code>value_type</code></td> 32<td>The type of the scalar expression.</td> 33</tr> 34</tbody> 35</table> 36<h4>Notation</h4> 37<table border="0" summary="notation"> 38<tbody> 39<tr> 40<td><code>S</code></td> 41<td>A type that is a model of Scalar Expression</td> 42</tr> 43</tbody> 44</table> 45<h4>Definitions</h4> 46<h4>Valid expressions</h4> 47<p>In addition to the expressions defined in Default Constructible 48the following expressions must be valid.</p> 49<table border="1" summary="expressions"> 50<tbody> 51<tr> 52<th>Name</th> 53<th>Expression</th> 54<th>Type requirements</th> 55<th>Return type</th> 56</tr> 57<tr> 58<td>Evaluation</td> 59<td><code>operator value_type () const</code></td> 60<td> </td> 61<td><code>value_type</code></td> 62</tr> 63</tbody> 64</table> 65<h4>Expression semantics</h4> 66<p>Semantics of an expression is defined only where it differs 67from, or is not defined in Default Constructible.</p> 68<table border="1" summary="semantics"> 69<tbody> 70<tr> 71<th>Name</th> 72<th>Expression</th> 73<th>Precondition</th> 74<th>Semantics</th> 75<th>Postcondition</th> 76</tr> 77<tr> 78<td>Evaluation</td> 79<td><code>operator value_type () const</code></td> 80<td> </td> 81<td> Evaluates the scalar expression.</td> 82<td> </td> 83</tr> 84</tbody> 85</table> 86<h4>Complexity guarantees</h4> 87<p>The run-time complexity of the evaluation is specific for the 88evaluated scalar expression.</p> 89<h4>Invariants</h4> 90<h4>Models</h4> 91<ul> 92<li><code>vector_scalar_unary</code></li> 93<li><code>vector_scalar_binary</code></li> 94</ul> 95<h2><a name="vector_expression"></a>Vector Expression</h2> 96<h4>Description</h4> 97<p>A Vector Expression is an expression evaluatable to a vector. 98Vector Expression provides an <a href= 99"iterator_concept.html#indexed_bidirectional_iterator">Indexed Bidirectional 100Iterator</a> or an <a href= 101"iterator_concept.html#indexed_random_access_iterator">Indexed Random Access 102Iterator</a> .</p> 103<h4>Refinement of</h4> 104<p>Default Constructible.</p> 105<h4>Associated types</h4> 106<table border="1" summary="associated types"> 107<tbody> 108<tr> 109<td>Public base</td> 110<td>vector_expression<V></td> 111<td>V must be derived from this public base type.</td> 112</tr> 113<tr> 114<td>Value type</td> 115<td><code>value_type</code></td> 116<td> 117The element type of the vector expression. 118</td> 119</tr> 120<tr> 121<td>Reference type</td> 122<td><code>reference</code></td> 123<td> 124The return type when accessing an element of a vector expression. 125<br /> 126Convertable to a<code>value_type</code>. 127</td> 128</tr> 129<tr> 130<td>Const reference type</td> 131<td><code>const_reference</code></td> 132<td> 133The return type when accessing an element of a constant vector expression. 134<br /> 135Convertable to a<code>value_type</code>. 136</td> 137</tr> 138<tr> 139<td>Size type</td> 140<td><code>size_type</code></td> 141<td> 142The index type of the vector expression. Am unsigned integral type used to represent size and index values. 143<br /> 144Can represent any nonnegative value of <code>difference_type</code>. 145</td> 146</tr> 147<tr> 148<td>Distance type</td> 149<td><code>difference_type</code></td> 150<td> 151A signed integral type used to represent the distance between two of the vector expression's iterators. 152</td> 153</tr> 154<tr> 155<td>Const iterator type</td> 156<td><code>const_iterator</code></td> 157<td>A type of iterator that may be used to examine a vector 158expression's elements.</td> 159</tr> 160<tr> 161<td>Iterator type</td> 162<td><code>iterator</code></td> 163<td>A type of iterator that may be used to modify a vector 164expression's elements.</td> 165</tr> 166<tr> 167<td>Const reverse iterator type</td> 168<td><code>const_reverse_iterator</code></td> 169<td>A Reverse Iterator adaptor whose base iterator type is the 170vector expression's const iterator type.</td> 171</tr> 172<tr> 173<td>Reverse iterator type</td> 174<td><code>reverse_iterator</code></td> 175<td>A Reverse Iterator adaptor whose base iterator type is the 176vector expression's iterator type.</td> 177</tr> 178</tbody> 179</table> 180<h4>Notation</h4> 181<table border="0" summary="notation"> 182<tbody> 183<tr> 184<td><code>V</code></td> 185<td>A type that is a model of Vector Expression</td> 186</tr> 187<tr> 188<td><code>v, v1, v2</code></td> 189<td>Object of type <code>V</code></td> 190</tr> 191<tr> 192<td><code>i</code></td> 193<td>Object of a type convertible to <code>size_type</code></td> 194</tr> 195<tr> 196<td><code>t</code></td> 197<td>Object of a type convertible to <code>value_type</code></td> 198</tr> 199</tbody> 200</table> 201<h4>Definitions</h4> 202<h4>Valid expressions</h4> 203<p>In addition to the expressions defined in Default Constructible 204the following expressions must be valid.</p> 205<table border="1" summary="expressions"> 206<tbody> 207<tr> 208<th>Name</th> 209<th>Expression</th> 210<th>Type requirements</th> 211<th>Return type</th> 212</tr> 213<tr> 214<td rowspan="2">Beginning of range</td> 215<td><code>v.begin ()</code></td> 216<td> </td> 217<td><code>const_iterator</code></td> 218</tr> 219<tr> 220<td><code>v.begin ()</code></td> 221<td><code>v</code> is mutable.</td> 222<td><code>iterator</code></td> 223</tr> 224<tr> 225<td rowspan="2">End of range</td> 226<td><code>v.end ()</code></td> 227<td> </td> 228<td><code>const_iterator</code></td> 229</tr> 230<tr> 231<td><code>v.end ()</code></td> 232<td><code>v</code> is mutable.</td> 233<td><code>iterator</code></td> 234</tr> 235<tr> 236<td>Size</td> 237<td><code>v.size ()</code></td> 238<td> </td> 239<td><code>size_type</code></td> 240</tr> 241<tr> 242<td>Swap</td> 243<td><code>v1.swap (v2)</code></td> 244<td><code>v1</code> and <code>v2</code> are mutable.</td> 245<td><code>void</code></td> 246</tr> 247<tr> 248<td rowspan="2">Beginning of reverse range</td> 249<td><code>v.rbegin ()</code></td> 250<td> </td> 251<td><code>const_reverse_iterator</code></td> 252</tr> 253<tr> 254<td><code>v.rbegin ()</code></td> 255<td><code>v</code> is mutable.</td> 256<td><code>reverse_iterator</code></td> 257</tr> 258<tr> 259<td rowspan="2">End of reverse range</td> 260<td><code>v.rend ()</code></td> 261<td> </td> 262<td><code>const_reverse_iterator</code></td> 263</tr> 264<tr> 265<td><code>v.rend ()</code></td> 266<td><code>v</code> is mutable.</td> 267<td><code>reverse_iterator</code></td> 268</tr> 269<tr> 270<td>Element access</td> 271<td><code>v (i)</code></td> 272<td><code>i</code> is convertible to <code>size_type</code>.</td> 273<td>Convertible to <code>value_type</code>.</td> 274</tr> 275<tr> 276<td rowspan="2">Assignment</td> 277<td><code>v2 = v1</code></td> 278<td><code>v2</code> is mutable and <code>v1</code> is convertible 279to <code>V</code>.</td> 280<td><code>V &</code></td> 281</tr> 282<tr> 283<td><code>v2.assign (v1)</code></td> 284<td><code>v2</code> is mutable and <code>v1</code> is convertible 285to <code>V</code>.</td> 286<td><code>V &</code></td> 287</tr> 288<tr> 289<td rowspan="5">Computed assignment</td> 290<td><code>v2 += v1</code></td> 291<td><code>v2</code> is mutable and <code>v1</code> is convertible 292to <code>V</code>.</td> 293<td><code>V &</code></td> 294</tr> 295<tr> 296<td><code>v2.plus_assign (v1)</code></td> 297<td><code>v2</code> is mutable and <code>v1</code> is convertible 298to <code>V</code>.</td> 299<td><code>V &</code></td> 300</tr> 301<tr> 302<td><code>v2 -= v1</code></td> 303<td><code>v2</code> is mutable and <code>v1</code> is convertible 304to <code>V</code>.</td> 305<td><code>V &</code></td> 306</tr> 307<tr> 308<td><code>v2.minus_assign (v1)</code></td> 309<td><code>v2</code> is mutable and <code>v1</code> is convertible 310to <code>V</code>.</td> 311<td><code>V &</code></td> 312</tr> 313<tr> 314<td><code>v *= t</code></td> 315<td><code>v</code> is mutable and <code>t</code> is convertible to 316<code>value_type</code>.</td> 317<td><code>V &</code></td> 318</tr> 319</tbody> 320</table> 321<h4>Expression semantics</h4> 322<p>Semantics of an expression is defined only where it differs 323from, or is not defined in Default Constructible.</p> 324<table border="1" summary="semantics"> 325<tbody> 326<tr> 327<th>Name</th> 328<th>Expression</th> 329<th>Precondition</th> 330<th>Semantics</th> 331<th>Postcondition</th> 332</tr> 333<tr> 334<td>Beginning of range</td> 335<td><code>v.begin ()</code></td> 336<td> </td> 337<td>Returns an iterator pointing to the first element in the vector 338expression.</td> 339<td><code>v.begin ()</code> is either dereferenceable or 340past-the-end. It is past-the-end if and only if <code>v.size () == 3410</code>.</td> 342</tr> 343<tr> 344<td>End of range</td> 345<td><code>v.end ()</code></td> 346<td> </td> 347<td>Returns an iterator pointing one past the last element in the 348vector expression.</td> 349<td><code>v.end ()</code> is past-the-end.</td> 350</tr> 351<tr> 352<td>Size</td> 353<td><code>v.size ()</code></td> 354<td> </td> 355<td>Returns the size of the vector expression, that is, its number 356of elements.</td> 357<td><code>v.size () >= 0</code></td> 358</tr> 359<tr> 360<td>Swap</td> 361<td><code>v1.swap (v2)</code></td> 362<td> </td> 363<td>Equivalent to <code>swap (v1, v2)</code>.</td> 364<td> </td> 365</tr> 366<tr> 367<td>Beginning of reverse range</td> 368<td><code>v.rbegin ()</code></td> 369<td> </td> 370<td>Equivalent to <code>reverse_iterator (v.end ())</code>.</td> 371<td><code>v.rbegin ()</code> is either dereferenceable or 372past-the-end. It is past-the-end if and only if <code>v.size () == 3730</code>.</td> 374</tr> 375<tr> 376<td>End of reverse range</td> 377<td><code>v.rend ()</code></td> 378<td> </td> 379<td>Equivalent to <code>reverse_iterator (v.begin ())</code>.</td> 380<td><code>v.rend ()</code> is past-the-end.</td> 381</tr> 382<tr> 383<td>Element access</td> 384<td><code>v (i)</code></td> 385<td><code>0 <= i < v.size ()</code></td> 386<td>Returns the <code>i</code>-th element of the vector 387expression.</td> 388<td> </td> 389</tr> 390<tr> 391<td rowspan="2">Assignment</td> 392<td><code>v2 = v1</code></td> 393<td><code>v1.size () == v2.size ()</code></td> 394<td>Assigns every element of the evaluated vector expression 395<code>v1</code> to the corresponding element of <code>v2</code> 396.</td> 397<td> </td> 398</tr> 399<tr> 400<td><code>v2.assign (v1)</code></td> 401<td><code>v1.size () == v2.size ()</code></td> 402<td>Assigns every element of <code>v1</code> to the corresponding 403element of <code>v2</code>.</td> 404<td> </td> 405</tr> 406<tr> 407<td rowspan="5">Computed assignment</td> 408<td><code>v2 += v1</code></td> 409<td><code>v1.size () == v2.size ()</code></td> 410<td>Adds every element of the evaluated vector expression 411<code>v1</code> to the corresponding element of 412<code>v2</code>.</td> 413<td> </td> 414</tr> 415<tr> 416<td><code>v2.plus_assign (v1)</code></td> 417<td><code>v1.size () == v2.size ()</code></td> 418<td>Adds every element of <code>v1</code> to the corresponding 419element of <code>v2</code>.</td> 420<td> </td> 421</tr> 422<tr> 423<td><code>v2 -= v1</code></td> 424<td><code>v1.size () == v2.size ()</code></td> 425<td>Subtracts every element of the evaluated vector expression 426<code>v1</code> from the corresponding element of <code>v2</code> 427.</td> 428<td> </td> 429</tr> 430<tr> 431<td><code>v2.minus_assign (v1)</code></td> 432<td><code>v1.size () == v2.size ()</code></td> 433<td>Subtracts every element of <code>v1</code> from the 434corresponding element of <code>v2</code>.</td> 435<td> </td> 436</tr> 437<tr> 438<td><code>v *= t</code></td> 439<td> </td> 440<td>Multiplies every element of <code>v</code> with <code>t</code> 441.</td> 442<td> </td> 443</tr> 444</tbody> 445</table> 446<h4>Complexity guarantees</h4> 447<p>The run-time complexity of <code>begin ()</code> and <code>end 448()</code> is specific for the evaluated vector expression, 449typically amortized constant time.</p> 450<p>The run-time complexity of <code>size ()</code> is constant 451time.</p> 452<p>The run-time complexity of <code>swap ()</code> is specific for 453the evaluated vector expression, typically constant time.</p> 454<p>The run-time complexity of <code>rbegin ()</code> and <code>rend 455()</code> is specific for the evaluated vector expression, 456typically amortized constant time.</p> 457<p>The run-time complexity of the element access is specific for 458the evaluated vector expression, typically amortized constant time 459for the dense and logarithmic for the sparse case.</p> 460<p>The run-time complexity of the arithmetic operations is specific 461for the evaluated vector expressions, typically linear in the size 462of the expressions.</p> 463<h4>Invariants</h4> 464<table border="1" summary="invariants"> 465<tbody> 466<tr> 467<td>Valid range</td> 468<td>For any vector expression <code>v</code>, <code>[v.begin (), 469v.end ())</code> is a valid range.</td> 470</tr> 471<tr> 472<td>Completeness</td> 473<td>An algorithm that iterates through the range <code>[v.begin (), 474v.end ())</code> will pass through every element of <code>v</code> 475.</td> 476</tr> 477<tr> 478<td>Valid reverse range</td> 479<td><code>[v.rbegin (), v.rend ())</code> is a valid range.</td> 480</tr> 481<tr> 482<td>Equivalence of ranges</td> 483<td>The distance from <code>v.begin ()</code> to <code>v.end 484()</code> is the same as the distance from <code>v.rbegin ()</code> 485to <code>v.rend ()</code>.</td> 486</tr> 487</tbody> 488</table> 489<h4>Models</h4> 490<ul> 491<li><code>vector_range;</code></li> 492<li><code>vector_slice</code></li> 493<li><code>matrix_row</code></li> 494<li><code>matrix_column</code></li> 495<li><code>matrix_vector_range</code></li> 496<li><code>matrix_vector_slice</code></li> 497<li><code>vector_unary</code></li> 498<li><code>vector_binary</code></li> 499<li><code>vector_binary_scalar1</code></li> 500<li><code>vector_binary_scalar2</code></li> 501<li><code>matrix_vector_unary1</code></li> 502<li><code>matrix_vector_unary2</code></li> 503<li><code>matrix_vector_binary1</code></li> 504<li><code>matrix_vector_binary2</code></li> 505</ul> 506 507<h2><a name="matrix_expression"></a>Matrix Expression</h2> 508<h4>Description</h4> 509<p>A Matrix Expression is an expression evaluatable to a matrix. 510Matrix Expression provides an <a href= 511"iterator_concept.html#indexed_bidirectional_cr_iterator">Indexed 512Bidirectional Column/Row Iterator</a> or an <a href= 513"iterator_concept.html#indexed_random_access_cr_iterator">Indexed Random 514Access Column/Row Iterator</a> .</p> 515<h4>Refinement of</h4> 516<p>Default Constructible.</p> 517 518<h4>Associated types</h4> 519<h5>immutable types</h5> 520<table border="1" summary="associated immutable types" title=""> 521<tbody> 522<tr> 523<td>Public base</td> 524<td><code>matrix_expression<M></code></td> 525<td>M must be derived from this public base type.</td> 526</tr> 527<tr> 528<td>Value type</td> 529<td><code>value_type</code></td> 530<td> 531The element type of the matrix expression. 532</td> 533</tr> 534<tr> 535<td>Const reference type</td> 536<td><code>const_reference</code></td> 537<td> 538The return type when accessing an element of a constant matrix expression. 539<br /> 540Convertable to a <code>value_type</code>. 541</td> 542</tr> 543<tr> 544<td>Size type</td> 545<td><code>size_type</code></td> 546<td> 547The index type of the matrix expression. Am unsigned integral type used to represent size and index values. 548<br /> 549Can represent any nonnegative value of <code>difference_type</code>. 550</td> 551</tr> 552<tr> 553<td>Distance type</td> 554<td><code>difference_type</code></td> 555<td> 556A signed integral type used to represent the distance between two of the matrix expression's iterators. 557</td> 558</tr> 559<tr> 560<td rowspan="2">Const iterator types</td> 561<td><code>const_iterator1</code></td> 562<td>A type of column iterator that may be used to examine a matrix 563expression's elements.</td> 564</tr> 565<tr> 566<td><code>const_iterator2</code></td> 567<td>A type of row iterator that may be used to examine a matrix 568expression's elements.</td> 569</tr> 570<tr> 571<td rowspan="2">Const reverse iterator types</td> 572<td><code>const_reverse_iterator1</code></td> 573<td>A Reverse Iterator adaptor whose base iterator type is the 574matrix expression's const column iterator type.</td> 575</tr> 576<tr> 577<td><code>const_reverse_iterator2</code></td> 578<td>A Reverse Iterator adaptor whose base iterator type is the 579matrix expression's const row iterator type.</td> 580</tr> 581</tbody> 582</table> 583 584<h5>mutable types</h5> 585<table border="1" summary="associated mutable types"> 586<tbody> 587<tr> 588<td>Reference type</td> 589<td><code>reference</code></td> 590<td> 591The return type when accessing an element of a matrix expression. 592<br /> 593Convertable to a <code>value_type</code>. 594</td> 595</tr> 596<tr> 597<td rowspan="2">Iterator types</td> 598<td><code>iterator1</code></td> 599<td>A type of column iterator that may be used to modify a matrix 600expression's elements.</td> 601</tr> 602<tr> 603<td><code>iterator2</code></td> 604<td>A type of row iterator that may be used to modify a matrix 605expression's elements.</td> 606</tr> 607<tr> 608<td rowspan="2">Reverse iterator types</td> 609<td><code>reverse_iterator1</code></td> 610<td>A Reverse Iterator adaptor whose base iterator type is the 611matrix expression's column iterator type.</td> 612</tr> 613<tr> 614<td><code>reverse_iterator2</code></td> 615<td>A Reverse Iterator adaptor whose base iterator type is the 616matrix expression's row iterator type.</td> 617</tr> 618</tbody> 619</table> 620 621 622<h4>Notation</h4> 623<table border="0" summary="notation"> 624<tbody> 625<tr> 626<td><code>M</code></td> 627<td>A type that is a model of Matrix Expression</td> 628</tr> 629<tr> 630<td><code>m, m1, m2</code></td> 631<td>Object of type <code>M</code></td> 632</tr> 633<tr> 634<td><code>i, j</code></td> 635<td>Objects of a type convertible to <code>size_type</code></td> 636</tr> 637<tr> 638<td><code>t</code></td> 639<td>Object of a type convertible to <code>value_type</code></td> 640</tr> 641</tbody> 642</table> 643<h4>Definitions</h4> 644<h4>Valid expressions</h4> 645<p>In addition to the expressions defined in Default Constructible 646the following expressions must be valid.</p> 647 648<h5>immutable expressions</h5> 649<table border="1" summary="expressions"> 650<thead> 651<tr> 652<th>Name</th> 653<th>Expression</th> 654<th>Type requirements</th> 655<th>Return type</th> 656</tr> 657</thead> 658<tbody> 659<tr> 660<td rowspan="2">Size</td> 661<td><code>m.size1 ()</code></td> 662<td> </td> 663<td><code>size_type</code></td> 664</tr> 665<tr> 666<td><code>m.size2 ()</code></td> 667<td> </td> 668<td><code>size_type</code></td> 669</tr> 670</tbody> 671</table> 672 673<h5>possibly mutable expressions</h5> 674<table border="1" summary="expressions"> 675<tbody> 676<tr> 677<th>Name</th> 678<th>Expression</th> 679<th>Type requirements</th> 680<th>Return type</th> 681</tr> 682<tr> 683<td rowspan="4">Beginning of range</td> 684<td><code>m.begin1 ()</code></td> 685<td> </td> 686<td><code>const_iterator1</code></td> 687</tr> 688<tr> 689<td><code>m.begin2 ()</code></td> 690<td> </td> 691<td><code>const_iterator2</code></td> 692</tr> 693<tr> 694<td><code>m.begin1 ()</code></td> 695<td><code>m</code> is mutable. </td> 696<td><code>iterator1</code></td> 697</tr> 698<tr> 699<td><code>m.begin2 ()</code></td> 700<td><code>m</code> is mutable.</td> 701<td><code>iterator2</code></td> 702</tr> 703<tr> 704<td rowspan="4">End of range</td> 705<td><code>m.end1 ()</code></td> 706<td> </td> 707<td><code>const_iterator1</code></td> 708</tr> 709<tr> 710<td><code>m.end2 ()</code></td> 711<td> </td> 712<td><code>const_iterator2</code></td> 713</tr> 714<tr> 715<td><code>m.end1 ()</code></td> 716<td><code>m</code> is mutable. </td> 717<td><code>iterator1</code></td> 718</tr> 719<tr> 720<td><code>m.end2 ()</code></td> 721<td><code>m</code> is mutable.</td> 722<td><code>iterator2</code></td> 723</tr> 724<tr> 725<td>Swap</td> 726<td><code>m1.swap (m2)</code></td> 727<td><code>m1</code> and <code>m2</code> are mutable. </td> 728<td><code>void</code></td> 729</tr> 730<tr> 731<td rowspan="4">Beginning of reverse range</td> 732<td><code>m.rbegin1 ()</code></td> 733<td> </td> 734<td><code>const_reverse_iterator1</code></td> 735</tr> 736<tr> 737<td><code>m.rbegin2 ()</code></td> 738<td> </td> 739<td><code>const_reverse_iterator2</code></td> 740</tr> 741<tr> 742<td><code>m.rbegin1 ()</code></td> 743<td><code>m</code> is mutable. </td> 744<td><code>reverse_iterator1</code></td> 745</tr> 746<tr> 747<td><code>m.rbegin2 ()</code></td> 748<td><code>m</code> is mutable.</td> 749<td><code>reverse_iterator2</code></td> 750</tr> 751<tr> 752<td rowspan="4">End of reverse range</td> 753<td><code>m.rend1 ()</code></td> 754<td> </td> 755<td><code>const_reverse_iterator1</code></td> 756</tr> 757<tr> 758<td><code>m.rend2 ()</code></td> 759<td> </td> 760<td><code>const_reverse_iterator2</code></td> 761</tr> 762<tr> 763<td><code>m.rend1 ()</code></td> 764<td><code>m</code> is mutable.</td> 765<td><code>reverse_iterator1</code></td> 766</tr> 767<tr> 768<td><code>m.rend2 ()</code></td> 769<td><code>m</code> is mutable.</td> 770<td><code>reverse_iterator2</code></td> 771</tr> 772<tr> 773<td>Element access</td> 774<td><code>m (i, j)</code></td> 775<td><code>i</code> and <code>j</code> are convertible to 776<code>size_type</code> .</td> 777<td>Convertible to <code>value_type</code>.</td> 778</tr> 779<tr> 780<td rowspan="2">Assignment</td> 781<td><code>m2 = m1</code></td> 782<td><code>m2</code> is mutable and <code>m1</code> is convertible 783to <code>M</code>.</td> 784<td><code>M &</code></td> 785</tr> 786<tr> 787<td><code>m2.assign (m1)</code></td> 788<td><code>m2</code> is mutable and <code>m1</code> is convertible 789to <code>M</code>.</td> 790<td><code>M &</code></td> 791</tr> 792<tr> 793<td rowspan="5">Computed assignment</td> 794<td><code>m2 += m1</code></td> 795<td><code>m2</code> is mutable and <code>m1</code> is convertible 796to <code>M</code>.</td> 797<td><code>M &</code></td> 798</tr> 799<tr> 800<td><code>m2.plus_assign (m1)</code></td> 801<td><code>m2</code> is mutable and <code>m1</code> is convertible 802to <code>M</code>.</td> 803<td><code>M &</code></td> 804</tr> 805<tr> 806<td><code>m2 -= m1</code></td> 807<td><code>m2</code> is mutable and <code>m1</code> is convertible 808to <code>M</code>.</td> 809<td><code>M &</code></td> 810</tr> 811<tr> 812<td><code>m2.minus_assign (m1)</code></td> 813<td><code>m2</code> is mutable and <code>m1</code> is convertible 814to <code>M</code>.</td> 815<td><code>M &</code></td> 816</tr> 817<tr> 818<td><code>m *= t</code></td> 819<td><code>m</code> is mutable and <code>t</code> is convertible to 820<code>value_type</code>.</td> 821<td><code>M &</code></td> 822</tr> 823</tbody> 824</table> 825<h4>Expression semantics</h4> 826<p>Semantics of an expression is defined only where it differs 827from, or is not defined in Default Constructible.</p> 828<table border="1" summary="semantics"> 829<tbody> 830<tr> 831<th>Name</th> 832<th>Expression</th> 833<th>Precondition</th> 834<th>Semantics</th> 835<th>Postcondition</th> 836</tr> 837<tr> 838<td rowspan="2">Beginning of range</td> 839<td><code>m.begin1 ()</code></td> 840<td> </td> 841<td>Returns an iterator pointing to the first element in the first 842column of a matrix expression.</td> 843<td><code>m.begin1 ()</code> is either dereferenceable or 844past-the-end. It is past-the-end if and only if <code>m.size1 () == 8450</code>.</td> 846</tr> 847<tr> 848<td><code>m.begin2 ()</code></td> 849<td> </td> 850<td>Returns an iterator pointing to the first element in the first 851row of a matrix expression.</td> 852<td><code>m.begin2 ()</code> is either dereferenceable or 853past-the-end. It is past-the-end if and only if <code>m.size2 () == 8540</code>.</td> 855</tr> 856<tr> 857<td rowspan="2">End of range</td> 858<td><code>m.end1 ()</code></td> 859<td> </td> 860<td>Returns an iterator pointing one past the last element in the 861matrix expression.</td> 862<td><code>m.end1 ()</code> is past-the-end.</td> 863</tr> 864<tr> 865<td><code>m.end2 ()</code></td> 866<td> </td> 867<td>Returns an iterator pointing one past the last element in the 868matrix expression.</td> 869<td><code>m.end2 ()</code> is past-the-end.</td> 870</tr> 871<tr> 872<td rowspan="2">Size</td> 873<td><code>m.size1 ()</code></td> 874<td> </td> 875<td>Returns the number of rows of the matrix expression.</td> 876<td><code>m.size1 () >= 0</code></td> 877</tr> 878<tr> 879<td><code>m.size2 ()</code></td> 880<td> </td> 881<td>Returns the number of columns of the matrix expression.</td> 882<td><code>m.size2 () >= 0</code></td> 883</tr> 884<tr> 885<td>Swap</td> 886<td><code>m1.swap (m2)</code></td> 887<td> </td> 888<td>Equivalent to <code>swap (m1, m2)</code>.</td> 889<td> </td> 890</tr> 891<tr> 892<td rowspan="2">Beginning of reverse range</td> 893<td><code>m.rbegin1 ()</code></td> 894<td> </td> 895<td>Equivalent to <code>reverse_iterator1 (m.end1 ())</code>.</td> 896<td><code>m.rbegin1 ()</code> is either dereferenceable or 897past-the-end. It is past-the-end if and only if <code>m.size1 () == 8980</code>.</td> 899</tr> 900<tr> 901<td><code>m.rbegin2 ()</code></td> 902<td> </td> 903<td>Equivalent to <code>reverse_iterator2 (m.end2 ())</code>.</td> 904<td><code>m.rbegin2 ()</code> is either dereferenceable or 905past-the-end. It is past-the-end if and only if <code>m.size2 () == 9060</code>.</td> 907</tr> 908<tr> 909<td rowspan="2">End of reverse range</td> 910<td><code>m.rend1 ()</code></td> 911<td> </td> 912<td>Equivalent to <code>reverse_iterator1 (m.begin1 913())</code>.</td> 914<td><code>m.rend1 ()</code> is past-the-end.</td> 915</tr> 916<tr> 917<td><code>m.rend2 ()</code></td> 918<td> </td> 919<td>Equivalent to <code>reverse_iterator2 (m.begin2 920())</code>.</td> 921<td><code>m.rend2 ()</code> is past-the-end.</td> 922</tr> 923<tr> 924<td>Element access</td> 925<td><code>m (i, j)</code></td> 926<td><code>0 <= i < m.size1 ()</code> and <code>0 <= j < 927m.size2 ()</code></td> 928<td>Returns the <code>j</code>-th element of the <code>i</code>-th 929row of the matrix expression.</td> 930<td> </td> 931</tr> 932<tr> 933<td rowspan="2">Assignment</td> 934<td><code>m2 = m1</code></td> 935<td><code>m1.size1 () == m2.size1 ()</code> and <code><br /> 936m1.size2 () == m2.size2 ()</code></td> 937<td>Assigns every element of the evaluated matrix expression 938<code>m1</code> to the corresponding element of <code>m2</code> 939.</td> 940<td> </td> 941</tr> 942<tr> 943<td><code>m2.assign (m1)</code></td> 944<td><code>m1.size1 () == m2.size1 ()</code> and <code><br /> 945m1.size2 () == m2.size2 ()</code></td> 946<td>Assigns every element of <code>m1</code> to the corresponding 947element of <code>m2</code>.</td> 948<td> </td> 949</tr> 950<tr> 951<td rowspan="5">Computed assignment</td> 952<td><code>m2 += m1</code></td> 953<td><code>m1.size1 () == m2.size1 ()</code> and <code><br /> 954m1.size2 () == m2.size2 ()</code></td> 955<td>Adds every element of the evaluated matrix expression 956<code>m1</code> to the corresponding element of 957<code>m2</code>.</td> 958<td> </td> 959</tr> 960<tr> 961<td><code>m2.plus_assign (m1)</code></td> 962<td><code>m1.size1 () == m2.size1 ()</code> and <code><br /> 963m1.size2 () == m2.size2 ()</code></td> 964<td>Adds every element of <code>m1</code> to the corresponding 965element of <code>m2</code>.</td> 966<td> </td> 967</tr> 968<tr> 969<td><code>m2 -= m1</code></td> 970<td><code>m1.size1 () == m2.size1 ()</code> and <code><br /> 971m1.size2 () == m2.size2 ()</code></td> 972<td>Subtracts every element of the evaluated matrix expression 973<code>m1</code> from the corresponding element of <code>m2</code> 974.</td> 975<td> </td> 976</tr> 977<tr> 978<td><code>m2.minus_assign (m1)</code></td> 979<td><code>m1.size1 () == m2.size1 ()</code> and <code><br /> 980m1.size2 () == m2.size2 ()</code></td> 981<td>Subtracts every element of <code>m1</code> from the 982corresponding element of <code>m2</code>.</td> 983<td> </td> 984</tr> 985<tr> 986<td><code>m *= t</code></td> 987<td> </td> 988<td>Multiplies every element of <code>m</code> with <code>t</code> 989.</td> 990<td> </td> 991</tr> 992</tbody> 993</table> 994<h4>Complexity guarantees</h4> 995<p>The run-time complexity of <code>begin1 ()</code>, <code>begin2 996()</code> , <code>end1 ()</code> and <code>end2 ()</code> is 997specific for the evaluated matrix expression.</p> 998<p>The run-time complexity of <code>size1 ()</code> and <code>size2 999()</code> is constant time.</p> 1000<p>The run-time complexity of <code>swap ()</code> is specific for 1001the evaluated matrix expression, typically constant time.</p> 1002<p>The run-time complexity of <code>rbegin1 ()</code>, 1003<code>rbegin2 ()</code> , <code>rend1 ()</code> and <code>rend2 1004()</code> is specific for the evaluated matrix expression.</p> 1005<p>The run-time complexity of the element access is specific for 1006the evaluated matrix expression, typically amortized constant time 1007for the dense and logarithmic for the sparse case.</p> 1008<p>The run-time complexity of the arithmetic operations is specific 1009for the evaluated matrix expressions, typically quadratic in the 1010size of the proxies.</p> 1011<h4>Invariants</h4> 1012<table border="1" summary="invariants"> 1013<tbody> 1014<tr> 1015<td>Valid range</td> 1016<td>For any matrix expression <code>m</code>, <code>[m.begin1 (), 1017m.end1 ())</code> and <code>[m.begin2 (), m.end2 ())</code> are 1018valid ranges.</td> 1019</tr> 1020<tr> 1021<td>Completeness</td> 1022<td>An algorithm that iterates through the range <code>[m.begin1 1023(), m.end1 ())</code> will pass through every row of <code>m</code> 1024, an algorithm that iterates through the range <code>[m.begin2 (), 1025m.end2 ())</code> will pass through every column of <code>m</code> 1026.</td> 1027</tr> 1028<tr> 1029<td>Valid reverse range</td> 1030<td><code>[m.rbegin1 (), m.rend1 ())</code> and <code>[m.rbegin2 1031(), m.rend2 ())</code> are valid ranges.</td> 1032</tr> 1033<tr> 1034<td>Equivalence of ranges</td> 1035<td>The distance from <code>m.begin1 ()</code> to <code>m.end1 1036()</code> is the same as the distance from <code>m.rbegin1 1037()</code> to <code>m.rend1 ()</code> and the distance from 1038<code>m.begin2 ()</code> to <code>m.end2 ()</code> is the same as 1039the distance from <code>m.rbegin2 ()</code> to <code>m.rend2 1040()</code>.</td> 1041</tr> 1042</tbody> 1043</table> 1044<h4>Models</h4> 1045<ul> 1046<li><code>matrix_range</code></li> 1047<li><code>matrix_slice;</code></li> 1048<li><code>triangular_adaptor</code></li> 1049<li><code>symmetric_adaptor</code></li> 1050<li><code>banded_adaptor</code></li> 1051<li><code>vector_matrix_binary</code></li> 1052<li><code>matrix_unary1</code></li> 1053<li><code>matrix_unary2</code></li> 1054<li><code>matrix_binary</code></li> 1055<li><code>matrix_binary_scalar1</code></li> 1056<li><code>matrix_binary_scalar2</code></li> 1057<li><code>matrix_matrix_binary</code></li> 1058</ul> 1059<hr /> 1060<p>Copyright (©) 2000-2002 Joerg Walter, Mathias Koch<br /> 1061 Use, modification and distribution are subject to the 1062 Boost Software License, Version 1.0. 1063 (See accompanying file LICENSE_1_0.txt 1064 or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> 1065 http://www.boost.org/LICENSE_1_0.txt 1066 </a>). 1067</p> 1068<script type="text/javascript"> 1069(function($) { 1070 $('#toc').toc(); 1071})(jQuery); 1072</script> 1073</body> 1074</html> 1075