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">
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>
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>
17 <p>A Scalar Expression is an expression convertible to a scalar
19 <h4>Refinement of
</h4>
20 <p>Default Constructible.
</p>
21 <h4>Associated types
</h4>
22 <table border=
"1" summary=
"associated types">
26 <td>scaler_expression
<S
></td>
27 <td>S must be derived from this public base type.
</td>
31 <td><code>value_type
</code></td>
32 <td>The type of the scalar expression.
</td>
37 <table border=
"0" summary=
"notation">
40 <td><code>S
</code></td>
41 <td>A type that is a model of Scalar Expression
</td>
46 <h4>Valid expressions
</h4>
47 <p>In addition to the expressions defined in Default Constructible
48 the following expressions must be valid.
</p>
49 <table border=
"1" summary=
"expressions">
54 <th>Type requirements
</th>
59 <td><code>operator value_type () const
</code></td>
61 <td><code>value_type
</code></td>
65 <h4>Expression semantics
</h4>
66 <p>Semantics of an expression is defined only where it differs
67 from, or is not defined in Default Constructible.
</p>
68 <table border=
"1" summary=
"semantics">
75 <th>Postcondition
</th>
79 <td><code>operator value_type () const
</code></td>
81 <td> Evaluates the scalar expression.
</td>
86 <h4>Complexity guarantees
</h4>
87 <p>The run-time complexity of the evaluation is specific for the
88 evaluated scalar expression.
</p>
92 <li><code>vector_scalar_unary
</code></li>
93 <li><code>vector_scalar_binary
</code></li>
95 <h2><a name=
"vector_expression"></a>Vector Expression
</h2>
97 <p>A Vector Expression is an expression evaluatable to a vector.
98 Vector Expression provides an
<a href=
99 "iterator_concept.html#indexed_bidirectional_iterator">Indexed Bidirectional
100 Iterator
</a> or an
<a href=
101 "iterator_concept.html#indexed_random_access_iterator">Indexed Random Access
103 <h4>Refinement of
</h4>
104 <p>Default Constructible.
</p>
105 <h4>Associated types
</h4>
106 <table border=
"1" summary=
"associated types">
110 <td>vector_expression
<V
></td>
111 <td>V must be derived from this public base type.
</td>
115 <td><code>value_type
</code></td>
117 The element type of the vector expression.
121 <td>Reference type
</td>
122 <td><code>reference
</code></td>
124 The return type when accessing an element of a vector expression.
126 Convertable to a
<code>value_type
</code>.
130 <td>Const reference type
</td>
131 <td><code>const_reference
</code></td>
133 The return type when accessing an element of a constant vector expression.
135 Convertable to a
<code>value_type
</code>.
140 <td><code>size_type
</code></td>
142 The index type of the vector expression. Am unsigned integral type used to represent size and index values.
144 Can represent any nonnegative value of
<code>difference_type
</code>.
148 <td>Distance type
</td>
149 <td><code>difference_type
</code></td>
151 A signed integral type used to represent the distance between two of the vector expression
's iterators.
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
158 expression's elements.
</td>
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
164 expression's elements.
</td>
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
170 vector expression's const iterator type.
</td>
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
176 vector expression's iterator type.
</td>
181 <table border=
"0" summary=
"notation">
184 <td><code>V
</code></td>
185 <td>A type that is a model of Vector Expression
</td>
188 <td><code>v, v1, v2
</code></td>
189 <td>Object of type
<code>V
</code></td>
192 <td><code>i
</code></td>
193 <td>Object of a type convertible to
<code>size_type
</code></td>
196 <td><code>t
</code></td>
197 <td>Object of a type convertible to
<code>value_type
</code></td>
202 <h4>Valid expressions
</h4>
203 <p>In addition to the expressions defined in Default Constructible
204 the following expressions must be valid.
</p>
205 <table border=
"1" summary=
"expressions">
210 <th>Type requirements
</th>
214 <td rowspan=
"2">Beginning of range
</td>
215 <td><code>v.begin ()
</code></td>
217 <td><code>const_iterator
</code></td>
220 <td><code>v.begin ()
</code></td>
221 <td><code>v
</code> is mutable.
</td>
222 <td><code>iterator
</code></td>
225 <td rowspan=
"2">End of range
</td>
226 <td><code>v.end ()
</code></td>
228 <td><code>const_iterator
</code></td>
231 <td><code>v.end ()
</code></td>
232 <td><code>v
</code> is mutable.
</td>
233 <td><code>iterator
</code></td>
237 <td><code>v.size ()
</code></td>
239 <td><code>size_type
</code></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>
248 <td rowspan=
"2">Beginning of reverse range
</td>
249 <td><code>v.rbegin ()
</code></td>
251 <td><code>const_reverse_iterator
</code></td>
254 <td><code>v.rbegin ()
</code></td>
255 <td><code>v
</code> is mutable.
</td>
256 <td><code>reverse_iterator
</code></td>
259 <td rowspan=
"2">End of reverse range
</td>
260 <td><code>v.rend ()
</code></td>
262 <td><code>const_reverse_iterator
</code></td>
265 <td><code>v.rend ()
</code></td>
266 <td><code>v
</code> is mutable.
</td>
267 <td><code>reverse_iterator
</code></td>
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>
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
279 to
<code>V
</code>.
</td>
280 <td><code>V
&</code></td>
283 <td><code>v2.assign (v1)
</code></td>
284 <td><code>v2
</code> is mutable and
<code>v1
</code> is convertible
285 to
<code>V
</code>.
</td>
286 <td><code>V
&</code></td>
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
292 to
<code>V
</code>.
</td>
293 <td><code>V
&</code></td>
296 <td><code>v2.plus_assign (v1)
</code></td>
297 <td><code>v2
</code> is mutable and
<code>v1
</code> is convertible
298 to
<code>V
</code>.
</td>
299 <td><code>V
&</code></td>
302 <td><code>v2 -= v1
</code></td>
303 <td><code>v2
</code> is mutable and
<code>v1
</code> is convertible
304 to
<code>V
</code>.
</td>
305 <td><code>V
&</code></td>
308 <td><code>v2.minus_assign (v1)
</code></td>
309 <td><code>v2
</code> is mutable and
<code>v1
</code> is convertible
310 to
<code>V
</code>.
</td>
311 <td><code>V
&</code></td>
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>
321 <h4>Expression semantics
</h4>
322 <p>Semantics of an expression is defined only where it differs
323 from, or is not defined in Default Constructible.
</p>
324 <table border=
"1" summary=
"semantics">
329 <th>Precondition
</th>
331 <th>Postcondition
</th>
334 <td>Beginning of range
</td>
335 <td><code>v.begin ()
</code></td>
337 <td>Returns an iterator pointing to the first element in the vector
339 <td><code>v.begin ()
</code> is either dereferenceable or
340 past-the-end. It is past-the-end if and only if
<code>v.size () ==
344 <td>End of range
</td>
345 <td><code>v.end ()
</code></td>
347 <td>Returns an iterator pointing one past the last element in the
348 vector expression.
</td>
349 <td><code>v.end ()
</code> is past-the-end.
</td>
353 <td><code>v.size ()
</code></td>
355 <td>Returns the size of the vector expression, that is, its number
357 <td><code>v.size ()
>=
0</code></td>
361 <td><code>v1.swap (v2)
</code></td>
363 <td>Equivalent to
<code>swap (v1, v2)
</code>.
</td>
367 <td>Beginning of reverse range
</td>
368 <td><code>v.rbegin ()
</code></td>
370 <td>Equivalent to
<code>reverse_iterator (v.end ())
</code>.
</td>
371 <td><code>v.rbegin ()
</code> is either dereferenceable or
372 past-the-end. It is past-the-end if and only if
<code>v.size () ==
376 <td>End of reverse range
</td>
377 <td><code>v.rend ()
</code></td>
379 <td>Equivalent to
<code>reverse_iterator (v.begin ())
</code>.
</td>
380 <td><code>v.rend ()
</code> is past-the-end.
</td>
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
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>
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
403 element of
<code>v2
</code>.
</td>
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>
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
419 element of
<code>v2
</code>.
</td>
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>
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
434 corresponding element of
<code>v2
</code>.
</td>
438 <td><code>v *= t
</code></td>
440 <td>Multiplies every element of
<code>v
</code> with
<code>t
</code>
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,
449 typically amortized constant time.
</p>
450 <p>The run-time complexity of
<code>size ()
</code> is constant
452 <p>The run-time complexity of
<code>swap ()
</code> is specific for
453 the 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,
456 typically amortized constant time.
</p>
457 <p>The run-time complexity of the element access is specific for
458 the evaluated vector expression, typically amortized constant time
459 for the dense and logarithmic for the sparse case.
</p>
460 <p>The run-time complexity of the arithmetic operations is specific
461 for the evaluated vector expressions, typically linear in the size
462 of the expressions.
</p>
464 <table border=
"1" summary=
"invariants">
468 <td>For any vector expression
<code>v
</code>,
<code>[v.begin (),
469 v.end ())
</code> is a valid range.
</td>
472 <td>Completeness
</td>
473 <td>An algorithm that iterates through the range
<code>[v.begin (),
474 v.end ())
</code> will pass through every element of
<code>v
</code>
478 <td>Valid reverse range
</td>
479 <td><code>[v.rbegin (), v.rend ())
</code> is a valid range.
</td>
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>
485 to
<code>v.rend ()
</code>.
</td>
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>
507 <h2><a name=
"matrix_expression"></a>Matrix Expression
</h2>
509 <p>A Matrix Expression is an expression evaluatable to a matrix.
510 Matrix Expression provides an
<a href=
511 "iterator_concept.html#indexed_bidirectional_cr_iterator">Indexed
512 Bidirectional Column/Row Iterator
</a> or an
<a href=
513 "iterator_concept.html#indexed_random_access_cr_iterator">Indexed Random
514 Access Column/Row Iterator
</a> .
</p>
515 <h4>Refinement of
</h4>
516 <p>Default Constructible.
</p>
518 <h4>Associated types
</h4>
519 <h5>immutable types
</h5>
520 <table border=
"1" summary=
"associated immutable types" title=
"">
524 <td><code>matrix_expression
<M
></code></td>
525 <td>M must be derived from this public base type.
</td>
529 <td><code>value_type
</code></td>
531 The element type of the matrix expression.
535 <td>Const reference type
</td>
536 <td><code>const_reference
</code></td>
538 The return type when accessing an element of a constant matrix expression.
540 Convertable to a
<code>value_type
</code>.
545 <td><code>size_type
</code></td>
547 The index type of the matrix expression. Am unsigned integral type used to represent size and index values.
549 Can represent any nonnegative value of
<code>difference_type
</code>.
553 <td>Distance type
</td>
554 <td><code>difference_type
</code></td>
556 A signed integral type used to represent the distance between two of the matrix expression
's iterators.
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
563 expression's elements.
</td>
566 <td><code>const_iterator2
</code></td>
567 <td>A type of row iterator that may be used to examine a matrix
568 expression's elements.
</td>
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
574 matrix expression's const column iterator type.
</td>
577 <td><code>const_reverse_iterator2
</code></td>
578 <td>A Reverse Iterator adaptor whose base iterator type is the
579 matrix expression's const row iterator type.
</td>
584 <h5>mutable types
</h5>
585 <table border=
"1" summary=
"associated mutable types">
588 <td>Reference type
</td>
589 <td><code>reference
</code></td>
591 The return type when accessing an element of a matrix expression.
593 Convertable to a
<code>value_type
</code>.
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
600 expression's elements.
</td>
603 <td><code>iterator2
</code></td>
604 <td>A type of row iterator that may be used to modify a matrix
605 expression's elements.
</td>
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
611 matrix expression's column iterator type.
</td>
614 <td><code>reverse_iterator2
</code></td>
615 <td>A Reverse Iterator adaptor whose base iterator type is the
616 matrix expression's row iterator type.
</td>
623 <table border=
"0" summary=
"notation">
626 <td><code>M
</code></td>
627 <td>A type that is a model of Matrix Expression
</td>
630 <td><code>m, m1, m2
</code></td>
631 <td>Object of type
<code>M
</code></td>
634 <td><code>i, j
</code></td>
635 <td>Objects of a type convertible to
<code>size_type
</code></td>
638 <td><code>t
</code></td>
639 <td>Object of a type convertible to
<code>value_type
</code></td>
644 <h4>Valid expressions
</h4>
645 <p>In addition to the expressions defined in Default Constructible
646 the following expressions must be valid.
</p>
648 <h5>immutable expressions
</h5>
649 <table border=
"1" summary=
"expressions">
654 <th>Type requirements
</th>
660 <td rowspan=
"2">Size
</td>
661 <td><code>m.size1 ()
</code></td>
663 <td><code>size_type
</code></td>
666 <td><code>m.size2 ()
</code></td>
668 <td><code>size_type
</code></td>
673 <h5>possibly mutable expressions
</h5>
674 <table border=
"1" summary=
"expressions">
679 <th>Type requirements
</th>
683 <td rowspan=
"4">Beginning of range
</td>
684 <td><code>m.begin1 ()
</code></td>
686 <td><code>const_iterator1
</code></td>
689 <td><code>m.begin2 ()
</code></td>
691 <td><code>const_iterator2
</code></td>
694 <td><code>m.begin1 ()
</code></td>
695 <td><code>m
</code> is mutable.
</td>
696 <td><code>iterator1
</code></td>
699 <td><code>m.begin2 ()
</code></td>
700 <td><code>m
</code> is mutable.
</td>
701 <td><code>iterator2
</code></td>
704 <td rowspan=
"4">End of range
</td>
705 <td><code>m.end1 ()
</code></td>
707 <td><code>const_iterator1
</code></td>
710 <td><code>m.end2 ()
</code></td>
712 <td><code>const_iterator2
</code></td>
715 <td><code>m.end1 ()
</code></td>
716 <td><code>m
</code> is mutable.
</td>
717 <td><code>iterator1
</code></td>
720 <td><code>m.end2 ()
</code></td>
721 <td><code>m
</code> is mutable.
</td>
722 <td><code>iterator2
</code></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>
731 <td rowspan=
"4">Beginning of reverse range
</td>
732 <td><code>m.rbegin1 ()
</code></td>
734 <td><code>const_reverse_iterator1
</code></td>
737 <td><code>m.rbegin2 ()
</code></td>
739 <td><code>const_reverse_iterator2
</code></td>
742 <td><code>m.rbegin1 ()
</code></td>
743 <td><code>m
</code> is mutable.
</td>
744 <td><code>reverse_iterator1
</code></td>
747 <td><code>m.rbegin2 ()
</code></td>
748 <td><code>m
</code> is mutable.
</td>
749 <td><code>reverse_iterator2
</code></td>
752 <td rowspan=
"4">End of reverse range
</td>
753 <td><code>m.rend1 ()
</code></td>
755 <td><code>const_reverse_iterator1
</code></td>
758 <td><code>m.rend2 ()
</code></td>
760 <td><code>const_reverse_iterator2
</code></td>
763 <td><code>m.rend1 ()
</code></td>
764 <td><code>m
</code> is mutable.
</td>
765 <td><code>reverse_iterator1
</code></td>
768 <td><code>m.rend2 ()
</code></td>
769 <td><code>m
</code> is mutable.
</td>
770 <td><code>reverse_iterator2
</code></td>
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>
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
783 to
<code>M
</code>.
</td>
784 <td><code>M
&</code></td>
787 <td><code>m2.assign (m1)
</code></td>
788 <td><code>m2
</code> is mutable and
<code>m1
</code> is convertible
789 to
<code>M
</code>.
</td>
790 <td><code>M
&</code></td>
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
796 to
<code>M
</code>.
</td>
797 <td><code>M
&</code></td>
800 <td><code>m2.plus_assign (m1)
</code></td>
801 <td><code>m2
</code> is mutable and
<code>m1
</code> is convertible
802 to
<code>M
</code>.
</td>
803 <td><code>M
&</code></td>
806 <td><code>m2 -= m1
</code></td>
807 <td><code>m2
</code> is mutable and
<code>m1
</code> is convertible
808 to
<code>M
</code>.
</td>
809 <td><code>M
&</code></td>
812 <td><code>m2.minus_assign (m1)
</code></td>
813 <td><code>m2
</code> is mutable and
<code>m1
</code> is convertible
814 to
<code>M
</code>.
</td>
815 <td><code>M
&</code></td>
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>
825 <h4>Expression semantics
</h4>
826 <p>Semantics of an expression is defined only where it differs
827 from, or is not defined in Default Constructible.
</p>
828 <table border=
"1" summary=
"semantics">
833 <th>Precondition
</th>
835 <th>Postcondition
</th>
838 <td rowspan=
"2">Beginning of range
</td>
839 <td><code>m.begin1 ()
</code></td>
841 <td>Returns an iterator pointing to the first element in the first
842 column of a matrix expression.
</td>
843 <td><code>m.begin1 ()
</code> is either dereferenceable or
844 past-the-end. It is past-the-end if and only if
<code>m.size1 () ==
848 <td><code>m.begin2 ()
</code></td>
850 <td>Returns an iterator pointing to the first element in the first
851 row of a matrix expression.
</td>
852 <td><code>m.begin2 ()
</code> is either dereferenceable or
853 past-the-end. It is past-the-end if and only if
<code>m.size2 () ==
857 <td rowspan=
"2">End of range
</td>
858 <td><code>m.end1 ()
</code></td>
860 <td>Returns an iterator pointing one past the last element in the
861 matrix expression.
</td>
862 <td><code>m.end1 ()
</code> is past-the-end.
</td>
865 <td><code>m.end2 ()
</code></td>
867 <td>Returns an iterator pointing one past the last element in the
868 matrix expression.
</td>
869 <td><code>m.end2 ()
</code> is past-the-end.
</td>
872 <td rowspan=
"2">Size
</td>
873 <td><code>m.size1 ()
</code></td>
875 <td>Returns the number of rows of the matrix expression.
</td>
876 <td><code>m.size1 ()
>=
0</code></td>
879 <td><code>m.size2 ()
</code></td>
881 <td>Returns the number of columns of the matrix expression.
</td>
882 <td><code>m.size2 ()
>=
0</code></td>
886 <td><code>m1.swap (m2)
</code></td>
888 <td>Equivalent to
<code>swap (m1, m2)
</code>.
</td>
892 <td rowspan=
"2">Beginning of reverse range
</td>
893 <td><code>m.rbegin1 ()
</code></td>
895 <td>Equivalent to
<code>reverse_iterator1 (m.end1 ())
</code>.
</td>
896 <td><code>m.rbegin1 ()
</code> is either dereferenceable or
897 past-the-end. It is past-the-end if and only if
<code>m.size1 () ==
901 <td><code>m.rbegin2 ()
</code></td>
903 <td>Equivalent to
<code>reverse_iterator2 (m.end2 ())
</code>.
</td>
904 <td><code>m.rbegin2 ()
</code> is either dereferenceable or
905 past-the-end. It is past-the-end if and only if
<code>m.size2 () ==
909 <td rowspan=
"2">End of reverse range
</td>
910 <td><code>m.rend1 ()
</code></td>
912 <td>Equivalent to
<code>reverse_iterator1 (m.begin1
914 <td><code>m.rend1 ()
</code> is past-the-end.
</td>
917 <td><code>m.rend2 ()
</code></td>
919 <td>Equivalent to
<code>reverse_iterator2 (m.begin2
921 <td><code>m.rend2 ()
</code> is past-the-end.
</td>
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
<
927 m.size2 ()
</code></td>
928 <td>Returns the
<code>j
</code>-th element of the
<code>i
</code>-th
929 row of the matrix expression.
</td>
933 <td rowspan=
"2">Assignment
</td>
934 <td><code>m2 = m1
</code></td>
935 <td><code>m1.size1 () == m2.size1 ()
</code> and
<code><br />
936 m1.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>
943 <td><code>m2.assign (m1)
</code></td>
944 <td><code>m1.size1 () == m2.size1 ()
</code> and
<code><br />
945 m1.size2 () == m2.size2 ()
</code></td>
946 <td>Assigns every element of
<code>m1
</code> to the corresponding
947 element of
<code>m2
</code>.
</td>
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 />
954 m1.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>
961 <td><code>m2.plus_assign (m1)
</code></td>
962 <td><code>m1.size1 () == m2.size1 ()
</code> and
<code><br />
963 m1.size2 () == m2.size2 ()
</code></td>
964 <td>Adds every element of
<code>m1
</code> to the corresponding
965 element of
<code>m2
</code>.
</td>
969 <td><code>m2 -= m1
</code></td>
970 <td><code>m1.size1 () == m2.size1 ()
</code> and
<code><br />
971 m1.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>
978 <td><code>m2.minus_assign (m1)
</code></td>
979 <td><code>m1.size1 () == m2.size1 ()
</code> and
<code><br />
980 m1.size2 () == m2.size2 ()
</code></td>
981 <td>Subtracts every element of
<code>m1
</code> from the
982 corresponding element of
<code>m2
</code>.
</td>
986 <td><code>m *= t
</code></td>
988 <td>Multiplies every element of
<code>m
</code> with
<code>t
</code>
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
997 specific 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
1001 the 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
1006 the evaluated matrix expression, typically amortized constant time
1007 for the dense and logarithmic for the sparse case.
</p>
1008 <p>The run-time complexity of the arithmetic operations is specific
1009 for the evaluated matrix expressions, typically quadratic in the
1010 size of the proxies.
</p>
1012 <table border=
"1" summary=
"invariants">
1015 <td>Valid range
</td>
1016 <td>For any matrix expression
<code>m
</code>,
<code>[m.begin1 (),
1017 m.end1 ())
</code> and
<code>[m.begin2 (), m.end2 ())
</code> are
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 (),
1025 m.end2 ())
</code> will pass through every column of
<code>m
</code>
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>
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
1039 the distance from
<code>m.rbegin2 ()
</code> to
<code>m.rend2
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>
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
1068 <script type=
"text/javascript">