2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-22 03:42:19 +00:00

Documentation update and some fixes.

svn path=/trunk/boost/libs/numeric/ublas/; revision=17184
This commit is contained in:
Jörg Walter
2003-02-04 07:22:11 +00:00
parent ffa7b2a1ac
commit eb94c15d04
77 changed files with 14864 additions and 22837 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,393 +1,422 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Container Concepts</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Container Concepts</title>
</head>
<body bgcolor="#FFFFFF">
<h1><img src="c++boost.gif" alt="c++boost.gif" align="center">Container Concepts</h1>
<h2><a name="vector"></a>Vector </h2>
<body bgcolor="#ffffff">
<h1><img src="c++boost.gif" alt="c++boost.gif" align="Center">
Container Concepts</h1>
<h2><a name="vector"></a>
Vector </h2>
<h4>Description</h4>
<p>A Vector describes common aspects of dense, packed and sparse vectors.
<p>A Vector describes common aspects of dense, packed and sparse vectors.
</p>
<h4>Refinement of </h4>
<p><a href="expression.htm#vector_expression">Vector Expression</a>.</p>
<p><a href="expression.htm#vector_expression">Vector Expression</a>
.</p>
<h4>Associated types</h4>
<table border="1">
<tbody>
<tr>
<td>Value type </td>
<td><code>value_type</code> </td>
<td>The type of the vector. </td>
</tr>
<tr>
<td>Distance type </td>
<td><code>difference_type</code> </td>
<td>A signed integral type used to represent the distance
between two of the vector's iterators. </td>
</tr>
<tr>
<td>Size type </td>
<td><code>size_type</code> </td>
<td>An unsigned integral type that can represent any
nonnegative value of the vector's distance type. </td>
</tr>
<td>Value type </td>
<td><code>value_type</code> </td>
<td>The type of the vector. </td>
</tr>
<tr>
<td>Distance type </td>
<td><code>difference_type</code> </td>
<td>A signed integral type used to represent the distance
between two of the vector's iterators. </td>
</tr>
<tr>
<td>Size type </td>
<td><code>size_type</code> </td>
<td>An unsigned integral type that can represent any nonnegative
value of the vector's distance type. </td>
</tr>
</tbody>
</table>
<h4>Notation</h4>
<table border="0">
<tbody>
<tr>
<td><code>V</code> </td>
<td>A type that is a model of Vector</td>
</tr>
<tr>
<td><code>v</code></td>
<td>Objects of type <code>V</code> </td>
</tr>
<tr>
<td><code>n, i</code></td>
<td>Objects of a type convertible to <code>size_type</code>
</td>
</tr>
<tr>
<td><code>t</code></td>
<td>Object of a type convertible to <code>value_type</code>
</td>
</tr>
<td><code>V</code> </td>
<td>A type that is a model of Vector</td>
</tr>
<tr>
<td><code>v</code></td>
<td>Objects of type <code>V</code> </td>
</tr>
<tr>
<td><code>n, i</code></td>
<td>Objects of a type convertible to <code>size_type</code>
</td>
</tr>
<tr>
<td><code>t</code></td>
<td>Object of a type convertible to <code>value_type</code>
</td>
</tr>
</tbody>
</table>
<h4>Definitions</h4>
<h4>Valid expressions</h4>
<p>In addition to the expressions defined in <a
href="expression.htm#vector_expression">Vector Expression</a> the
following expressions must be valid. </p>
<p>In addition to the expressions defined in <a href="expression.htm#vector_expression">
Vector Expression</a>
the following expressions must be valid. </p>
<table border="1">
<tbody>
<tr>
<th>Name </th>
<th>Expression </th>
<th>Type requirements </th>
<th>Return type </th>
</tr>
<tr>
<td>Sizing constructor </td>
<td><code>V v (n)</code> </td>
<td>&nbsp;</td>
<td><code>V</code></td>
</tr>
<tr>
<td>Insert </td>
<td><code>v.insert (i, t)</code> </td>
<td><code>v</code> is mutable.</td>
<td><code>void</code></td>
</tr>
<tr>
<td>Erase </td>
<td><code>v.erase (i)</code> </td>
<td><code>v</code> is mutable.</td>
<td><code>void</code></td>
</tr>
<tr>
<td>Clear </td>
<td><code>v.clear ()</code> </td>
<td><code>v</code> is mutable.</td>
<td><code>void</code> </td>
</tr>
<tr>
<td>Resize </td>
<td><code>v.resize (n)</code> </td>
<td><code>v</code> is mutable.</td>
<td><code>void</code> </td>
</tr>
<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>&nbsp;</td>
<td><code>V</code></td>
</tr>
<tr>
<td>Insert </td>
<td><code>v.insert (i, t)</code> </td>
<td><code>v</code> is mutable.</td>
<td><code>void</code></td>
</tr>
<tr>
<td>Erase </td>
<td><code>v.erase (i)</code> </td>
<td><code>v</code> is mutable.</td>
<td><code>void</code></td>
</tr>
<tr>
<td>Clear </td>
<td><code>v.clear ()</code> </td>
<td><code>v</code> is mutable.</td>
<td><code>void</code> </td>
</tr>
<tr>
<td>Resize </td>
<td><code>v.resize (n)</code> </td>
<td><code>v</code> is mutable.</td>
<td><code>void</code> </td>
</tr>
</tbody>
</table>
<h4>Expression semantics</h4>
<p>Semantics of an expression is defined only where it differs
from, or is not defined in <a
href="expression.htm#vector_expression">Vector Expression</a>.</p>
<p>Semantics of an expression is defined only where it differs from, or is
not defined in <a href="expression.htm#vector_expression">Vector Expression</a>
.</p>
<table border="1">
<tbody>
<tr>
<th>Name </th>
<th>Expression </th>
<th>Precondition </th>
<th>Semantics </th>
<th>Postcondition </th>
</tr>
<tr>
<td>Sizing constructor </td>
<td><code>V v (n)</code> </td>
<td><code>n &gt;= 0</code> </td>
<td>Creates a vector of <code>n</code> elements. </td>
<td><code>v.size () == n</code>. </td>
</tr>
<tr>
<td>Insert </td>
<td><code>v.insert (i, t)</code> </td>
<td><code>0 &lt;= i &lt; v.size ()</code> and <br>
<code>v (i)</code> is a copy of <code>value_type ()</code>.</td>
<td>A copy of <code>t</code> is inserted in <code>v</code>.
</td>
<td><code>v (i)</code> is a copy of <code>t</code>.</td>
</tr>
<tr>
<td>Erase </td>
<td><code>v.erase (i)</code> </td>
<td><code>0 &lt;= i &lt; 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>&nbsp; </td>
<td>Equivalent to <br>
<code>for (i = 0; i &lt; v.size (); ++ i)</code><br>
&nbsp; <code>v.erase (i);</code> </td>
<td>&nbsp; </td>
</tr>
<tr>
<td>Resize </td>
<td><code>v.resize (n)</code> </td>
<td>&nbsp;</td>
<td>Modifies the vector so that it can hold <code>n</code>
elements. </td>
<td><code>v.size () == n</code>. </td>
</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 &gt;= 0</code> </td>
<td>Creates a vector of <code>n</code> elements. </td>
<td><code>v.size () == n</code>. </td>
</tr>
<tr>
<td>Insert </td>
<td><code>v.insert (i, t)</code> </td>
<td><code>0 &lt;= i &lt; v.size ()</code> and <br>
<code>v (i)</code> is a copy of <code>value_type ()</code>.</td>
<td>A copy of <code>t</code> is inserted in <code>v</code>.
</td>
<td><code>v (i)</code> is a copy of <code>t</code>.</td>
</tr>
<tr>
<td>Erase </td>
<td><code>v.erase (i)</code> </td>
<td><code>0 &lt;= i &lt; 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>&nbsp; </td>
<td>Equivalent to <br>
<code>for (i = 0; i &lt; v.size (); ++ i)</code><br>
&nbsp; <code>v.erase (i);</code> </td>
<td>&nbsp; </td>
</tr>
<tr>
<td>Resize </td>
<td><code>v.resize (n)</code> </td>
<td>&nbsp;</td>
<td>Modifies the vector so that it can hold <code>n</code>
elements. </td>
<td><code>v.size () == n</code>. </td>
</tr>
</tbody>
</table>
<h4>Complexity guarantees</h4>
<p>The run-time complexity of the sizing constructor is linear in
the vector's size. </p>
<p>The run-time complexity of insert and erase is specific for
the vector.</p>
<p>The run-time complexity of the sizing constructor is linear in the vector's
size. </p>
<p>The run-time complexity of insert and erase is specific for the vector.</p>
<h4>Invariants</h4>
<h4>Models</h4>
<ul>
<li><code>vector&lt;T, A&gt;</code></li>
<li><code>unit_vector&lt;T&gt;</code></li>
<li><code>zero_vector&lt;T&gt;</code></li>
<li><code>sparse_vector&lt;T, A&gt;</code></li>
<li><code>vector&lt;T, A&gt;</code></li>
<li><code>unit_vector&lt;T&gt;</code></li>
<li><code>zero_vector&lt;T&gt;</code></li>
<li><code>sparse_vector&lt;T, A&gt;</code></li>
</ul>
<h2><a name="matrix"></a>Matrix </h2>
<h2><a name="matrix"></a>
Matrix </h2>
<h4>Description</h4>
<p>A Matrix describes common aspects of dense, packed and sparse
matrices. </p>
<p>A Matrix describes common aspects of dense, packed and sparse matrices.
</p>
<h4>Refinement of </h4>
<p><a href="expression.htm#matrix_expression">Matrix Expression</a>.</p>
<p><a href="expression.htm#matrix_expression">Matrix Expression</a>
.</p>
<h4>Associated types</h4>
<table border="1">
<tbody>
<tr>
<td>Value type </td>
<td><code>value_type</code> </td>
<td>The type of the matrix. </td>
</tr>
<tr>
<td>Distance type </td>
<td><code>difference_type</code> </td>
<td>A signed integral type used to represent the distance
between two of the matrix's iterators. </td>
</tr>
<tr>
<td>Size type </td>
<td><code>size_type</code> </td>
<td>An unsigned integral type that can represent any
nonnegative value of the matrix's distance type. </td>
</tr>
<td>Value type </td>
<td><code>value_type</code> </td>
<td>The type of the matrix. </td>
</tr>
<tr>
<td>Distance type </td>
<td><code>difference_type</code> </td>
<td>A signed integral type used to represent the distance
between two of the matrix's iterators. </td>
</tr>
<tr>
<td>Size type </td>
<td><code>size_type</code> </td>
<td>An unsigned integral type that can represent any nonnegative
value of the matrix's distance type. </td>
</tr>
</tbody>
</table>
<h4>Notation</h4>
<table border="0">
<tbody>
<tr>
<td><code>M</code> </td>
<td>A type that is a model of Matrix</td>
</tr>
<tr>
<td><code>m</code></td>
<td>Objects of type <code>M</code> </td>
</tr>
<tr>
<td><code>n1, n2, i, j</code></td>
<td>Objects of a type convertible to <code>size_type</code>
</td>
</tr>
<tr>
<td><code>t</code></td>
<td>Object of a type convertible to <code>value_type</code>
</td>
</tr>
<td><code>M</code> </td>
<td>A type that is a model of Matrix</td>
</tr>
<tr>
<td><code>m</code></td>
<td>Objects of type <code>M</code> </td>
</tr>
<tr>
<td><code>n1, n2, i, j</code></td>
<td>Objects of a type convertible to <code>size_type</code>
</td>
</tr>
<tr>
<td><code>t</code></td>
<td>Object of a type convertible to <code>value_type</code>
</td>
</tr>
</tbody>
</table>
<h4>Definitions</h4>
<h4>Valid expressions</h4>
<p>In addition to the expressions defined in <a
href="expression.htm#matrix_expression">Matrix Expression</a> the
following expressions must be valid. </p>
<p>In addition to the expressions defined in <a href="expression.htm#matrix_expression">
Matrix Expression</a>
the following expressions must be valid. </p>
<table border="1">
<tbody>
<tr>
<th>Name </th>
<th>Expression </th>
<th>Type requirements </th>
<th>Return type </th>
</tr>
<tr>
<td>Sizing constructor </td>
<td><code>M m (n1, n2)</code> </td>
<td>&nbsp;</td>
<td><code>M</code></td>
</tr>
<tr>
<td>Insert </td>
<td><code>m.insert (i, j, t)</code> </td>
<td><code>m</code> is mutable.</td>
<td><code>void</code></td>
</tr>
<tr>
<td>Erase </td>
<td><code>m.erase (i, j)</code> </td>
<td><code>m</code> is mutable.</td>
<td><code>void</code></td>
</tr>
<tr>
<td>Clear </td>
<td><code>m.clear ()</code> </td>
<td><code>m</code> is mutable.</td>
<td><code>void</code> </td>
</tr>
<tr>
<td>Resize </td>
<td><code>m.resize (n1, n2)</code> </td>
<td><code>m</code> is mutable.</td>
<td><code>void</code> </td>
</tr>
<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>&nbsp;</td>
<td><code>M</code></td>
</tr>
<tr>
<td>Insert </td>
<td><code>m.insert (i, j, t)</code> </td>
<td><code>m</code> is mutable.</td>
<td><code>void</code></td>
</tr>
<tr>
<td>Erase </td>
<td><code>m.erase (i, j)</code> </td>
<td><code>m</code> is mutable.</td>
<td><code>void</code></td>
</tr>
<tr>
<td>Clear </td>
<td><code>m.clear ()</code> </td>
<td><code>m</code> is mutable.</td>
<td><code>void</code> </td>
</tr>
<tr>
<td>Resize </td>
<td><code>m.resize (n1, n2)</code> </td>
<td><code>m</code> is mutable.</td>
<td><code>void</code> </td>
</tr>
</tbody>
</table>
<h4>Expression semantics</h4>
<p>Semantics of an expression is defined only where it differs
from, or is not defined in <a
href="expression.htm#matrix_expression">Matrix Expression</a>.</p>
<p>Semantics of an expression is defined only where it differs from, or is
not defined in <a href="expression.htm#matrix_expression">Matrix Expression</a>
.</p>
<table border="1">
<tbody>
<tr>
<th>Name </th>
<th>Expression </th>
<th>Precondition </th>
<th>Semantics </th>
<th>Postcondition </th>
</tr>
<tr>
<td>Sizing constructor </td>
<td><code>M m (n1, n2)</code> </td>
<td><code>n1 &gt;= 0</code> and<code> n2 &gt;= 0</code></td>
<td>Creates a matrix of <code>n1 </code>rows and <code>n2</code>
columns. </td>
<td><code>m.size1 () == n1</code> and <code>m.size2 () ==
n2</code>.</td>
</tr>
<tr>
<td>Insert </td>
<td><code>m.insert (i, j, t)</code> </td>
<td><code>0 &lt;= i &lt; m.size1 ()</code>, <br>
<code>0 &lt;= j &lt; m.size2 ()</code>and <code><br>
m (i, j)</code> is a copy of <code>value_type ()</code>.</td>
<td>A copy of <code>t</code> is inserted in <code>m</code>.
</td>
<td><code>m (i, j)</code> is a copy of <code>t</code>.</td>
</tr>
<tr>
<td>Erase </td>
<td><code>m.erase (i, j)</code> </td>
<td><code>0 &lt;= i &lt; m.size1 ()</code>and <code><br>
0 &lt;= j &lt; 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>&nbsp; </td>
<td>Equivalent to<br>
<code>for (i = 0; i &lt; m.size1 (); ++ i)</code><br>
&nbsp; <code>for (j = 0; j &lt; m.size2 (); ++ j)</code><br>
&nbsp; &nbsp; <code>m.erase (i, j);</code> </td>
<td>&nbsp; </td>
</tr>
<tr>
<td>Resize </td>
<td><code>m.resize (n1, n2)</code> </td>
<td>&nbsp;</td>
<td>Modifies the vector so that it can hold <code>n1 </code>rows
<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 &gt;= 0</code> and<code> n2 &gt;= 0</code></td>
<td>Creates a matrix of <code>n1 </code>rows and <code>n2</code>
columns. </td>
<td><code>m.size1 () == n1</code> and <code>m.size2 () ==
n2</code>.</td>
</tr>
<tr>
<td>Insert </td>
<td><code>m.insert (i, j, t)</code> </td>
<td><code>0 &lt;= i &lt; m.size1 ()</code>, <br>
<code>0 &lt;= j &lt; m.size2 ()</code>and <code><br>
m (i, j)</code> is a copy of <code>value_type ()</code>.</td>
<td>A copy of <code>t</code> is inserted in <code>m</code>.
</td>
<td><code>m (i, j)</code> is a copy of <code>t</code>.</td>
</tr>
<tr>
<td>Erase </td>
<td><code>m.erase (i, j)</code> </td>
<td><code>0 &lt;= i &lt; m.size1 ()</code>and <code><br>
0 &lt;= j &lt; 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>&nbsp; </td>
<td>Equivalent to<br>
<code>for (i = 0; i &lt; m.size1 (); ++ i)</code><br>
&nbsp; <code>for (j = 0; j &lt; m.size2 (); ++ j)</code><br>
&nbsp; &nbsp; <code>m.erase (i, j);</code> </td>
<td>&nbsp; </td>
</tr>
<tr>
<td>Resize </td>
<td><code>m.resize (n1, n2)</code> </td>
<td>&nbsp;</td>
<td>Modifies the vector so that it can hold <code>n1 </code>rows
and <code>n2</code> columns. </td>
<td><code>m.size1 () == n1</code> and <code>m.size2 () ==
n2</code>.</td>
</tr>
<td><code>m.size1 () == n1</code> and <code>m.size2 () ==
n2</code>.</td>
</tr>
</tbody>
</table>
<h4>Complexity guarantees</h4>
<p>The run-time complexity of the sizing constructor is quadratic
in the matrix's size. </p>
<p>The run-time complexity of insert and erase is specific for
the matrix.</p>
<p>The run-time complexity of the sizing constructor is quadratic in the
matrix's size. </p>
<p>The run-time complexity of insert and erase is specific for the matrix.</p>
<h4>Invariants</h4>
<h4>Models</h4>
<ul>
<li><code>matrix&lt;T, F, A&gt;</code></li>
<li><code>identity_matrix&lt;T&gt;</code></li>
<li><code>zero_matrix&lt;T&gt;</code></li>
<li><code>triangular_matrix&lt;T, F1, F2, A&gt;</code></li>
<li><code>symmetric_matrix&lt;T, F1, F2, A&gt;</code></li>
<li><code>banded_matrix&lt;T, F, A&gt;</code></li>
<li><code>sparse_matrix&lt;T, F, A&gt;</code></li>
<li><code>matrix&lt;T, F, A&gt;</code></li>
<li><code>identity_matrix&lt;T&gt;</code></li>
<li><code>zero_matrix&lt;T&gt;</code></li>
<li><code>triangular_matrix&lt;T, F1, F2, A&gt;</code></li>
<li><code>symmetric_matrix&lt;T, F1, F2, A&gt;</code></li>
<li><code>banded_matrix&lt;T, F, A&gt;</code></li>
<li><code>sparse_matrix&lt;T, F, A&gt;</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>
<hr>
<p>Copyright (&copy;) 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: 8/3/2002</p>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,324 +1,400 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Boost Basic Linear Algebra</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Boost Basic Linear Algebra</title>
</head>
<body bgcolor="#FFFFFF">
<h1><img src="c++boost.gif" alt="c++boost.gif" align="center"
width="277" height="86"> Basic Linear Algebra</h1>
<p>uBLAS is a C++ template class library that provides <a
href="http://www.netlib.org/blas">BLAS</a> level 1, 2, 3
functionality for dense, packed and sparse matrices. The design
and implementation unify mathematical notation via operator
overloading and efficient code generation via expression
templates. </p>
<body bgcolor="#ffffff">
<h1><img src="c++boost.gif" alt="c++boost.gif" align="Center">
Basic Linear Algebra</h1>
<p>uBLAS is a C++ template class library that provides <a href="http://www.netlib.org/blas">
BLAS</a>
level 1, 2, 3 functionality for dense, packed and sparse matrices. The
design and implementation unify mathematical notation via operator overloading
and efficient code generation via expression templates. </p>
<h2>Functionality</h2>
<p>uBLAS provides templated C++ classes for dense, unit and
sparse vectors, dense, identity, triangular, banded, symmetric,
hermitian and sparse matrices. Views into vectors and matrices
can be constructed via ranges or slices and adaptor classes. The
library covers the usual basic linear algebra operations on
vectors and matrices: reductions like different norms, addition
and subtraction of vectors and matrices and multiplication with a
scalar, inner and outer products of vectors, matrix vector and
matrix matrix products and triangular solver. The glue between
containers, views and expression templated operations is a mostly
<a href="http://www.sgi.com/tech/stl">STL</a> conforming iterator
interface.</p>
<p>Dense, packed and sparse matrix classes are being tested with the <a
href="http://www.netlib.org/clapack">CLAPACK</a> test suite.</p>
<p>uBLAS provides templated C++ classes for dense, unit and sparse vectors,
dense, identity, triangular, banded, symmetric, hermitian and sparse matrices.
Views into vectors and matrices can be constructed via ranges or slices and
adaptor classes. The library covers the usual basic linear algebra operations
on vectors and matrices: reductions like different norms, addition and subtraction
of vectors and matrices and multiplication with a scalar, inner and outer
products of vectors, matrix vector and matrix matrix products and triangular
solver. The glue between containers, views and expression templated operations
is a mostly <a href="http://www.sgi.com/tech/stl">STL</a>
conforming iterator interface.</p>
<p>Dense, packed and sparse matrix classes are being tested with the <a href="http://www.netlib.org/clapack">
CLAPACK</a>
test suite.</p>
<p>Known limitations:</p>
<ul type="disc">
<li>The implementation assumes a linear memory address model.</li>
<li>Tuning was focussed on dense matrices.</li>
<ul type="Disc">
<li>The implementation assumes a linear memory address model.</li>
<li>Tuning was focussed on dense matrices.</li>
</ul>
<h2>Documentation</h2>
<ul>
<li><a href="overview.htm">Overview</a></li>
<li><a href="expression.htm">Expression Concepts</a><ul
type="circle">
<li><a href="expression.htm#scalar_expression">Scalar
Expression</a></li>
<li><a href="expression.htm#vector_expression">Vector
Expression</a></li>
<li><a href="expression.htm#matrix_expression">Matrix
Expression</a></li>
</ul>
</li>
<li><a href="container.htm">Container Concepts</a><ul
type="circle">
<li><a href="container.htm#vector">Vector</a></li>
<li><a href="container.htm#matrix">Matrix</a></li>
</ul>
</li>
<li><a href="iterator.htm">Iterator Concepts</a><ul
type="circle">
<li><a
href="iterator.htm#indexed_bidirectional_iterator">Indexed
Bidirectional Iterator</a></li>
<li><a
href="iterator.htm#indexed_random_access_iterator">Indexed
Random Access Iterator</a></li>
<li><a
href="iterator.htm#indexed_bidirectional_cr_iterator">Indexed
Bidirectional Column/Row Iterator</a></li>
<li><a
href="iterator.htm#indexed_random_access_cr_iterator">Indexed
Random Access Column/Row Iterator</a></li>
</ul>
</li>
<li><a href="storage.htm">Storage</a><ul type="circle">
<li><a href="storage.htm#unbounded_array">Unbounded
Array</a></li>
<li><a href="storage.htm#bounded_array">Bounded Array</a></li>
<li><a href="storage.htm#range">Range</a></li>
<li><a href="storage.htm#slice">Slice</a></li>
</ul>
</li>
<li><a href="storage_sparse.htm">Sparse Storage</a><ul
type="circle">
<li><a href="storage_sparse.htm#map_array">Map Array</a></li>
</ul>
</li>
<li><a href="vector.htm">Vector</a><ul type="circle">
<li><a href="vector.htm#vector">Vector</a></li>
<li><a href="vector.htm#unit_vector">Unit Vector</a></li>
<li><a href="vector.htm#zero_vector">Zero Vector</a></li>
</ul>
</li>
<li><a href="vector_sparse.htm">Sparse Vector</a><ul
type="circle">
<li><a href="vector_sparse.htm#sparse_vector">Sparse
Vector</a></li>
<li><a href="vector_sparse.htm#compressed_vector">Compressed
Vector</a></li>
<li><a href="vector_sparse.htm#coordinate_vector">Coordinate
Vector</a></li>
</ul>
</li>
<li><a href="vector_proxy.htm">Vector Proxies</a><ul
type="circle">
<li><a href="vector_proxy.htm#vector_range">Vector
Range</a></li>
<li><a href="vector_proxy.htm#vector_slice">Vector
Slice</a></li>
</ul>
</li>
<li><a href="vector_expression.htm">Vector Expressions</a><ul
type="circle">
<li><a href="vector_expression.htm#vector_expression">Vector
Expression</a></li>
<li><a href="vector_expression.htm#vector_references">Vector
References</a></li>
<li><a href="vector_expression.htm#vector_operations">Vector
Operations</a></li>
<li><a href="vector_expression.htm#vector_reductions">Vector
Reductions</a></li>
</ul>
</li>
<li><a href="matrix.htm">Matrix</a><ul type="circle">
<li><a href="matrix.htm#matrix">Matrix</a></li>
<li><a href="matrix.htm#identity_matrix">Identity
Matrix</a></li>
<li><a href="matrix.htm#zero_matrix">Zero Matrix</a></li>
</ul>
</li>
<li><a href="triangular.htm">Triangular Matrix</a><ul
type="circle">
<li><a href="triangular.htm#triangular_matrix">Triangular
Matrix</a></li>
<li><a href="triangular.htm#triangular_adaptor">Triangular
Adaptor</a></li>
</ul>
</li>
<li><a href="symmetric.htm">Symmetric Matrix</a><ul
type="circle">
<li><a href="symmetric.htm#symmetric_matrix">Symmetric
Matrix</a></li>
<li><a href="symmetric.htm#symmetric_adaptor">Symmetric
Adaptor</a></li>
</ul>
</li>
<li><a href="hermitian.htm">Hermitian Matrix</a><ul
type="circle">
<li><a href="hermitian.htm#hermitian_matrix">Hermitian
Matrix</a></li>
<li><a href="hermitian.htm#hermitian_adaptor">Hermitian
Adaptor</a></li>
</ul>
</li>
<li><a href="banded.htm">Banded Matrix</a><ul type="circle">
<li><a href="banded.htm#banded_matrix">Banded Matrix</a></li>
<li><a href="banded.htm#banded_adaptor">Banded
Adaptor</a></li>
</ul>
</li>
<li><a href="matrix_sparse.htm">Sparse Matrix</a><ul
type="circle">
<li><a href="matrix_sparse.htm#sparse_matrix">Sparse
Matrix</a></li>
<li><a href="matrix_sparse.htm#compressed_matrix">Compressed
Matrix</a></li>
<li><a href="matrix_sparse.htm#coordinate_matrix">Coordinate
Matrix</a></li>
</ul>
</li>
<li><a href="matrix_proxy.htm">Matrix Proxies</a><ul
type="circle">
<li><a href="matrix_proxy.htm#matrix_row">Matrix Row</a></li>
<li><a href="matrix_proxy.htm#matrix_column">Matrix
Column</a></li>
<li><a href="matrix_proxy.htm#vector_range">Vector
Range</a></li>
<li><a href="matrix_proxy.htm#vector_slice">Vector
Slice</a></li>
<li><a href="matrix_proxy.htm#matrix_range">Matrix
Range</a></li>
<li><a href="matrix_proxy.htm#matrix_slice">Matrix
Slice</a></li>
</ul>
</li>
<li><a href="matrix_expression.htm">Matrix Expressions</a><ul
type="circle">
<li><a href="matrix_expression.htm#matrix_expression">Matrix
Expression</a></li>
<li><a href="matrix_expression.htm#matrix_references">Matrix
References</a></li>
<li><a href="matrix_expression.htm#matrix_operations">Matrix
Operations</a></li>
<li><a href="matrix_expression.htm#matrix_reductions">Matrix
Reductions</a></li>
<li><a
href="matrix_expression.htm#matrix_vector_operations">Matrix
Vector Operations</a></li>
<li><a
href="matrix_expression.htm#matrix_matrix_operations">Matrix
Matrix Operations</a></li>
</ul>
</li>
<li><a href="overview.htm">Overview</a>
</li>
<li><a href="expression.htm">Expression Concepts</a>
<ul type="Circle">
<li><a href="expression.htm#scalar_expression">Scalar
Expression</a>
</li>
<li><a href="expression.htm#vector_expression">Vector
Expression</a>
</li>
<li><a href="expression.htm#matrix_expression">Matrix
Expression</a>
</li>
</ul>
</li>
<li><a href="container.htm">Container Concepts</a>
<ul type="Circle">
<li><a href="container.htm#vector">Vector</a>
</li>
<li><a href="container.htm#matrix">Matrix</a>
</li>
</ul>
</li>
<li><a href="iterator.htm">Iterator Concepts</a>
<ul type="Circle">
<li><a href="iterator.htm#indexed_bidirectional_iterator">Indexed
Bidirectional Iterator</a>
</li>
<li><a href="iterator.htm#indexed_random_access_iterator">Indexed
Random Access Iterator</a>
</li>
<li><a href="iterator.htm#indexed_bidirectional_cr_iterator">
Indexed Bidirectional Column/Row Iterator</a>
</li>
<li><a href="iterator.htm#indexed_random_access_cr_iterator">
Indexed Random Access Column/Row Iterator</a>
</li>
</ul>
</li>
<li><a href="storage.htm">Storage</a>
<ul type="Circle">
<li><a href="storage.htm#unbounded_array">Unbounded
Array</a>
</li>
<li><a href="storage.htm#bounded_array">Bounded Array</a>
</li>
<li><a href="storage.htm#range">Range</a>
</li>
<li><a href="storage.htm#slice">Slice</a>
</li>
</ul>
</li>
<li><a href="storage_sparse.htm">Sparse Storage</a>
<ul type="Circle">
<li><a href="storage_sparse.htm#map_array">Map Array</a>
</li>
</ul>
</li>
<li><a href="vector.htm">Vector</a>
<ul type="Circle">
<li><a href="vector.htm#vector">Vector</a>
</li>
<li><a href="vector.htm#unit_vector">Unit Vector</a>
</li>
<li><a href="vector.htm#zero_vector">Zero Vector</a>
</li>
</ul>
</li>
<li><a href="vector_sparse.htm">Sparse Vector</a>
<ul type="Circle">
<li><a href="vector_sparse.htm#sparse_vector">Sparse
Vector</a>
</li>
<li><a href="vector_sparse.htm#compressed_vector">Compressed
Vector</a>
</li>
<li><a href="vector_sparse.htm#coordinate_vector">Coordinate
Vector</a>
</li>
</ul>
</li>
<li><a href="vector_proxy.htm">Vector Proxies</a>
<ul type="Circle">
<li><a href="vector_proxy.htm#vector_range">Vector
Range</a>
</li>
<li><a href="vector_proxy.htm#vector_slice">Vector
Slice</a>
</li>
</ul>
</li>
<li><a href="vector_expression.htm">Vector Expressions</a>
<ul type="Circle">
<li><a href="vector_expression.htm#vector_expression">Vector
Expression</a>
</li>
<li><a href="vector_expression.htm#vector_references">Vector
References</a>
</li>
<li><a href="vector_expression.htm#vector_operations">Vector
Operations</a>
</li>
<li><a href="vector_expression.htm#vector_reductions">Vector
Reductions</a>
</li>
</ul>
</li>
<li><a href="matrix.htm">Matrix</a>
<ul type="Circle">
<li><a href="matrix.htm#matrix">Matrix</a>
</li>
<li><a href="matrix.htm#identity_matrix">Identity
Matrix</a>
</li>
<li><a href="matrix.htm#zero_matrix">Zero Matrix</a>
</li>
</ul>
</li>
<li><a href="triangular.htm">Triangular Matrix</a>
<ul type="Circle">
<li><a href="triangular.htm#triangular_matrix">Triangular
Matrix</a>
</li>
<li><a href="triangular.htm#triangular_adaptor">Triangular
Adaptor</a>
</li>
</ul>
</li>
<li><a href="symmetric.htm">Symmetric Matrix</a>
<ul type="Circle">
<li><a href="symmetric.htm#symmetric_matrix">Symmetric
Matrix</a>
</li>
<li><a href="symmetric.htm#symmetric_adaptor">Symmetric
Adaptor</a>
</li>
</ul>
</li>
<li><a href="hermitian.htm">Hermitian Matrix</a>
<ul type="Circle">
<li><a href="hermitian.htm#hermitian_matrix">Hermitian
Matrix</a>
</li>
<li><a href="hermitian.htm#hermitian_adaptor">Hermitian
Adaptor</a>
</li>
</ul>
</li>
<li><a href="banded.htm">Banded Matrix</a>
<ul type="Circle">
<li><a href="banded.htm#banded_matrix">Banded Matrix</a>
</li>
<li><a href="banded.htm#banded_adaptor">Banded
Adaptor</a>
</li>
</ul>
</li>
<li><a href="matrix_sparse.htm">Sparse Matrix</a>
<ul type="Circle">
<li><a href="matrix_sparse.htm#sparse_matrix">Sparse
Matrix</a>
</li>
<li><a href="matrix_sparse.htm#compressed_matrix">Compressed
Matrix</a>
</li>
<li><a href="matrix_sparse.htm#coordinate_matrix">Coordinate
Matrix</a>
</li>
</ul>
</li>
<li><a href="matrix_proxy.htm">Matrix Proxies</a>
<ul type="Circle">
<li><a href="matrix_proxy.htm#matrix_row">Matrix Row</a>
</li>
<li><a href="matrix_proxy.htm#matrix_column">Matrix
Column</a>
</li>
<li><a href="matrix_proxy.htm#vector_range">Vector
Range</a>
</li>
<li><a href="matrix_proxy.htm#vector_slice">Vector
Slice</a>
</li>
<li><a href="matrix_proxy.htm#matrix_range">Matrix
Range</a>
</li>
<li><a href="matrix_proxy.htm#matrix_slice">Matrix
Slice</a>
</li>
</ul>
</li>
<li><a href="matrix_expression.htm">Matrix Expressions</a>
<ul type="Circle">
<li><a href="matrix_expression.htm#matrix_expression">Matrix
Expression</a>
</li>
<li><a href="matrix_expression.htm#matrix_references">Matrix
References</a>
</li>
<li><a href="matrix_expression.htm#matrix_operations">Matrix
Operations</a>
</li>
<li><a href="matrix_expression.htm#matrix_vector_operations">
Matrix Vector Operations</a>
</li>
<li><a href="matrix_expression.htm#matrix_matrix_operations">
Matrix Matrix Operations</a>
</li>
</ul>
</li>
</ul>
<h2>Supported Platforms</h2>
<p>As main development platform for uBLAS we used MSVC 6.0 with
Dinkumware STL. Other compilers known to accept the library are</p>
<p>As main development platform for uBLAS we used MSVC 6.0 with Dinkumware
STL. Other compilers known to accept the library are</p>
<ul>
<li>MSVC 6.0 with STLPort-4.5.3</li>
<li>BCC 5.5</li>
<li>GCC 2.95.x, 3.0.x, 3.1</li>
<li>ICC 5.0, 6.0</li>
<li>Comeau 4.2.x</li>
<li>MWCW</li>
<li>MSVC 6.0 with STLPort-4.5.3</li>
<li>BCC 5.5</li>
<li>GCC 2.95.x, 3.0.x, 3.1</li>
<li>ICC 5.0, 6.0</li>
<li>Comeau 4.2.x</li>
<li>MWCW</li>
</ul>
<h2>Download</h2>
<p>You can download the current stable release of the source code
from <a href="http://www.genesys-e.org/ublas/downloads/ublas.zip">here</a>.
Prerequisite is the latest stable release of the <a
href="http://www.boost.org">Boost</a> libraries Configuration,
Timer and optionally SmartPointer.</p>
<p>You can download the current stable release of the source code from <a href="http://www.genesys-e.org/ublas/downloads/ublas.zip">
here</a>
. Prerequisite is the latest stable release of the <a href="http://www.boost.org">
Boost</a>
libraries Configuration, Timer and optionally SmartPointer.</p>
<h2>CVS Access</h2>
<p>You can also check out the latest version via anonymous CVS.
Here's how: </p>
<pre> cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost login
(password is empty)
cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost checkout boost/boost/numeric/ublas
cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost checkout boost/libs/numeric/ublas</pre>
<p>If you have gzip installed on your system, you can speed up
the transfer using</p>
<pre> cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost -z9 checkout boost/boost/numeric/ublas
cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost -z9 checkout boost/libs/numeric/ublas</pre>
<p>You can also <a
href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost">view</a>
the CVS archive. You may find the library <a
href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost/boost/boost/numeric/ublas/">here</a>.
Documentation and test programs reside <a
href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost/boost/libs/numeric/ublas/">here</a>.</p>
<p>You can also check out the latest version via anonymous CVS. Here's how:
</p>
<pre> cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost login<br> (password is empty)<br> cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost checkout boost/boost/numeric/ublas<br> cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost checkout boost/libs/numeric/ublas</pre>
<p>If you have gzip installed on your system, you can speed up the transfer
using</p>
<pre> cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost -z9 checkout boost/boost/numeric/ublas<br> cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost -z9 checkout boost/libs/numeric/ublas</pre>
<p>You can also <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost">
view</a>
the CVS archive. You may find the library <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost/boost/boost/numeric/ublas/">
here</a>
. Documentation and test programs reside <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost/boost/libs/numeric/ublas/">
here</a>
.</p>
<h2>Mailing lists</h2>
<p>uBLAS has no dedicated mailing list. Feel free to use the
mailing lists of <a href="http://www.boost.org">Boost</a>.</p>
<p>uBLAS has no dedicated mailing list. Feel free to use the mailing lists
of <a href="http://www.boost.org">Boost</a>
.</p>
<h2>Authors and Credits</h2>
<p>uBLAS initially was written by Joerg Walter and Mathias Koch.
We would like to thank all, which supported the development of
this library: David Abrahams, Ed Brey, Fernando Cacciola, Beman Dawes,
Bob Fletcher, Kresimir Fresl, Joachim Kessel, Toon Knapen, John Maddock,
Jens Maurer, Alexei Novakov, Gary Powell, Joachim Pyras, Peter Schmitteckert,
Jeremy Siek, Markus Steffl, Michael Stevens, Benedikt Weber, Martin Weiser,
Marc Zimmermann and the members of <a
href="http://www.boost.org">Boost</a></p>
<p>uBLAS initially was written by Joerg Walter and Mathias Koch. We would
like to thank all, which supported the development of this library: David
Abrahams, Ed Brey, Fernando Cacciola, Beman Dawes, Bob Fletcher, Kresimir
Fresl, Joachim Kessel, Toon Knapen, John Maddock, Jens Maurer, Alexei Novakov,
Gary Powell, Joachim Pyras, Peter Schmitteckert, Jeremy Siek, Markus Steffl,
Michael Stevens, Benedikt Weber, Martin Weiser, Marc Zimmermann and the members
of <a href="http://www.boost.org">Boost</a>
</p>
<h2>Frequently Asked Questions</h2>
<p>Q: I'm running the uBLAS dense vector and matrix benchmarks.
Why do I see a significant performance difference between the
native C and library implementations?<br>
A: uBLAS distinguishes debug mode (size and type conformance
checks enabled, expression templates disabled) and release mode
(size and type conformance checks disabled, expression templates
enabled). Please check, if the preprocessor symbol <code>NDEBUG</code>
of <code>cassert</code> is defined. <code>NDEBUG</code> enables
release mode, which in turn uses expression templates.</p>
<p>Q: I've written some uBLAS tests, which try to incorrectly
assign different matrix types or overrun vector and matrix
dimensions. Why don't I get a compile time or runtime diagnostic?<br>
A: uBLAS distinguishes debug mode (size and type conformance
checks enabled, expression templates disabled) and release mode
(size and type conformance checks disabled, expression templates
enabled). Please check, if the preprocessor symbol <code>NDEBUG</code>
of <code>cassert</code> is defined. <code>NDEBUG</code> disables
debug mode, which is needed to get size and type conformance
checks.</p>
<p>Q: I've written some uBLAS benchmarks to measure the
performance of matrix chain multiplications like <code>prod (A,
prod (B, C))</code> and see a significant performance penalty due
to the use of expression templates. How can I disable expression
templates?<br>
A: You do not need to disable expression templates. Please try
reintroducing temporaries using either <code>prod (A, </code><code><em>matrix_type</em></code><code>
(prod (B, C)))</code> or <code>prod (A, prod&lt;</code><code><em>matrix_type</em></code><code>&gt;
(B, C))</code>.</p>
<p>Q: I'm running the uBLAS dense vector and matrix benchmarks. Why do I see
a significant performance difference between the native C and library implementations?<br>
A: uBLAS distinguishes debug mode (size and type conformance checks enabled,
expression templates disabled) and release mode (size and type conformance
checks disabled, expression templates enabled). Please check, if the preprocessor
symbol <code>NDEBUG</code> of <code>cassert</code> is defined. <code>NDEBUG</code>
enables release mode, which in turn uses expression templates.</p>
<p>Q: I've written some uBLAS tests, which try to incorrectly assign different
matrix types or overrun vector and matrix dimensions. Why don't I get a compile
time or runtime diagnostic?<br>
A: uBLAS distinguishes debug mode (size and type conformance checks enabled,
expression templates disabled) and release mode (size and type conformance
checks disabled, expression templates enabled). Please check, if the preprocessor
symbol <code>NDEBUG</code> of <code>cassert</code> is defined. <code>NDEBUG</code>
disables debug mode, which is needed to get size and type conformance checks.</p>
<p>Q: I've written some uBLAS benchmarks to measure the performance of matrix
chain multiplications like <code>prod (A, prod (B, C))</code> and see a significant
performance penalty due to the use of expression templates. How can I disable
expression templates?<br>
A: You do not need to disable expression templates. Please try reintroducing
temporaries using either <code>prod (A, </code><code><em>matrix_type</em></code><code>
(prod (B, C)))</code> or <code>prod (A, prod&lt;</code><code><em>matrix_type</em></code><code>
&gt; (B, C))</code>.</p>
<h2>Contact Information</h2>
<p>If you have a problem, or have found a bug, please send us a <a
href="mailto:ublas@genesys-e.org">note</a>. </p>
<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>If you have a problem, or have found a bug, please send us a <a href="mailto:ublas@genesys-e.org">
note</a>
. </p>
<hr>
<p>Copyright (&copy;) 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: 8/3/2002</p>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
Welcome to the evaluation of our C++ matrix library.
Installation:
Extract the zip-file to a (new) directory of your choice. Workspace and
project files for MSVC and simple makefiles for BCC and GCC are contained within
the archive.
Extract the zip-file to a (new) directory of your choice. Workspace and
project files for MSVC and Jamfiles for the Boost build system are contained
within the archive.
Tests and benchmarks:
Test1 contains a couple of basic tests for dense vectors and matrices.
@@ -11,10 +11,15 @@ Test2 demonstrates how to emulate BLAS with this matrix library.
Test3 contains a couple of basic tests for sparse vectors and matrices.
Test4 contains a couple of basic tests for banded matrices.
Test5 contains a couple of basic tests for triangular matrices.
Bench1 measures the abstraction penalty using certain dense matrix and vector
Test6 contains a couple of basic tests for symmetric matrices.
Test7 contains a couple of basic tests for dense vectors and matrices of
boost::numeric::interval(s).
Bench1 measures the abstraction penalty using certain dense matrix and vector
operations.
Bench2 measures the performance of sparse matrix and vector operations.
Bench3 measures the performance of vector and matrix proxy's operations.
Bench4 measures the abstraction penalty using certain dense matrix and vector
operations with boost::numeric::interval(s).
If you have any problems installing or using the library, please feel free to contact
us at mailto:ublas@genesys-e.org
us at mailto:ublas@genesys-e.org

