mirror of
https://github.com/boostorg/ublas.git
synced 2026-02-12 00:22:22 +00:00
423 lines
11 KiB
HTML
423 lines
11 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
|
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
|
|
<title>Container Concepts</title>
|
|
</head>
|
|
<body bgcolor="#ffffff">
|
|
|
|
<h1><img src="c++boost.gif" alt="c++boost.gif" align="Center">
|
|
Container Concepts</h1>
|
|
|
|
<h2><a name="vector"></a>
|
|
Vector </h2>
|
|
|
|
<h4>Description</h4>
|
|
|
|
<p>A Vector describes common aspects of dense, packed and sparse vectors.
|
|
</p>
|
|
|
|
<h4>Refinement of </h4>
|
|
|
|
<p><a href="expression.htm#vector_expression">Vector Expression</a>
|
|
.</p>
|
|
|
|
<h4>Associated types</h4>
|
|
|
|
<table border="1">
|
|
<tbody>
|
|
<tr>
|
|
<td>Value type </td>
|
|
<td><code>value_type</code> </td>
|
|
<td>The type of the vector. </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Distance type </td>
|
|
<td><code>difference_type</code> </td>
|
|
<td>A signed integral type used to represent the distance
|
|
between two of the vector's iterators. </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Size type </td>
|
|
<td><code>size_type</code> </td>
|
|
<td>An unsigned integral type that can represent any nonnegative
|
|
value of the vector's distance type. </td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<h4>Notation</h4>
|
|
|
|
<table border="0">
|
|
<tbody>
|
|
<tr>
|
|
<td><code>V</code> </td>
|
|
<td>A type that is a model of Vector</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>v</code></td>
|
|
<td>Objects of type <code>V</code> </td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>n, i</code></td>
|
|
<td>Objects of a type convertible to <code>size_type</code>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>t</code></td>
|
|
<td>Object of a type convertible to <code>value_type</code>
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<h4>Definitions</h4>
|
|
|
|
<h4>Valid expressions</h4>
|
|
|
|
<p>In addition to the expressions defined in <a href="expression.htm#vector_expression">
|
|
Vector Expression</a>
|
|
the following expressions must be valid. </p>
|
|
|
|
<table border="1">
|
|
<tbody>
|
|
<tr>
|
|
<th>Name </th>
|
|
<th>Expression </th>
|
|
<th>Type requirements </th>
|
|
<th>Return type </th>
|
|
</tr>
|
|
<tr>
|
|
<td>Sizing constructor </td>
|
|
<td><code>V v (n)</code> </td>
|
|
<td> </td>
|
|
<td><code>V</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Insert </td>
|
|
<td><code>v.insert (i, t)</code> </td>
|
|
<td><code>v</code> is mutable.</td>
|
|
<td><code>void</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Erase </td>
|
|
<td><code>v.erase (i)</code> </td>
|
|
<td><code>v</code> is mutable.</td>
|
|
<td><code>void</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Clear </td>
|
|
<td><code>v.clear ()</code> </td>
|
|
<td><code>v</code> is mutable.</td>
|
|
<td><code>void</code> </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Resize </td>
|
|
<td><code>v.resize (n)</code> </td>
|
|
<td><code>v</code> is mutable.</td>
|
|
<td><code>void</code> </td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<h4>Expression semantics</h4>
|
|
|
|
<p>Semantics of an expression is defined only where it differs from, or is
|
|
not defined in <a href="expression.htm#vector_expression">Vector Expression</a>
|
|
.</p>
|
|
|
|
<table border="1">
|
|
<tbody>
|
|
<tr>
|
|
<th>Name </th>
|
|
<th>Expression </th>
|
|
<th>Precondition </th>
|
|
<th>Semantics </th>
|
|
<th>Postcondition </th>
|
|
</tr>
|
|
<tr>
|
|
<td>Sizing constructor </td>
|
|
<td><code>V v (n)</code> </td>
|
|
<td><code>n >= 0</code> </td>
|
|
<td>Creates a vector of <code>n</code> elements. </td>
|
|
<td><code>v.size () == n</code>. </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Insert </td>
|
|
<td><code>v.insert (i, t)</code> </td>
|
|
<td><code>0 <= i < v.size ()</code> and <br>
|
|
<code>v (i)</code> is a copy of <code>value_type ()</code>.</td>
|
|
<td>A copy of <code>t</code> is inserted in <code>v</code>.
|
|
</td>
|
|
<td><code>v (i)</code> is a copy of <code>t</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Erase </td>
|
|
<td><code>v.erase (i)</code> </td>
|
|
<td><code>0 <= i < v.size ()</code> </td>
|
|
<td>Destroys the element <code>v (i)</code> and replaces
|
|
it with <code>value_type ()</code>. </td>
|
|
<td><code>v (i)</code> is a copy of <code>value_type ()</code>.
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Clear </td>
|
|
<td><code>v.clear ()</code> </td>
|
|
<td> </td>
|
|
<td>Equivalent to <br>
|
|
<code>for (i = 0; i < v.size (); ++ i)</code><br>
|
|
<code>v.erase (i);</code> </td>
|
|
<td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Resize </td>
|
|
<td><code>v.resize (n)</code> </td>
|
|
<td> </td>
|
|
<td>Modifies the vector so that it can hold <code>n</code>
|
|
elements. </td>
|
|
<td><code>v.size () == n</code>. </td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<h4>Complexity guarantees</h4>
|
|
|
|
<p>The run-time complexity of the sizing constructor is linear in the vector's
|
|
size. </p>
|
|
|
|
<p>The run-time complexity of insert and erase is specific for the vector.</p>
|
|
|
|
<h4>Invariants</h4>
|
|
|
|
<h4>Models</h4>
|
|
|
|
<ul>
|
|
<li><code>vector<T, A></code></li>
|
|
<li><code>unit_vector<T></code></li>
|
|
<li><code>zero_vector<T></code></li>
|
|
<li><code>sparse_vector<T, A></code></li>
|
|
|
|
</ul>
|
|
|
|
<h2><a name="matrix"></a>
|
|
Matrix </h2>
|
|
|
|
<h4>Description</h4>
|
|
|
|
<p>A Matrix describes common aspects of dense, packed and sparse matrices.
|
|
</p>
|
|
|
|
<h4>Refinement of </h4>
|
|
|
|
<p><a href="expression.htm#matrix_expression">Matrix Expression</a>
|
|
.</p>
|
|
|
|
<h4>Associated types</h4>
|
|
|
|
<table border="1">
|
|
<tbody>
|
|
<tr>
|
|
<td>Value type </td>
|
|
<td><code>value_type</code> </td>
|
|
<td>The type of the matrix. </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Distance type </td>
|
|
<td><code>difference_type</code> </td>
|
|
<td>A signed integral type used to represent the distance
|
|
between two of the matrix's iterators. </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Size type </td>
|
|
<td><code>size_type</code> </td>
|
|
<td>An unsigned integral type that can represent any nonnegative
|
|
value of the matrix's distance type. </td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<h4>Notation</h4>
|
|
|
|
<table border="0">
|
|
<tbody>
|
|
<tr>
|
|
<td><code>M</code> </td>
|
|
<td>A type that is a model of Matrix</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>m</code></td>
|
|
<td>Objects of type <code>M</code> </td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>n1, n2, i, j</code></td>
|
|
<td>Objects of a type convertible to <code>size_type</code>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>t</code></td>
|
|
<td>Object of a type convertible to <code>value_type</code>
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<h4>Definitions</h4>
|
|
|
|
<h4>Valid expressions</h4>
|
|
|
|
<p>In addition to the expressions defined in <a href="expression.htm#matrix_expression">
|
|
Matrix Expression</a>
|
|
the following expressions must be valid. </p>
|
|
|
|
<table border="1">
|
|
<tbody>
|
|
<tr>
|
|
<th>Name </th>
|
|
<th>Expression </th>
|
|
<th>Type requirements </th>
|
|
<th>Return type </th>
|
|
</tr>
|
|
<tr>
|
|
<td>Sizing constructor </td>
|
|
<td><code>M m (n1, n2)</code> </td>
|
|
<td> </td>
|
|
<td><code>M</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Insert </td>
|
|
<td><code>m.insert (i, j, t)</code> </td>
|
|
<td><code>m</code> is mutable.</td>
|
|
<td><code>void</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Erase </td>
|
|
<td><code>m.erase (i, j)</code> </td>
|
|
<td><code>m</code> is mutable.</td>
|
|
<td><code>void</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Clear </td>
|
|
<td><code>m.clear ()</code> </td>
|
|
<td><code>m</code> is mutable.</td>
|
|
<td><code>void</code> </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Resize </td>
|
|
<td><code>m.resize (n1, n2)</code> </td>
|
|
<td><code>m</code> is mutable.</td>
|
|
<td><code>void</code> </td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<h4>Expression semantics</h4>
|
|
|
|
<p>Semantics of an expression is defined only where it differs from, or is
|
|
not defined in <a href="expression.htm#matrix_expression">Matrix Expression</a>
|
|
.</p>
|
|
|
|
<table border="1">
|
|
<tbody>
|
|
<tr>
|
|
<th>Name </th>
|
|
<th>Expression </th>
|
|
<th>Precondition </th>
|
|
<th>Semantics </th>
|
|
<th>Postcondition </th>
|
|
</tr>
|
|
<tr>
|
|
<td>Sizing constructor </td>
|
|
<td><code>M m (n1, n2)</code> </td>
|
|
<td><code>n1 >= 0</code> and<code> n2 >= 0</code></td>
|
|
<td>Creates a matrix of <code>n1 </code>rows and <code>n2</code>
|
|
columns. </td>
|
|
<td><code>m.size1 () == n1</code> and <code>m.size2 () ==
|
|
n2</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Insert </td>
|
|
<td><code>m.insert (i, j, t)</code> </td>
|
|
<td><code>0 <= i < m.size1 ()</code>, <br>
|
|
<code>0 <= j < m.size2 ()</code>and <code><br>
|
|
m (i, j)</code> is a copy of <code>value_type ()</code>.</td>
|
|
<td>A copy of <code>t</code> is inserted in <code>m</code>.
|
|
</td>
|
|
<td><code>m (i, j)</code> is a copy of <code>t</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Erase </td>
|
|
<td><code>m.erase (i, j)</code> </td>
|
|
<td><code>0 <= i < m.size1 ()</code>and <code><br>
|
|
0 <= j < m.size2 </code></td>
|
|
<td>Destroys the element <code>m (i, j)</code> and replaces
|
|
it with <code>value_type ()</code>. </td>
|
|
<td><code>m (i, j)</code> is a copy of <code>value_type
|
|
()</code>. </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Clear </td>
|
|
<td><code>m.clear ()</code> </td>
|
|
<td> </td>
|
|
<td>Equivalent to<br>
|
|
<code>for (i = 0; i < m.size1 (); ++ i)</code><br>
|
|
<code>for (j = 0; j < m.size2 (); ++ j)</code><br>
|
|
<code>m.erase (i, j);</code> </td>
|
|
<td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Resize </td>
|
|
<td><code>m.resize (n1, n2)</code> </td>
|
|
<td> </td>
|
|
<td>Modifies the vector so that it can hold <code>n1 </code>rows
|
|
and <code>n2</code> columns. </td>
|
|
<td><code>m.size1 () == n1</code> and <code>m.size2 () ==
|
|
n2</code>.</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<h4>Complexity guarantees</h4>
|
|
|
|
<p>The run-time complexity of the sizing constructor is quadratic in the
|
|
matrix's size. </p>
|
|
|
|
<p>The run-time complexity of insert and erase is specific for the matrix.</p>
|
|
|
|
<h4>Invariants</h4>
|
|
|
|
<h4>Models</h4>
|
|
|
|
<ul>
|
|
<li><code>matrix<T, F, A></code></li>
|
|
<li><code>identity_matrix<T></code></li>
|
|
<li><code>zero_matrix<T></code></li>
|
|
<li><code>triangular_matrix<T, F1, F2, A></code></li>
|
|
<li><code>symmetric_matrix<T, F1, F2, A></code></li>
|
|
<li><code>banded_matrix<T, F, A></code></li>
|
|
<li><code>sparse_matrix<T, F, A></code></li>
|
|
|
|
</ul>
|
|
|
|
<hr>
|
|
<p>Copyright (©) 2000-2002 Joerg Walter, Mathias Koch <br>
|
|
Permission to copy, use, modify, sell and distribute this document is granted
|
|
provided this copyright notice appears in all copies. This document is provided
|
|
``as is'' without express or implied warranty, and with no claim as to its
|
|
suitability for any purpose.</p>
|
|
|
|
<p>Last revised: 1/15/2003</p>
|
|
|
|
</body>
|
|
</html>
|