| [12] | 1 | <HTML> |
|---|
| 2 | <!-- |
|---|
| 3 | -- Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000 |
|---|
| 4 | -- |
|---|
| 5 | -- Permission to use, copy, modify, distribute and sell this software |
|---|
| 6 | -- and its documentation for any purpose is hereby granted without fee, |
|---|
| 7 | -- provided that the above copyright notice appears in all copies and |
|---|
| 8 | -- that both that copyright notice and this permission notice appear |
|---|
| 9 | -- in supporting documentation. We make no |
|---|
| 10 | -- representations about the suitability of this software for any |
|---|
| 11 | -- purpose. It is provided "as is" without express or implied warranty. |
|---|
| 12 | --> |
|---|
| 13 | <Head> |
|---|
| 14 | <Title>BasicMatrix</Title> |
|---|
| 15 | <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" |
|---|
| 16 | ALINK="#ff0000"> |
|---|
| 17 | <IMG SRC="../../../boost.png" |
|---|
| 18 | ALT="C++ Boost" width="277" height="86"> |
|---|
| 19 | |
|---|
| 20 | <BR Clear> |
|---|
| 21 | |
|---|
| 22 | <H1><A NAME="concept:BasicMatrix"></A> |
|---|
| 23 | BasicMatrix |
|---|
| 24 | </H1> |
|---|
| 25 | |
|---|
| 26 | The BasicMatrix concept provides a minimalist interface for |
|---|
| 27 | accessing elements from a 2 dimensional table of values. |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | <H3>Refinement of</H3> |
|---|
| 31 | |
|---|
| 32 | none |
|---|
| 33 | |
|---|
| 34 | <h3>Notation</h3> |
|---|
| 35 | |
|---|
| 36 | <Table> |
|---|
| 37 | <TR> |
|---|
| 38 | <TD>{<tt>M,I,V</tt>}</TD> |
|---|
| 39 | <TD>The matrix, index, and values types that together model the BasicMatrix concept.</TD> |
|---|
| 40 | </TR> |
|---|
| 41 | |
|---|
| 42 | <TR> |
|---|
| 43 | <TD><tt>A</tt></TD> |
|---|
| 44 | <TD>An object of type <tt>M</tt>.</TD> |
|---|
| 45 | </TR> |
|---|
| 46 | |
|---|
| 47 | <TR> |
|---|
| 48 | <TD><tt>i, j</tt></TD> |
|---|
| 49 | <TD>Objects of type <tt>I</tt>.</TD> |
|---|
| 50 | </TR> |
|---|
| 51 | |
|---|
| 52 | </table> |
|---|
| 53 | |
|---|
| 54 | <H3>Associated Types</H3> |
|---|
| 55 | |
|---|
| 56 | none |
|---|
| 57 | |
|---|
| 58 | <h3>Valid Expressions</h3> |
|---|
| 59 | |
|---|
| 60 | <Table border> |
|---|
| 61 | |
|---|
| 62 | <tr> |
|---|
| 63 | <td><a name="sec:elt-access"><TT>A[i][j]</TT></a></TD> |
|---|
| 64 | <TD>Returns a reference to the element object stored at index <tt>(i,j)</tt><br> |
|---|
| 65 | Return type: <TT>V&</TT> for mutable <tt>A</tt> or <TT>const V&</TT> |
|---|
| 66 | for constant <tt>A</tt>. |
|---|
| 67 | </TD> |
|---|
| 68 | </TR> |
|---|
| 69 | |
|---|
| 70 | </table> |
|---|
| 71 | |
|---|
| 72 | <H3>Complexity guarantees</H3> |
|---|
| 73 | |
|---|
| 74 | Element access is constant time. |
|---|
| 75 | |
|---|
| 76 | <H3>Concept Checking Class</H3> |
|---|
| 77 | |
|---|
| 78 | <pre> |
|---|
| 79 | template <class M, class I, class V> |
|---|
| 80 | struct BasicMatrixConcept |
|---|
| 81 | { |
|---|
| 82 | void constraints() { |
|---|
| 83 | V& elt = A[i][j]; |
|---|
| 84 | const_constraints(A); |
|---|
| 85 | ignore_unused_variable_warning(elt); |
|---|
| 86 | } |
|---|
| 87 | void const_constraints(const M& A) { |
|---|
| 88 | const V& elt = A[i][j]; |
|---|
| 89 | ignore_unused_variable_warning(elt); |
|---|
| 90 | } |
|---|
| 91 | M A; |
|---|
| 92 | I i, j; |
|---|
| 93 | }; |
|---|
| 94 | </pre> |
|---|
| 95 | |
|---|
| 96 | <br> |
|---|
| 97 | <HR> |
|---|
| 98 | <TABLE> |
|---|
| 99 | <TR valign=top> |
|---|
| 100 | <TD nowrap>Copyright © 2000-2001</TD><TD> |
|---|
| 101 | <A HREF="../../../people/jeremy_siek.htm">Jeremy Siek</A>, |
|---|
| 102 | Indiana University (<A |
|---|
| 103 | HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>) |
|---|
| 104 | </TD></TR></TABLE> |
|---|
| 105 | |
|---|
| 106 | </BODY> |
|---|
| 107 | </HTML> |
|---|