365
doc/samples/Jamfile Normal file
View File

@@ -0,0 +1,365 @@
subproject libs/numeric/ublas/doc/samples ;
exe unbounded_array
: unbounded_array.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe bounded_array
: bounded_array.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe range
: range.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe slice
: slice.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe map_array
: map_array.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector
: vector.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe unit_vector
: unit_vector.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe zero_vector
: zero_vector.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe sparse_vector
: sparse_vector.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe compressed_vector
: compressed_vector.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe coordinate_vector
: coordinate_vector.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_range
: vector_range.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_range_project
: vector_range_project.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_slice
: vector_slice.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_slice_project
: vector_slice_project.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_unary
: vector_unary.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_binary
: vector_binary.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_binary_outer
: vector_binary_outer.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_binary_scalar
: vector_binary_scalar.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_unary_redux
: vector_unary_redux.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe vector_binary_redux
: vector_binary_redux.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix
: matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe identity_matrix
: identity_matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe zero_matrix
: zero_matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe sparse_matrix
: sparse_matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe compressed_matrix
: compressed_matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe coordinate_matrix
: coordinate_matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_row
: matrix_row.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_row_project
: matrix_row_project.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_column
: matrix_column.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_column_project
: matrix_column_project.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_vector_range
: matrix_vector_range.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_vector_slice
: matrix_vector_slice.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_range
: matrix_range.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_range_project
: matrix_range_project.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_slice
: matrix_slice.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_slice_project
: matrix_slice_project.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_unary
: matrix_unary.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_binary
: matrix_binary.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_binary_scalar
: matrix_binary_scalar.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_vector_binary
: matrix_vector_binary.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_vector_solve
: matrix_vector_solve.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_matrix_binary
: matrix_matrix_binary.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe matrix_matrix_solve
: matrix_matrix_solve.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe banded_matrix
: banded_matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe banded_adaptor
: banded_adaptor.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe hermitian_matrix
: hermitian_matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe hermitian_adaptor
: hermitian_adaptor.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe symmetric_matrix
: symmetric_matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe symmetric_adaptor
: symmetric_adaptor.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe triangular_matrix
: triangular_matrix.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;
exe triangular_adaptor
: triangular_adaptor.cpp
: <include>$(BOOST_ROOT)
<borland><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
<kylix><*><cxxflags>"-w-8026 -w-8027 -w-8057 -w-8084 -w-8092"
;

