mirror of
https://github.com/boostorg/ublas.git
synced 2026-02-22 15:52:18 +00:00
Update doc matches name change sparse_ to mapped_
This commit is contained in:
@@ -1,224 +0,0 @@
|
||||
<!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>
|
||||
@@ -86,7 +86,7 @@ Access Column/Row Iterator</a></li>
|
||||
</li>
|
||||
<li><a href="vector_sparse.htm">Sparse Vector</a>
|
||||
<ul>
|
||||
<li><a href="vector_sparse.htm#sparse_vector">Sparse
|
||||
<li><a href="vector_sparse.htm#mapped_vector">Sparse
|
||||
Vector</a></li>
|
||||
<li><a href="vector_sparse.htm#compressed_vector">Compressed
|
||||
Vector</a></li>
|
||||
@@ -152,7 +152,7 @@ Adaptor</a></li>
|
||||
</li>
|
||||
<li><a href="matrix_sparse.htm">Sparse Matrix</a>
|
||||
<ul>
|
||||
<li><a href="matrix_sparse.htm#sparse_matrix">Sparse
|
||||
<li><a href="matrix_sparse.htm#mapped_matrix">Sparse
|
||||
Matrix</a></li>
|
||||
<li><a href="matrix_sparse.htm#compressed_matrix">Compressed
|
||||
Matrix</a></li>
|
||||
|
||||
@@ -11,14 +11,12 @@
|
||||
</head>
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
Sparse Matrix</h1>
|
||||
<h2><a name="sparse_matrix" id="sparse_matrix"></a> Sparse
|
||||
Matrix</h2>
|
||||
Sparse Matricies</h1>
|
||||
<h2><a name="mapped_matrix" id="mapped_matrix"></a>Mapped Matrix</h2>
|
||||
<h4>Description</h4>
|
||||
<!---->
|
||||
<p>The templated class <code>sparse_matrix<T, F, A></code> is
|
||||
the base container adaptor for sparse matrices. For a <em>(m x
|
||||
n</em>)-dimensional sparse matrix and <em>0 <= i < m</em>,
|
||||
<p>The templated class <code>mapped_matrix<T, F, A></code> is
|
||||
the base container adaptor for sparse matricies using element maps.
|
||||
For a <em>(m xn</em>)-dimensional sparse matrix and <em>0 <= i < m</em>,
|
||||
<em>0 <= j < n</em> the non-zero elements
|
||||
<em>m</em><sub><em>i, j</em></sub> are mapped via <em>(i x n +
|
||||
j)</em> for row major orientation or via <em>(i + j x m)</em> for
|
||||
@@ -46,7 +44,7 @@ orientation.</p>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
sparse_matrix<double> m (3, 3, 3 * 3);
|
||||
mapped_matrix<double> m (3, 3, 3 * 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
@@ -65,19 +63,19 @@ int main () {
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>T</code></td>
|
||||
<td>The type of object stored in the sparse matrix.</td>
|
||||
<td>The type of object stored in the mapped matrix.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>F</code></td>
|
||||
<td>Functor describing the storage organization. <a href=
|
||||
"#sparse_matrix_1">[1]</a></td>
|
||||
"#mapped_matrix_1">[1]</a></td>
|
||||
<td><code>row_major</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>A</code></td>
|
||||
<td>The type of the adapted array. <a href=
|
||||
"#sparse_matrix_2">[2]</a></td>
|
||||
"#mapped_matrix_2">[2]</a></td>
|
||||
<td><code>map_std<std::size_t, T></code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -88,7 +86,7 @@ int main () {
|
||||
<p>None, except for those imposed by the requirements of <a href=
|
||||
"container.htm#matrix">Matrix</a> .</p>
|
||||
<h4>Public base classes</h4>
|
||||
<p><code>matrix_expression<sparse_matrix<T, F, A>
|
||||
<p><code>matrix_expression<mapped_matrix<T, F, A>
|
||||
></code></p>
|
||||
<h4>Members</h4>
|
||||
<table border="1" summary="members">
|
||||
@@ -98,30 +96,30 @@ int main () {
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix ()</code></td>
|
||||
<td>Allocates a <code>sparse_matrix</code> that holds at most zero
|
||||
<td><code>mapped_matrix ()</code></td>
|
||||
<td>Allocates a <code>mapped_matrix</code> that holds at most zero
|
||||
rows of zero elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix (size_type size1, size_type2, size_type non_zeros = 0)</code></td>
|
||||
<td>Allocates a <code>sparse_matrix</code> that holds at most
|
||||
<td><code>mapped_matrix (size_type size1, size_type2, size_type non_zeros = 0)</code></td>
|
||||
<td>Allocates a <code>mapped_matrix</code> that holds at most
|
||||
<code>size1</code> rows of <code>size2</code> elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix (const sparse_matrix &m)</code></td>
|
||||
<td><code>mapped_matrix (const mapped_matrix &m)</code></td>
|
||||
<td>The copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_matrix (size_type non_zeros, const
|
||||
mapped_matrix (size_type non_zeros, const
|
||||
matrix_expression<AE> &ae)</code></td>
|
||||
<td>The extended copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void resize (size_type size1, size_type size2, bool preserve = true)</code></td>
|
||||
<td>Reallocates a <code>sparse_matrix</code> to hold at most
|
||||
<td>Reallocates a <code>mapped_matrix</code> to hold at most
|
||||
<code>size1</code> rows of <code>size2</code> elements. The
|
||||
existing elements of the <code>sparse_matrix</code> are preseved
|
||||
existing elements of the <code>mapped_matrix</code> are preseved
|
||||
when specified.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -145,72 +143,72 @@ j)</code></td>
|
||||
<code>i</code>-th row.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix &operator = (const sparse_matrix
|
||||
<td><code>mapped_matrix &operator = (const mapped_matrix
|
||||
&m)</code></td>
|
||||
<td>The assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix &assign_temporary (sparse_matrix
|
||||
<td><code>mapped_matrix &assign_temporary (mapped_matrix
|
||||
&m)</code></td>
|
||||
<td>Assigns a temporary. May change the sparse matrix
|
||||
<td>Assigns a temporary. May change the mapped matrix
|
||||
<code>m</code> .</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_matrix &operator = (const matrix_expression<AE>
|
||||
mapped_matrix &operator = (const matrix_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>The extended assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_matrix &assign (const matrix_expression<AE>
|
||||
mapped_matrix &assign (const matrix_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>Assigns a matrix expression to the sparse matrix. Left and
|
||||
<td>Assigns a matrix expression to the mapped matrix. Left and
|
||||
right hand side of the assignment should be independent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_matrix &operator += (const matrix_expression<AE>
|
||||
mapped_matrix &operator += (const matrix_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>A computed assignment operator. Adds the matrix expression to
|
||||
the sparse matrix.</td>
|
||||
the mapped matrix.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_matrix &plus_assign (const matrix_expression<AE>
|
||||
mapped_matrix &plus_assign (const matrix_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>Adds a matrix expression to the sparse matrix. Left and right
|
||||
<td>Adds a matrix expression to the mapped matrix. Left and right
|
||||
hand side of the assignment should be independent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_matrix &operator -= (const matrix_expression<AE>
|
||||
mapped_matrix &operator -= (const matrix_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>A computed assignment operator. Subtracts the matrix expression
|
||||
from the sparse matrix.</td>
|
||||
from the mapped matrix.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_matrix &minus_assign (const matrix_expression<AE>
|
||||
mapped_matrix &minus_assign (const matrix_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>Subtracts a matrix expression from the sparse matrix. Left and
|
||||
<td>Subtracts a matrix expression from the mapped matrix. Left and
|
||||
right hand side of the assignment should be independent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AT><br />
|
||||
sparse_matrix &operator *= (const AT &at)</code></td>
|
||||
<td>A computed assignment operator. Multiplies the sparse matrix
|
||||
mapped_matrix &operator *= (const AT &at)</code></td>
|
||||
<td>A computed assignment operator. Multiplies the mapped matrix
|
||||
with a scalar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AT><br />
|
||||
sparse_matrix &operator /= (const AT &at)</code></td>
|
||||
<td>A computed assignment operator. Divides the sparse matrix
|
||||
mapped_matrix &operator /= (const AT &at)</code></td>
|
||||
<td>A computed assignment operator. Divides the mapped matrix
|
||||
through a scalar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void swap (sparse_matrix &m)</code></td>
|
||||
<td>Swaps the contents of the sparse matrices.</td>
|
||||
<td><code>void swap (mapped_matrix &m)</code></td>
|
||||
<td>Swaps the contents of the mapped matrices.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>true_refrence insert_element (size_type i, size_type j, const_reference
|
||||
@@ -225,95 +223,95 @@ element of the <code>i</code>-th row. Duplicates elements are not allowed.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void clear ()</code></td>
|
||||
<td>Clears the sparse matrix.</td>
|
||||
<td>Clears the mapped matrix.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator1 begin1 () const</code></td>
|
||||
<td>Returns a <code>const_iterator1</code> pointing to the
|
||||
beginning of the <code>sparse_matrix</code>.</td>
|
||||
beginning of the <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator1 end1 () const</code></td>
|
||||
<td>Returns a <code>const_iterator1</code> pointing to the end of
|
||||
the <code>sparse_matrix</code>.</td>
|
||||
the <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator1 begin1 ()</code></td>
|
||||
<td>Returns a <code>iterator1</code> pointing to the beginning of
|
||||
the <code>sparse_matrix</code>.</td>
|
||||
the <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator1 end1 ()</code></td>
|
||||
<td>Returns a <code>iterator1</code> pointing to the end of the
|
||||
<code>sparse_matrix</code>.</td>
|
||||
<code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator2 begin2 () const</code></td>
|
||||
<td>Returns a <code>const_iterator2</code> pointing to the
|
||||
beginning of the <code>sparse_matrix</code>.</td>
|
||||
beginning of the <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_iterator2 end2 () const</code></td>
|
||||
<td>Returns a <code>const_iterator2</code> pointing to the end of
|
||||
the <code>sparse_matrix</code>.</td>
|
||||
the <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator2 begin2 ()</code></td>
|
||||
<td>Returns a <code>iterator2</code> pointing to the beginning of
|
||||
the <code>sparse_matrix</code>.</td>
|
||||
the <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator2 end2 ()</code></td>
|
||||
<td>Returns a <code>iterator2</code> pointing to the end of the
|
||||
<code>sparse_matrix</code>.</td>
|
||||
<code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator1 rbegin1 () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator1</code> pointing to the
|
||||
beginning of the reversed <code>sparse_matrix</code>.</td>
|
||||
beginning of the reversed <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator1 rend1 () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator1</code> pointing to the
|
||||
end of the reversed <code>sparse_matrix</code>.</td>
|
||||
end of the reversed <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator1 rbegin1 ()</code></td>
|
||||
<td>Returns a <code>reverse_iterator1</code> pointing to the
|
||||
beginning of the reversed <code>sparse_matrix</code>.</td>
|
||||
beginning of the reversed <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator1 rend1 ()</code></td>
|
||||
<td>Returns a <code>reverse_iterator1</code> pointing to the end of
|
||||
the reversed <code>sparse_matrix</code>.</td>
|
||||
the reversed <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator2 rbegin2 () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator2</code> pointing to the
|
||||
beginning of the reversed <code>sparse_matrix</code>.</td>
|
||||
beginning of the reversed <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reverse_iterator2 rend2 () const</code></td>
|
||||
<td>Returns a <code>const_reverse_iterator2</code> pointing to the
|
||||
end of the reversed <code>sparse_matrix</code>.</td>
|
||||
end of the reversed <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator2 rbegin2 ()</code></td>
|
||||
<td>Returns a <code>reverse_iterator2</code> pointing to the
|
||||
beginning of the reversed <code>sparse_matrix</code>.</td>
|
||||
beginning of the reversed <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator2 rend2 ()</code></td>
|
||||
<td>Returns a <code>reverse_iterator2</code> pointing to the end of
|
||||
the reversed <code>sparse_matrix</code>.</td>
|
||||
the reversed <code>mapped_matrix</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Notes</h4>
|
||||
<p><a name="sparse_matrix_1" id="sparse_matrix_1">[1]</a> Supported
|
||||
<p><a name="mapped_matrix_1" id="mapped_matrix_1">[1]</a> Supported
|
||||
parameters for the storage organization are <code>row_major</code>
|
||||
and <code>column_major</code>.</p>
|
||||
<p><a name="sparse_matrix_2" id="sparse_matrix_2">[1]</a> Supported
|
||||
<p><a name="mapped_matrix_2" id="mapped_matrix_2">[2]</a> Supported
|
||||
parameters for the adapted array are
|
||||
<code>map_array<std::size_t, T></code> and
|
||||
<code>map_std<std::size_t, T></code>. The latter is
|
||||
|
||||
@@ -93,7 +93,7 @@ vector is zero other then a single specified element.
|
||||
<br/><code>index</code> should be less than <code>size</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector<T [, S]><br /> v(size);</code></td>
|
||||
<td><code>mapped_vector<T [, S]><br /> v(size);</code></td>
|
||||
<td>a sparse vector of values of type <code>T</code> of variable
|
||||
size. The sparse storage type <code>S</code> can be <code>std::map<size_t,
|
||||
T></code> or <code>map_array<size_t, T></code>.</td>
|
||||
@@ -242,7 +242,7 @@ variable size. Only the given triangular matrix is stored using
|
||||
the order <code>F</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix<T, [F, S]><br /> m(size1, size2 [,
|
||||
<td><code>mapped_matrix<T, [F, S]><br /> m(size1, size2 [,
|
||||
non_zeros]);</code></td>
|
||||
<td>a sparse matrix of values of type <code>T</code> of variable
|
||||
size. The sparse storage type <code>S</code> can be either <code>std::map<size_t,
|
||||
@@ -369,14 +369,14 @@ array.<br />
|
||||
The storage layout usually is BLAS compliant.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector<T,<br />
|
||||
<td><code>mapped_vector<T,<br />
|
||||
std::map<std::size_t, T> ><br />
|
||||
v (size, non_zeros)</code></td>
|
||||
<td>a sparse vector, storage is provided by a standard
|
||||
map.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector<T,<br />
|
||||
<td><code>mapped_vector<T,<br />
|
||||
map_array<std::size_t, T> ><br />
|
||||
v (size, non_zeros)</code></td>
|
||||
<td>a sparse vector, storage is provided by a map
|
||||
@@ -494,7 +494,7 @@ major.<br />
|
||||
The storage layout usually is BLAS compliant.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix<T,<br />
|
||||
<td><code>mapped_matrix<T,<br />
|
||||
row_major,<br />
|
||||
std::map<std::size_t, T> ><br />
|
||||
m (size1, size2, non_zeros)</code></td>
|
||||
@@ -502,7 +502,7 @@ The storage layout usually is BLAS compliant.</td>
|
||||
is provided by a standard map.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix<T,<br />
|
||||
<td><code>mapped_matrix<T,<br />
|
||||
column_major,<br />
|
||||
std::map<std::size_t, T> ><br />
|
||||
m (size1, size2, non_zeros)</code></td>
|
||||
@@ -510,7 +510,7 @@ is provided by a standard map.</td>
|
||||
storage is provided by a standard map.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix<T,<br />
|
||||
<td><code>mapped_matrix<T,<br />
|
||||
row_major,<br />
|
||||
map_array<std::size_t, T> ><br />
|
||||
m (size1, size2, non_zeros)</code></td>
|
||||
@@ -518,7 +518,7 @@ storage is provided by a standard map.</td>
|
||||
is provided by a map array.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_matrix<T,<br />
|
||||
<td><code>mapped_matrix<T,<br />
|
||||
column_major,<br />
|
||||
map_array<std::size_t, T> ><br />
|
||||
m (size1, size2, non_zeros)</code></td>
|
||||
|
||||
@@ -12,12 +12,10 @@
|
||||
<body>
|
||||
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
|
||||
Sparse Vector</h1>
|
||||
<h2><a name="sparse_vector" id="sparse_vector"></a> Sparse
|
||||
Vector</h2>
|
||||
<h2><a name="mapped_vector" id="mapped_vector"></a>Mapped Vector</h2>
|
||||
<h4>Description</h4>
|
||||
<!---->
|
||||
<p>The templated class <code>sparse_vector<T, A></code> is
|
||||
the base container adaptor for sparse vectors. For a
|
||||
<p>The templated class <code>mapped_vector<T, A></code> is
|
||||
the base container adaptor for sparse vectors using element maps. For a
|
||||
<em>n</em>-dimensional sparse vector and <em>0 <= i < n</em>
|
||||
the non-zero elements <em>v</em><sub><em>i</em></sub> are mapped to
|
||||
consecutive elements of the associative container, i.e. for
|
||||
@@ -34,7 +32,7 @@ i</em><sub><em>2</em></sub>.</p>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
sparse_vector<double> v (3, 3);
|
||||
mapped_vector<double> v (3, 3);
|
||||
for (unsigned i = 0; i < v.size (); ++ i)
|
||||
v (i) = i;
|
||||
std::cout << v << std::endl;
|
||||
@@ -52,13 +50,13 @@ int main () {
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>T</code></td>
|
||||
<td>The type of object stored in the sparse vector.</td>
|
||||
<td>The type of object stored in the mapped vector.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>A</code></td>
|
||||
<td>The type of the adapted array. <a href=
|
||||
"#sparse_vector_1">[1]</a></td>
|
||||
"#mapped_vector_1">[1]</a></td>
|
||||
<td><code>map_std<std::size_t, T></code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -69,7 +67,7 @@ int main () {
|
||||
<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<sparse_vector<T, A>
|
||||
<p><code>vector_expression<mapped_vector<T, A>
|
||||
></code></p>
|
||||
<h4>Members</h4>
|
||||
<table border="1" summary="members">
|
||||
@@ -79,36 +77,36 @@ int main () {
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector ()</code></td>
|
||||
<td>Allocates a <code>sparse_vector</code> that holds zero
|
||||
<td><code>mapped_vector ()</code></td>
|
||||
<td>Allocates a <code>mapped_vector</code> that holds zero
|
||||
elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector (size_type size, size_type
|
||||
<td><code>mapped_vector (size_type size, size_type
|
||||
non_zeros = 0)</code></td>
|
||||
<td>Allocates a <code>sparse_vector</code> that holds at most
|
||||
<td>Allocates a <code>mapped_vector</code> that holds at most
|
||||
<code>size</code> elements.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector (const sparse_vector &v)</code></td>
|
||||
<td><code>mapped_vector (const mapped_vector &v)</code></td>
|
||||
<td>The copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_vector (size_type non_zeros, const
|
||||
mapped_vector (size_type non_zeros, const
|
||||
vector_expression<AE> &ae)</code></td>
|
||||
<td>The extended copy constructor.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void resize (size_type size, bool
|
||||
preserve = true)</code></td>
|
||||
<td>Reallocates a <code>sparse_vector</code> to hold at most
|
||||
<td>Reallocates a <code>mapped_vector</code> to hold at most
|
||||
<code>size</code> elements. The existing elements of the
|
||||
<code>sparse_vector</code> are preseved when specified.</td>
|
||||
<code>mapped_vector</code> are preseved when specified.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>size_type size () const</code></td>
|
||||
<td>Returns the size of the <code>sparse_vector</code>.</td>
|
||||
<td>Returns the size of the <code>mapped_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>const_reference operator () (size_type i)
|
||||
@@ -129,72 +127,72 @@ const</code></td>
|
||||
<td>Returns a reference of the <code>i</code>-th element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector &operator = (const sparse_vector
|
||||
<td><code>mapped_vector &operator = (const mapped_vector
|
||||
&v)</code></td>
|
||||
<td>The assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector &assign_temporary (sparse_vector
|
||||
<td><code>mapped_vector &assign_temporary (mapped_vector
|
||||
&v)</code></td>
|
||||
<td>Assigns a temporary. May change the sparse vector
|
||||
<td>Assigns a temporary. May change the mapped vector
|
||||
<code>v</code> .</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_vector &operator = (const vector_expression<AE>
|
||||
mapped_vector &operator = (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>The extended assignment operator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_vector &assign (const vector_expression<AE>
|
||||
mapped_vector &assign (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>Assigns a vector expression to the sparse vector. Left and
|
||||
<td>Assigns a vector expression to the mapped vector. Left and
|
||||
right hand side of the assignment should be independent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_vector &operator += (const vector_expression<AE>
|
||||
mapped_vector &operator += (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>A computed assignment operator. Adds the vector expression to
|
||||
the sparse vector.</td>
|
||||
the mapped vector.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_vector &plus_assign (const vector_expression<AE>
|
||||
mapped_vector &plus_assign (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>Adds a vector expression to the sparse vector. Left and right
|
||||
<td>Adds a vector expression to the mapped vector. Left and right
|
||||
hand side of the assignment should be independent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_vector &operator -= (const vector_expression<AE>
|
||||
mapped_vector &operator -= (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>A computed assignment operator. Subtracts the vector expression
|
||||
from the sparse vector.</td>
|
||||
from the mapped vector.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AE><br />
|
||||
sparse_vector &minus_assign (const vector_expression<AE>
|
||||
mapped_vector &minus_assign (const vector_expression<AE>
|
||||
&ae)</code></td>
|
||||
<td>Subtracts a vector expression from the sparse vector. Left and
|
||||
<td>Subtracts a vector expression from the mapped vector. Left and
|
||||
right hand side of the assignment should be independent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AT><br />
|
||||
sparse_vector &operator *= (const AT &at)</code></td>
|
||||
<td>A computed assignment operator. Multiplies the sparse vector
|
||||
mapped_vector &operator *= (const AT &at)</code></td>
|
||||
<td>A computed assignment operator. Multiplies the mapped vector
|
||||
with a scalar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>template<class AT><br />
|
||||
sparse_vector &operator /= (const AT &at)</code></td>
|
||||
<td>A computed assignment operator. Divides the sparse vector
|
||||
mapped_vector &operator /= (const AT &at)</code></td>
|
||||
<td>A computed assignment operator. Divides the mapped vector
|
||||
through a scalar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void swap (sparse_vector &v)</code></td>
|
||||
<td>Swaps the contents of the sparse vectors.</td>
|
||||
<td><code>void swap (mapped_vector &v)</code></td>
|
||||
<td>Swaps the contents of the mapped vectors.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>true_reference insert_element (size_type i, const_reference t)</code></td>
|
||||
@@ -207,52 +205,52 @@ element. Duplicates elements are not allowed.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>void clear ()</code></td>
|
||||
<td>Clears the sparse vector.</td>
|
||||
<td>Clears the mapped vector.</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>sparse_vector</code>.</td>
|
||||
of the <code>mapped_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>sparse_vector</code>.</td>
|
||||
the <code>mapped_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator begin ()</code></td>
|
||||
<td>Returns a <code>iterator</code> pointing to the beginning of
|
||||
the <code>sparse_vector</code>.</td>
|
||||
the <code>mapped_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>iterator end ()</code></td>
|
||||
<td>Returns a <code>iterator</code> pointing to the end of the
|
||||
<code>sparse_vector</code>.</td>
|
||||
<code>mapped_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>sparse_vector</code>.</td>
|
||||
beginning of the reversed <code>mapped_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>sparse_vector</code>.</td>
|
||||
end of the reversed <code>mapped_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator rbegin ()</code></td>
|
||||
<td>Returns a <code>reverse_iterator</code> pointing to the
|
||||
beginning of the reversed <code>sparse_vector</code>.</td>
|
||||
beginning of the reversed <code>mapped_vector</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>reverse_iterator rend ()</code></td>
|
||||
<td>Returns a <code>reverse_iterator</code> pointing to the end of
|
||||
the reversed <code>sparse_vector</code>.</td>
|
||||
the reversed <code>mapped_vector</code>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Notes</h4>
|
||||
<p><a name="sparse_vector_1" id="sparse_vector_1">[1]</a> Supported
|
||||
<p><a name="mapped_vector_1" id="mapped_vector_1">[1]</a> Supported
|
||||
parameters for the adapted array are
|
||||
<code>map_array<std::size_t, T></code> and
|
||||
<code>map_std<std::size_t, T></code>. The latter is
|
||||
|
||||
Reference in New Issue
Block a user