mirror of
https://github.com/boostorg/ublas.git
synced 2026-02-22 03:42:19 +00:00
merged from uBLAS-cvs
svn path=/trunk/boost/libs/numeric/ublas/; revision=26707
This commit is contained in:
206
doc/bounded_array.htm
Normal file
206
doc/bounded_array.htm
Normal file
@@ -0,0 +1,206 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
||||
<link href="ublas.css" type="text/css" />
|
||||
<title>Bounded Array;</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
Bounded Array Storage</h1>
|
||||
<h2><a name="bounded_array" id="bounded_array"></a>Bounded Array<T,N,Alloc></h2>
|
||||
<h4>Description</h4>
|
||||
<p>The templated class <code>bounded_array<T, N, ALLOC></code> implements a bounded storage array. The bounded array is similar to a C++ array type in that its maximum size is bounded by N and is allocated on the stack instead of the heap. Similarly a <code>bounded_array</code> requires no secondary storage and ALLOC is only used to specify<code>size_type</code> and <code>difference_type</code>.
|
||||
</p>
|
||||
<p>When resized <code>bounded_array</code> uses the same storage with the same bound!. It is therefore efficient to resize a <code>bounded_array</code></p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/storage.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
bounded_array<double, 3> a (3);
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {
|
||||
a [i] = i;
|
||||
std::cout << a [i] << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header storage.hpp.</p>
|
||||
<h4>Template parameters</h4>
|
||||
<table border="1" summary="parameters">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>T</code></td>
|
||||
<td>The type of object stored in the array.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>N</code></td>
|
||||
<td>The allocation size of the array.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>ALLOC</code></td>
|
||||
<td>An STL Allocator</td>
|
||||
<td>std::allocator</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Model of</h4>
|
||||
<p>Random Access Container.</p>
|
||||
<h4>Type requirements</h4>
|
||||
<p>None, except for those imposed by the requirements of Random Access Container.</p>
|
||||
<h4>Public base classes</h4>
|
||||
<p>None.</p>
|
||||
<h4>Members</h4>
|
||||
Editor's notes:
|
||||
<ul>
|
||||
<li>The description does not describe what the member actually does, this can be looked up
|
||||
in the corresponding concept documentation, but instead contains a remark on the implementation of the
|
||||
member inside this model of the concept.</li>
|
||||
<li>Type setting:
|
||||
<ul>
|
||||
<li>Members that currently lack are <font color="red">in red</font>.</li>
|
||||
<li>Members that are not part of the implemented concepts are <font color="blue">in blue</font>.</li>
|
||||
<li>Differences compared to the concept are in <em>italics</em>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<table border="1" summary="members">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Member</th>
|
||||
<th>Where defined</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr><td><code>value_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td></tr>
|
||||
<tr><td><code>pointer</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>value_type*</code></td></tr>
|
||||
<tr><td><code>const_pointer</code></td><td></td><td>Currently defined as <code>value_type*</code></td></tr>
|
||||
<tr><td><code>reference</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>value_type&</code></td></tr>
|
||||
<tr><td><code>const_reference</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>const value_type&</code></td></tr>
|
||||
<tr><td><code>size_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>Alloc::size_type</code></td></tr>
|
||||
<tr><td><code>difference_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>Alloc::difference_type</code></td></tr>
|
||||
<tr><td><code>iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>pointer</code></td></tr>
|
||||
<tr><td><code>const_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>const_pointer</code></td></tr>
|
||||
<tr><td><code>revere_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>std::reverse_iterator<iterator></code></td></tr>
|
||||
<tr><td><code>const_revere_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>std::reverse_iterator<const_iterator></code></td></tr>
|
||||
<tr>
|
||||
<td><code>bounded_array ()</code></td>
|
||||
<td>Creates a <code>bounded_array</code> that holds at most <strong>ZERO</strong> elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code><em>explicit</em> bounded_array (size_type size, const T& = init)</code></td>
|
||||
<td><a href="storage.htm">Storage</a>
|
||||
<td>Creates an initialized <code>bounded_array</code> that holds at most <code>size</code> elements. All the elements are constructed from the <code>init</code> value.</td> </tr>
|
||||
<tr>
|
||||
<td><code>bounded_array (size_type size)</code></td>
|
||||
<td><a href="storage.htm">Storage</a>
|
||||
<td>Creates an uninitialized <code>bounded_array</code> that holds at most <code>size</code> elements. All the elements are default constructed.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bounded_array (size_type size, const T& init)</code></td>
|
||||
<td><a href="storage.htm">Storage</a>
|
||||
<td>Creates an <code>bounded_array</code> that holds at most <code>size</code> elements. All the elements are copy-constructed from init.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bounded_array (const bounded_array &c)</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>The copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>~bounded_array ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Deallocates the <code>bounded_array</code> itself.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void resize (size_type size)</code></td>
|
||||
<td><a href="storage.htm">Storage</a>
|
||||
<td>Reallocates a <code>bounded_array</code> to hold at most <code>size</code> elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void resize (size_type size, const T& t)</code></td>
|
||||
<td><a href="storage.htm">Storage</a>
|
||||
<td>Reallocates a <code>bounded_array</code> to hold at most <code>size</code> elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type size () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns the size of the <code>bounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator [] (size_type i) const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>const</code> reference of the <code>i</code> -th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reference operator [] (size_type i)</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a reference of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bounded_array &operator = (const bounded_array &a)</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>The assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font color="blue"><code>bounded_array &assign_temporary (bounded_array &a)</code></font></td>
|
||||
<td></td>
|
||||
<td>Assigns a temporary. May change the array <code>a</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void swap (bounded_array &a)</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Swaps the contents of the arrays.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator begin () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the beginning of the <code>bounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator end () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the end of the <code>bounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator begin ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>iterator</code> pointing to the beginning of the <code>bounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator end ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>iterator</code> pointing to the end of the <code>bounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rbegin () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the beginning of the reversed <code>bounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rend () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the end of the reversed <code>bounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator rbegin ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
|
||||
<td>Returns a <code>reverse_iterator</code> pointing to the beginning of the reversed <code>bounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator rend ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
|
||||
<td>Returns a <code>reverse_iterator</code> pointing to the end of the reversed <code>bounded_array</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
397
doc/container_concept.htm
Normal file
397
doc/container_concept.htm
Normal file
@@ -0,0 +1,397 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=us-ascii" />
|
||||
<link href="ublas.css" type="text/css" />
|
||||
<title>Container Concepts</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
Container Concepts</h1>
|
||||
<h2><a name="vector" id="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_concept.htm#vector_expression">Vector Expression</a>
|
||||
.</p>
|
||||
<h4>Associated types</h4>
|
||||
<p>
|
||||
In addition to the types defined int
|
||||
<a href="expression_concept.htm#vector_expression">Vector Expression</a>
|
||||
</p>
|
||||
<table border="0" summary="types">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td>array_type</td>
|
||||
<td>The type of underlying storage used to store the elements</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Notation</h4>
|
||||
<table border="0" summary="notation">
|
||||
<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>
|
||||
<tr>
|
||||
<td><code>p</code></td>
|
||||
<td>Object of a type convertible to <code>bool</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Definitions</h4>
|
||||
<h4>Valid expressions</h4>
|
||||
<p>In addition to the expressions defined in <a href=
|
||||
"expression_concept.htm#vector_expression">Vector Expression</a> the
|
||||
following expressions must be valid.</p>
|
||||
<table border="1" summary="expressions">
|
||||
<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>Element access <a href="#element_access_note">[1]</a></td>
|
||||
<td><code>v[n]</code></td>
|
||||
<td><code>n</code> is convertible to <code>size_type</code></td>
|
||||
<td><code>reference</code> if v is mutable, <code>const_reference</code> otherwise</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Insert</td>
|
||||
<td><code>v.insert_element (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_element (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><br />
|
||||
<code>v.resize (n, p)</code></td>
|
||||
<td><code>v</code> is mutable.</td>
|
||||
<td><code>void</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>data() const</code></td>
|
||||
<td></td>
|
||||
<td><code>const array_type&</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>data()</code></td>
|
||||
<td><code>v</code> is mutable</td>
|
||||
<td><code>array_type&</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_concept.htm#vector_expression">Vector Expression</a> .</p>
|
||||
<table border="1" summary="semantics">
|
||||
<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>Allocates a vector of<code>n</code> elements.</td>
|
||||
<td><code>v.size () == n</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Element access <a href="#element_access_note">[1]</a></td>
|
||||
<td><code>v[n]</code></td>
|
||||
<td><code>0<n>v.size()</code></td>
|
||||
<td>returns the n-th element in v</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Insert</td>
|
||||
<td><code>v.insert_element (i, t)</code></td>
|
||||
<td><code>0 <= i < v.size ()</code> and<br />
|
||||
<code>v (i)</code> is equal to <code>value_type (0)</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_element (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)
|
||||
<br />v.resize (n, p)</code></td>
|
||||
<td> </td>
|
||||
<td>Reallocates the vector so that it can hold <code>n</code>
|
||||
elements.<br />
|
||||
Erases or appends elements in order to bring the vector to the prescribed size. Appended elements copies of <code>value_type()</code>.
|
||||
<br />
|
||||
When <code>p == false</code> then existing elements are not preserved and elements will not appended as normal. Instead the vector is in the same state as that after an equivalent sizing constructor.</td>
|
||||
<td><code>v.size () == n</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>v.data()</code></td>
|
||||
<td><code>v</code> is const</td>
|
||||
<td>Returns a reference to the underlying storage</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>v.data()</code></td>
|
||||
<td><code>v</code> is mutable</td>
|
||||
<td>Returns a reference to the underlying storage</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</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_element and erase_element is specific for the
|
||||
vector.</p>
|
||||
<p>The run-time complexity of resize is linear in the vector's
|
||||
size.</p>
|
||||
<h4>Invariants</h4>
|
||||
<h4>Models</h4>
|
||||
<ul>
|
||||
<li><code>vector<T></code> , <code>bounded_vector<T, N></code></li>
|
||||
<li><code>unit_vector<T></code> , <code>zero_vector<T></code> , <code>scalar_vector<T></code></li>
|
||||
<li><code>mapped_vector<T></code> , <code>compressed_vector</code> , <code>coordinate_vector</code></li>
|
||||
</ul>
|
||||
<h4>Notes</h4>
|
||||
<a name="element_access_note">[1]</a>The <code>operator[]</code> is added purely for convenience
|
||||
and compatibility with the <code>std::vector</code>. In uBLAS however,
|
||||
generally <code>operator()</code> is used for indexing because this can be
|
||||
used for both vectors and matrices.
|
||||
<h2><a name="matrix" id="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_concept.htm#matrix_expression">Matrix Expression</a>
|
||||
.</p>
|
||||
<h4>Associated types</h4>
|
||||
<p>
|
||||
See <a href="expression_concept.htm#matrix_expression">Matrix Expression</a>
|
||||
</p>
|
||||
<h4>Notation</h4>
|
||||
<table border="0" summary="notation">
|
||||
<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>
|
||||
<tr>
|
||||
<td><code>p</code></td>
|
||||
<td>Object of a type convertible to <code>bool</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Definitions</h4>
|
||||
<h4>Valid expressions</h4>
|
||||
<p>In addition to the expressions defined in <a href=
|
||||
"expression_concept.htm#matrix_expression">Matrix Expression</a> the
|
||||
following expressions must be valid.</p>
|
||||
<table border="1" summary="expressions">
|
||||
<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_element (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_element (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><br />
|
||||
<code>m.resize (n1, n2, p)</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_concept.htm#matrix_expression">Matrix Expression</a> .</p>
|
||||
<table border="1" summary="semantics">
|
||||
<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>Allocates 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_element (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 equal to <code>value_type (0)</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)
|
||||
<br />
|
||||
m.resize (n1, n2, p)
|
||||
</code></td>
|
||||
<td> </td>
|
||||
<td>Reallocate the matrix so that it can hold <code>n1</code> rows
|
||||
and <code>n2</code> columns.<br />
|
||||
Erases or appends elements in order to bring the matrix to the
|
||||
prescribed size. Appended elements are <code>value_type()</code>
|
||||
copies.<br />
|
||||
When <code>p == false</code> then existing elements are not preserved and elements will not appended as normal. Instead the matrix is in the same state as that after an equivalent sizing constructor.</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_element and erase_element is specific for the
|
||||
matrix.</p>
|
||||
<p>The run-time complexity of resize is quadratic in the matrix's
|
||||
size.</p>
|
||||
<h4>Invariants</h4>
|
||||
<h4>Models</h4>
|
||||
<ul>
|
||||
<li><code>matrix<T></code> , <code>bounded_matrix<T, M, N></code></li>
|
||||
<li><code>identity_matrix<T></code> , <code>zero_matrix<T></code> , <code>scalar_matrix<T></code></li>
|
||||
<li><code>triangular_matrix<T></code> , <code>symmetric_matrix<T></code> , <code>banded_matrix<T></code></li>
|
||||
<li><code>mapped_matrix<T></code> , <code>compressed_matrix</code> , <code>coordinate_matrix</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: 24/06/2004</p>
|
||||
</body>
|
||||
</html>
|
||||
397
doc/dense_matrix_concept.htm
Normal file
397
doc/dense_matrix_concept.htm
Normal file
@@ -0,0 +1,397 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=us-ascii" />
|
||||
<link href="ublas.css" type="text/css" />
|
||||
<title>Container Concepts</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
Container Concepts</h1>
|
||||
<h2><a name="vector" id="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_concept.htm#vector_expression">Vector Expression</a>
|
||||
.</p>
|
||||
<h4>Associated types</h4>
|
||||
<p>
|
||||
In addition to the types defined int
|
||||
<a href="expression_concept.htm#vector_expression">Vector Expression</a>
|
||||
</p>
|
||||
<table border="0" summary="types">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td>array_type</td>
|
||||
<td>The type of underlying storage used to store the elements</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Notation</h4>
|
||||
<table border="0" summary="notation">
|
||||
<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>
|
||||
<tr>
|
||||
<td><code>p</code></td>
|
||||
<td>Object of a type convertible to <code>bool</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Definitions</h4>
|
||||
<h4>Valid expressions</h4>
|
||||
<p>In addition to the expressions defined in <a href=
|
||||
"expression_concept.htm#vector_expression">Vector Expression</a> the
|
||||
following expressions must be valid.</p>
|
||||
<table border="1" summary="expressions">
|
||||
<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>Element access <a href="#element_access_note">[1]</a></td>
|
||||
<td><code>v[n]</code></td>
|
||||
<td><code>n</code> is convertible to <code>size_type</code></td>
|
||||
<td><code>reference</code> if v is mutable, <code>const_reference</code> otherwise</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Insert</td>
|
||||
<td><code>v.insert_element (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_element (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><br />
|
||||
<code>v.resize (n, p)</code></td>
|
||||
<td><code>v</code> is mutable.</td>
|
||||
<td><code>void</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>data() const</code></td>
|
||||
<td></td>
|
||||
<td><code>const array_type&</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>data()</code></td>
|
||||
<td><code>v</code> is mutable</td>
|
||||
<td><code>array_type&</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_concept.htm#vector_expression">Vector Expression</a> .</p>
|
||||
<table border="1" summary="semantics">
|
||||
<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>Allocates a vector of<code>n</code> elements.</td>
|
||||
<td><code>v.size () == n</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Element access <a href="#element_access_note">[1]</a></td>
|
||||
<td><code>v[n]</code></td>
|
||||
<td><code>0<n>v.size()</code></td>
|
||||
<td>returns the n-th element in v</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Insert</td>
|
||||
<td><code>v.insert_element (i, t)</code></td>
|
||||
<td><code>0 <= i < v.size ()</code> and<br />
|
||||
<code>v (i)</code> is equal to <code>value_type (0)</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_element (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)
|
||||
<br />v.resize (n, p)</code></td>
|
||||
<td> </td>
|
||||
<td>Reallocates the vector so that it can hold <code>n</code>
|
||||
elements.<br />
|
||||
Erases or appends elements in order to bring the vector to the prescribed size. Appended elements copies of <code>value_type()</code>.
|
||||
<br />
|
||||
When <code>p == false</code> then existing elements are not preserved and elements will not appended as normal. Instead the vector is in the same state as that after an equivalent sizing constructor.</td>
|
||||
<td><code>v.size () == n</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>v.data()</code></td>
|
||||
<td><code>v</code> is const</td>
|
||||
<td>Returns a reference to the underlying storage</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>v.data()</code></td>
|
||||
<td><code>v</code> is mutable</td>
|
||||
<td>Returns a reference to the underlying storage</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</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_element and erase_element is specific for the
|
||||
vector.</p>
|
||||
<p>The run-time complexity of resize is linear in the vector's
|
||||
size.</p>
|
||||
<h4>Invariants</h4>
|
||||
<h4>Models</h4>
|
||||
<ul>
|
||||
<li><code>vector<T></code> , <code>bounded_vector<T, N></code></li>
|
||||
<li><code>unit_vector<T></code> , <code>zero_vector<T></code> , <code>scalar_vector<T></code></li>
|
||||
<li><code>mapped_vector<T></code> , <code>compressed_vector</code> , <code>coordinate_vector</code></li>
|
||||
</ul>
|
||||
<h4>Notes</h4>
|
||||
<a name="element_access_note">[1]</a>The <code>operator[]</code> is added purely for convenience
|
||||
and compatibility with the <code>std::vector</code>. In uBLAS however,
|
||||
generally <code>operator()</code> is used for indexing because this can be
|
||||
used for both vectors and matrices.
|
||||
<h2><a name="matrix" id="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_concept.htm#matrix_expression">Matrix Expression</a>
|
||||
.</p>
|
||||
<h4>Associated types</h4>
|
||||
<p>
|
||||
See <a href="expression_concept.htm#matrix_expression">Matrix Expression</a>
|
||||
</p>
|
||||
<h4>Notation</h4>
|
||||
<table border="0" summary="notation">
|
||||
<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>
|
||||
<tr>
|
||||
<td><code>p</code></td>
|
||||
<td>Object of a type convertible to <code>bool</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Definitions</h4>
|
||||
<h4>Valid expressions</h4>
|
||||
<p>In addition to the expressions defined in <a href=
|
||||
"expression_concept.htm#matrix_expression">Matrix Expression</a> the
|
||||
following expressions must be valid.</p>
|
||||
<table border="1" summary="expressions">
|
||||
<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_element (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_element (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><br />
|
||||
<code>m.resize (n1, n2, p)</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_concept.htm#matrix_expression">Matrix Expression</a> .</p>
|
||||
<table border="1" summary="semantics">
|
||||
<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>Allocates 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_element (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 equal to <code>value_type (0)</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)
|
||||
<br />
|
||||
m.resize (n1, n2, p)
|
||||
</code></td>
|
||||
<td> </td>
|
||||
<td>Reallocate the matrix so that it can hold <code>n1</code> rows
|
||||
and <code>n2</code> columns.<br />
|
||||
Erases or appends elements in order to bring the matrix to the
|
||||
prescribed size. Appended elements are <code>value_type()</code>
|
||||
copies.<br />
|
||||
When <code>p == false</code> then existing elements are not preserved and elements will not appended as normal. Instead the matrix is in the same state as that after an equivalent sizing constructor.</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_element and erase_element is specific for the
|
||||
matrix.</p>
|
||||
<p>The run-time complexity of resize is quadratic in the matrix's
|
||||
size.</p>
|
||||
<h4>Invariants</h4>
|
||||
<h4>Models</h4>
|
||||
<ul>
|
||||
<li><code>matrix<T></code> , <code>bounded_matrix<T, M, N></code></li>
|
||||
<li><code>identity_matrix<T></code> , <code>zero_matrix<T></code> , <code>scalar_matrix<T></code></li>
|
||||
<li><code>triangular_matrix<T></code> , <code>symmetric_matrix<T></code> , <code>banded_matrix<T></code></li>
|
||||
<li><code>mapped_matrix<T></code> , <code>compressed_matrix</code> , <code>coordinate_matrix</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: 24/06/2004</p>
|
||||
</body>
|
||||
</html>
|
||||
218
doc/dense_vector_concept.htm
Normal file
218
doc/dense_vector_concept.htm
Normal file
@@ -0,0 +1,218 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=us-ascii" />
|
||||
<link href="ublas.css" type="text/css" />
|
||||
<title>DenseVector Concept</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
DenseVector Concept</h1>
|
||||
<h2>DenseVector</h2>
|
||||
<h4>Description</h4>
|
||||
<p>A dense-vector is a, exactly as the name says, a dense vector that is intended to behave well for linear algebra operations</p>
|
||||
<h4>Refinement of</h4>
|
||||
<p><a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible</a>, <a href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">RandomAccessContainer</a> and <a href="expression_concept.htm#vector_expression">Vector Expression</a><a href="#footnote1">[1]</a>.</p>
|
||||
<h4>Associated types</h4>
|
||||
<p>In addition to the types defined by <a href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">RandomAccessContainer</a> and <a href="expression_concept.htm#vector_expression">Vector Expression</a></p>
|
||||
<table border="1" summary="types">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>StorageArray</td>
|
||||
<td>array_type</td>
|
||||
<td>The type of underlying storage used to store the elements</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Notation</h4>
|
||||
<table border="0" summary="notation">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>V</code></td>
|
||||
<td>A type that is a model of Vector</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>T</code></td>
|
||||
<td>The value_type of elements of V</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>T</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>p</code></td>
|
||||
<td>Object of a type convertible to <code>bool</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Definitions</h4>
|
||||
<h4>Valid expressions</h4>
|
||||
<p>In addition to the expressions defined in <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible</a> and <a href="expression_concept.htm#vector_expression">Vector Expression</a> the following expressions must be valid.</p>
|
||||
<table border="1" summary="expressions">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Expression</th>
|
||||
<th>Type requirements</th>
|
||||
<th>Return type</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Size-constructor</td>
|
||||
<td><code>V v(n)</code></td>
|
||||
<td>T is <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible</a></td>
|
||||
<td><code>V</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Insert</td>
|
||||
<td><code>v.insert_element (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_element (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><br />
|
||||
<code>v.resize (n, p)</code></td>
|
||||
<td><code>v</code> is mutable.</td>
|
||||
<td><code>void</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>data() const</code></td>
|
||||
<td></td>
|
||||
<td><code>const array_type&</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>data()</code></td>
|
||||
<td><code>v</code> is mutable</td>
|
||||
<td><code>array_type&</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_concept.htm#vector_expression">Vector Expression</a> .</p>
|
||||
<table border="1" summary="semantics">
|
||||
<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>Allocates a vector of<code>n</code> elements.</td>
|
||||
<td><code>v.size () == n</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Element access <a href="#element_access_note">[1]</a></td>
|
||||
<td><code>v[n]</code></td>
|
||||
<td><code>0<n>v.size()</code></td>
|
||||
<td>returns the n-th element in v</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Insert</td>
|
||||
<td><code>v.insert_element (i, t)</code></td>
|
||||
<td><code>0 <= i < v.size ()</code> and<br />
|
||||
<code>v (i)</code> is equal to <code>value_type (0)</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_element (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)
|
||||
<br />v.resize (n, p)</code></td>
|
||||
<td> </td>
|
||||
<td>Reallocates the vector so that it can hold <code>n</code>
|
||||
elements.<br />
|
||||
Erases or appends elements in order to bring the vector to the prescribed size. Appended elements copies of <code>value_type()</code>.
|
||||
<br />
|
||||
When <code>p == false</code> then existing elements are not preserved and elements will not appended as normal. Instead the vector is in the same state as that after an equivalent sizing constructor.</td>
|
||||
<td><code>v.size () == n</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>v.data()</code></td>
|
||||
<td><code>v</code> is const</td>
|
||||
<td>Returns a reference to the underlying storage</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>v.data()</code></td>
|
||||
<td><code>v</code> is mutable</td>
|
||||
<td>Returns a reference to the underlying storage</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</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_element and erase_element is specific for the
|
||||
vector.</p>
|
||||
<p>The run-time complexity of resize is linear in the vector's
|
||||
size.</p>
|
||||
<h4>Invariants</h4>
|
||||
<h4>Models</h4>
|
||||
<ul>
|
||||
<li><code>vector<T></code> , <code>bounded_vector<T, N></code></li>
|
||||
<li><code>unit_vector<T></code> , <code>zero_vector<T></code> , <code>scalar_vector<T></code></li>
|
||||
<li><code>mapped_vector<T></code> , <code>compressed_vector</code> , <code>coordinate_vector</code></li>
|
||||
</ul>
|
||||
<h4>Notes</h4>
|
||||
<p><a name="footnote1">[1]</a>
|
||||
As a user you should not care about <tt>DenseVector</tt> being a refinement of the VectorExpression. Being a refinement of the VectorExpression is only important for the template-expression engine but not the user.
|
||||
<a name="element_access_note">[1]</a>The <code>operator[]</code> is added purely for convenience
|
||||
and compatibility with the <code>std::vector</code>. In uBLAS however,
|
||||
generally <code>operator()</code> is used for indexing because this can be
|
||||
used for both vectors and matrices.
|
||||
</body>
|
||||
</html>
|
||||
224
doc/dense_vector_concept.htm~
Normal file
224
doc/dense_vector_concept.htm~
Normal file
@@ -0,0 +1,224 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=us-ascii" />
|
||||
<link href="ublas.css" type="text/css" />
|
||||
<title>DenseVector Concept</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
DenseVector Concept</h1>
|
||||
<h2>DenseVector</h2>
|
||||
<h4>Description</h4>
|
||||
<p>A dense-vector is a, exactly as the name says, a dense vector that is intended to behave well for linear algebra operations</p>
|
||||
<h4>Refinement of</h4>
|
||||
<p><a href="expression_concept.htm#vector_expression">Vector Expression</a><a href="#footnote1">[1]</a>.</p>
|
||||
<h4>Associated types</h4>
|
||||
<p>
|
||||
In addition to the types defined int
|
||||
<a href="expression_concept.htm#vector_expression">Vector Expression</a>
|
||||
</p>
|
||||
<table border="0" summary="types">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td>array_type</td>
|
||||
<td>The type of underlying storage used to store the elements</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Notation</h4>
|
||||
<table border="0" summary="notation">
|
||||
<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>
|
||||
<tr>
|
||||
<td><code>p</code></td>
|
||||
<td>Object of a type convertible to <code>bool</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Definitions</h4>
|
||||
<h4>Valid expressions</h4>
|
||||
<p>In addition to the expressions defined in <a href=
|
||||
"expression_concept.htm#vector_expression">Vector Expression</a> the
|
||||
following expressions must be valid.</p>
|
||||
<table border="1" summary="expressions">
|
||||
<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>Element access <a href="#element_access_note">[1]</a></td>
|
||||
<td><code>v[n]</code></td>
|
||||
<td><code>n</code> is convertible to <code>size_type</code></td>
|
||||
<td><code>reference</code> if v is mutable, <code>const_reference</code> otherwise</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Insert</td>
|
||||
<td><code>v.insert_element (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_element (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><br />
|
||||
<code>v.resize (n, p)</code></td>
|
||||
<td><code>v</code> is mutable.</td>
|
||||
<td><code>void</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>data() const</code></td>
|
||||
<td></td>
|
||||
<td><code>const array_type&</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>data()</code></td>
|
||||
<td><code>v</code> is mutable</td>
|
||||
<td><code>array_type&</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_concept.htm#vector_expression">Vector Expression</a> .</p>
|
||||
<table border="1" summary="semantics">
|
||||
<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>Allocates a vector of<code>n</code> elements.</td>
|
||||
<td><code>v.size () == n</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Element access <a href="#element_access_note">[1]</a></td>
|
||||
<td><code>v[n]</code></td>
|
||||
<td><code>0<n>v.size()</code></td>
|
||||
<td>returns the n-th element in v</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Insert</td>
|
||||
<td><code>v.insert_element (i, t)</code></td>
|
||||
<td><code>0 <= i < v.size ()</code> and<br />
|
||||
<code>v (i)</code> is equal to <code>value_type (0)</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_element (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)
|
||||
<br />v.resize (n, p)</code></td>
|
||||
<td> </td>
|
||||
<td>Reallocates the vector so that it can hold <code>n</code>
|
||||
elements.<br />
|
||||
Erases or appends elements in order to bring the vector to the prescribed size. Appended elements copies of <code>value_type()</code>.
|
||||
<br />
|
||||
When <code>p == false</code> then existing elements are not preserved and elements will not appended as normal. Instead the vector is in the same state as that after an equivalent sizing constructor.</td>
|
||||
<td><code>v.size () == n</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>v.data()</code></td>
|
||||
<td><code>v</code> is const</td>
|
||||
<td>Returns a reference to the underlying storage</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage</td>
|
||||
<td><code>v.data()</code></td>
|
||||
<td><code>v</code> is mutable</td>
|
||||
<td>Returns a reference to the underlying storage</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</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_element and erase_element is specific for the
|
||||
vector.</p>
|
||||
<p>The run-time complexity of resize is linear in the vector's
|
||||
size.</p>
|
||||
<h4>Invariants</h4>
|
||||
<h4>Models</h4>
|
||||
<ul>
|
||||
<li><code>vector<T></code> , <code>bounded_vector<T, N></code></li>
|
||||
<li><code>unit_vector<T></code> , <code>zero_vector<T></code> , <code>scalar_vector<T></code></li>
|
||||
<li><code>mapped_vector<T></code> , <code>compressed_vector</code> , <code>coordinate_vector</code></li>
|
||||
</ul>
|
||||
<h4>Notes</h4>
|
||||
<p><a name="footnote1">[1]</a>
|
||||
As a user you should not care about <tt>DenseVector</tt> being a refinement of the VectorExpression. Being a refinement of the VectorExpression is only important for the template-expression engine but not the user.
|
||||
<a name="element_access_note">[1]</a>The <code>operator[]</code> is added purely for convenience
|
||||
and compatibility with the <code>std::vector</code>. In uBLAS however,
|
||||
generally <code>operator()</code> is used for indexing because this can be
|
||||
used for both vectors and matrices.
|
||||
</body>
|
||||
</html>
|
||||
1027
doc/expression_concept.htm
Normal file
1027
doc/expression_concept.htm
Normal file
File diff suppressed because it is too large
Load Diff
1182
doc/iterator_concept.htm
Normal file
1182
doc/iterator_concept.htm
Normal file
File diff suppressed because it is too large
Load Diff
210
doc/range.htm
Normal file
210
doc/range.htm
Normal file
@@ -0,0 +1,210 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
||||
<link href="ublas.css" type="text/css" />
|
||||
<title>Range and slice</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
Range and Slice Storage</h1>
|
||||
<h2><a name="range" id="range"></a>Range<SizeType,DistanceType></h2>
|
||||
<h4>Description</h4>
|
||||
<p>The class <code>range</code> specifies a range of indicies. The range is a sequence of indices
|
||||
from a start value to stop value. The indices increase by one and exlude the stop value.
|
||||
<code>range</code> can therefore be used to specify ranges of elements from vectors and matrices.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/storage.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
range r (0, 3);
|
||||
for (unsigned i = 0; i < r.size (); ++ i) {
|
||||
std::cout << r (i) << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header storage.hpp.</p>
|
||||
<h4>Model of</h4>
|
||||
<p>Reversible Container.</p>
|
||||
<h4>Type requirements</h4>
|
||||
<p>None, except for those imposed by the requirements of Reversible
|
||||
Container.</p>
|
||||
<h4>Public base classes</h4>
|
||||
<p>None.</p>
|
||||
<h4>Members</h4>
|
||||
<table border="1" summary="members">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Member</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>range (size_type start, size_type stop)</code></td>
|
||||
<td>Constructs a range of indicies from <code>start</code> to <code>stop (excluded)</code>
|
||||
.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type start () const</code></td>
|
||||
<td>Returns the beginning of the <code>range</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type size () const</code></td>
|
||||
<td>Returns the size of the <code>range</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator [] (size_type i)
|
||||
const</code></td>
|
||||
<td>Returns the value <code>start + i</code> of the <code>i</code>
|
||||
-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>range compose (const range &r) const</code></td>
|
||||
<td>Returns the composite range from <code>start + r.start
|
||||
()</code> to <code>start + r.start () + r.size ()</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bool operator == (const range &r) const</code></td>
|
||||
<td>Tests two ranges for equality.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bool operator != (const range &r) const</code></td>
|
||||
<td>Tests two ranges for inequality.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator begin () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the beginning
|
||||
of the <code>range</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator end () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the end of
|
||||
the <code>range</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rbegin () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
beginning of the reversed <code>range</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rend () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
end of the reversed <code>range</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Preconditions</h4>
|
||||
<ul>
|
||||
<li><code>start () <= stop ()</code></li>
|
||||
</ul>
|
||||
|
||||
<h2><a name="slice" id="slice"></a> Slice<SizeType,DistanceType></h2>
|
||||
<h4>Description</h4>
|
||||
<p>The class <code>slice</code> specifies a 'slice' of indicies. Slices are more general
|
||||
then ranges, the stride allows the sequence of indicies to increase and decrease by the specified amount between element.
|
||||
<code>slice</code> can therefore be used to specify slices of element from vectors and matrices.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/storage.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
slice s (0, 1, 3);
|
||||
for (unsigned i = 0; i < s.size (); ++ i) {
|
||||
std::cout << s (i) << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header storage.hpp.</p>
|
||||
<h4>Model of</h4>
|
||||
<p>Reversible Container.</p>
|
||||
<h4>Type requirements</h4>
|
||||
<p>None, except for those imposed by the requirements of Reversible
|
||||
Container.</p>
|
||||
<h4>Public base classes</h4>
|
||||
<p>None.</p>
|
||||
<h4>Members</h4>
|
||||
<table border="1" summary="members">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Member</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>slice (size_type start, size_type stride, size_type
|
||||
size)</code></td>
|
||||
<td>Constructs a slice <code>start,start+stride,start+2*stride...</code> with
|
||||
<code>size</code> elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type start () const</code></td>
|
||||
<td>Returns the beginning of the <code>slice</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type stride () const</code></td>
|
||||
<td>Returns the stride of the <code>slice</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type size () const</code></td>
|
||||
<td>Returns the size of the <code>slice</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator [] (size_type i)
|
||||
const</code></td>
|
||||
<td>Returns the value <code>start + i * stride</code> of the
|
||||
<code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>slice compose (const range &r) const</code></td>
|
||||
<td>Returns the composite slice from <code>start + stride * r.start
|
||||
()</code> to <code>start + stride * (r.start () + r.size ())</code>
|
||||
with stride <code>stride</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>slice compose (const slice &s) const</code></td>
|
||||
<td>Returns the composite slice from <code>start + stride * s.start
|
||||
()</code> to <code>start + stride * s.stride () * (s.start () +
|
||||
s.size ())</code> with stride <code>stride * s.stride ()</code>
|
||||
.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bool operator == (const slice &s) const</code></td>
|
||||
<td>Tests two slices for equality.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>bool operator != (const slice &s) const</code></td>
|
||||
<td>Tests two slices for inequality.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator begin () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the beginning
|
||||
of the <code>slice</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator end () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the end of
|
||||
the <code>slice</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rbegin () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
beginning of the reversed <code>slice</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rend () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
end of the reversed <code>slice</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Preconditions</h4>
|
||||
<ul>
|
||||
<li>None all strides are vaild. However when an index is returned or an iterator is dereferenced its
|
||||
value must be representable as the size_type.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
139
doc/storage_concept.htm
Normal file
139
doc/storage_concept.htm
Normal file
@@ -0,0 +1,139 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=us-ascii" />
|
||||
<link href="ublas.css" type="text/css" />
|
||||
<title>Storage concept</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
Storage concept</h1>
|
||||
<h2><a name="range" id="range"></a>Storage concept</h2>
|
||||
<h4>Description</h4>
|
||||
<p>Storage is a variable-size container whose elements are arranged in a strict linear order.
|
||||
<p>Storage extends the Container concept with some Sequence-like functionality. The main difference with
|
||||
the Sequence concept however is that the Storage concept does not require default-initialisation of its
|
||||
elements.
|
||||
<h4>Refinement of</h4>
|
||||
<a href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random Access Container</a>
|
||||
and
|
||||
<a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">Default Constructible</a>
|
||||
<h4>Associated types</h4>
|
||||
No additional types beyond those defined by
|
||||
<a href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random Access Container</a>
|
||||
<h4>Notation</h4>
|
||||
<table summary="storage types">
|
||||
<tr><td><tt>X</tt></td><td>A type that is model of Storage</td></tr>
|
||||
<tr><td><tt>T</tt></td><td>The value_type of <tt>X</tt></td></tr>
|
||||
<tr><td><tt>t</tt></td><td>An object of type <tt>T</tt></td></tr>
|
||||
<tr><td><tt>n</tt></td><td>object of type convertible to <tt>X::size_type</tt></td></tr>
|
||||
</table>
|
||||
<h4>Definitions</h4>
|
||||
<h4>Valid expressions</h4>
|
||||
In addition to the expressions defined in
|
||||
<a href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random Access Container</a>,
|
||||
and
|
||||
<a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">Default Constructible</a>
|
||||
the following expressions must be valid:
|
||||
<table border="1" summary="type requirements">
|
||||
<TR><TH>Name</TH><TH>Expression</TH><TH>Type requirements</TH><TH>Return type</TH></TR>
|
||||
<TR>
|
||||
<td>Size constructor</td>
|
||||
<td><tt>X(n)</tt></td>
|
||||
<td>T is <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible</a></td>
|
||||
<td><tt>X</tt></td>
|
||||
</TR>
|
||||
<TR>
|
||||
<td>Fill constructor</td>
|
||||
<td><tt>X(n,t)</tt></td>
|
||||
<td></td>
|
||||
<td><tt>X</tt></td>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Range constructor</TD>
|
||||
<TD><tt>X(i, j)</tt></TD>
|
||||
<TD><tt>i</tt> and <tt>j</tt> are <A href="http://www.sgi.com/tech/stl/InputIterator.html">Input Iterators</A> whose value type is convertible to <tt>T</tt> </TD>
|
||||
<TD><tt>X</tt> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Resize</TD>
|
||||
<TD><tt>a.resize(n, t)</tt></TD>
|
||||
<TD><tt>a</tt> is mutable</TD>
|
||||
<TD><tt>void</tt></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Resize</TD>
|
||||
<TD><tt>a.resize(n)</tt></TD>
|
||||
<TD><tt>a</tt> is mutable</TD>
|
||||
<TD><tt>void</tt></TD>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Expression semantics</h3>
|
||||
<table border="1" summary="expresisons">
|
||||
<tr><th>Name<th>Expression<th>Precondition<th>Semantics<th>Postcondition
|
||||
<tr>
|
||||
<td>Default-constructor</td>
|
||||
<td><tt>X()</tt>
|
||||
<td></td>
|
||||
<td>Creates 0 elements.
|
||||
</td>
|
||||
<td><tt>size()==0</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Size-constructor</td>
|
||||
<td><tt>X(n)</tt>
|
||||
<td><tt>n>=0</tt></td>
|
||||
<td>Creates n elements. Elements are constructed without an initializer. That is
|
||||
if T is a (possibly cv-qualified) non-POD class type (or array thereof), the object is default
|
||||
initialized. Otherwise, the object created has indeterminate value. See the sentance
|
||||
"If new initializer is omitted" in section 5.3.4 paragraph 15 of the ISO C++ standard.
|
||||
</td>
|
||||
<td><tt>size()==n</tt></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fill-constructor</td>
|
||||
<td><tt>X(n,t)</tt>
|
||||
<td><tt>n>=0</tt></td>
|
||||
<td>Creates n initialised element with copies of <code>t</code></td>
|
||||
<td><tt>size()==n</tt></td>
|
||||
</tr>
|
||||
<TR>
|
||||
<TD>Range constructor</TD>
|
||||
<TD><tt>X(i, j)</tt></TD>
|
||||
<TD><tt>[i,j)</tt> is a valid range.</TD>
|
||||
<TD>copies the range <tt>[i,j) to the storage</tt></TD>
|
||||
<TD><tt>size()</tt> is equal to the distance from <tt>i</tt> to <tt>j</tt>. Each element is a copy of the corresponding element in the range <tt>[i,j)</tt>.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Resize</TD>
|
||||
<TD><tt>a.resize(n, t)</tt></TD>
|
||||
<TD><tt>n <= a.max_size()</tt></TD>
|
||||
<td>Modified the container so that it has exactly <tt>n</tt> elements.<br />
|
||||
The container may be reallocated if its size changes.
|
||||
Existing element values are preserved, additional elements are copies of <code>t</code>.</td>
|
||||
<TD><tt>a.size() == n</tt></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD>Resize</TD>
|
||||
<TD><tt>a.resize(n)</tt></TD>
|
||||
<TD><tt>n <= a.max_size()</tt></TD>
|
||||
<TD>Modified the container so that it has exactly <tt>n</tt> elements.<br />
|
||||
The container may be reallocated if its size changes. Element values are undefined. That is
|
||||
each element value may be a previously assigned value or the value when it was constructed.</TD>
|
||||
<TD><tt>a.size() == n</tt></TD>
|
||||
</tr>
|
||||
</table>
|
||||
<h4>Complexity guarantees</h4>
|
||||
<h4>Invariants</h4>
|
||||
<h4>Models</h4>
|
||||
<ul>
|
||||
<li><a href="unbounded_array.htm">unbounded_array</a>
|
||||
<li><a href="bounded_array.htm">bounded_array</a>
|
||||
<li><a href="range.htm">range, slice</a>
|
||||
</ul>
|
||||
<h4>Notes</h4>
|
||||
|
||||
758
doc/tidy.htm
Normal file
758
doc/tidy.htm
Normal file
@@ -0,0 +1,758 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="generator" content=
|
||||
"HTML Tidy for Windows (vers 1st September 2004), see www.w3.org" />
|
||||
<meta http-equiv="Content-Type" content=
|
||||
"text/html; charset=us-ascii" />
|
||||
<link href="ublas.css" type="text/css" />
|
||||
<title>Vector</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
Vector</h1>
|
||||
<h2><a name="vector" id="vector"></a> Vector</h2>
|
||||
<h4>Description</h4>
|
||||
<p>The templated class <code>vector<T, A></code> is the base
|
||||
container adaptor for dense vectors. For a <em>n</em>-dimensional
|
||||
vector and <em>0 <= i < n</em> every element
|
||||
<em>v</em><sub><em>i</em></sub> is mapped to the <em>i-</em>th
|
||||
element of the container.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v (3);
|
||||
for (unsigned i = 0; i < v.size (); ++ i)
|
||||
v (i) = i;
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header vector.hpp.</p>
|
||||
<h4>Template parameters</h4>
|
||||
<table border="1" summary="parameters">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>T</code></td>
|
||||
<td>The type of object stored in the vector.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>A</code></td>
|
||||
<td>The type of the adapted array. <a href="#vector_1">[1]</a></td>
|
||||
<td><code>unbounded_array<T></code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Model of</h4>
|
||||
<p><a href="container.htm#vector">Vector</a> .</p>
|
||||
<h4>Type requirements</h4>
|
||||
<p>None, except for those imposed by the requirements of <a href=
|
||||
"container.htm#vector">Vector</a> .</p>
|
||||
<h4>Public base classes</h4>
|
||||
<p><code>vector_expression<vector<T, A> ></code></p>
|
||||
<h4>Members</h4>
|
||||
<table border="1" summary="members">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Member</th>
|
||||
<th>Where defined</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>value_type</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reference</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>difference_type</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>array_type</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>vector ()</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Allocates an uninitialized <code>vector</code> that holds zero
|
||||
elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>vector (size_type size)</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td>Allocates an uninitialized <code>vector</code> that holds
|
||||
<code>size</code> elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>vector (const vector &v)</code></td>
|
||||
<td></td>
|
||||
<td>The copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
vector (const vector_expression<AE> &ae)</code></td>
|
||||
<td></td>
|
||||
<td>The extended copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void resize (size_type size, bool preserve =
|
||||
true)</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td>Reallocates a <code>vector</code> to hold <code>size</code>
|
||||
elements. The existing elements of the <code>vector</code> are
|
||||
preseved when specified.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type size () const</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns the size of the <code>vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const array_type& data () const</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>array_type& data ()</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator () (size_type i)
|
||||
const</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a <code>const</code> reference of the <code>i</code>
|
||||
-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reference operator () (size_type i)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a reference of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator [] (size_type i)
|
||||
const</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td>Returns a <code>const</code> reference of the <code>i</code>
|
||||
-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reference operator [] (size_type i)</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td>Returns a reference of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>vector &operator = (const vector &v)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>The assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>vector &assign_temporary (vector &v)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Assigns a temporary. May change the vector <code>v</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
vector &operator = (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>The extended assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
vector &assign (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Assigns a vector expression to the vector. Left and right hand
|
||||
side of the assignment should be independent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
vector &operator += (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>A computed assignment operator. Adds the vector expression to
|
||||
the vector.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
vector &plus_assign (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Adds a vector expression to the vector. Left and right hand
|
||||
side of the assignment should be independent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
vector &operator -= (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>A computed assignment operator. Subtracts the vector expression
|
||||
from the vector.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
vector &minus_assign (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Subtracts a vector expression from the vector. Left and right
|
||||
hand side of the assignment should be independent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AT><br />
|
||||
vector &operator *= (const AT &at)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>A computed assignment operator. Multiplies the vector with a
|
||||
scalar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AT><br />
|
||||
vector &operator /= (const AT &at)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>A computed assignment operator. Divides the vector through a
|
||||
scalar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void swap (vector &v)</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Swaps the contents of the vectors.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void insert (size_type i, const_reference t)</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td>Inserts the value <code>t</code> at the <code>i</code>-th
|
||||
element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void erase (size_type i)</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td>Erases the value at the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void clear ()</code></td>
|
||||
<td><a href="container_concept.htm#vector">Vector</a></td>
|
||||
<td>Clears the vector.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator begin () const</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the beginning
|
||||
of the <code>vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator end () const</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the end of
|
||||
the <code>vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator begin ()</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a <code>iterator</code> pointing to the beginning of
|
||||
the <code>vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator end ()</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a <code>iterator</code> pointing to the end of the
|
||||
<code>vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rbegin () const</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
beginning of the reversed <code>vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rend () const</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
end of the reversed <code>vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator rbegin ()</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a <code>reverse_iterator</code> pointing to the
|
||||
beginning of the reversed <code>vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator rend ()</code></td>
|
||||
<td><a href=
|
||||
"expression_concept.htm#vector_expression">VectorExpression</a></td>
|
||||
<td>Returns a <code>reverse_iterator</code> pointing to the end of
|
||||
the reversed <code>vector</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Notes</h4>
|
||||
<p><a name="vector_1" id="vector_1">[1]</a> Supported parameters
|
||||
for the adapted array are <code>unbounded_array<T></code> ,
|
||||
<code>bounded_array<T></code> and
|
||||
<code>std::vector<T></code> .</p>
|
||||
<h2><a name="unit_vector" id="unit_vector"></a> Unit Vector</h2>
|
||||
<h4>Description</h4>
|
||||
<p>The templated class <code>unit_vector<T></code> represents
|
||||
canonical unit vectors. For the <em>k</em>-th
|
||||
<em>n</em>-dimensional canonical unit vector and <em>0 <= i <
|
||||
n</em> holds <em>u</em><sup><em>k</em></sup><sub><em>i</em></sub>
|
||||
<em>= 0</em>, if <em>i <> k</em>, and
|
||||
<em>u</em><sup><em>k</em></sup><sub><em>i</em></sub> <em>=
|
||||
1</em>.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
for (int i = 0; i < 3; ++ i) {
|
||||
unit_vector<double> v (3, i);
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header vector.hpp.</p>
|
||||
<h4>Template parameters</h4>
|
||||
<table border="1" summary="parameters">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>T</code></td>
|
||||
<td>The type of object stored in the vector.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Model of</h4>
|
||||
<p><a href="expression_concept.htm#vector_expression">Vector
|
||||
Expression</a> .</p>
|
||||
<h4>Type requirements</h4>
|
||||
<p>None, except for those imposed by the requirements of <a href=
|
||||
"expression_concept.htm#vector_expression">Vector Expression</a>
|
||||
.</p>
|
||||
<h4>Public base classes</h4>
|
||||
<p><code>vector_expression<unit_vector<T> ></code></p>
|
||||
<h4>Members</h4>
|
||||
<table border="1" summary="members">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Member</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unit_vector ()</code></td>
|
||||
<td>Constructs an <code>unit_vector</code> that holds zero
|
||||
elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unit_vector (size_type size, size_type index)</code></td>
|
||||
<td>Constructs the <code>index</code>-th <code>unit_vector</code>
|
||||
that holds <code>size</code> elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unit_vector (const unit_vector &v)</code></td>
|
||||
<td>The copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void resize (size_type size, bool preserve =
|
||||
true)</code></td>
|
||||
<td>Resizes a <code>unit_vector</code> to hold <code>size</code>
|
||||
elements. Therefore the existing elements of the
|
||||
<code>unit_vector</code> are always preseved.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type size () const</code></td>
|
||||
<td>Returns the size of the <code>unit_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type index () const</code></td>
|
||||
<td>Returns the index of the <code>unit_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator () (size_type i)
|
||||
const</code></td>
|
||||
<td>Returns the value of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator [] (size_type i)
|
||||
const</code></td>
|
||||
<td>Returns the value of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unit_vector &operator = (const unit_vector
|
||||
&v)</code></td>
|
||||
<td>The assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unit_vector &assign_temporary (unit_vector
|
||||
&v)</code></td>
|
||||
<td>Assigns a temporary. May change the unit vector <code>v</code>
|
||||
.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void swap (unit_vector &v)</code></td>
|
||||
<td>Swaps the contents of the unit vectors.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator begin () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the beginning
|
||||
of the <code>unit_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator end () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the end of
|
||||
the <code>unit_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rbegin () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
beginning of the reversed <code>unit_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rend () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
end of the reversed <code>unit_vector</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2><a name="zero_vector" id="zero_vector"></a> Zero Vector</h2>
|
||||
<h4>Description</h4>
|
||||
<p>The templated class <code>zero_vector<T></code> represents
|
||||
zero vectors. For a <em>n</em>-dimensional zero vector and <em>0
|
||||
<= i < n</em> holds <em>z</em><sub><em>i</em></sub> <em>=
|
||||
0</em>.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
zero_vector<double> v (3);
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header vector.hpp.</p>
|
||||
<h4>Template parameters</h4>
|
||||
<table border="1" summary="parameters">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>T</code></td>
|
||||
<td>The type of object stored in the vector.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Model of</h4>
|
||||
<p><a href="expression_concept.htm#vector_expression">Vector
|
||||
Expression</a> .</p>
|
||||
<h4>Type requirements</h4>
|
||||
<p>None, except for those imposed by the requirements of <a href=
|
||||
"expression_concept.htm#vector_expression">Vector Expression</a>
|
||||
.</p>
|
||||
<h4>Public base classes</h4>
|
||||
<p><code>vector_expression<zero_vector<T> ></code></p>
|
||||
<h4>Members</h4>
|
||||
<table border="1" summary="members">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Member</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>zero_vector ()</code></td>
|
||||
<td>Constructs a <code>zero_vector</code> that holds zero
|
||||
elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>zero_vector (size_type size)</code></td>
|
||||
<td>Constructs a <code>zero_vector</code> that holds
|
||||
<code>size</code> elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>zero_vector (const zero_vector &v)</code></td>
|
||||
<td>The copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void resize (size_type size, bool preserve =
|
||||
true)</code></td>
|
||||
<td>Resizes a <code>zero_vector</code> to hold <code>size</code>
|
||||
elements. Therefore the existing elements of the
|
||||
<code>zero_vector</code> are always preseved.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type size () const</code></td>
|
||||
<td>Returns the size of the <code>zero_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator () (size_type i)
|
||||
const</code></td>
|
||||
<td>Returns the value of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator [] (size_type i)
|
||||
const</code></td>
|
||||
<td>Returns the value of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>zero_vector &operator = (const zero_vector
|
||||
&v)</code></td>
|
||||
<td>The assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>zero_vector &assign_temporary (zero_vector
|
||||
&v)</code></td>
|
||||
<td>Assigns a temporary. May change the zero vector <code>v</code>
|
||||
.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void swap (zero_vector &v)</code></td>
|
||||
<td>Swaps the contents of the zero vectors.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator begin () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the beginning
|
||||
of the <code>zero_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator end () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the end of
|
||||
the <code>zero_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rbegin () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
beginning of the reversed <code>zero_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rend () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
end of the reversed <code>zero_vector</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2><a name="scalar_vector" id="scalar_vector"></a> Scalar
|
||||
Vector</h2>
|
||||
<h4>Description</h4>
|
||||
<p>The templated class <code>scalar_vector<T></code>
|
||||
represents scalar vectors. For a <em>n</em>-dimensional scalar
|
||||
vector and <em>0 <= i < n</em> holds
|
||||
<em>z</em><sub><em>i</em></sub> <em>= s</em>.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
scalar_vector<double> v (3);
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header vector.hpp.</p>
|
||||
<h4>Template parameters</h4>
|
||||
<table border="1" summary="parameters">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>T</code></td>
|
||||
<td>The type of object stored in the vector.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Model of</h4>
|
||||
<p><a href="expression_concept.htm#vector_expression">Vector
|
||||
Expression</a> .</p>
|
||||
<h4>Type requirements</h4>
|
||||
<p>None, except for those imposed by the requirements of <a href=
|
||||
"expression_concept.htm#vector_expression">Vector Expression</a>
|
||||
.</p>
|
||||
<h4>Public base classes</h4>
|
||||
<p><code>vector_expression<scalar_vector<T>
|
||||
></code></p>
|
||||
<h4>Members</h4>
|
||||
<table border="1" summary="members">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Member</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>scalar_vector ()</code></td>
|
||||
<td>Constructs a <code>scalar_vector</code> that holds zero
|
||||
elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>scalar_vector (size_type size, const value_type
|
||||
&value)</code></td>
|
||||
<td>Constructs a <code>scalar_vector</code> that holds
|
||||
<code>size</code> elements each of the specified value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>scalar_vector (const scalar_vector &v)</code></td>
|
||||
<td>The copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void resize (size_type size, bool preserve =
|
||||
true)</code></td>
|
||||
<td>Resizes a <code>scalar_vector</code> to hold <code>size</code>
|
||||
elements. Therefore the existing elements of the
|
||||
<code>scalar_vector</code> are always preseved.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type size () const</code></td>
|
||||
<td>Returns the size of the <code>scalar_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator () (size_type i)
|
||||
const</code></td>
|
||||
<td>Returns the value of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator [] (size_type i)
|
||||
const</code></td>
|
||||
<td>Returns the value of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>scalar_vector &operator = (const scalar_vector
|
||||
&v)</code></td>
|
||||
<td>The assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>scalar_vector &assign_temporary (scalar_vector
|
||||
&v)</code></td>
|
||||
<td>Assigns a temporary. May change the scalar vector
|
||||
<code>v</code> .</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void swap (scalar_vector &v)</code></td>
|
||||
<td>Swaps the contents of the scalar vectors.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator begin () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the beginning
|
||||
of the <code>scalar_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator end () const</code></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the end of
|
||||
the <code>scalar_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rbegin () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
beginning of the reversed <code>scalar_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rend () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
||||
end of the reversed <code>scalar_vector</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<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>
|
||||
206
doc/unbounded_array.htm
Normal file
206
doc/unbounded_array.htm
Normal file
@@ -0,0 +1,206 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
||||
<link href="ublas.css" type="text/css" />
|
||||
<title>Unbounded array</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
Unbounded Array Storage</h1>
|
||||
<h2><a name="unbounded_array" id="unbounded_array"></a> Unbounded Array<T,Alloc></h2>
|
||||
<h4>Description</h4>
|
||||
<p>The templated class <code>unbounded_array<T, ALLOC></code> implements a unbounded storage array using an allocator.
|
||||
The unbounded array is similar to a <code>std::vector</code> in that in can grow in size beyond any fixed bound.
|
||||
However <code>unbounded_array</code> is aimed at optimal performance. Therefore <code>unbounded_array</code> does not model a
|
||||
<code>Sequence</code> like <code>std::vector</code> does.
|
||||
<p>When resized <code>unbounded_array</code> will reallocate it's storage even if the new size requirement is smaller. It is therefore inefficient to resize a <code>unbounded_array</code></p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/storage.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
unbounded_array<double> a (3);
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {
|
||||
a [i] = i;
|
||||
std::cout << a [i] << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header storage.hpp.</p>
|
||||
<h4>Template parameters</h4>
|
||||
<table border="1" summary="parameters">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Parameter</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>T</code></td>
|
||||
<td>The type of object stored in the array.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>ALLOC</code></td>
|
||||
<td>An STL Allocator</td>
|
||||
<td>std::allocator</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Model of</h4>
|
||||
<p><a href="Storage.htm">Storage</a></p>
|
||||
<h4>Type requirements</h4>
|
||||
<p>None, except for those imposed by the requirements of Random
|
||||
Access Container.</p>
|
||||
<h4>Public base classes</h4>
|
||||
<p>None.</p>
|
||||
<h4>Members</h4>
|
||||
Editor's notes:
|
||||
<ul>
|
||||
<li>The description does not describe what the member actually does, this can be looked up
|
||||
in the corresponding concept documentation, but instead contains a remark on the implementation of the
|
||||
member inside this model of the concept.</li>
|
||||
<li>Type setting:
|
||||
<ul>
|
||||
<li>Members that currently lack are <font color="red">in red</font>.</li>
|
||||
<li>Members that are not part of the implemented concepts are <font color="blue">in blue</font>.</li>
|
||||
<li>Differences compared to the concept are in <em>italics</em>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<table border="1" summary="members">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Member</th>
|
||||
<th>Where defined</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr><td><code>value_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td></tr>
|
||||
<tr><td><code>pointer</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>value_type*</code></td></tr>
|
||||
<tr><td><code>const_pointer</code></td><td></td><td>Currently defined as <code>value_type*</code></td></tr>
|
||||
<tr><td><code>reference</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>value_type&</code></td></tr>
|
||||
<tr><td><code>const_reference</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>const value_type&</code></td></tr>
|
||||
<tr><td><code>size_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>Alloc::size_type</code></td></tr>
|
||||
<tr><td><code>difference_type</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>Alloc::difference_type</code></td></tr>
|
||||
<tr><td><code>iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>pointer</code></td></tr>
|
||||
<tr><td><code>const_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>const_pointer</code></td></tr>
|
||||
<tr><td><code>revere_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>std::reverse_iterator<iterator></code></td></tr>
|
||||
<tr><td><code>const_revere_iterator</code></td><td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td><td>Currently defined as <code>std::reverse_iterator<const_iterator></code></td></tr>
|
||||
<tr><td><font color="blue"><code>allocator_type</code></code></td><td></td><td>Defined as ALLOC</td></tr>
|
||||
<tr>
|
||||
<td><code><em>explicit</em> unbounded_array (<em>ALLOC &a = ALLOC()</em>)</code></td>
|
||||
<td><a href="Storage.htm">Storage</a></td>
|
||||
<td>Creates an <code>unbounded_array</code> that holds at most zero elements, using a specified allocator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code><em>explicit</em> unbounded_array (size_type size<em>, ALLOC &a = ALLOC()</em>)</code></td>
|
||||
<td><a href="Storage.htm">Storage</a></td>
|
||||
<td>Creates a uninitialized <code>unbounded_array</code> that holds at most <code>size</code> elements, using a specified allocator. All the elements are constructed without an initializer. </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code><em>explicit </em>unbounded_array (size_type size, const T& init<em>, ALLOC& a = ALLOC()</em>)</code></td>
|
||||
<td><a href="Storage.htm">Storage</a></td>
|
||||
<td>Creates an initialized <code>unbounded_array</code> that holds at most <code>size</code> elements, using a specified allocator. All the elements are constructed from the <code>init</code> value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unbounded_array (const unbounded_array &a)</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>The copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>~unbounded_array ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Deallocates the <code>unbounded_array</code> itself.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font color="red"><code>void resize (size_type n <em>, bool preserve = true</em>)</code></font></td>
|
||||
<td><a href="Storage.htm">Storage</a></td>
|
||||
<td>Reallocates an <code>unbounded_array</code> to hold at most <code>n</code> elements. When <code>preserve == false</code> the elements values after resize are undefined.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void resize(size_type n, const T& t)</code></font></td>
|
||||
<td><a href="Storage.htm">Storage</a></td>
|
||||
<td>Reallocates an <code>unbounded_array</code> to hold at most <code>n</code> elements.
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type size () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns the size of the <code>unbounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator [] (size_type i) const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>const</code> reference of the <code>i</code> -th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reference operator [] (size_type i)</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a reference of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unbounded_array &operator = (const unbounded_array &a)</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>The assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font color="blue"><code>unbounded_array &assign_temporary (unbounded_array &a)</code></font></td>
|
||||
<td></td>
|
||||
<td>Assigns a temporary. May change the array <code>a</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void swap (unbounded_array &a)</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Swaps the contents of the arrays.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator begin () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the beginning
|
||||
of the <code>unbounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator end () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>const_iterator</code> pointing to the end of
|
||||
the <code>unbounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator begin ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>iterator</code> pointing to the beginning of
|
||||
the <code>unbounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator end ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/Container.html">Container</a></td>
|
||||
<td>Returns a <code>iterator</code> pointing to the end of the
|
||||
<code>unbounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rbegin () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the beginning of the reversed <code>unbounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator rend () const</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
|
||||
<td>Returns a <code>const_reverse_iterator</code> pointing to the end of the reversed <code>unbounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator rbegin ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
|
||||
<td>Returns a <code>reverse_iterator</code> pointing to the beginning of the reversed <code>unbounded_array</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator rend ()</code></td>
|
||||
<td><a href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible Container</a></td>
|
||||
<td>Returns a <code>reverse_iterator</code> pointing to the end of the reversed <code>unbounded_array</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
0
doc/vector.html
Normal file
0
doc/vector.html
Normal file
Reference in New Issue
Block a user