View File

@@ -0,0 +1,13 @@
#include <boost/numeric/ublas/banded.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
banded_adaptor<matrix<double> > ba (m, 1, 1);
for (signed i = 0; i < signed (ba.size1 ()); ++ i)
for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (ba.size2 ())); ++ j)
ba (i, j) = 3 * i + j;
std::cout << ba << std::endl;
}

View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/banded.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
banded_matrix<double> m (3, 3, 1, 1);
for (signed i = 0; i < signed (m.size1 ()); ++ i)
for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (m.size2 ())); ++ j)
m (i, j) = 3 * i + j;
std::cout << m << std::endl;
}

View File

@@ -0,0 +1,11 @@
#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;
}
}

View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
compressed_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;
std::cout << m << std::endl;
}

View File

@@ -0,0 +1,11 @@
#include <boost/numeric/ublas/vector_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
compressed_vector<double> v (3, 3);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = i;
std::cout << v << std::endl;
}

View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
coordinate_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;
std::cout << m << std::endl;
}

View File

@@ -0,0 +1,11 @@
#include <boost/numeric/ublas/vector_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
coordinate_vector<double> v (3, 3);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = i;
std::cout << v << std::endl;
}

View File

@@ -0,0 +1,22 @@
#include <boost/numeric/ublas/hermitian.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<std::complex<double> > m (3, 3);
hermitian_adaptor<matrix<std::complex<double> >, lower> hal (m);
for (unsigned i = 0; i < hal.size1 (); ++ i) {
for (unsigned j = 0; j < i; ++ j)
hal (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
hal (i, i) = std::complex<double> (4 * i, 0);
}
std::cout << hal << std::endl;
hermitian_adaptor<matrix<std::complex<double> >, upper> hau (m);
for (unsigned i = 0; i < hau.size1 (); ++ i) {
hau (i, i) = std::complex<double> (4 * i, 0);
for (unsigned j = i + 1; j < hau.size2 (); ++ j)
hau (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
}
std::cout << hau << std::endl;
}

View File

@@ -0,0 +1,21 @@
#include <boost/numeric/ublas/hermitian.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
hermitian_matrix<std::complex<double>, lower> ml (3, 3);
for (unsigned i = 0; i < ml.size1 (); ++ i) {
for (unsigned j = 0; j < i; ++ j)
ml (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
ml (i, i) = std::complex<double> (4 * i, 0);
}
std::cout << ml << std::endl;
hermitian_matrix<std::complex<double>, upper> mu (3, 3);
for (unsigned i = 0; i < mu.size1 (); ++ i) {
mu (i, i) = std::complex<double> (4 * i, 0);
for (unsigned j = i + 1; j < mu.size2 (); ++ j)
mu (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
}
std::cout << mu << std::endl;
}

View File

@@ -0,0 +1,9 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
identity_matrix<double> m (3);
std::cout << m << std::endl;
}

11
doc/samples/map_array.cpp Normal file
View File

@@ -0,0 +1,11 @@
#include <boost/numeric/ublas/storage_sparse.hpp>
int main () {
using namespace boost::numeric::ublas;
map_array<int, double> a (3);
for (unsigned i = 0; i < a.size (); ++ i) {
a [i] = i;
std::cout << a [i] << std::endl;
}
}

12
doc/samples/matrix.cpp Normal file
View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout << m << std::endl;
}

View File

@@ -0,0 +1,14 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m1 (3, 3), m2 (3, 3);
for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)
for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j)
m1 (i, j) = m2 (i, j) = 3 * i + j;
std::cout << m1 + m2 << std::endl;
std::cout << m1 - m2 << std::endl;
}

View File

@@ -0,0 +1,14 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout << 2.0 * m << std::endl;
std::cout << m * 2.0 << std::endl;
}

View File

@@ -0,0 +1,14 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned j = 0; j < m.size2 (); ++ j) {
matrix_column<matrix<double> > mc (m, j);
for (unsigned i = 0; i < mc.size (); ++ i)
mc (i) = 3 * i + j;
std::cout << mc << std::endl;
}
}

View File

@@ -0,0 +1,13 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned j = 0; j < m.size2 (); ++ j) {
for (unsigned i = 0; i < m.size1 (); ++ i)
column (m, j) (i) = 3 * i + j;
std::cout << column (m, j) << std::endl;
}
}

View File

@@ -0,0 +1,13 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m1 (3, 3), m2 (3, 3);
for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)
for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j)
m1 (i, j) = m2 (i, j) = 3 * i + j;
std::cout << prod (m1, m2) << std::endl;
}

View File

@@ -0,0 +1,13 @@
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m1 (3, 3), m2 (3, 3);
for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)
for (unsigned j = 0; j <= i; ++ j)
m1 (i, j) = m2 (i, j) = 3 * i + j + 1;
std::cout << solve (m1, m2, lower_tag ()) << std::endl;
}

View File

@@ -0,0 +1,13 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
matrix_range<matrix<double> > mr (m, range (0, 3), range (0, 3));
for (unsigned i = 0; i < mr.size1 (); ++ i)
for (unsigned j = 0; j < mr.size2 (); ++ j)
mr (i, j) = 3 * i + j;
std::cout << mr << std::endl;
}

View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
project (m, range (0, 3), range (0, 3)) (i, j) = 3 * i + j;
std::cout << project (m, range (0, 3), range (0, 3)) << std::endl;
}

View File

@@ -0,0 +1,14 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i) {
matrix_row<matrix<double> > mr (m, i);
for (unsigned j = 0; j < mr.size (); ++ j)
mr (j) = 3 * i + j;
std::cout << mr << std::endl;
}
}

View File

@@ -0,0 +1,13 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i) {
for (unsigned j = 0; j < m.size2 (); ++ j)
row (m, i) (j) = 3 * i + j;
std::cout << row (m, i) << std::endl;
}
}

View File

@@ -0,0 +1,13 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
matrix_slice<matrix<double> > ms (m, slice (0, 1, 3), slice (0, 1, 3));
for (unsigned i = 0; i < ms.size1 (); ++ i)
for (unsigned j = 0; j < ms.size2 (); ++ j)
ms (i, j) = 3 * i + j;
std::cout << ms << std::endl;
}

View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
project (m, slice (0, 1, 3), slice (0, 1, 3)) (i, j) = 3 * i + j;
std::cout << project (m, slice (0, 1, 3), slice (0, 1, 3)) << std::endl;
}

View File

@@ -0,0 +1,18 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<std::complex<double> > m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
std::cout << - m << std::endl;
std::cout << conj (m) << std::endl;
std::cout << real (m) << std::endl;
std::cout << imag (m) << std::endl;
std::cout << trans (m) << std::endl;
std::cout << herm (m) << std::endl;
}

View File

@@ -0,0 +1,17 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
vector<double> v (3);
for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) {
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i + j;
v (i) = i;
}
std::cout << prod (m, v) << std::endl;
std::cout << prod (v, m) << std::endl;
}

View File

@@ -0,0 +1,14 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i + j;
matrix_vector_range<matrix<double> > mvr (m, range (0, 3), range (0, 3));
std::cout << mvr << std::endl;
}

View File

@@ -0,0 +1,14 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i)
for (unsigned j = 0; j < m.size2 (); ++ j)
m (i, j) = 3 * i + j;
matrix_vector_slice<matrix<double> > mvs (m, slice (0, 1, 3), slice (0, 1, 3));
std::cout << mvs << std::endl;
}

View File

@@ -0,0 +1,17 @@
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
vector<double> v (3);
for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) {
for (unsigned j = 0; j <= i; ++ j)
m (i, j) = 3 * i + j + 1;
v (i) = i;
}
std::cout << solve (m, v, lower_tag ()) << std::endl;
std::cout << solve (v, m, lower_tag ()) << std::endl;
}

10
doc/samples/range.cpp Normal file
View File

@@ -0,0 +1,10 @@
#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;
}
}

10
doc/samples/slice.cpp Normal file
View File

@@ -0,0 +1,10 @@
#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;
}
}

View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
sparse_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;
std::cout << m << std::endl;
}

View File

@@ -0,0 +1,11 @@
#include <boost/numeric/ublas/vector_sparse.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
sparse_vector<double> v (3, 3);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = i;
std::cout << v << std::endl;
}

View File

@@ -0,0 +1,18 @@
#include <boost/numeric/ublas/symmetric.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
symmetric_adaptor<matrix<double>, lower> sal (m);
for (unsigned i = 0; i < sal.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
sal (i, j) = 3 * i + j;
std::cout << sal << std::endl;
symmetric_adaptor<matrix<double>, upper> sau (m);
for (unsigned i = 0; i < sau.size1 (); ++ i)
for (unsigned j = i; j < sau.size2 (); ++ j)
sau (i, j) = 3 * i + j;
std::cout << sau << std::endl;
}

View File

@@ -0,0 +1,17 @@
#include <boost/numeric/ublas/symmetric.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
symmetric_matrix<double, lower> ml (3, 3);
for (unsigned i = 0; i < ml.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
ml (i, j) = 3 * i + j;
std::cout << ml << std::endl;
symmetric_matrix<double, upper> mu (3, 3);
for (unsigned i = 0; i < mu.size1 (); ++ i)
for (unsigned j = i; j < mu.size2 (); ++ j)
mu (i, j) = 3 * i + j;
std::cout << mu << std::endl;
}

View File

@@ -0,0 +1,18 @@
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
triangular_adaptor<matrix<double>, lower> tal (m);
for (unsigned i = 0; i < tal.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
tal (i, j) = 3 * i + j;
std::cout << tal << std::endl;
triangular_adaptor<matrix<double>, upper> tau (m);
for (unsigned i = 0; i < tau.size1 (); ++ i)
for (unsigned j = i; j < tau.size2 (); ++ j)
tau (i, j) = 3 * i + j;
std::cout << tau << std::endl;
}

View File

@@ -0,0 +1,17 @@
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
triangular_matrix<double, lower> ml (3, 3);
for (unsigned i = 0; i < ml.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
ml (i, j) = 3 * i + j;
std::cout << ml << std::endl;
triangular_matrix<double, upper> mu (3, 3);
for (unsigned i = 0; i < mu.size1 (); ++ i)
for (unsigned j = i; j < mu.size2 (); ++ j)
mu (i, j) = 3 * i + j;
std::cout << mu << std::endl;
}

View File

@@ -0,0 +1,11 @@
#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;
}
}

View File

@@ -0,0 +1,11 @@
#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;
}
}

11
doc/samples/vector.cpp Normal file
View File

@@ -0,0 +1,11 @@
#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;
}

View File

@@ -0,0 +1,13 @@
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v1 (3), v2 (3);
for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout << v1 + v2 << std::endl;
std::cout << v1 - v2 << std::endl;
}

View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v1 (3), v2 (3);
for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout << outer_prod (v1, v2) << std::endl;
}

View File

@@ -0,0 +1,11 @@
#include <boost/numeric/ublas/vector.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v1 (3), v2 (3);
for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout << inner_prod (v1, v2) << std::endl;
}

View File

@@ -0,0 +1,13 @@
#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 << 2.0 * v << std::endl;
std::cout << v * 2.0 << std::endl;
}

View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
vector_range<vector<double> > vr (v, range (0, 3));
for (unsigned i = 0; i < vr.size (); ++ i)
vr (i) = i;
std::cout << vr << std::endl;
}

View File

@@ -0,0 +1,11 @@
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
for (int i = 0; i < 3; ++ i)
project (v, range (0, 3)) (i) = i;
std::cout << project (v, range (0, 3)) << std::endl;
}

View File

@@ -0,0 +1,12 @@
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
vector_slice<vector<double> > vs (v, slice (0, 1, 3));
for (unsigned i = 0; i < vs.size (); ++ i)
vs (i) = i;
std::cout << vs << std::endl;
}

View File

@@ -0,0 +1,11 @@
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
for (int i = 0; i < 3; ++ i)
project (v, slice (0, 1, 3)) (i) = i;
std::cout << project (v, slice (0, 1, 3)) << std::endl;
}

View File

@@ -0,0 +1,17 @@
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<std::complex<double> > v (3);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = std::complex<double> (i, i);
std::cout << - v << std::endl;
std::cout << conj (v) << std::endl;
std::cout << real (v) << std::endl;
std::cout << imag (v) << std::endl;
std::cout << trans (v) << std::endl;
std::cout << herm (v) << std::endl;
}

View File

@@ -0,0 +1,15 @@
#include <boost/numeric/ublas/vector.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 << sum (v) << std::endl;
std::cout << norm_1 (v) << std::endl;
std::cout << norm_2 (v) << std::endl;
std::cout << norm_inf (v) << std::endl;
std::cout << index_norm_inf (v) << std::endl;
}

View File

@@ -0,0 +1,9 @@
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
zero_matrix<double> m (3, 3);
std::cout << m << std::endl;
}

View File

@@ -0,0 +1,9 @@
#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;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,310 +1,219 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Sparse Storage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Sparse Storage</title>
</head>
<body bgcolor="#FFFFFF">
<h1><img src="c++boost.gif" alt="c++boost.gif" align="center">Sparse Storage</h1>
<h2><a name="map_array"></a>Map Array</h2>
<body bgcolor="#ffffff">
<h1><img src="c++boost.gif" alt="c++boost.gif" align="Center">
Sparse Storage</h1>
<h2><a name="map_array"></a>
Map Array</h2>
<h4>Description</h4>
<p>The templated class <code>map_array&lt;I, T&gt; </code>implements
a simple std::map-like associative container as a sorted array.</p>
<p>The templated class <code>map_array&lt;I, T&gt; </code>implements a simple
std::map-like associative container as a sorted array.</p>
<h4>Example</h4>
<pre>int main () {
using namespace boost::numeric::ublas;
map_array&lt;int, double&gt; a (3);
for (int i = 0; i &lt; a.size (); ++ i) {
a [i] = i;
std::cout &lt;&lt; a [i] &lt;&lt; std::endl;
}
}</pre>
<pre>#include &lt;boost/numeric/ublas/storage_sparse.hpp&gt;<br><br>int main () {<br> using namespace boost::numeric::ublas;<br> map_array&lt;int, double&gt; a (3);<br> for (unsigned i = 0; i &lt; a.size (); ++ i) {<br> a [i] = i;<br> std::cout &lt;&lt; a [i] &lt;&lt; std::endl;<br> }<br>}<br></pre>
<h4>Definition</h4>
<p>Defined in the header storage_sparse.hpp.</p>
<h4>Template parameters</h4>
<table border="1">
<tbody>
<tr>
<th>Parameter </th>
<th>Description </th>
<th>Default </th>
</tr>
<tr>
<td><code>I</code></td>
<td>The type of index stored in the array.</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><code>T</code> </td>
<td>The type of object stored in the array. </td>
<td>&nbsp;</td>
</tr>
<th>Parameter </th>
<th>Description </th>
<th>Default </th>
</tr>
<tr>
<td><code>I</code></td>
<td>The type of index stored in the array.</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><code>T</code> </td>
<td>The type of object stored in the array. </td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<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>
<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">
<tbody>
<tr>
<th>Member </th>
<th>Description </th>
</tr>
<tr>
<td><code>map_array ()</code> </td>
<td>Allocates a <code>map_array </code>that holds
at most zero elements.</td>
</tr>
<tr>
<td><code>map_array (size_type size)</code></td>
<td>Allocates a <code>map_array </code>that holds
at most <code>size</code> elements.</td>
</tr>
<tr>
<td><code>map_array (const map_array
&amp;a)</code></td>
<td>The copy constructor.</td>
</tr>
<tr>
<td><code>~map_array ()</code></td>
<td>Deallocates the <code>map_array </code>itself.
</td>
</tr>
<tr>
<td><code>void resize (size_type size)</code></td>
<td>Reallocates a <code>map_array </code>to hold
at most <code>size</code> elements. The content of the <code>map_array
</code>is preserved.</td>
</tr>
<tr>
<td><code>size_type size () const</code></td>
<td>Returns the size of the <code>map_array</code>.
</td>
</tr>
<tr>
<td><code>data_reference operator [] (index_type i)</code></td>
<td>Returns a reference of the element that is associated
with a particular index. If the <code>map_array</code>
does not already contain such an element, <code>operator[]</code>
inserts the default<code> T ()</code>.</td>
</tr>
<tr>
<td><code>map_array &amp;operator = (const
map_array &amp;a)</code></td>
<td>The assignment operator.</td>
</tr>
<tr>
<td><code>map_array &amp;assign_temporary
(map_array &amp;a)</code></td>
<td>Assigns a temporary. May change the array <code>a</code>.</td>
</tr>
<tr>
<td><code>void swap (map_array &amp;a)</code></td>
<td>Swaps the contents of the arrays. </td>
</tr>
<tr>
<td><code>pointer insert (pointer it, const
value_type &amp;p)</code></td>
<td>Inserts <code>p</code> into the array, using <code>it</code>
as a hint to where it will be inserted. </td>
</tr>
<tr>
<td><code>void erase (pointer it)</code></td>
<td>Erases the value at <code>it</code>.</td>
</tr>
<tr>
<td><code>void clear ()</code></td>
<td>Clears the array. </td>
</tr>
<tr>
<td><code>const_pointer find (index_type i) const</code></td>
<td>Finds an element whose index is <code>i</code>. </td>
</tr>
<tr>
<td><code>pointer find (index_type i)</code></td>
<td>Finds an element whose index is <code>i</code>. </td>
</tr>
<tr>
<td><code>const_pointer lower_bound (index_type i)
const</code></td>
<td>Finds the first element whose index is not less than <code>i</code>.</td>
</tr>
<tr>
<td><code>pointer lower_bound (index_type i)</code></td>
<td>Finds the first element whose index is not less than <code>i</code>.
</td>
</tr>
<tr>
<td><code>const_pointer upper_bound (index_type i)
const</code></td>
<td>Finds the first element whose index is greater than <code>i</code>.
</td>
</tr>
<tr>
<td><code>pointer upper_bound (index_type i)</code></td>
<td>Finds the first element whose index is greater than <code>i</code>.
</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>map_array</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>map_array</code>. </td>
</tr>
<tr>
<td><code>iterator begin () </code></td>
<td>Returns a <code>iterator</code> pointing to the
beginning of the <code>map_array</code>. </td>
</tr>
<tr>
<td><code>iterator end () </code></td>
<td>Returns a <code>iterator</code> pointing to the end
of the <code>map_array</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>map_array</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>map_array</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>map_array</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>map_array</code>. </td>
</tr>
<th>Member </th>
<th>Description </th>
</tr>
<tr>
<td><code>map_array ()</code> </td>
<td>Allocates a <code>map_array </code>that holds at most
zero elements.</td>
</tr>
<tr>
<td><code>map_array (size_type size)</code></td>
<td>Allocates a <code>map_array </code>that holds at most
<code>size</code> elements.</td>
</tr>
<tr>
<td><code>map_array (const map_array &amp;a)</code></td>
<td>The copy constructor.</td>
</tr>
<tr>
<td><code>~map_array ()</code></td>
<td>Deallocates the <code>map_array </code>itself. </td>
</tr>
<tr>
<td><code>void resize (size_type size)</code></td>
<td>Reallocates a <code>map_array </code>to hold at most
<code>size</code> elements. The content of the <code>map_array
</code>is preserved.</td>
</tr>
<tr>
<td><code>size_type size () const</code></td>
<td>Returns the size of the <code>map_array</code>. </td>
</tr>
<tr>
<td><code>data_reference operator [] (index_type i)</code></td>
<td>Returns a reference of the element that is associated
with a particular index. If the <code>map_array</code> does not
already contain such an element, <code>operator[]</code> inserts
the default<code> T ()</code>.</td>
</tr>
<tr>
<td><code>map_array &amp;operator = (const map_array &amp;a)</code></td>
<td>The assignment operator.</td>
</tr>
<tr>
<td><code>map_array &amp;assign_temporary (map_array &amp;a)</code></td>
<td>Assigns a temporary. May change the array <code>a</code>.</td>
</tr>
<tr>
<td><code>void swap (map_array &amp;a)</code></td>
<td>Swaps the contents of the arrays. </td>
</tr>
<tr>
<td><code>pointer insert (pointer it, const value_type &amp;p)</code></td>
<td>Inserts <code>p</code> into the array, using <code>it</code>
as a hint to where it will be inserted. </td>
</tr>
<tr>
<td><code>void erase (pointer it)</code></td>
<td>Erases the value at <code>it</code>.</td>
</tr>
<tr>
<td><code>void clear ()</code></td>
<td>Clears the array. </td>
</tr>
<tr>
<td><code>const_pointer find (index_type i) const</code></td>
<td>Finds an element whose index is <code>i</code>. </td>
</tr>
<tr>
<td><code>pointer find (index_type i)</code></td>
<td>Finds an element whose index is <code>i</code>. </td>
</tr>
<tr>
<td><code>const_pointer lower_bound (index_type i) const</code></td>
<td>Finds the first element whose index is not less than <code>i</code>
.</td>
</tr>
<tr>
<td><code>pointer lower_bound (index_type i)</code></td>
<td>Finds the first element whose index is not less than <code>i</code>
. </td>
</tr>
<tr>
<td><code>const_pointer upper_bound (index_type i) const</code></td>
<td>Finds the first element whose index is greater than <code>i</code>
. </td>
</tr>
<tr>
<td><code>pointer upper_bound (index_type i)</code></td>
<td>Finds the first element whose index is greater than <code>i</code>
. </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>map_array</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>map_array</code>. </td>
</tr>
<tr>
<td><code>iterator begin () </code></td>
<td>Returns a <code>iterator</code> pointing to the beginning
of the <code>map_array</code>. </td>
</tr>
<tr>
<td><code>iterator end () </code></td>
<td>Returns a <code>iterator</code> pointing to the end
of the <code>map_array</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>map_array</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>map_array</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>map_array</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>map_array</code>. </td>
</tr>
</tbody>
</table>
<h4>Interface</h4>
<pre><code> // Map array
template&lt;class I, class T&gt;
class map_array {
public:
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef I index_type;
typedef T data_value_type;
typedef const T &amp;data_const_reference;
typedef T &amp;data_reference;
typedef std::pair&lt;I, T&gt; value_type;
typedef const std::pair&lt;I, T&gt; &amp;const_reference;
typedef std::pair&lt;I, T&gt; &amp;reference;
typedef const std::pair&lt;I, T&gt; *const_pointer;
typedef std::pair&lt;I, T&gt; *pointer;
// Construction and destruction
map_array ();
map_array (size_type size);
map_array (const map_array &amp;a);
~map_array ();
// Resizing
void resize (size_type size);
size_type size () const;
// Element access
data_reference operator [] (index_type i);
// Assignment
map_array &amp;operator = (const map_array &amp;a);
map_array &amp;assign_temporary (map_array &amp;a);
// Swapping
void swap (map_array &amp;a);
friend void swap (map_array &amp;a1, map_array &amp;a2);
// Element insertion and deletion
pointer insert (pointer it, const value_type &amp;p);
void insert (pointer it, pointer it1, pointer it2);
void erase (pointer it);
void erase (pointer it1, pointer it2);
void clear ();
// Element lookup
const_pointer find (index_type i) const;
pointer find (index_type i);
const_pointer lower_bound (index_type i) const;
pointer lower_bound (index_type i);
const_pointer upper_bound (index_type i) const;
pointer upper_bound (index_type i);
// Iterators simply are pointers.
typedef const_pointer const_iterator;
const_iterator begin () const;
const_iterator end () const;
typedef pointer iterator;
iterator begin ();
iterator end ();
// Reverse iterators
typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;
const_reverse_iterator rbegin () const;
const_reverse_iterator rend () const;
typedef std::reverse_iterator&lt;iterator&gt; reverse_iterator;
reverse_iterator rbegin ();
reverse_iterator rend ();
};
template&lt;class I, class T&gt;
map_array&lt;I, T&gt; &amp;assign_temporary (map_array&lt;I, T&gt; &amp;a1, map_array&lt;I, T&gt; &amp;a2);</code></pre>
<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>
<pre><code> // Map array<br> template&lt;class I, class T&gt;<br> class map_array {<br> public:<br> typedef std::size_t size_type;<br> typedef std::ptrdiff_t difference_type;<br> typedef I index_type;<br> typedef T data_value_type;<br> typedef const T &amp;data_const_reference;<br> typedef T &amp;data_reference;<br> typedef std::pair&lt;I, T&gt; value_type;<br> typedef const std::pair&lt;I, T&gt; &amp;const_reference;<br> typedef std::pair&lt;I, T&gt; &amp;reference;<br> typedef const std::pair&lt;I, T&gt; *const_pointer;<br> typedef std::pair&lt;I, T&gt; *pointer;<br><br> // Construction and destruction<br> map_array ();<br> map_array (size_type size);<br> map_array (const map_array &amp;a);<br> ~map_array ();<br><br> // Resizing<br> void resize (size_type size);<br><br> size_type size () const;<br><br> // Element access<br> data_reference operator [] (index_type i);<br><br> // Assignment<br> map_array &amp;operator = (const map_array &amp;a);<br> map_array &amp;assign_temporary (map_array &amp;a);<br><br> // Swapping<br> void swap (map_array &amp;a);<br> friend void swap (map_array &amp;a1, map_array &amp;a2);<br><br> // Element insertion and deletion<br> pointer insert (pointer it, const value_type &amp;p);<br> void insert (pointer it, pointer it1, pointer it2);<br> void erase (pointer it);<br> void erase (pointer it1, pointer it2);<br> void clear ();<br><br> // Element lookup<br> const_pointer find (index_type i) const;<br> pointer find (index_type i);<br> const_pointer lower_bound (index_type i) const;<br> pointer lower_bound (index_type i);<br> const_pointer upper_bound (index_type i) const;<br> pointer upper_bound (index_type i);<br><br> // Iterators simply are pointers.<br><br> typedef const_pointer const_iterator;<br><br> const_iterator begin () const;<br> const_iterator end () const;<br><br> typedef pointer iterator;<br><br> iterator begin ();<br> iterator end ();<br><br> // Reverse iterators<br><br> typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;<br><br> const_reverse_iterator rbegin () const;<br> const_reverse_iterator rend () const;<br><br> typedef std::reverse_iterator&lt;iterator&gt; reverse_iterator;<br><br> reverse_iterator rbegin ();<br> reverse_iterator rend ();<br> };<br><br> template&lt;class I, class T&gt;<br> map_array&lt;I, T&gt; &amp;assign_temporary (map_array&lt;I, T&gt; &amp;a1, map_array&lt;I, T&gt; &amp;a2);</code></pre>
<hr>
<p>Copyright (&copy;) 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: 8/3/2002</p>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -71,8 +71,14 @@
#define BOOST_UBLAS_USE_STREAM
// #endif
// MSVC extensions seem to disable abs () overloads in <cmath>.
#ifdef _MSC_EXTENSIONS
#define BOOST_UBLAS_NO_CMATH
#endif
#define BOOST_UBLAS_NO_ELEMENT_PROXIES
#define BOOST_UBLAS_NO_SMART_PROXIES
// This seems to work now thanks to the great work of the MPL team!
// #define BOOST_UBLAS_NO_SMART_PROXIES
// Using MSVC the following is missing:
// namespace std {
@@ -270,7 +276,7 @@ namespace std {
#endif
#ifdef BOOST_UBLAS_BOUNDS_CHECK
#ifdef BOOST_UBLAS_TYPE_CHECK
static bool disable_type_check = false;
#endif

View File

@@ -119,7 +119,7 @@ namespace boost { namespace numeric { namespace ublas {
static
BOOST_UBLAS_INLINE
real_type abs (const_reference t) {
#ifdef BOOST_NO_STDC_NAMESPACE
#if defined (BOOST_NO_STDC_NAMESPACE) || defined (BOOST_UBLAS_NO_CMATH)
return ::fabsf (t);
#else
return std::abs (t);
@@ -128,7 +128,7 @@ namespace boost { namespace numeric { namespace ublas {
static
BOOST_UBLAS_INLINE
value_type sqrt (const_reference t) {
#ifdef BOOST_NO_STDC_NAMESPACE
#if defined (BOOST_NO_STDC_NAMESPACE) || defined (BOOST_UBLAS_NO_CMATH)
return ::sqrtf (t);
#else
return std::sqrt (t);
@@ -197,7 +197,7 @@ namespace boost { namespace numeric { namespace ublas {
static
BOOST_UBLAS_INLINE
real_type abs (const_reference t) {
#ifdef BOOST_NO_STDC_NAMESPACE
#if defined (BOOST_NO_STDC_NAMESPACE) || defined (BOOST_UBLAS_NO_CMATH)
return ::fabs (t);
#else
return std::abs (t);
@@ -206,7 +206,7 @@ namespace boost { namespace numeric { namespace ublas {
static
BOOST_UBLAS_INLINE
value_type sqrt (const_reference t) {
#ifdef BOOST_NO_STDC_NAMESPACE
#if defined (BOOST_NO_STDC_NAMESPACE) || defined (BOOST_UBLAS_NO_CMATH)
return ::sqrt (t);
#else
return std::sqrt (t);
@@ -272,7 +272,7 @@ namespace boost { namespace numeric { namespace ublas {
static
BOOST_UBLAS_INLINE
real_type abs (const_reference t) {
#ifdef BOOST_NO_STDC_NAMESPACE
#if defined (BOOST_NO_STDC_NAMESPACE) || defined (BOOST_UBLAS_NO_CMATH)
return ::fabsl (t);
#else
return std::abs (t);
@@ -281,7 +281,7 @@ namespace boost { namespace numeric { namespace ublas {
static
BOOST_UBLAS_INLINE
value_type sqrt (const_reference t) {
#ifdef BOOST_NO_STDC_NAMESPACE
#if defined (BOOST_NO_STDC_NAMESPACE) || defined (BOOST_UBLAS_NO_CMATH)
return ::sqrtl (t);
#else
return std::sqrt (t);

View File

@@ -1968,14 +1968,14 @@ namespace boost { namespace numeric { namespace ublas {
typedef BOOST_UBLAS_TYPENAME E1::difference_type difference_type;
typedef BOOST_UBLAS_TYPENAME E1::value_type value_type;
BOOST_UBLAS_CHECK (e1 ().size () == e2.size1 (), bad_size ());
BOOST_UBLAS_CHECK (e2.size1 () == e2.size2 (), bad_size ());
BOOST_UBLAS_CHECK (e1.size () == e2 ().size1 (), bad_size ());
BOOST_UBLAS_CHECK (e2 ().size1 () == e2 ().size2 (), bad_size ());
size_type size = e1.size ();
for (size_type n = 0; n < size; ++ n) {
BOOST_UBLAS_CHECK (e2 (n, n) != value_type (), singular ());
value_type t = e1 (n) /= e2 (n, n);
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type (), singular ());
value_type t = e1 (n) /= e2 () (n, n);
for (size_type m = n + 1; m < size; ++ m)
e1 (m) -= t * e2 (n, m);
e1 (m) -= t * e2 () (n, m);
}
}
// Packed (proxy) case
@@ -1987,14 +1987,14 @@ namespace boost { namespace numeric { namespace ublas {
typedef BOOST_UBLAS_TYPENAME E1::difference_type difference_type;
typedef BOOST_UBLAS_TYPENAME E1::value_type value_type;
BOOST_UBLAS_CHECK (e1 ().size () == e2.size1 (), bad_size ());
BOOST_UBLAS_CHECK (e2.size1 () == e2.size2 (), bad_size ());
BOOST_UBLAS_CHECK (e1.size () == e2 ().size1 (), bad_size ());
BOOST_UBLAS_CHECK (e2 ().size1 () == e2 ().size2 (), bad_size ());
size_type size = e1.size ();
for (size_type n = 0; n < size; ++ n) {
BOOST_UBLAS_CHECK (e2 (n, n) != value_type (), singular ());
value_type t = e1 (n) /= e2 (n, n);
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type (), singular ());
value_type t = e1 (n) /= e2 () (n, n);
typename E1::iterator ite1 (e1.find_first (n + 1));
typename E1::iterator ite1_end (e1.find_first (e2.size ()));
typename E1::iterator ite1_end (e1.find_first (e2 ().size ()));
typename E2::const_iterator2 it2e2 (e2 ().find_first2 (1, n, n + 1));
typename E2::const_iterator2 it2e2_end (e2 ().find_first2 (1, n, e2 ().size2 ()));
difference_type m (it2e2_end - it2e2);
@@ -2011,12 +2011,12 @@ namespace boost { namespace numeric { namespace ublas {
typedef BOOST_UBLAS_TYPENAME E1::difference_type difference_type;
typedef BOOST_UBLAS_TYPENAME E1::value_type value_type;
BOOST_UBLAS_CHECK (e1 ().size () == e2.size1 (), bad_size ());
BOOST_UBLAS_CHECK (e2.size1 () == e2.size2 (), bad_size ());
BOOST_UBLAS_CHECK (e1.size () == e2 ().size1 (), bad_size ());
BOOST_UBLAS_CHECK (e2 ().size1 () == e2 ().size2 (), bad_size ());
size_type size = e1.size ();
for (size_type n = 0; n < size; ++ n) {
BOOST_UBLAS_CHECK (e2 (n, n) != value_type (), singular ());
value_type t = e1 (n) /= e2 (n, n);
BOOST_UBLAS_CHECK (e2 () (n, n) != value_type (), singular ());
value_type t = e1 (n) /= e2 () (n, n);
typename E2::const_iterator2 it2e2 (e2 ().find_first2 (1, n, n + 1));
typename E2::const_iterator2 it2e2_end (e2 ().find_first2 (1, n, e2 ().size2 ()));
while (it2e2 != it2e2_end)
@@ -2029,7 +2029,7 @@ namespace boost { namespace numeric { namespace ublas {
void inplace_solve (E1 &e1, const matrix_expression<E2> &e2,
vector_tag, lower_tag) {
typedef BOOST_UBLAS_TYPENAME E2::storage_category dispatch_category;
inplace_solve (e1, e2, lower_tag (), vector_tag (), dispatch_category ());
inplace_solve (e1, e2, vector_tag (), lower_tag (), dispatch_category ());
}
// Dense (proxy) case

View File

@@ -1852,7 +1852,7 @@ namespace boost { namespace numeric { namespace ublas {
#endif
};
// inner_prod (v1, v2) = sum (v1 [i] * v2 [i]
// inner_prod (v1, v2) = sum (v1 [i] * v2 [i])
template<class E1, class E2>
BOOST_UBLAS_INLINE
typename vector_scalar_binary_traits<E1, E2, vector_inner_prod<typename E1::value_type,