2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-25 16:52:09 +00:00

Added Gunters new overviews

Renamed files with names not consitent with titles
Technical and style fixes to types and operations_overview
 Mostly storage and container paramters are more consitently used
<br /> dropped from <pre> sections
This commit is contained in:
Michael Stevens
2004-08-13 16:23:01 +00:00
parent 662150369b
commit 6712bf01f0
21 changed files with 2958 additions and 1220 deletions

View File

@@ -24,17 +24,17 @@ n</em>)-dimensional banded matrix with <em>l</em> lower and
storage of banded matrices is packed.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/banded.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
banded_matrix&lt;double&gt; m (3, 3, 1, 1);<br />
for (signed i = 0; i &lt; signed (m.size1 ()); ++ i)<br />
for (signed j = std::max (i - 1, 0); j &lt; std::min (i + 2, signed (m.size2 ())); ++ j)<br />
m (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; m &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/banded.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
banded_matrix&lt;double&gt; m (3, 3, 1, 1);
for (signed i = 0; i &lt; signed (m.size1 ()); ++ i)
for (signed j = std::max (i - 1, 0); j &lt; std::min (i + 2, signed (m.size2 ())); ++ j)
m (i, j) = 3 * i + j;
std::cout &lt;&lt; m &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header banded.hpp.</p>
@@ -321,18 +321,18 @@ Adaptor</h2>
banded matrix adaptor for other matrices.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/banded.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
banded_adaptor&lt;matrix&lt;double&gt; &gt; ba (m, 1, 1);<br />
for (signed i = 0; i &lt; signed (ba.size1 ()); ++ i)<br />
for (signed j = std::max (i - 1, 0); j &lt; std::min (i + 2, signed (ba.size2 ())); ++ j)<br />
ba (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; ba &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/banded.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
banded_adaptor&lt;matrix&lt;double&gt; &gt; ba (m, 1, 1);
for (signed i = 0; i &lt; signed (ba.size1 ()); ++ i)
for (signed j = std::max (i - 1, 0); j &lt; std::min (i + 2, signed (ba.size2 ())); ++ j)
ba (i, j) = 3 * i + j;
std::cout &lt;&lt; ba &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header banded.hpp.</p>

446
doc/blas.htm Normal file
View File

@@ -0,0 +1,446 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- $Id: blas.htm,v 1.2 2004/08/13 15:59:34 mistevens Exp $ -->
<head>
<title>BLAS</title>
<meta name="GENERATOR" content="Quanta Plus" />
<meta name="AUTHOR" content="Gunter Winkler" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="ublas.css" />
<link rel="stylesheet" type="text/css" href="doxygen.css" />
</head>
<body>
<h1>Level 3 BLAS</h1>
<hr />
<a name="_details"></a>
<table summary="" border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br /><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class M1, class T, class M2, class M3&gt; M1 &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga0">boost::numeric::ublas::blas_3::tmm</a> (M1 &amp;m1, const T &amp;t, const M2 &amp;m2, const M3 &amp;m3)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">triangular matrix multiplication <a href="#ga0"></a><br /><br /></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class M1, class T, class M2, class C&gt; M1 &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga1">boost::numeric::ublas::blas_3::tsm</a> (M1 &amp;m1, const T &amp;t, const M2 &amp;m2, C)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">triangular solve <em>m2</em> * <em>x</em> = <em>t</em> * <em>m1</em> in place, <em>m2</em> is a triangular matrix <a href="#ga1"></a><br /><br /></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class M1, class T1, class T2, class M2, class M3&gt; M1 &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga2">boost::numeric::ublas::blas_3::gmm</a> (M1 &amp;m1, const T1 &amp;t1, const T2 &amp;t2, const M2 &amp;m2, const M3 &amp;m3)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">general matrix multiplication <a href="#ga2"></a><br /><br /></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class M1, class T1, class T2, class M2&gt; M1 &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga3">boost::numeric::ublas::blas_3::srk</a> (M1 &amp;m1, const T1 &amp;t1, const T2 &amp;t2, const M2 &amp;m2)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">symmetric rank k update: <em>m1</em> = <em>t</em> * <em>m1</em> + <em>t2</em> * (<em>m2</em> * <em>m2<sup>T</sup></em>) <a href="#ga3"></a><br /><br /></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class M1, class T1, class T2, class M2&gt; M1 &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga4">boost::numeric::ublas::blas_3::hrk</a> (M1 &amp;m1, const T1 &amp;t1, const T2 &amp;t2, const M2 &amp;m2)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">hermitian rank k update: <em>m1</em> = <em>t</em> * <em>m1</em> + <em>t2</em> * (<em>m2</em> * <em>m2<sup>H</sup></em>) <a href="#ga4"></a><br /><br /></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class M1, class T1, class T2, class M2, class M3&gt; M1 &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga5">boost::numeric::ublas::blas_3::sr2k</a> (M1 &amp;m1, const T1 &amp;t1, const T2 &amp;t2, const M2 &amp;m2, const M3 &amp;m3)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">generalized symmetric rank k update: <em>m1</em> = <em>t1</em> * <em>m1</em> + <em>t2</em> * (<em>m2</em> * <em>m3<sup>T</sup></em>) + <em>t2</em> * (<em>m3</em> * <em>m2<sup>T</sup></em>) <a href="#ga5"></a><br /><br /></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class M1, class T1, class T2, class M2, class M3&gt; M1 &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga6">boost::numeric::ublas::blas_3::hr2k</a> (M1 &amp;m1, const T1 &amp;t1, const T2 &amp;t2, const M2 &amp;m2, const M3 &amp;m3)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">generalized hermitian rank k update: <em>m1</em> = <em>t1</em> * <em>m1</em> + <em>t2</em> * (<em>m2</em> * <em>m3<sup>H</sup></em>) + (<em>m3</em> * (<em>t2</em> * <em>m2</em>)<sup>H</sup>) <a href="#ga6"></a><br /><br /></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class M, class E1, class E2&gt; BOOST_UBLAS_INLINE M &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="operations.htm#ga7">boost::numeric::ublas::axpy_prod</a> (const matrix_expression&lt; E1 &gt; &amp;e1, const matrix_expression&lt; E2 &gt; &amp;e2, M &amp;m, bool init=true)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">computes <code>M += A X</code> or <code>M = A X</code> in an optimized fashion. <a href="operations.htm#ga7"></a><br /><br /></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class M, class E1, class E2&gt; BOOST_UBLAS_INLINE M &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="operations.htm#ga8">boost::numeric::ublas::opb_prod</a> (const matrix_expression&lt; E1 &gt; &amp;e1, const matrix_expression&lt; E2 &gt; &amp;e2, M &amp;m, bool init=true)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">computes <code>M += A X</code> or <code>M = A X</code> in an optimized fashion. <a href="operations.htm#ga8"></a><br /><br /></td></tr>
</table>
<hr />
<h2>Function Documentation</h2>
<a class="anchor" name="ga0" doxytag="boost::numeric::ublas::blas_3::tmm" ></a>
<table summary="" class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> M1&amp; tmm </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">M1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M3 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m3</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>triangular matrix multiplication </p>
</td>
</tr>
</table>
<a class="anchor" name="ga1" doxytag="boost::numeric::ublas::blas_3::tsm" ></a>
<table summary="" class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> M1&amp; tsm </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">M1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>C&nbsp;</td>
<td class="mdname" nowrap></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
triangular solve <em>m2</em> * <em>x</em> = <em>t</em> * <em>m1</em> in place, <em>m2</em> is a triangular matrix
</p>
</td>
</tr>
</table>
<a class="anchor" name="ga2" doxytag="boost::numeric::ublas::blas_3::gmm" ></a>
<table summary="" class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> M1&amp; gmm </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">M1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M3 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m3</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
general matrix multiplication
</p>
</td>
</tr>
</table>
<a class="anchor" name="ga3" doxytag="boost::numeric::ublas::blas_3::srk" ></a>
<table summary="" class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> M1&amp; srk </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">M1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m2</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
symmetric rank k update: <em>m1</em> = <em>t</em> * <em>m1</em> + <em>t2</em> * (<em>m2</em> * <em>m2<sup>T</sup></em>)
</p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000003">Todo:</a></b></dt><dd>use <a class="el" href="../../d3/d2/group__blas3.html#ga8">opb_prod()</a> </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="ga4" doxytag="boost::numeric::ublas::blas_3::hrk" ></a>
<table summary="" class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> M1&amp; hrk </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">M1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m2</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
hermitian rank k update: <em>m1</em> = <em>t</em> * <em>m1</em> + <em>t2</em> * (<em>m2</em> * <em>m2<sup>H</sup></em>)
</p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000004">Todo:</a></b></dt><dd>use <a class="el" href="../../d3/d2/group__blas3.html#ga8">opb_prod()</a> </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="ga5" doxytag="boost::numeric::ublas::blas_3::sr2k" ></a>
<table summary="" class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> M1&amp; sr2k </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">M1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M3 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m3</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
generalized symmetric rank k update: <em>m1</em> = <em>t1</em> * <em>m1</em> + <em>t2</em> * (<em>m2</em> * <em>m3<sup>T</sup></em>) + <em>t2</em> * (<em>m3</em> * <em>m2<sup>T</sup></em>)
</p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000005">Todo:</a></b></dt><dd>use <a class="el" href="../../d3/d2/group__blas3.html#ga8">opb_prod()</a> </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="ga6" doxytag="boost::numeric::ublas::blas_3::hr2k" ></a>
<table summary="" class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> M1&amp; hr2k </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">M1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T1 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const T2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>t2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M2 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const M3 &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m3</em></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
generalized hermitian rank k update: <em>m1</em> = <em>t1</em> * <em>m1</em> + <em>t2</em> * (<em>m2</em> * <em>m3<sup>H</sup></em>) + (<em>m3</em> * (<em>t2</em> * <em>m2</em>)<sup>H</sup>)
</p>
<dl compact><dt><b><a class="el" href="todo.html#_todo000006">Todo:</a></b></dt><dd>use <a class="el" href="../../d3/d2/group__blas3.html#ga8">opb_prod()</a> </dd></dl>
</td>
</tr>
</table>
<hr />
<p>Copyright (&copy;) 2000-2004 Michael Stevens, Mathias Koch,
Joerg Walter, Gunter Winkler<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: 2004-07-26</p>
</body>
</html>

218
doc/doxygen.css Normal file
View File

@@ -0,0 +1,218 @@
H1 {
text-align: center;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
H2 {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
CAPTION { font-weight: bold }
DIV.qindex {
width: 100%;
background-color: #eeeeff;
border: 1px solid #B0B0B0;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 120%;
}
A.qindex {
text-decoration: none;
font-weight: bold;
color: #1A419D;
padding: 2px;
}
A.qindex:visited {
text-decoration: none;
font-weight: bold;
color: #1A419D
padding: 2px;
}
A.qindex:hover {
text-decoration: none;
background-color: #ddddff;
padding: 2px;
}
A.qindexHL {
text-decoration: none;
font-weight: bold;
background-color: #6666cc;
color: #ffffff;
padding: 2px 6px;
border: 1px double #9295C2;
}
A.qindexHL:hover {
text-decoration: none;
background-color: #6666cc;
color: #ffffff;
padding: 2px 6px;
}
A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff }
A.el { text-decoration: none; font-weight: bold }
A.elRef { font-weight: bold }
A.code { text-decoration: none; font-weight: normal; color: #1A419D}
A.codeRef { font-weight: normal; color: #1A419D}
A:hover { text-decoration: none; background-color: #f2f2ff }
DL.el { margin-left: -1cm }
PRE.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
margin-top: 4px;
margin-bottom: 4px;
margin-left: 2px;
margin-right: 8px;
padding-left: 6px;
padding-right: 6px;
padding-top: 4px;
padding-bottom: 4px;
}
DIV.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
padding: 6px;
}
DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
TD.md { background-color: #F4F4FB; font-weight: bold; }
TD.mdname1 { background-color: #F4F4FB; font-weight: bold; color: #602020; }
TD.mdname { background-color: #F4F4FB; font-weight: bold; color: #602020; width: 600px; }
DIV.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller }
BODY {
background: white;
color: black;
margin-right: 20px;
margin-left: 20px;
}
TD.indexkey {
background-color: #eeeeff;
font-weight: bold;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
TD.indexvalue {
background-color: #eeeeff;
font-style: italic;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
TR.memlist {
background-color: #f0f0f0;
}
P.formulaDsp { text-align: center; }
IMG.formulaDsp { }
IMG.formulaInl { vertical-align: middle; }
SPAN.keyword { color: #008000 }
SPAN.keywordtype { color: #604020 }
SPAN.keywordflow { color: #e08000 }
SPAN.comment { color: #800000 }
SPAN.preprocessor { color: #806020 }
SPAN.stringliteral { color: #002080 }
SPAN.charliteral { color: #008080 }
.mdTable {
border: 1px solid #868686;
background-color: #F4F4FB;
}
.mdRow {
padding: 8px 10px;
}
.mdescLeft {
font-size: smaller;
font-style: italic;
background-color: #FAFAFA;
padding-left: 8px;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.mdescRight {
font-size: smaller;
font-style: italic;
background-color: #FAFAFA;
padding-left: 4px;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
padding-bottom: 0px;
padding-right: 8px;
}
.memItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.memItemRight {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 13px;
}
.search { color: #003399;
font-weight: bold;
}
FORM.search {
margin-bottom: 0px;
margin-top: 0px;
}
INPUT.search { font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #eeeeff;
}
TD.tiny { font-size: 75%;
}
a {
color: #252E78;
}
a:visited {
color: #3D2185;
}

View File

@@ -34,90 +34,71 @@ Overview of Matrix and Vector Operations</h1>
<tr><td><code>t, t1, t2</code></td>
<td>are scalar values</td></tr>
<tr><td><code>r, r1, r2</code></td>
<td>are ranges, e.g. <code>range(0, 3)</code></td></tr>
<td>are <a href="storage.htm#range">ranges</a>, e.g. <code>range(0, 3)</code></td></tr>
<tr><td><code>s, s1, s2</code></td>
<td>are slices, e.g. <code>slice(0, 1, 3)</code></td></tr>
<td>are <a href="storage.htm#slice">slices</a>, e.g. <code>slice(0, 1, 3)</code></td></tr>
</table>
<p><em>Note:</em> A range <code>r = range(start, count)</code>
contains all indices <code>i</code> with <code>start &lt;= i &lt;
start+count</code>. A slice is something more general. The slice
<code>s = slice(start, stride, count)</code> contains the indices
<code>start, start+stride, ..., start+(count-1)*stride</code>. The
stride can be any integer including 0 and -1!</p>
<h2><a name="blas">Basic Linear Algebra</a></h2>
<h3>standard operations: addition, subtraction, multiplication by a
scalar</h3>
<pre>
<code>
<pre><code>
C = A + B; C = A - B; C = -A;
w = u + v; w = u - v; w = -u;
C = t * A; C = A * t; C = A / t;
w = t * u; w = u * t; w = u / t;
</code>
</pre>
</code></pre>
<h3>computed assignements</h3>
<pre>
<code>
<pre><code>
C += A; C -= A;
w += u; w -= u;
C *= t; C /= t;
w *= t; w /= t;
</code>
</pre>
</code></pre>
<h3>inner, outer and other products</h3>
<pre>
<code>
<pre><code>
t = inner_prod(u, v);
C = outer_prod(u, v);
w = prod(A, u); w = prod(u, A); w = prec_prod(A, u); w = prec_prod(u, A);
C = prod(A, B); C = prec_prod(A, B);
w = element_prod(u, v); w = element_div(u, v);
C = element_prod(A, B); C = element_div(A, B);
</code>
</pre>
</code></pre>
<h3>transformations</h3>
<pre>
<code>
<pre><code>
w = conj(u); w = real(u); w = imag(u);
C = trans(A); C = conj(A); C = herm(A); C = real(A); C = imag(A);
</code>
</pre>
</code></pre>
<h2><a name="advanced">Advanced functions</a></h2>
<h3>norms</h3>
<pre>
<code>
<pre><code>
t = norm_inf(v); i = index_norm_inf(v);
t = norm_1(v); t = norm_2(v);
t = norm_inf(A); i = index_norm_inf(A);
t = norm_1(A); t = norm_frobenius(A);
</code>
</pre>
</code></pre>
<h3>products</h3>
<pre>
<code>
<pre><code>
axpy_prod(A, u, w, true); // w = A * u
axpy_prod(A, u, w, false); // w += A * u
axpy_prod(u, A, w, true); // w = trans(A) * u
axpy_prod(u, A, w, false); // w += trans(A) * u
axpy_prod(A, B, C, true); // C = A * B
axpy_prod(A, B, C, false); // C += A * B
</code>
</pre>
</code></pre>
<p><em>Note:</em> The last argument (<code>bool init</code>) of
<code>axpy_prod</code> is optional. Currently it defaults to
<code>true</code>, but this may change in the future. Set the
@@ -125,24 +106,20 @@ axpy_prod(A, B, C, false); // C += A * B
<code>w.clear()</code> before <code>axpy_prod</code>. Up to now
there are some specialisation for compressed matrices that give a
large speed up compared to <code>prod</code>.</p>
<pre>
<code>
<pre><code>
w = block_prod&lt;matrix_type, 64&gt; (A, u); // w = A * u
w = block_prod&lt;matrix_type, 64&gt; (u, A); // w = trans(A) * u
C = block_prod&lt;matrix_type, 64&gt; (A, B); // w = A * B
</code>
</pre>
</code></pre>
<p><em>Note:</em> The blocksize can be any integer. However, the
total speed depends very strong on the combination of blocksize,
CPU and compiler. The function <code>block_prod</code> is designed
for large dense matrices.</p>
<h3>rank-k updates</h3>
<pre>
<code>
<pre><code>
opb_prod(A, B, C, true); // C = A * B
opb_prod(A, B, C, false); // C += A * B
</code>
</pre>
</code></pre>
<p><em>Note:</em> The last argument (<code>bool init</code>) of
<code>opb_prod</code> is optional. Currently it defaults to
<code>true</code>, but this may change in the future. This function
@@ -151,21 +128,25 @@ because the product is computed as a sum of outer products.</p>
<h2><a name="sub">Submatrices, Subvectors</a></h2>
<pre>
<code>
w = project(u, r); w = project(u, s);
C = project(A, r1, r2); C = project(A, s1, s2);
w = row(A, i); w = column(A, j);
</code>
</pre>
<p><em>Note:</em> A range <code>r = range(start, stop)</code>
contains all indices <code>i</code> with <code>start &lt;= i &lt;
stop</code>. A slice is something more general. The slice
<code>s = slice(start, stride, size)</code> contains the indices
<code>start, start+stride, ..., start+(size-1)*stride</code>. The
stride can be 0 or negative! If <code>start >= stop</code> for a range
or <code>size == 0</code> for a slice then it contains no elements.</p>
<pre><code>
w = project(u, r); // a subvector of u specifed by the index range r
w = project(u, s); // a subvector of u specifed by the index slice s
C = project(A, r1, r2); // a submatrix of A specified by the two index ranges r1 and r2
C = project(A, s1, s2); // a submatrix of A specified by the two index slices s1 and s2
w = row(A, i); w = column(A, j); // a row or column of matrix as a vector
</code></pre>
<p>There are to more ways to access some matrix elements as a
vector:</p>
<pre>
<code>
matrix_vector_range&lt;matrix_type&gt; (A, r1, r2);
<pre><code>matrix_vector_range&lt;matrix_type&gt; (A, r1, r2);
matrix_vector_slice&lt;matrix_type&gt; (A, s1, s2);
</code>
</pre>
</code></pre>
<p><em>Note:</em> These matrix proxies take a sequence of elements
of a matrix and allow you to access these as a vector. In
particular <code>matrix_vector_slice</code> can do this in a very
@@ -175,34 +156,38 @@ elements must lie along a diagonal.</p>
column of a matrix we access the row with a slice with stride 1 and
the column with a slice with stride 0 thus:<br />
<code>matrix_vector_slice&lt;matrix_type&gt; (A, slice(0,1,2),
slice(0,0,2));</code></p>
slice(0,0,2));
</code></p>
<h2><a name="speed">Speed improvements</a></h2>
<h3>Matrix / Vector assignment</h3>
<p>If you know for sure that the left hand expression and the right
hand expression have no common storage, then you can tell ublas
that there is no aliasing:</p>
<pre>
<code>
noalias(C) = prod(A, B);
</code>
</pre>
<p>Most often the right hand side of an assignement is constant.
So you can give your compiler a hint to use const member function
even if <code>A</code> is mutable. (<code>MATRIX</code> is the type of <code>A</code>.)
This cast drastically reduces the access time of sparse matrix elements, since no
temporary sparse element proxies are created.
</p>
<pre>
<code>
C = static_cast&lt;const MATRIX&amp;&gt; A;
</code>
</pre>
<!-- template:
<pre><code>
hand expression have no common storage, then assignment has
no <em>aliasing</em>. A more efficient assignment can be specified
in this case:</p>
<pre><code>noalias(C) = prod(A, B);
</code></pre>
-->
<p>This avoids the creation of a temporary matrix that is required in a normal assignment.
'noalias' assignment requires that the left and right hand side be size conformant.</p>
<h3>Sparse element access</h3>
<p>The matrix element access function <code>A(i1,i2)</code> or the equivalent vector
element access functions (<code>v(i) or v[i]</code>) usually create 'sparse element proxies'
when applied to a sparse matrix or vector. These <em>proxies</em> allow access to elements
without having to worry about nasty C++ issues where references are invalidated.</p>
<p>These 'sparse element proxies' can be implemented more efficiently when applied to <code>const</code>
objects.
Sadly in C++ there is no way to distinguish between an element access on the left and right hand side of
an assignment. Most often elements on the right hand side will not be changed and therefore it would
be better to use the <code>const</code> proxies. We can do this by making the matrix or vector
<code>const</code> before accessing it's elements. For example:</p>
<pre><code>value = const_cast&lt;const VEC&&gt;(v)[i]; // VEC is the type of V
</code></pre>
<p>If more then one element needs to be accessed <code>const_iterator</code>'s should be used
in preference to <code>iterator</code>'s for the same reason. For the more daring 'sparse element proxies'
can be completely turned off in uBLAS by defining the configuration macro <code>BOOST_UBLAS_NO_ELEMENT_PROXIES</code>.
</p>
<hr />
<p>Copyright (&copy;) 2000-2004 Joerg Walter, Mathias Koch, Gunter
Winkler, Michael Stevens<br />
@@ -211,6 +196,6 @@ 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: 2004-07-05</p>
<p>Last revised: 2004-08-09</p>
</body>
</html>

View File

@@ -24,26 +24,26 @@ i</em></sub><sup><em>-</em></sup>. The storage of hermitian
matrices is packed.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/hermitian.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
hermitian_matrix&lt;std::complex&lt;double&gt;, lower&gt; ml (3, 3);<br />
for (unsigned i = 0; i &lt; ml.size1 (); ++ i) {<br />
for (unsigned j = 0; j &lt; i; ++ j)<br />
ml (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);<br />
ml (i, i) = std::complex&lt;double&gt; (4 * i, 0);<br />
}<br />
std::cout &lt;&lt; ml &lt;&lt; std::endl;<br />
hermitian_matrix&lt;std::complex&lt;double&gt;, upper&gt; mu (3, 3);<br />
for (unsigned i = 0; i &lt; mu.size1 (); ++ i) {<br />
mu (i, i) = std::complex&lt;double&gt; (4 * i, 0);<br />
for (unsigned j = i + 1; j &lt; mu.size2 (); ++ j)<br />
mu (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);<br />
}<br />
std::cout &lt;&lt; mu &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/hermitian.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
hermitian_matrix&lt;std::complex&lt;double&gt;, lower&gt; ml (3, 3);
for (unsigned i = 0; i &lt; ml.size1 (); ++ i) {
for (unsigned j = 0; j &lt; i; ++ j)
ml (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);
ml (i, i) = std::complex&lt;double&gt; (4 * i, 0);
}
std::cout &lt;&lt; ml &lt;&lt; std::endl;
hermitian_matrix&lt;std::complex&lt;double&gt;, upper&gt; mu (3, 3);
for (unsigned i = 0; i &lt; mu.size1 (); ++ i) {
mu (i, i) = std::complex&lt;double&gt; (4 * i, 0);
for (unsigned j = i + 1; j &lt; mu.size2 (); ++ j)
mu (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);
}
std::cout &lt;&lt; mu &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header hermitian.hpp.</p>
@@ -328,26 +328,26 @@ Hermitian Adaptor</h2>
is a hermitian matrix adaptor for other matrices.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/hermitian.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;std::complex&lt;double&gt; &gt; m (3, 3);<br />
hermitian_adaptor&lt;matrix&lt;std::complex&lt;double&gt; &gt;, lower&gt; hal (m);<br />
for (unsigned i = 0; i &lt; hal.size1 (); ++ i) {<br />
for (unsigned j = 0; j &lt; i; ++ j)<br />
hal (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);<br />
hal (i, i) = std::complex&lt;double&gt; (4 * i, 0);<br />
}<br />
std::cout &lt;&lt; hal &lt;&lt; std::endl;<br />
hermitian_adaptor&lt;matrix&lt;std::complex&lt;double&gt; &gt;, upper&gt; hau (m);<br />
for (unsigned i = 0; i &lt; hau.size1 (); ++ i) {<br />
hau (i, i) = std::complex&lt;double&gt; (4 * i, 0);<br />
for (unsigned j = i + 1; j &lt; hau.size2 (); ++ j)<br />
hau (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);<br />
}<br />
std::cout &lt;&lt; hau &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/hermitian.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;std::complex&lt;double&gt; &gt; m (3, 3);
hermitian_adaptor&lt;matrix&lt;std::complex&lt;double&gt; &gt;, lower&gt; hal (m);
for (unsigned i = 0; i &lt; hal.size1 (); ++ i) {
for (unsigned j = 0; j &lt; i; ++ j)
hal (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);
hal (i, i) = std::complex&lt;double&gt; (4 * i, 0);
}
std::cout &lt;&lt; hal &lt;&lt; std::endl;
hermitian_adaptor&lt;matrix&lt;std::complex&lt;double&gt; &gt;, upper&gt; hau (m);
for (unsigned i = 0; i &lt; hau.size1 (); ++ i) {
hau (i, i) = std::complex&lt;double&gt; (4 * i, 0);
for (unsigned j = i + 1; j &lt; hau.size2 (); ++ j)
hau (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);
}
std::cout &lt;&lt; hau &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>

View File

@@ -40,14 +40,14 @@ suite.</p>
</ul>
<h2>Documentation</h2>
<ul>
<li><a href="overview.htm">Overview</a>
<ul style="list-style-type:disc">
<li><a href="types.htm">Overview of Matrix- and Vector-Types</a></li>
<li><a href="functions.htm">Overview of Matrix and Vector Operations</a></li>
<li><big><a href="overview.htm">Overview</a></big>
<ul>
<li><a href="types_overview.htm">Overview of Matrix- and Vector-Types</a></li>
<li><a href="operations_overview.htm">Overview of Matrix and Vector Operations</a></li>
</ul>
</li>
<li><a href="expression.htm">Expression Concepts</a>
<ul type="Circle">
<ul>
<li><a href="expression.htm#scalar_expression">Scalar
Expression</a></li>
<li><a href="expression.htm#vector_expression">Vector
@@ -57,13 +57,13 @@ Expression</a></li>
</ul>
</li>
<li><a href="container.htm">Container Concepts</a>
<ul type="Circle">
<ul>
<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">
<ul>
<li><a href="iterator.htm#indexed_bidirectional_iterator">Indexed
Bidirectional Iterator</a></li>
<li><a href="iterator.htm#indexed_random_access_iterator">Indexed
@@ -77,7 +77,7 @@ Access Column/Row Iterator</a></li>
</ul>
</li>
<li><a href="storage.htm">Storage</a>
<ul type="Circle">
<ul>
<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>
@@ -85,14 +85,14 @@ Access Column/Row Iterator</a></li>
</ul>
</li>
<li><a href="storage_sparse.htm">Sparse Storage</a>
<ul type="Circle">
<ul>
<li><a href="storage_sparse.htm#map_std">Default Standard
Map</a></li>
<li><a href="storage_sparse.htm#map_array">Map Array</a></li>
</ul>
</li>
<li><a href="vector.htm">Vector</a>
<ul type="Circle">
<ul>
<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>
@@ -100,7 +100,7 @@ Map</a></li>
</ul>
</li>
<li><a href="vector_sparse.htm">Sparse Vector</a>
<ul type="Circle">
<ul>
<li><a href="vector_sparse.htm#sparse_vector">Sparse
Vector</a></li>
<li><a href="vector_sparse.htm#compressed_vector">Compressed
@@ -110,13 +110,13 @@ Vector</a></li>
</ul>
</li>
<li><a href="vector_proxy.htm">Vector Proxies</a>
<ul type="Circle">
<ul>
<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">
<ul>
<li><a href="vector_expression.htm#vector_expression">Vector
Expression</a></li>
<li><a href="vector_expression.htm#vector_references">Vector
@@ -128,7 +128,7 @@ Reductions</a></li>
</ul>
</li>
<li><a href="matrix.htm">Matrix</a>
<ul type="Circle">
<ul>
<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>
@@ -136,7 +136,7 @@ Reductions</a></li>
</ul>
</li>
<li><a href="triangular.htm">Triangular Matrix</a>
<ul type="Circle">
<ul>
<li><a href="triangular.htm#triangular_matrix">Triangular
Matrix</a></li>
<li><a href="triangular.htm#triangular_adaptor">Triangular
@@ -144,7 +144,7 @@ Adaptor</a></li>
</ul>
</li>
<li><a href="symmetric.htm">Symmetric Matrix</a>
<ul type="Circle">
<ul>
<li><a href="symmetric.htm#symmetric_matrix">Symmetric
Matrix</a></li>
<li><a href="symmetric.htm#symmetric_adaptor">Symmetric
@@ -152,7 +152,7 @@ Adaptor</a></li>
</ul>
</li>
<li><a href="hermitian.htm">Hermitian Matrix</a>
<ul type="Circle">
<ul>
<li><a href="hermitian.htm#hermitian_matrix">Hermitian
Matrix</a></li>
<li><a href="hermitian.htm#hermitian_adaptor">Hermitian
@@ -160,13 +160,13 @@ Adaptor</a></li>
</ul>
</li>
<li><a href="banded.htm">Banded Matrix</a>
<ul type="Circle">
<ul>
<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">
<ul>
<li><a href="matrix_sparse.htm#sparse_matrix">Sparse
Matrix</a></li>
<li><a href="matrix_sparse.htm#compressed_matrix">Compressed
@@ -176,7 +176,7 @@ Matrix</a></li>
</ul>
</li>
<li><a href="matrix_proxy.htm">Matrix Proxies</a>
<ul type="Circle">
<ul>
<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>
@@ -186,7 +186,7 @@ Matrix</a></li>
</ul>
</li>
<li><a href="matrix_expression.htm">Matrix Expressions</a>
<ul type="Circle">
<ul>
<li><a href="matrix_expression.htm#matrix_expression">Matrix
Expression</a></li>
<li><a href="matrix_expression.htm#matrix_references">Matrix
@@ -199,6 +199,12 @@ Vector Operations</a></li>
Matrix Operations</a></li>
</ul>
</li>
<li>Operations &amp; Functions
<ul>
<li><a href="products.htm">Special Products</a></li>
<li><a href="blas.htm">BLAS</a></li>
</ul>
</li>
</ul>
<h2>Supported Platforms</h2>
<p>The original development platform for uBLAS we used MSVC 6.0
@@ -206,7 +212,6 @@ with Dinkumware STL. Other compilers known to accept the library
are</p>
<ul>
<li>MSVC 6.0 with STLPort-4.5.3, 7.0, 7.1</li>
<li>BCC 5.5</li>
<li>GCC 2.95.x, 3.0.x, 3.1.x, 3.2.x, 3.3.x, 3.4.x</li>
<li>ICC 7.0, 7.1 8.0</li>
<li>Comeau 4.2.x</li>

View File

@@ -24,17 +24,17 @@ m)-</em>th element of the container for column major
orientation.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
m (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; m &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout &lt;&lt; m &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix.hpp.</p>
@@ -305,14 +305,14 @@ n</em> holds <em>id</em><sub><em>i, j</em></sub> <em>= 0</em>, if
1</em>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
identity_matrix&lt;double&gt; m (3);<br />
std::cout &lt;&lt; m &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
identity_matrix&lt;double&gt; m (3);
std::cout &lt;&lt; m &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix.hpp.</p>
@@ -449,14 +449,14 @@ zero matrices. For a <em>(m x n</em>)-dimensional zero matrix and
<em>z</em><sub><em>i, j</em></sub> <em>= 0</em>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
zero_matrix&lt;double&gt; m (3, 3);<br />
std::cout &lt;&lt; m &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
zero_matrix&lt;double&gt; m (3, 3);
std::cout &lt;&lt; m &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix.hpp.</p>
@@ -592,14 +592,14 @@ scalar matrix and <em>0 &lt;= i &lt; m</em>, <em>0 &lt;= j &lt;
n</em> holds <em>z</em><sub><em>i, j</em></sub> <em>= s</em>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
scalar_matrix&lt;double&gt; m (3, 3);<br />
std::cout &lt;&lt; m &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
scalar_matrix&lt;double&gt; m (3, 3);
std::cout &lt;&lt; m &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix.hpp.</p>

View File

@@ -420,46 +420,46 @@ end of the reversed expression.</td>
<h3>Unary Operations</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class E, class F&gt;<br />
struct matrix_unary1_traits {<br />
typedef matrix_unary1&lt;typename E::const_closure_type, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (- m) [i] [j] = - m [i] [j]<br />
template&lt;class E&gt;<br />
typename matrix_unary1_traits&lt;E, scalar_negate&lt;typename E::value_type&gt; &gt;::result_type<br />
operator - (const matrix_expression&lt;E&gt; &amp;e);<br />
<br />
// (conj m) [i] [j] = conj (m [i] [j])<br />
template&lt;class E&gt;<br />
typename matrix_unary1_traits&lt;E, scalar_conj&lt;typename E::value_type&gt; &gt;::result_type<br />
conj (const matrix_expression&lt;E&gt; &amp;e);<br />
<br />
// (real m) [i] [j] = real (m [i] [j])<br />
template&lt;class E&gt;<br />
typename matrix_unary1_traits&lt;E, scalar_real&lt;typename E::value_type&gt; &gt;::result_type<br />
real (const matrix_expression&lt;E&gt; &amp;e);<br />
<br />
// (imag m) [i] [j] = imag (m [i] [j])<br />
template&lt;class E&gt;<br />
typename matrix_unary1_traits&lt;E, scalar_imag&lt;typename E::value_type&gt; &gt;::result_type<br />
imag (const matrix_expression&lt;E&gt; &amp;e);<br />
<br />
template&lt;class E, class F&gt;<br />
struct matrix_unary2_traits {<br />
typedef matrix_unary2&lt;typename E::const_closure_type, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (trans m) [i] [j] = m [j] [i]<br />
template&lt;class E&gt;<br />
typename matrix_unary2_traits&lt;E, scalar_identity&lt;typename E::value_type&gt; &gt;::result_type<br />
trans (const matrix_expression&lt;E&gt; &amp;e);<br />
<br />
// (herm m) [i] [j] = conj (m [j] [i])<br />
template&lt;class E&gt;<br />
typename matrix_unary2_traits&lt;E, scalar_conj&lt;typename E::value_type&gt; &gt;::result_type<br />
<code>template&lt;class E, class F&gt;
struct matrix_unary1_traits {
typedef matrix_unary1&lt;typename E::const_closure_type, F&gt; expression_type;
typedef expression_type result_type;
};
// (- m) [i] [j] = - m [i] [j]
template&lt;class E&gt;
typename matrix_unary1_traits&lt;E, scalar_negate&lt;typename E::value_type&gt; &gt;::result_type
operator - (const matrix_expression&lt;E&gt; &amp;e);
// (conj m) [i] [j] = conj (m [i] [j])
template&lt;class E&gt;
typename matrix_unary1_traits&lt;E, scalar_conj&lt;typename E::value_type&gt; &gt;::result_type
conj (const matrix_expression&lt;E&gt; &amp;e);
// (real m) [i] [j] = real (m [i] [j])
template&lt;class E&gt;
typename matrix_unary1_traits&lt;E, scalar_real&lt;typename E::value_type&gt; &gt;::result_type
real (const matrix_expression&lt;E&gt; &amp;e);
// (imag m) [i] [j] = imag (m [i] [j])
template&lt;class E&gt;
typename matrix_unary1_traits&lt;E, scalar_imag&lt;typename E::value_type&gt; &gt;::result_type
imag (const matrix_expression&lt;E&gt; &amp;e);
template&lt;class E, class F&gt;
struct matrix_unary2_traits {
typedef matrix_unary2&lt;typename E::const_closure_type, F&gt; expression_type;
typedef expression_type result_type;
};
// (trans m) [i] [j] = m [j] [i]
template&lt;class E&gt;
typename matrix_unary2_traits&lt;E, scalar_identity&lt;typename E::value_type&gt; &gt;::result_type
trans (const matrix_expression&lt;E&gt; &amp;e);
// (herm m) [i] [j] = conj (m [j] [i])
template&lt;class E&gt;
typename matrix_unary2_traits&lt;E, scalar_conj&lt;typename E::value_type&gt; &gt;::result_type
herm (const matrix_expression&lt;E&gt; &amp;e);</code>
</pre>
<h4>Description</h4>
@@ -483,22 +483,22 @@ conjugate of the transpose of a matrix expression.</p>
<p>Quadratic depending from the size of the matrix expression.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;std::complex&lt;double&gt; &gt; m (3, 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
m (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);<br />
<br />
std::cout &lt;&lt; - m &lt;&lt; std::endl;<br />
std::cout &lt;&lt; conj (m) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; real (m) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; imag (m) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; trans (m) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; herm (m) &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;std::complex&lt;double&gt; &gt; m (3, 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
m (i, j) = std::complex&lt;double&gt; (3 * i + j, 3 * i + j);
std::cout &lt;&lt; - m &lt;&lt; std::endl;
std::cout &lt;&lt; conj (m) &lt;&lt; std::endl;
std::cout &lt;&lt; real (m) &lt;&lt; std::endl;
std::cout &lt;&lt; imag (m) &lt;&lt; std::endl;
std::cout &lt;&lt; trans (m) &lt;&lt; std::endl;
std::cout &lt;&lt; herm (m) &lt;&lt; std::endl;
}
</pre>
<h3>Binary Operation Description</h3>
@@ -612,25 +612,25 @@ end of the reversed expression.</td>
<h3>Binary Operations</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class E1, class E2, class F&gt;<br />
struct matrix_binary_traits {<br />
typedef matrix_binary&lt;typename E1::const_closure_type,<br />
typename E2::const_closure_type, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (m1 + m2) [i] [j] = m1 [i] [j] + m2 [i] [j]<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_binary_traits&lt;E1, E2, scalar_plus&lt;typename E1::value_type,<br />
typename E2::value_type&gt; &gt;::result_type<br />
operator + (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2);<br />
<br />
// (m1 - m2) [i] [j] = m1 [i] [j] - m2 [i] [j]<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_binary_traits&lt;E1, E2, scalar_minus&lt;typename E1::value_type,<br />
typename E2::value_type&gt; &gt;::result_type<br />
operator - (const matrix_expression&lt;E1&gt; &amp;e1,<br />
<code>template&lt;class E1, class E2, class F&gt;
struct matrix_binary_traits {
typedef matrix_binary&lt;typename E1::const_closure_type,
typename E2::const_closure_type, F&gt; expression_type;
typedef expression_type result_type;
};
// (m1 + m2) [i] [j] = m1 [i] [j] + m2 [i] [j]
template&lt;class E1, class E2&gt;
typename matrix_binary_traits&lt;E1, E2, scalar_plus&lt;typename E1::value_type,
typename E2::value_type&gt; &gt;::result_type
operator + (const matrix_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);
// (m1 - m2) [i] [j] = m1 [i] [j] - m2 [i] [j]
template&lt;class E1, class E2&gt;
typename matrix_binary_traits&lt;E1, E2, scalar_minus&lt;typename E1::value_type,
typename E2::value_type&gt; &gt;::result_type
operator - (const matrix_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);</code>
</pre>
<h4>Description</h4>
@@ -655,19 +655,19 @@ matrix expressions.</p>
<p>Quadratic depending from the size of the matrix expressions.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m1 (3, 3), m2 (3, 3);<br />
for (unsigned i = 0; i &lt; std::min (m1.size1 (), m2.size1 ()); ++ i)<br />
for (unsigned j = 0; j &lt; std::min (m1.size2 (), m2.size2 ()); ++ j)<br />
m1 (i, j) = m2 (i, j) = 3 * i + j;<br />
<br />
std::cout &lt;&lt; m1 + m2 &lt;&lt; std::endl;<br />
std::cout &lt;&lt; m1 - m2 &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m1 (3, 3), m2 (3, 3);
for (unsigned i = 0; i &lt; std::min (m1.size1 (), m2.size1 ()); ++ i)
for (unsigned j = 0; j &lt; std::min (m1.size2 (), m2.size2 ()); ++ j)
m1 (i, j) = m2 (i, j) = 3 * i + j;
std::cout &lt;&lt; m1 + m2 &lt;&lt; std::endl;
std::cout &lt;&lt; m1 - m2 &lt;&lt; std::endl;
}
</pre>
<h3>Scalar Matrix Operation Description</h3>
<h4>Description</h4>
@@ -789,36 +789,36 @@ end of the reversed expression.</td>
<h3>Scalar Matrix Operations</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class T1, class E2, class F&gt;<br />
struct matrix_binary_scalar1_traits {<br />
typedef matrix_binary_scalar1&lt;scalar_const_reference&lt;T1&gt;,<br />
typename E2::const_closure_type, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (t * m) [i] [j] = t * m [i] [j]<br />
template&lt;class T1, class E2&gt;<br />
typename matrix_binary_scalar1_traits&lt;T1, E2, scalar_multiplies&lt;T1, typename E2::value_type&gt; &gt;::result_type<br />
operator * (const T1 &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class E1, class T2, class F&gt;<br />
struct matrix_binary_scalar2_traits {<br />
typedef matrix_binary_scalar2&lt;typename E1::const_closure_type,<br />
scalar_const_reference&lt;T2&gt;, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (m * t) [i] [j] = m [i] [j] * t<br />
template&lt;class E1, class T2&gt;<br />
typename matrix_binary_scalar2_traits&lt;E1, T2, scalar_multiplies&lt;typename E1::value_type, T2&gt; &gt;::result_type<br />
operator * (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const T2 &amp;e2);<br />
<br />
// (m / t) [i] [j] = m [i] [j] / t<br />
template&lt;class E1, class T2&gt;<br />
typename matrix_binary_scalar2_traits&lt;E1, T2, scalar_divides&lt;typename E1::value_type, T2&gt; &gt;::result_type<br />
operator / (const matrix_expression&lt;E1&gt; &amp;e1,<br />
<code>template&lt;class T1, class E2, class F&gt;
struct matrix_binary_scalar1_traits {
typedef matrix_binary_scalar1&lt;scalar_const_reference&lt;T1&gt;,
typename E2::const_closure_type, F&gt; expression_type;
typedef expression_type result_type;
};
// (t * m) [i] [j] = t * m [i] [j]
template&lt;class T1, class E2&gt;
typename matrix_binary_scalar1_traits&lt;T1, E2, scalar_multiplies&lt;T1, typename E2::value_type&gt; &gt;::result_type
operator * (const T1 &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);
template&lt;class E1, class T2, class F&gt;
struct matrix_binary_scalar2_traits {
typedef matrix_binary_scalar2&lt;typename E1::const_closure_type,
scalar_const_reference&lt;T2&gt;, F&gt; expression_type;
typedef expression_type result_type;
};
// (m * t) [i] [j] = m [i] [j] * t
template&lt;class E1, class T2&gt;
typename matrix_binary_scalar2_traits&lt;E1, T2, scalar_multiplies&lt;typename E1::value_type, T2&gt; &gt;::result_type
operator * (const matrix_expression&lt;E1&gt; &amp;e1,
const T2 &amp;e2);
// (m / t) [i] [j] = m [i] [j] / t
template&lt;class E1, class T2&gt;
typename matrix_binary_scalar2_traits&lt;E1, T2, scalar_divides&lt;typename E1::value_type, T2&gt; &gt;::result_type
operator / (const matrix_expression&lt;E1&gt; &amp;e1,
const T2 &amp;e2);</code>
</pre>
<h4>Description</h4>
@@ -840,18 +840,18 @@ with the reciprocal of the scalar.</p>
<p>Quadratic depending from the size of the matrix expression.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
m (i, j) = 3 * i + j;<br />
<br />
std::cout &lt;&lt; 2.0 * m &lt;&lt; std::endl;<br />
std::cout &lt;&lt; m * 2.0 &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout &lt;&lt; 2.0 * m &lt;&lt; std::endl;
std::cout &lt;&lt; m * 2.0 &lt;&lt; std::endl;
}
</pre>
<h2><a name="matrix_vector_operations" id=
@@ -950,100 +950,100 @@ end of the reversed expression.</td>
<h3>Binary Operations</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class T1, class E1, class T2, class E2&gt;<br />
struct matrix_vector_binary1_traits {<br />
typedef row_major_tag dispatch_category;<br />
typedef typename promote_traits&lt;T1, T2&gt;::promote_type promote_type;<br />
typedef matrix_vector_binary1&lt;typename E1::const_closure_type,<br />
typename E2::const_closure_type,<br />
matrix_vector_prod1&lt;T1, T2, promote_type&gt; &gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_vector_binary1_traits&lt;typename E1::value_type, E1,<br />
typename E2::value_type, E2&gt;::result_type<br />
prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2,<br />
row_major_tag);<br />
<br />
// Dispatcher<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_vector_binary1_traits&lt;typename E1::value_type, E1,<br />
typename E2::value_type, E2&gt;::result_type<br />
prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_vector_binary1_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,<br />
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type<br />
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2,<br />
row_major_tag);<br />
<br />
// Dispatcher<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_vector_binary1_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,<br />
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type<br />
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class V, class E1, class E2&gt;<br />
V<br />
prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class V, class E1, class E2&gt;<br />
V<br />
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class T1, class E1, class T2, class E2&gt;<br />
struct matrix_vector_binary2_traits {<br />
typedef column_major_tag dispatch_category;<br />
typedef typename promote_traits&lt;T1, T2&gt;::promote_type promote_type;<br />
typedef matrix_vector_binary2&lt;typename E1::const_closure_type,<br />
typename E2::const_closure_type,<br />
matrix_vector_prod2&lt;T1, T2, promote_type&gt; &gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_vector_binary2_traits&lt;typename E1::value_type, E1,<br />
typename E2::value_type, E2&gt;::result_type<br />
prod (const vector_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
column_major_tag);<br />
<br />
// Dispatcher<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_vector_binary2_traits&lt;typename E1::value_type, E1,<br />
typename E2::value_type, E2&gt;::result_type<br />
prod (const vector_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_vector_binary2_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,<br />
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type<br />
prec_prod (const vector_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
column_major_tag);<br />
<br />
// Dispatcher<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_vector_binary2_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,<br />
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type<br />
prec_prod (const vector_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class V, class E1, class E2&gt;<br />
V<br />
prod (const vector_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class V, class E1, class E2&gt;<br />
V<br />
prec_prod (const vector_expression&lt;E1&gt; &amp;e1,<br />
<code>template&lt;class T1, class E1, class T2, class E2&gt;
struct matrix_vector_binary1_traits {
typedef row_major_tag dispatch_category;
typedef typename promote_traits&lt;T1, T2&gt;::promote_type promote_type;
typedef matrix_vector_binary1&lt;typename E1::const_closure_type,
typename E2::const_closure_type,
matrix_vector_prod1&lt;T1, T2, promote_type&gt; &gt; expression_type;
typedef expression_type result_type;
};
template&lt;class E1, class E2&gt;
typename matrix_vector_binary1_traits&lt;typename E1::value_type, E1,
typename E2::value_type, E2&gt;::result_type
prod (const matrix_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2,
row_major_tag);
// Dispatcher
template&lt;class E1, class E2&gt;
typename matrix_vector_binary1_traits&lt;typename E1::value_type, E1,
typename E2::value_type, E2&gt;::result_type
prod (const matrix_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);
template&lt;class E1, class E2&gt;
typename matrix_vector_binary1_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2,
row_major_tag);
// Dispatcher
template&lt;class E1, class E2&gt;
typename matrix_vector_binary1_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);
template&lt;class V, class E1, class E2&gt;
V
prod (const matrix_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);
template&lt;class V, class E1, class E2&gt;
V
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);
template&lt;class T1, class E1, class T2, class E2&gt;
struct matrix_vector_binary2_traits {
typedef column_major_tag dispatch_category;
typedef typename promote_traits&lt;T1, T2&gt;::promote_type promote_type;
typedef matrix_vector_binary2&lt;typename E1::const_closure_type,
typename E2::const_closure_type,
matrix_vector_prod2&lt;T1, T2, promote_type&gt; &gt; expression_type;
typedef expression_type result_type;
};
template&lt;class E1, class E2&gt;
typename matrix_vector_binary2_traits&lt;typename E1::value_type, E1,
typename E2::value_type, E2&gt;::result_type
prod (const vector_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
column_major_tag);
// Dispatcher
template&lt;class E1, class E2&gt;
typename matrix_vector_binary2_traits&lt;typename E1::value_type, E1,
typename E2::value_type, E2&gt;::result_type
prod (const vector_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);
template&lt;class E1, class E2&gt;
typename matrix_vector_binary2_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type
prec_prod (const vector_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
column_major_tag);
// Dispatcher
template&lt;class E1, class E2&gt;
typename matrix_vector_binary2_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type
prec_prod (const vector_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);
template&lt;class V, class E1, class E2&gt;
V
prod (const vector_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);
template&lt;class V, class E1, class E2&gt;
V
prec_prod (const vector_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);</code>
</pre>
<h4>Description</h4>
@@ -1072,84 +1072,84 @@ precision product of the matrix and the vector expression.</p>
<p>Quadratic depending from the size of the matrix expression.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
vector&lt;double&gt; v (3);<br />
for (unsigned i = 0; i &lt; std::min (m.size1 (), v.size ()); ++ i) {<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
m (i, j) = 3 * i + j;<br />
v (i) = i;<br />
}<br />
<br />
std::cout &lt;&lt; prod (m, v) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; prod (v, m) &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
vector&lt;double&gt; v (3);
for (unsigned i = 0; i &lt; std::min (m.size1 (), v.size ()); ++ i) {
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
m (i, j) = 3 * i + j;
v (i) = i;
}
std::cout &lt;&lt; prod (m, v) &lt;&lt; std::endl;
std::cout &lt;&lt; prod (v, m) &lt;&lt; std::endl;
}
</pre>
<h3>Triangular Solver</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class E1, class E2&gt;<br />
struct matrix_vector_solve_traits {<br />
typedef typename promote_traits&lt;typename E1::value_type, typename E2::value_type&gt;::promote_type promote_type;<br />
typedef vector&lt;promote_type&gt; result_type;<br />
};<br />
<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
E2 &amp;e2,<br />
lower_tag,<br />
vector_tag);<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
E2 &amp;e2,<br />
upper_tag,<br />
vector_tag);<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
E2 &amp;e2,<br />
unit_lower_tag,<br />
vector_tag);<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
E2 &amp;e2,<br />
unit_upper_tag,<br />
vector_tag);<br />
<br />
template&lt;class E1, class E2, class C&gt;<br />
typename matrix_vector_solve_traits&lt;E1, E2&gt;::result_type<br />
solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2,<br />
C);<br />
<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (E1 &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
vector_tag,<br />
lower_tag);<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (E1 &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
vector_tag,<br />
upper_tag);<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (E1 &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
vector_tag,<br />
unit_lower_tag);<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (E1 &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
vector_tag,<br />
unit_upper_tag);<br />
<br />
template&lt;class E1, class E2, class C&gt;<br />
typename matrix_vector_solve_traits&lt;E1, E2&gt;::result_type<br />
solve (const vector_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
<code>template&lt;class E1, class E2&gt;
struct matrix_vector_solve_traits {
typedef typename promote_traits&lt;typename E1::value_type, typename E2::value_type&gt;::promote_type promote_type;
typedef vector&lt;promote_type&gt; result_type;
};
template&lt;class E1, class E2&gt;
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,
E2 &amp;e2,
lower_tag,
vector_tag);
template&lt;class E1, class E2&gt;
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,
E2 &amp;e2,
upper_tag,
vector_tag);
template&lt;class E1, class E2&gt;
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,
E2 &amp;e2,
unit_lower_tag,
vector_tag);
template&lt;class E1, class E2&gt;
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,
E2 &amp;e2,
unit_upper_tag,
vector_tag);
template&lt;class E1, class E2, class C&gt;
typename matrix_vector_solve_traits&lt;E1, E2&gt;::result_type
solve (const matrix_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2,
C);
template&lt;class E1, class E2&gt;
void inplace_solve (E1 &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
vector_tag,
lower_tag);
template&lt;class E1, class E2&gt;
void inplace_solve (E1 &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
vector_tag,
upper_tag);
template&lt;class E1, class E2&gt;
void inplace_solve (E1 &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
vector_tag,
unit_lower_tag);
template&lt;class E1, class E2&gt;
void inplace_solve (E1 &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
vector_tag,
unit_upper_tag);
template&lt;class E1, class E2, class C&gt;
typename matrix_vector_solve_traits&lt;E1, E2&gt;::result_type
solve (const vector_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
C);</code>
</pre>
<h4>Description</h4>
@@ -1179,22 +1179,22 @@ int main () {<br />
<p>Quadratic depending from the size of the matrix expression.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/triangular.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
vector&lt;double&gt; v (3);<br />
for (unsigned i = 0; i &lt; std::min (m.size1 (), v.size ()); ++ i) {<br />
for (unsigned j = 0; j &lt;= i; ++ j)<br />
m (i, j) = 3 * i + j + 1;<br />
v (i) = i;<br />
}<br />
<br />
std::cout &lt;&lt; solve (m, v, lower_tag ()) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; solve (v, m, lower_tag ()) &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/triangular.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
vector&lt;double&gt; v (3);
for (unsigned i = 0; i &lt; std::min (m.size1 (), v.size ()); ++ i) {
for (unsigned j = 0; j &lt;= i; ++ j)
m (i, j) = 3 * i + j + 1;
v (i) = i;
}
std::cout &lt;&lt; solve (m, v, lower_tag ()) &lt;&lt; std::endl;
std::cout &lt;&lt; solve (v, m, lower_tag ()) &lt;&lt; std::endl;
}
</pre>
<h2><a name="matrix_matrix_operations" id=
"matrix_matrix_operations"></a> Matrix Matrix Operations</h2>
@@ -1309,52 +1309,52 @@ end of the reversed expression.</td>
<h3>Binary Operations</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class T1, class E1, class T2, class E2&gt;<br />
struct matrix_matrix_binary_traits {<br />
typedef unknown_orientation_tag dispatch_category;<br />
typedef typename promote_traits&lt;T1, T2&gt;::promote_type promote_type;<br />
typedef matrix_matrix_binary&lt;typename E1::const_closure_type,<br />
typename E2::const_closure_type,<br />
matrix_matrix_prod&lt;T1, T2, promote_type&gt; &gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_matrix_binary_traits&lt;typename E1::value_type, E1,<br />
typename E2::value_type, E2&gt;::result_type<br />
prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
unknown_orientation_tag);<br />
<br />
// Dispatcher<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_matrix_binary_traits&lt;typename E1::value_type, E1,<br />
typename E2::value_type, E2&gt;::result_type<br />
prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_matrix_binary_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,<br />
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type<br />
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
unknown_orientation_tag);<br />
<br />
// Dispatcher<br />
template&lt;class E1, class E2&gt;<br />
typename matrix_matrix_binary_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,<br />
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type<br />
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class M, class E1, class E2&gt;<br />
M<br />
prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class M, class E1, class E2&gt;<br />
M<br />
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,<br />
<code>template&lt;class T1, class E1, class T2, class E2&gt;
struct matrix_matrix_binary_traits {
typedef unknown_orientation_tag dispatch_category;
typedef typename promote_traits&lt;T1, T2&gt;::promote_type promote_type;
typedef matrix_matrix_binary&lt;typename E1::const_closure_type,
typename E2::const_closure_type,
matrix_matrix_prod&lt;T1, T2, promote_type&gt; &gt; expression_type;
typedef expression_type result_type;
};
template&lt;class E1, class E2&gt;
typename matrix_matrix_binary_traits&lt;typename E1::value_type, E1,
typename E2::value_type, E2&gt;::result_type
prod (const matrix_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
unknown_orientation_tag);
// Dispatcher
template&lt;class E1, class E2&gt;
typename matrix_matrix_binary_traits&lt;typename E1::value_type, E1,
typename E2::value_type, E2&gt;::result_type
prod (const matrix_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);
template&lt;class E1, class E2&gt;
typename matrix_matrix_binary_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
unknown_orientation_tag);
// Dispatcher
template&lt;class E1, class E2&gt;
typename matrix_matrix_binary_traits&lt;typename type_traits&lt;typename E1::value_type&gt;::precision_type, E1,
typename type_traits&lt;typename E2::value_type&gt;::precision_type, E2&gt;::result_type
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);
template&lt;class M, class E1, class E2&gt;
M
prod (const matrix_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);
template&lt;class M, class E1, class E2&gt;
M
prec_prod (const matrix_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2);</code>
</pre>
<h4>Description</h4>
@@ -1378,53 +1378,53 @@ product of the matrix expressions.</p>
<p>Cubic depending from the size of the matrix expression.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m1 (3, 3), m2 (3, 3);<br />
for (unsigned i = 0; i &lt; std::min (m1.size1 (), m2.size1 ()); ++ i)<br />
for (unsigned j = 0; j &lt; std::min (m1.size2 (), m2.size2 ()); ++ j)<br />
m1 (i, j) = m2 (i, j) = 3 * i + j;<br />
<br />
std::cout &lt;&lt; prod (m1, m2) &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m1 (3, 3), m2 (3, 3);
for (unsigned i = 0; i &lt; std::min (m1.size1 (), m2.size1 ()); ++ i)
for (unsigned j = 0; j &lt; std::min (m1.size2 (), m2.size2 ()); ++ j)
m1 (i, j) = m2 (i, j) = 3 * i + j;
std::cout &lt;&lt; prod (m1, m2) &lt;&lt; std::endl;
}
</pre>
<h3>Triangular Solvers</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class E1, class E2&gt;<br />
struct matrix_matrix_solve_traits {<br />
typedef typename promote_traits&lt;typename E1::value_type, typename E2::value_type&gt;::promote_type promote_type;<br />
typedef matrix&lt;promote_type&gt; result_type;<br />
};<br />
<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
E2 &amp;e2,<br />
lower_tag,<br />
matrix_tag);<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
E2 &amp;e2,<br />
upper_tag,<br />
matrix_tag);<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
E2 &amp;e2,<br />
unit_lower_tag,<br />
matrix_tag);<br />
template&lt;class E1, class E2&gt;<br />
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
E2 &amp;e2,<br />
unit_upper_tag,<br />
matrix_tag);<br />
<br />
template&lt;class E1, class E2, class C&gt;<br />
typename matrix_matrix_solve_traits&lt;E1, E2&gt;::result_type<br />
solve (const matrix_expression&lt;E1&gt; &amp;e1,<br />
const matrix_expression&lt;E2&gt; &amp;e2,<br />
<code>template&lt;class E1, class E2&gt;
struct matrix_matrix_solve_traits {
typedef typename promote_traits&lt;typename E1::value_type, typename E2::value_type&gt;::promote_type promote_type;
typedef matrix&lt;promote_type&gt; result_type;
};
template&lt;class E1, class E2&gt;
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,
E2 &amp;e2,
lower_tag,
matrix_tag);
template&lt;class E1, class E2&gt;
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,
E2 &amp;e2,
upper_tag,
matrix_tag);
template&lt;class E1, class E2&gt;
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,
E2 &amp;e2,
unit_lower_tag,
matrix_tag);
template&lt;class E1, class E2&gt;
void inplace_solve (const matrix_expression&lt;E1&gt; &amp;e1,
E2 &amp;e2,
unit_upper_tag,
matrix_tag);
template&lt;class E1, class E2, class C&gt;
typename matrix_matrix_solve_traits&lt;E1, E2&gt;::result_type
solve (const matrix_expression&lt;E1&gt; &amp;e1,
const matrix_expression&lt;E2&gt; &amp;e2,
C);</code>
</pre>
<h4>Description</h4>
@@ -1448,18 +1448,18 @@ int main () {<br />
<p>Cubic depending from the size of the matrix expressions.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/triangular.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m1 (3, 3), m2 (3, 3);<br />
for (unsigned i = 0; i &lt; std::min (m1.size1 (), m2.size1 ()); ++ i)<br />
for (unsigned j = 0; j &lt;= i; ++ j)<br />
m1 (i, j) = m2 (i, j) = 3 * i + j + 1;<br />
<br />
std::cout &lt;&lt; solve (m1, m2, lower_tag ()) &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/triangular.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m1 (3, 3), m2 (3, 3);
for (unsigned i = 0; i &lt; std::min (m1.size1 (), m2.size1 ()); ++ i)
for (unsigned j = 0; j &lt;= i; ++ j)
m1 (i, j) = m2 (i, j) = 3 * i + j + 1;
std::cout &lt;&lt; solve (m1, m2, lower_tag ()) &lt;&lt; std::endl;
}
</pre>
<hr />
<p>Copyright (&copy;) 2000-2002 Joerg Walter, Mathias Koch<br />

View File

@@ -18,18 +18,18 @@ Matrix Proxies</h1>
addressing a row of a matrix.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i) {<br />
matrix_row&lt;matrix&lt;double&gt; &gt; mr (m, i);<br />
for (unsigned j = 0; j &lt; mr.size (); ++ j)<br />
mr (j) = 3 * i + j;<br />
std::cout &lt;&lt; mr &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i) {
matrix_row&lt;matrix&lt;double&gt; &gt; mr (m, i);
for (unsigned j = 0; j &lt; mr.size (); ++ j)
mr (j) = 3 * i + j;
std::cout &lt;&lt; mr &lt;&lt; std::endl;
}
}
</pre>
<h4>Definition</h4>
@@ -199,9 +199,9 @@ the reversed <code>matrix_row</code>.</td>
<h3>Projections</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class M&gt;<br />
matrix_row&lt;M&gt; row (M &amp;data, std::size_t i);<br />
template&lt;class M&gt;<br />
<code>template&lt;class M&gt;
matrix_row&lt;M&gt; row (M &amp;data, std::size_t i);
template&lt;class M&gt;
const matrix_row&lt;const M&gt; row (const M &amp;data, std::size_t i);</code>
</pre>
<h4>Description</h4>
@@ -218,18 +218,18 @@ matrix rows.</p>
<p>Linear depending from the size of the row.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i) {<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
row (m, i) (j) = 3 * i + j;<br />
std::cout &lt;&lt; row (m, i) &lt;&lt; std::endl;<br />
}<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i) {
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
row (m, i) (j) = 3 * i + j;
std::cout &lt;&lt; row (m, i) &lt;&lt; std::endl;
}
}
</pre>
<h2><a name="matrix_column" id="matrix_column"></a> Matrix
Column</h2>
@@ -238,19 +238,19 @@ Column</h2>
addressing a column of a matrix.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j) {<br />
matrix_column&lt;matrix&lt;double&gt; &gt; mc (m, j);<br />
for (unsigned i = 0; i &lt; mc.size (); ++ i)<br />
mc (i) = 3 * i + j;<br />
std::cout &lt;&lt; mc &lt;&lt; std::endl;<br />
}<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned j = 0; j &lt; m.size2 (); ++ j) {
matrix_column&lt;matrix&lt;double&gt; &gt; mc (m, j);
for (unsigned i = 0; i &lt; mc.size (); ++ i)
mc (i) = 3 * i + j;
std::cout &lt;&lt; mc &lt;&lt; std::endl;
}
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix_proxy.hpp.</p>
@@ -420,9 +420,9 @@ the reversed <code>matrix_column</code>.</td>
<h3>Projections</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class M&gt;<br />
matrix_column&lt;M&gt; column (M &amp;data, std::size_t j);<br />
template&lt;class M&gt;<br />
<code>template&lt;class M&gt;
matrix_column&lt;M&gt; column (M &amp;data, std::size_t j);
template&lt;class M&gt;
const matrix_column&lt;const M&gt; column (const M &amp;data, std::size_t j);</code>
</pre>
<h4>Description</h4>
@@ -439,18 +439,18 @@ of matrix columns.</p>
<p>Linear depending from the size of the column.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j) {<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
column (m, j) (i) = 3 * i + j;<br />
std::cout &lt;&lt; column (m, j) &lt;&lt; std::endl;<br />
}<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned j = 0; j &lt; m.size2 (); ++ j) {
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
column (m, j) (i) = 3 * i + j;
std::cout &lt;&lt; column (m, j) &lt;&lt; std::endl;
}
}
</pre>
<h2><a name="vector_range" id="vector_range"></a> Vector Range</h2>
<h4>Description</h4>
@@ -458,19 +458,19 @@ int main () {<br />
allows addressing a sub vector of a matrix.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
m (i, j) = 3 * i + j;<br />
<br />
matrix_vector_range&lt;matrix&lt;double&gt; &gt; mvr (m, range (0, 3), range (0, 3));<br />
std::cout &lt;&lt; mvr &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
m (i, j) = 3 * i + j;
matrix_vector_range&lt;matrix&lt;double&gt; &gt; mvr (m, range (0, 3), range (0, 3));
std::cout &lt;&lt; mvr &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix_proxy.hpp.</p>
@@ -643,18 +643,18 @@ the reversed <code>matrix_vector_range</code>.</td>
allows addressing a sliced sub vector of a matrix.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
m (i, j) = 3 * i + j;<br />
<br />
matrix_vector_slice&lt;matrix&lt;double&gt; &gt; mvs (m, slice (0, 1, 3), slice (0, 1, 3));<br />
std::cout &lt;&lt; mvs &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
m (i, j) = 3 * i + j;
matrix_vector_slice&lt;matrix&lt;double&gt; &gt; mvs (m, slice (0, 1, 3), slice (0, 1, 3));
std::cout &lt;&lt; mvs &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
@@ -828,18 +828,18 @@ the reversed <code>matrix_vector_slice</code>.</td>
addressing a sub matrix of a matrix.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
matrix_range&lt;matrix&lt;double&gt; &gt; mr (m, range (0, 3), range (0, 3));<br />
for (unsigned i = 0; i &lt; mr.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; mr.size2 (); ++ j)<br />
mr (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; mr &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
matrix_range&lt;matrix&lt;double&gt; &gt; mr (m, range (0, 3), range (0, 3));
for (unsigned i = 0; i &lt; mr.size1 (); ++ i)
for (unsigned j = 0; j &lt; mr.size2 (); ++ j)
mr (i, j) = 3 * i + j;
std::cout &lt;&lt; mr &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix_proxy.hpp.</p>
@@ -1063,11 +1063,11 @@ reversed the <code>matrix_range</code>.</td>
<h3>Projections</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class M&gt;<br />
matrix_range&lt;M&gt; project (M &amp;data, const range &amp;r1, const range &amp;r2);<br />
template&lt;class M&gt;<br />
const matrix_range&lt;const M&gt; project (const M &amp;data, const range &amp;r1, const range &amp;r2);<br />
template&lt;class M&gt;<br />
<code>template&lt;class M&gt;
matrix_range&lt;M&gt; project (M &amp;data, const range &amp;r1, const range &amp;r2);
template&lt;class M&gt;
const matrix_range&lt;const M&gt; project (const M &amp;data, const range &amp;r1, const range &amp;r2);
template&lt;class M&gt;
matrix_range&lt;M&gt; project (const matrix_range&lt;M&gt; &amp;data, const range &amp;r1, const range &amp;r2);</code>
</pre>
<h4>Description</h4>
@@ -1084,17 +1084,17 @@ of matrix ranges.</p>
<p>Quadratic depending from the size of the ranges.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
project (m, range (0, 3), range (0, 3)) (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; project (m, range (0, 3), range (0, 3)) &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
project (m, range (0, 3), range (0, 3)) (i, j) = 3 * i + j;
std::cout &lt;&lt; project (m, range (0, 3), range (0, 3)) &lt;&lt; std::endl;
}
</pre>
<h2><a name="matrix_slice" id="matrix_slice"></a> Matrix Slice</h2>
<h4>Description</h4>
@@ -1102,18 +1102,18 @@ int main () {<br />
addressing a sliced sub matrix of a matrix.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
matrix_slice&lt;matrix&lt;double&gt; &gt; ms (m, slice (0, 1, 3), slice (0, 1, 3));<br />
for (unsigned i = 0; i &lt; ms.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; ms.size2 (); ++ j)<br />
ms (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; ms &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
matrix_slice&lt;matrix&lt;double&gt; &gt; ms (m, slice (0, 1, 3), slice (0, 1, 3));
for (unsigned i = 0; i &lt; ms.size1 (); ++ i)
for (unsigned j = 0; j &lt; ms.size2 (); ++ j)
ms (i, j) = 3 * i + j;
std::cout &lt;&lt; ms &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix_proxy.hpp.</p>
@@ -1329,13 +1329,13 @@ the reversed <code>matrix_slice</code>.</td>
<h3>Projections</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class M&gt;<br />
matrix_slice&lt;M&gt; project (const matrix_slice&lt;M&gt; &amp;data, const range &amp;r1, const range &amp;r2);<br />
template&lt;class M&gt;<br />
matrix_slice&lt;M&gt; project (M &amp;data, const slice &amp;s1, const slice &amp;s2);<br />
template&lt;class M&gt;<br />
const matrix_slice&lt;const M&gt; project (const M &amp;data, const slice &amp;s1, const slice &amp;s2);<br />
template&lt;class M&gt;<br />
<code>template&lt;class M&gt;
matrix_slice&lt;M&gt; project (const matrix_slice&lt;M&gt; &amp;data, const range &amp;r1, const range &amp;r2);
template&lt;class M&gt;
matrix_slice&lt;M&gt; project (M &amp;data, const slice &amp;s1, const slice &amp;s2);
template&lt;class M&gt;
const matrix_slice&lt;const M&gt; project (const M &amp;data, const slice &amp;s1, const slice &amp;s2);
template&lt;class M&gt;
matrix_slice&lt;M&gt; project (const matrix_slice&lt;M&gt; &amp;data, const slice &amp;s1, const slice &amp;s2);</code>
</pre>
<h4>Description</h4>
@@ -1352,17 +1352,17 @@ of matrix slices.</p>
<p>Quadratic depending from the size of the slices.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
project (m, slice (0, 1, 3), slice (0, 1, 3)) (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; project (m, slice (0, 1, 3), slice (0, 1, 3)) &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
project (m, slice (0, 1, 3), slice (0, 1, 3)) (i, j) = 3 * i + j;
std::cout &lt;&lt; project (m, slice (0, 1, 3), slice (0, 1, 3)) &lt;&lt; std::endl;
}
</pre>
<hr />
<p>Copyright (&copy;) 2000-2002 Joerg Walter, Mathias Koch<br />

View File

@@ -41,16 +41,16 @@ i</em><sub><em>2</em></sub><em>)</em> with column major
orientation.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix_sparse.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
sparse_matrix&lt;double&gt; m (3, 3, 3 * 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
m (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; m &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/matrix_sparse.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
sparse_matrix&lt;double&gt; m (3, 3, 3 * 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout &lt;&lt; m &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
@@ -348,17 +348,17 @@ i</em><sub><em>2</em></sub><em>)</em> with column major
orientation.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix_sparse.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
compressed_matrix&lt;double&gt; m (3, 3, 3 * 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
m (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; m &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix_sparse.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
compressed_matrix&lt;double&gt; m (3, 3, 3 * 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout &lt;&lt; m &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix_sparse.hpp.</p>
@@ -671,17 +671,17 @@ i</em><sub><em>2</em></sub><em>)</em> with column major
orientation.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix_sparse.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
coordinate_matrix&lt;double&gt; m (3, 3, 3 * 3);<br />
for (unsigned i = 0; i &lt; m.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt; m.size2 (); ++ j)<br />
m (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; m &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix_sparse.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
coordinate_matrix&lt;double&gt; m (3, 3, 3 * 3);
for (unsigned i = 0; i &lt; m.size1 (); ++ i)
for (unsigned j = 0; j &lt; m.size2 (); ++ j)
m (i, j) = 3 * i + j;
std::cout &lt;&lt; m &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header matrix_sparse.hpp.</p>

201
doc/operations_overview.htm Normal file
View File

@@ -0,0 +1,201 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
<meta name="GENERATOR" content="Quanta Plus" />
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii" />
<link href="ublas.css" type="text/css" />
<title>uBLAS functions overview</title>
</head>
<body>
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
Overview of Matrix and Vector Operations</h1>
<dl>
<dt>Contents:</dt>
<dd><a href="#blas">Basic Linear Algebra</a></dd>
<dd><a href="#advanced">Advanced Functions</a></dd>
<dd><a href="#sub">Submatrices, Subvectors</a></dd>
<dd><a href="#speed">Speed Improvements</a></dd>
</dl>
<h3>Definitions:</h3>
<table style="" summary="notation">
<tr><td><code>A, B, C</code></td>
<td> are matrices</td></tr>
<tr><td><code>u, v, w</code></td>
<td>are vectors</td></tr>
<tr><td><code>i, j, k</code></td>
<td>are integer values</td></tr>
<tr><td><code>t, t1, t2</code></td>
<td>are scalar values</td></tr>
<tr><td><code>r, r1, r2</code></td>
<td>are <a href="storage.htm#range">ranges</a>, e.g. <code>range(0, 3)</code></td></tr>
<tr><td><code>s, s1, s2</code></td>
<td>are <a href="storage.htm#slice">slices</a>, e.g. <code>slice(0, 1, 3)</code></td></tr>
</table>
<h2><a name="blas">Basic Linear Algebra</a></h2>
<h3>standard operations: addition, subtraction, multiplication by a
scalar</h3>
<pre><code>
C = A + B; C = A - B; C = -A;
w = u + v; w = u - v; w = -u;
C = t * A; C = A * t; C = A / t;
w = t * u; w = u * t; w = u / t;
</code></pre>
<h3>computed assignements</h3>
<pre><code>
C += A; C -= A;
w += u; w -= u;
C *= t; C /= t;
w *= t; w /= t;
</code></pre>
<h3>inner, outer and other products</h3>
<pre><code>
t = inner_prod(u, v);
C = outer_prod(u, v);
w = prod(A, u); w = prod(u, A); w = prec_prod(A, u); w = prec_prod(u, A);
C = prod(A, B); C = prec_prod(A, B);
w = element_prod(u, v); w = element_div(u, v);
C = element_prod(A, B); C = element_div(A, B);
</code></pre>
<h3>transformations</h3>
<pre><code>
w = conj(u); w = real(u); w = imag(u);
C = trans(A); C = conj(A); C = herm(A); C = real(A); C = imag(A);
</code></pre>
<h2><a name="advanced">Advanced functions</a></h2>
<h3>norms</h3>
<pre><code>
t = norm_inf(v); i = index_norm_inf(v);
t = norm_1(v); t = norm_2(v);
t = norm_inf(A); i = index_norm_inf(A);
t = norm_1(A); t = norm_frobenius(A);
</code></pre>
<h3>products</h3>
<pre><code>
axpy_prod(A, u, w, true); // w = A * u
axpy_prod(A, u, w, false); // w += A * u
axpy_prod(u, A, w, true); // w = trans(A) * u
axpy_prod(u, A, w, false); // w += trans(A) * u
axpy_prod(A, B, C, true); // C = A * B
axpy_prod(A, B, C, false); // C += A * B
</code></pre>
<p><em>Note:</em> The last argument (<code>bool init</code>) of
<code>axpy_prod</code> is optional. Currently it defaults to
<code>true</code>, but this may change in the future. Set the
<code>init</code> to <code>true</code> is equivalent to call
<code>w.clear()</code> before <code>axpy_prod</code>. Up to now
there are some specialisation for compressed matrices that give a
large speed up compared to <code>prod</code>.</p>
<pre><code>
w = block_prod&lt;matrix_type, 64&gt; (A, u); // w = A * u
w = block_prod&lt;matrix_type, 64&gt; (u, A); // w = trans(A) * u
C = block_prod&lt;matrix_type, 64&gt; (A, B); // w = A * B
</code></pre>
<p><em>Note:</em> The blocksize can be any integer. However, the
total speed depends very strong on the combination of blocksize,
CPU and compiler. The function <code>block_prod</code> is designed
for large dense matrices.</p>
<h3>rank-k updates</h3>
<pre><code>
opb_prod(A, B, C, true); // C = A * B
opb_prod(A, B, C, false); // C += A * B
</code></pre>
<p><em>Note:</em> The last argument (<code>bool init</code>) of
<code>opb_prod</code> is optional. Currently it defaults to
<code>true</code>, but this may change in the future. This function
may give a speedup if <code>A</code> has less columns than rows,
because the product is computed as a sum of outer products.</p>
<h2><a name="sub">Submatrices, Subvectors</a></h2>
<p><em>Note:</em> A range <code>r = range(start, stop)</code>
contains all indices <code>i</code> with <code>start &lt;= i &lt;
stop</code>. A slice is something more general. The slice
<code>s = slice(start, stride, size)</code> contains the indices
<code>start, start+stride, ..., start+(size-1)*stride</code>. The
stride can be 0 or negative! If <code>start >= stop</code> for a range
or <code>size == 0</code> for a slice then it contains no elements.</p>
<pre><code>
w = project(u, r); // a subvector of u specifed by the index range r
w = project(u, s); // a subvector of u specifed by the index slice s
C = project(A, r1, r2); // a submatrix of A specified by the two index ranges r1 and r2
C = project(A, s1, s2); // a submatrix of A specified by the two index slices s1 and s2
w = row(A, i); w = column(A, j); // a row or column of matrix as a vector
</code></pre>
<p>There are to more ways to access some matrix elements as a
vector:</p>
<pre><code>matrix_vector_range&lt;matrix_type&gt; (A, r1, r2);
matrix_vector_slice&lt;matrix_type&gt; (A, s1, s2);
</code></pre>
<p><em>Note:</em> These matrix proxies take a sequence of elements
of a matrix and allow you to access these as a vector. In
particular <code>matrix_vector_slice</code> can do this in a very
general way. <code>matrix_vector_range</code> is less useful as the
elements must lie along a diagonal.</p>
<p><em>Example:</em> To access the first two elements of a sub
column of a matrix we access the row with a slice with stride 1 and
the column with a slice with stride 0 thus:<br />
<code>matrix_vector_slice&lt;matrix_type&gt; (A, slice(0,1,2),
slice(0,0,2));
</code></p>
<h2><a name="speed">Speed improvements</a></h2>
<h3>Matrix / Vector assignment</h3>
<p>If you know for sure that the left hand expression and the right
hand expression have no common storage, then assignment has
no <em>aliasing</em>. A more efficient assignment can be specified
in this case:</p>
<pre><code>noalias(C) = prod(A, B);
</code></pre>
<p>This avoids the creation of a temporary matrix that is required in a normal assignment.
'noalias' assignment requires that the left and right hand side be size conformant.</p>
<h3>Sparse element access</h3>
<p>The matrix element access function <code>A(i1,i2)</code> or the equivalent vector
element access functions (<code>v(i) or v[i]</code>) usually create 'sparse element proxies'
when applied to a sparse matrix or vector. These <em>proxies</em> allow access to elements
without having to worry about nasty C++ issues where references are invalidated.</p>
<p>These 'sparse element proxies' can be implemented more efficiently when applied to <code>const</code>
objects.
Sadly in C++ there is no way to distinguish between an element access on the left and right hand side of
an assignment. Most often elements on the right hand side will not be changed and therefore it would
be better to use the <code>const</code> proxies. We can do this by making the matrix or vector
<code>const</code> before accessing it's elements. For example:</p>
<pre><code>value = const_cast&lt;const VEC&&gt;(v)[i]; // VEC is the type of V
</code></pre>
<p>If more then one element needs to be accessed <code>const_iterator</code>'s should be used
in preference to <code>iterator</code>'s for the same reason. For the more daring 'sparse element proxies'
can be completely turned off in uBLAS by defining the configuration macro <code>BOOST_UBLAS_NO_ELEMENT_PROXIES</code>.
</p>
<hr />
<p>Copyright (&copy;) 2000-2004 Joerg Walter, Mathias Koch, Gunter
Winkler, Michael Stevens<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: 2004-08-09</p>
</body>
</html>

312
doc/products.htm Normal file
View File

@@ -0,0 +1,312 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- $Id: products.htm,v 1.2 2004/08/13 15:59:34 mistevens Exp $ -->
<head>
<title>Special Products</title>
<meta name="GENERATOR" content="Quanta Plus" />
<meta name="AUTHOR" content="Gunter Winkler" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="ublas.css" />
<link rel="stylesheet" type="text/css" href="doxygen.css" />
</head>
<body>
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
Special Products </h1>
<h2>Functions</h2>
<table summary="" border=0 cellpadding=0 cellspacing=0>
<tr>
<td class="memItemLeft" nowrap align=right valign=top>template&lt;class V, class E1, class E2&gt; BOOST_UBLAS_INLINE V &amp;&nbsp;</td>
<td class="memItemRight" valign=bottom><a class="el" href="#ga8">axpy_prod</a> (const matrix_expression&lt; E1 &gt; &amp;e1, const vector_expression&lt; E2 &gt; &amp;e2, V &amp;v, bool init=true)</td></tr>
<tr>
<td class="mdescLeft">&nbsp;</td>
<td class="mdescRight">computes <code>v += A x</code> or <code>v = A x</code> in an optimized fashion. <a href="#ga8"></a><br /><br /></td></tr>
<tr>
<td class="memItemLeft" nowrap align=right valign=top>template&lt;class V, class E1, class E2&gt; BOOST_UBLAS_INLINE V &amp;&nbsp;</td>
<td class="memItemRight" valign=bottom><a class="el" href="#ga9">axpy_prod</a> (const vector_expression&lt; E1 &gt; &amp;e1, const matrix_expression&lt; E2 &gt; &amp;e2, V &amp;v, bool init=true)</td></tr>
<tr>
<td class="mdescLeft">&nbsp;</td>
<td class="mdescRight">computes <code>v += A<sup>T</sup> x</code> or <code>v = A<sup>T</sup> x</code> in an optimized fashion. <a href="../../d2/d2/group__blas2.html#ga9"></a><br /><br /></td></tr>
<tr>
<td class="memItemLeft" nowrap align=right valign=top>template&lt;class M, class E1, class E2&gt; BOOST_UBLAS_INLINE M &amp;&nbsp;</td>
<td class="memItemRight" valign=bottom><a class="el" href="#ga7">axpy_prod</a> (const matrix_expression&lt; E1 &gt; &amp;e1, const matrix_expression&lt; E2 &gt; &amp;e2, M &amp;m, bool init=true)</td></tr>
<tr>
<td class="mdescLeft">&nbsp;</td>
<td class="mdescRight">computes <code>M += A X</code> or <code>M = A X</code> in an optimized fashion. <a href="#ga7"></a><br /><br /></td></tr>
<tr>
<td class="memItemLeft" nowrap align=right valign=top>template&lt;class M, class E1, class E2&gt; BOOST_UBLAS_INLINE M &amp;&nbsp;</td>
<td class="memItemRight" valign=bottom><a class="el" href="#ga6">opb_prod</a> (const matrix_expression&lt; E1 &gt; &amp;e1, const matrix_expression&lt; E2 &gt; &amp;e2, M &amp;m, bool init=true)</td></tr>
<tr>
<td class="mdescLeft">&nbsp;</td>
<td class="mdescRight">computes <code>M += A X</code> or <code>M = A X</code> in an optimized fashion. <a href="#ga6"></a><br /><br /></td></tr>
</table>
<hr />
<a class="anchor" name="ga8" doxytag="boost::numeric::ublas::axpy_prod" ></a>
<table summary="" class="mdTable" width="95%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> BOOST_UBLAS_INLINE V&amp; axpy_prod </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const matrix_expression&lt; E1 &gt; &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>e1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const vector_expression&lt; E2 &gt; &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>e2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>V &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>v</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>bool&nbsp;</td>
<td class="mdname" nowrap> <em>init</em> = <code>true</code></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
computes <code>v += A x</code> or <code>v = A x</code> in an optimized fashion.
</p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table summary="" border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>e1</em>&nbsp;</td><td>the matrix expression <code>A</code> </td></tr>
<tr><td></td><td valign=top><em>e2</em>&nbsp;</td><td>the vector expression <code>x</code> </td></tr>
<tr><td></td><td valign=top><em>v</em>&nbsp;</td><td>the result vector <code>v</code> </td></tr>
<tr><td></td><td valign=top><em>init</em>&nbsp;</td><td>a boolean parameter</td></tr>
</table>
</dl>
<code>axpy_prod(A, x, v, init)</code> implements the well known axpy-product. Setting <em>init</em> to <code>true</code> is equivalent to call <code>v.clear()</code> before <code>axpy_prod</code>. Currently <em>init</em> defaults to <code>true</code>, but this may change in the future.<p>
Up to now there are some specialisation for compressed matrices that give a large speed up compared to prod. </td>
</tr>
</table>
<a class="anchor" name="ga9" doxytag="boost::numeric::ublas::axpy_prod" ></a>
<table summary="" class="mdTable" width="95%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> BOOST_UBLAS_INLINE V&amp; axpy_prod </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const vector_expression&lt; E1 &gt; &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>e1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const matrix_expression&lt; E2 &gt; &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>e2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>V &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>v</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>bool&nbsp;</td>
<td class="mdname" nowrap> <em>init</em> = <code>true</code></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
computes <code>v += A<sup>T</sup> x</code> or <code>v = A<sup>T</sup> x</code> in an optimized fashion.
</p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table summary="" border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>e1</em>&nbsp;</td><td>the vector expression <code>x</code> </td></tr>
<tr><td></td><td valign=top><em>e2</em>&nbsp;</td><td>the matrix expression <code>A</code> </td></tr>
<tr><td></td><td valign=top><em>v</em>&nbsp;</td><td>the result vector <code>v</code> </td></tr>
<tr><td></td><td valign=top><em>init</em>&nbsp;</td><td>a boolean parameter</td></tr>
</table>
</dl>
<code>axpy_prod(x, A, v, init)</code> implements the well known axpy-product. Setting <em>init</em> to <code>true</code> is equivalent to call <code>v.clear()</code> before <code>axpy_prod</code>. Currently <em>init</em> defaults to <code>true</code>, but this may change in the future.<p>
Up to now there are some specialisation for compressed matrices that give a large speed up compared to prod. </td>
</tr>
</table>
<a class="anchor" name="ga7" doxytag="boost::numeric::ublas::axpy_prod" ></a>
<table summary="" class="mdTable" width="95%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> BOOST_UBLAS_INLINE M&amp; axpy_prod </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const matrix_expression&lt; E1 &gt; &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>e1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const matrix_expression&lt; E2 &gt; &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>e2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>M &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>bool&nbsp;</td>
<td class="mdname" nowrap> <em>init</em> = <code>true</code></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
computes <code>M += A X</code> or <code>M = A X</code> in an optimized fashion.
</p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table summary="" border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>e1</em>&nbsp;</td><td>the matrix expression <code>A</code> </td></tr>
<tr><td></td><td valign=top><em>e2</em>&nbsp;</td><td>the matrix expression <code>X</code> </td></tr>
<tr><td></td><td valign=top><em>m</em>&nbsp;</td><td>the result matrix <code>M</code> </td></tr>
<tr><td></td><td valign=top><em>init</em>&nbsp;</td><td>a boolean parameter</td></tr>
</table>
</dl>
<code>axpy_prod(A, X, M, init)</code> implements the well known axpy-product. Setting <em>init</em> to <code>true</code> is equivalent to call <code>M.clear()</code> before <code>axpy_prod</code>. Currently <em>init</em> defaults to <code>true</code>, but this may change in the future.<p>
Up to now there are no specialisations. </td>
</tr>
</table>
<a class="anchor" name="ga6" doxytag="boost::numeric::ublas::opb_prod" ></a>
<table summary="" class="mdTable" width="95%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table summary="" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> BOOST_UBLAS_INLINE M&amp; opb_prod </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const matrix_expression&lt; E1 &gt; &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>e1</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const matrix_expression&lt; E2 &gt; &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>e2</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>M &amp;&nbsp;</td>
<td class="mdname" nowrap> <em>m</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>bool&nbsp;</td>
<td class="mdname" nowrap> <em>init</em> = <code>true</code></td>
</tr>
<tr>
<td></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table summary="" cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
&nbsp;
</td>
<td>
<p>
computes <code>M += A X</code> or <code>M = A X</code> in an optimized fashion.
</p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table summary="" border="0" cellspacing="2" cellpadding="0">
<tr><td></td><td valign=top><em>e1</em>&nbsp;</td><td>the matrix expression <code>A</code> </td></tr>
<tr><td></td><td valign=top><em>e2</em>&nbsp;</td><td>the matrix expression <code>X</code> </td></tr>
<tr><td></td><td valign=top><em>m</em>&nbsp;</td><td>the result matrix <code>M</code> </td></tr>
<tr><td></td><td valign=top><em>init</em>&nbsp;</td><td>a boolean parameter</td></tr>
</table>
</dl>
<code>opb_prod(A, X, M, init)</code> implements the well known axpy-product. Setting <em>init</em> to <code>true</code> is equivalent to call <code>M.clear()</code> before <code>opb_prod</code>. Currently <em>init</em> defaults to <code>true</code>, but this may change in the future.<p>
This function may give a speedup if <code>A</code> has less columns than rows, because the product is computed as a sum of outer products. </td>
</tr>
</table>
<hr />
<p>Copyright (&copy;) 2000-2004 Michael Stevens, Mathias Koch,
Joerg Walter, Gunter Winkler<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: 2004-07-26</p>
</body>
</html>

View File

@@ -20,15 +20,15 @@ implements a simple C-like array using allocation via
<code>new/delete</code>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
unbounded_array&lt;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 />
#include &lt;boost/numeric/ublas/storage.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
unbounded_array&lt;double&gt; a (3);
for (unsigned i = 0; i &lt; a.size (); ++ i) {
a [i] = i;
std::cout &lt;&lt; a [i] &lt;&lt; std::endl;
}
}
</pre>
<h4>Definition</h4>
@@ -178,16 +178,16 @@ Array</h2>
implements a simple C-like array.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
bounded_array&lt;double, 3&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 />
#include &lt;boost/numeric/ublas/storage.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
bounded_array&lt;double, 3&gt; a (3);
for (unsigned i = 0; i &lt; a.size (); ++ i) {
a [i] = i;
std::cout &lt;&lt; a [i] &lt;&lt; std::endl;
}
}
</pre>
<h4>Definition</h4>
<p>Defined in the header storage.hpp.</p>
@@ -338,15 +338,15 @@ the reversed <code>bounded_array</code>.</td>
needed to address ranges of vectors and matrices.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
range r (0, 3);<br />
for (unsigned i = 0; i &lt; r.size (); ++ i) {<br />
std::cout &lt;&lt; r (i) &lt;&lt; std::endl;<br />
}<br />
}<br />
#include &lt;boost/numeric/ublas/storage.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
range r (0, 3);
for (unsigned i = 0; i &lt; r.size (); ++ i) {
std::cout &lt;&lt; r (i) &lt;&lt; std::endl;
}
}
</pre>
<h4>Definition</h4>
<p>Defined in the header storage.hpp.</p>
@@ -428,15 +428,15 @@ end of the reversed <code>range</code>.</td>
needed to address slices of vectors and matrices.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
slice s (0, 1, 3);<br />
for (unsigned i = 0; i &lt; s.size (); ++ i) {<br />
std::cout &lt;&lt; s (i) &lt;&lt; std::endl;<br />
}<br />
}<br />
#include &lt;boost/numeric/ublas/storage.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
slice s (0, 1, 3);
for (unsigned i = 0; i &lt; s.size (); ++ i) {
std::cout &lt;&lt; s (i) &lt;&lt; std::endl;
}
}
</pre>
<h4>Definition</h4>
<p>Defined in the header storage.hpp.</p>

View File

@@ -21,16 +21,16 @@ allows the definition of a default template parameter (for the
adapted array) when declaring the sparse container types.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage_sparse.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
map_std&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 />
#include &lt;boost/numeric/ublas/storage_sparse.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
map_std&lt;int, double&gt; a (3);
for (unsigned i = 0; i &lt; a.size (); ++ i) {
a [i] = i;
std::cout &lt;&lt; a [i] &lt;&lt; std::endl;
}
}
</pre>
<h4>Definition</h4>
<p>Defined in the header storage_sparse.hpp.</p>
@@ -68,16 +68,16 @@ implements a simple std::map-like associative container as a sorted
array.</p>
<h4>Example</h4>
<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 />
#include &lt;boost/numeric/ublas/storage_sparse.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
map_array&lt;int, double&gt; a (3);
for (unsigned i = 0; i &lt; a.size (); ++ i) {
a [i] = i;
std::cout &lt;&lt; a [i] &lt;&lt; std::endl;
}
}
</pre>
<h4>Definition</h4>
<p>Defined in the header storage_sparse.hpp.</p>

View File

@@ -23,21 +23,21 @@ For a <em>(n x n</em> )-dimensional symmetric matrix and <em>0
i</em></sub>. The storage of symmetric matrices is packed.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/symmetric.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
symmetric_matrix&lt;double, lower&gt; ml (3, 3);<br />
for (unsigned i = 0; i &lt; ml.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt;= i; ++ j)<br />
ml (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; ml &lt;&lt; std::endl;<br />
symmetric_matrix&lt;double, upper&gt; mu (3, 3);<br />
for (unsigned i = 0; i &lt; mu.size1 (); ++ i)<br />
for (unsigned j = i; j &lt; mu.size2 (); ++ j)<br />
mu (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; mu &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/symmetric.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
symmetric_matrix&lt;double, lower&gt; ml (3, 3);
for (unsigned i = 0; i &lt; ml.size1 (); ++ i)
for (unsigned j = 0; j &lt;= i; ++ j)
ml (i, j) = 3 * i + j;
std::cout &lt;&lt; ml &lt;&lt; std::endl;
symmetric_matrix&lt;double, upper&gt; mu (3, 3);
for (unsigned i = 0; i &lt; mu.size1 (); ++ i)
for (unsigned j = i; j &lt; mu.size2 (); ++ j)
mu (i, j) = 3 * i + j;
std::cout &lt;&lt; mu &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
@@ -323,22 +323,22 @@ Symmetric Adaptor</h2>
is a symmetric matrix adaptor for other matrices.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/symmetric.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
symmetric_adaptor&lt;matrix&lt;double&gt;, lower&gt; sal (m);<br />
for (unsigned i = 0; i &lt; sal.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt;= i; ++ j)<br />
sal (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; sal &lt;&lt; std::endl;<br />
symmetric_adaptor&lt;matrix&lt;double&gt;, upper&gt; sau (m);<br />
for (unsigned i = 0; i &lt; sau.size1 (); ++ i)<br />
for (unsigned j = i; j &lt; sau.size2 (); ++ j)<br />
sau (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; sau &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/symmetric.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
symmetric_adaptor&lt;matrix&lt;double&gt;, lower&gt; sal (m);
for (unsigned i = 0; i &lt; sal.size1 (); ++ i)
for (unsigned j = 0; j &lt;= i; ++ j)
sal (i, j) = 3 * i + j;
std::cout &lt;&lt; sal &lt;&lt; std::endl;
symmetric_adaptor&lt;matrix&lt;double&gt;, upper&gt; sau (m);
for (unsigned i = 0; i &lt; sau.size1 (); ++ i)
for (unsigned j = i; j &lt; sau.size2 (); ++ j)
sau (i, j) = 3 * i + j;
std::cout &lt;&lt; sau &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>

View File

@@ -332,23 +332,23 @@ Triangular Adaptor</h2>
is a triangular matrix adaptor for other matrices.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/triangular.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
matrix&lt;double&gt; m (3, 3);<br />
triangular_adaptor&lt;matrix&lt;double&gt;, lower&gt; tal (m);<br />
for (unsigned i = 0; i &lt; tal.size1 (); ++ i)<br />
for (unsigned j = 0; j &lt;= i; ++ j)<br />
tal (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; tal &lt;&lt; std::endl;<br />
triangular_adaptor&lt;matrix&lt;double&gt;, upper&gt; tau (m);<br />
for (unsigned i = 0; i &lt; tau.size1 (); ++ i)<br />
for (unsigned j = i; j &lt; tau.size2 (); ++ j)<br />
tau (i, j) = 3 * i + j;<br />
std::cout &lt;&lt; tau &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/triangular.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
matrix&lt;double&gt; m (3, 3);
triangular_adaptor&lt;matrix&lt;double&gt;, lower&gt; tal (m);
for (unsigned i = 0; i &lt; tal.size1 (); ++ i)
for (unsigned j = 0; j &lt;= i; ++ j)
tal (i, j) = 3 * i + j;
std::cout &lt;&lt; tal &lt;&lt; std::endl;
triangular_adaptor&lt;matrix&lt;double&gt;, upper&gt; tau (m);
for (unsigned i = 0; i &lt; tau.size1 (); ++ i)
for (unsigned j = i; j &lt; tau.size2 (); ++ j)
tau (i, j) = 3 * i + j;
std::cout &lt;&lt; tau &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header triangular.hpp.</p>

571
doc/types_overview.htm Normal file
View File

@@ -0,0 +1,571 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
<meta name="GENERATOR" content="Quanta Plus" />
<link href="ublas.css" type="text/css" />
<title>Types Overview</title>
</head>
<body>
<h1><img src="c++boost.gif" alt="c++boost.gif" align="middle" />
Overview of Matrix- and Vector-Types </h1>
<dl>
<dt>Contents:</dt>
<dd><a href="#vectors">Vectors</a></dd>
<dd><a href="#vector_proxies">Vector Proxies</a></dd>
<dd><a href="#matrices">Matrices</a></dd>
<dd><a href="#matrix_proxies">Matrix Proxies</a></dd>
<dd><a href="#storage_layout">Special Storage Layouts</a></dd>
</dl>
<h3>Notation:</h3>
<table style="border: none;" summary="notation">
<tr><td><code>T</code></td>
<td>is the data type. For general linear algebra operations this will be a real type e.g. <code>double</code>, ...</td></tr>
<tr><td><code>F</code></td>
<td>is the orientation type (functor), either
<code>row_major</code> or <code>column_major</code></td></tr>
<tr><td><code>A, IA, TA</code></td> <td>is an array storage type, e.g. <code>std::vector,
bounded_array, unbounded_array, ...</code></td></tr>
<tr><td><code>TRI</code></td>
<td>is a triangular functor: <code>lower,
unit_lower, strict_lower, upper, unit_upper,
strict_upper</code></td></tr>
<tr><td><code>M, N</code></td>
<td>are unsigned integer sizes
(<code>std::size_t</code>)</td></tr>
<tr><td><code>IB</code></td>
<td>is an index base
(<code>std::size_t</code>)</td></tr>
<tr><td><code>VEC</code></td>
<td>is any vector type</td></tr>
<tr><td><code>MAT</code> </td>
<td>is any matrix type</td></tr>
<tr><td><code>[...]</code></td>
<td>denote optional arguments - for more details
look at the section "storage layout".</td></tr>
</table>
<h2><a name="vectors">Vectors</a></h2>
<table border="1" summary="vector types">
<thead>
<tr>
<th width="30%">Definition</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>vector&lt;T [, A]&gt;<br />&nbsp;&nbsp; v(size);</code></td>
<td>a dense vector of values of type <code>T</code> of variable
size. A storage type <code>A</code> can be specified
which defaults to <code>unbounded_array</code>.
Elements are zeroed by default.</td>
</tr>
<tr>
<td><code>bounded_vector&lt;T, N&gt;<br />&nbsp;&nbsp; v;</code></td>
<td>a dense vector of values of type <code>T</code> of variable size but with maximum
<code>N</code>. The default constructor creates <code>v</code>
with size <code>N</code>.
Elements are zeroed by default.</td>
</tr>
<tr>
<td><code>c_vector&lt;T, M&gt;<br />&nbsp;&nbsp; v(size);</code></td>
<td>a dense vector of values of type <code>T</code> with the given size.
The data is stored as an ordinary C++ array <code>T
data_[M]</code></td>
</tr>
<tr>
<td><code>zero_vector&lt;T&gt;<br />&nbsp;&nbsp; v(size);</code></td>
<td>the zero vector of type <code>T</code> with the given
size.</td>
</tr>
<tr>
<td><code>unit_vector&lt;T&gt;<br />&nbsp;&nbsp; v(size,&nbsp;index);</code></td>
<td>the unit vector of type <code>T</code> with the given size. The
vector is zero other then a single specified element.
<br/><code>index</code> should be less than <code>size</code>.</td>
</tr>
<tr>
<td><code>sparse_vector&lt;T [, S]&gt;<br />&nbsp;&nbsp; v(size);</code></td>
<td>a sparse vector of values of type <code>T</code> of variable
size. The sparse storage type <code>S</code> can be <code>std::map&lt;size_t,
T&gt;</code> or <code>map_array&lt;size_t, T&gt;</code>.</td>
</tr>
<tr>
<td><code>compressed_vector&lt;T [,IB, IA, TA]&gt;<br />&nbsp;&nbsp; v(size);</code></td>
<td>a sparse vector of values of type <code>T</code> of variable
size. The non zero values are stored as two seperate arrays - an
index array and a value array. The index array is always sorted and
the is at most one entry for each index.</td>
</tr>
<tr>
<td><code>coordinate_vector&lt;T [,IB, IA, TA]&gt;<br />&nbsp;&nbsp; v(size);</code></td>
<td>a sparse vector of values of type <code>T</code> of variable
size. The non zero values are stored as two seperate arrays - an
index array and a value array. The arrays may be out of order with
multiple entries for each vector element. If there are multiple
values for the same index the sum of these values is the real
value.</td>
</tr>
</tbody>
</table>
<p><em>Note:</em> the default types are defined in
<code>boost/numeric/ublas/fwd.hpp</code>.</p>
<h2><a name="vector_proxies">Vector Proxies</a></h2>
<table border="1" summary="vector proxies">
<thead>
<tr>
<th width="30%">Definition</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>vector_range&lt;VEC&gt;<br />&nbsp;&nbsp; vr(v, range);</code></td>
<td>a vector referencing a continuous subvector of elements of
vector <code>v</code> containing all elements specified by
<code>range</code>.</td>
</tr>
<tr>
<td><code>vector_slice&lt;VEC&gt;<br />&nbsp;&nbsp; vs(v, slice);</code></td>
<td>a vector referencing a non continuous subvector of elements of
vector <code>v</code> containing all elements specified by
<code>slice</code>.</td>
</tr>
<tr>
<td><code>matrix_row&lt;MAT&gt;<br />&nbsp;&nbsp; vr(m, index);</code></td>
<td>a vector referencing the <code>index</code>-th row of matrix
<code>m</code></td>
</tr>
<tr>
<td><code>matrix_column&lt;MAT&gt;<br />&nbsp;&nbsp; vc(m, index);</code></td>
<td>a vector referencing the <code>index</code>-th column of matrix
<code>m</code></td>
</tr>
</tbody>
</table>
<h2><a name="matrices">Matrices</a></h2>
<table border="1" summary="matrix types">
<thead>
<tr>
<th width="30%">Definition</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>matrix&lt;T [, F, A]&gt;<br />&nbsp;&nbsp; m(size1, size2);</code></td>
<td>a dense matrix of values of type <code>T</code> of variable
size. A storage type <code>A</code> can be specified
which defaults to <code>unbounded_array</code>.
The orientation functor <code>F</code> defaults to
<code>row_major</code>.
Elements are zeroed by default.</td>
</tr>
<tr>
<td><code>bounded_matrix&lt;T, M, N [, F]&gt;<br />&nbsp;&nbsp; m;</code></td>
<td>a dense matrix of type <code>T</code> with variable size with maximum <code>M</code>-by-<code>N</code>. The orientation functor <code>F</code>
defaults to <code>row_major</code>. The default constructor creates
<code>m</code> with size <code>M</code>-by-<code>N</code>.
Elements are zeroed by default.</td>
</tr>
<tr>
<td><code>c_matrix&lt;T, M, N&gt;<br />&nbsp;&nbsp; m(size1, size2);</code></td>
<td>a dense matrix of values of type <code>T</code> with the given size.
The data is stored as an ordinary C++ array <code>T
data_[N][M]</code></td>
</tr>
<tr>
<td><code>vector_of_vector&lt;T [, F, A]&gt;<br />&nbsp;&nbsp; m(size1,
size2);</code></td>
<td>a dense matrix of values of type <code>T</code> with the given size.
The data is stored as a vector of vectors. The orientation
<code>F</code> defaults to <code>row_major</code>. The storage
type <code>S</code> defaults to
<code>unbounded_array&lt;unbounded_array&lt;T&gt;&nbsp;&gt;</code></td>
</tr>
<tr>
<td><code>zero_matrix&lt;T&gt;<br />&nbsp;&nbsp; m(size1, size2);</code></td>
<td>a zero matrix of type <code>T</code> with the given size.</td>
</tr>
<tr>
<td><code>identity_matrix&lt;T&gt;<br />&nbsp;&nbsp; m(size1, size2);</code></td>
<td>an identity matrix of type <code>T</code> with the given size.
The values are <code>v(i,j) = (i==j)?T(1):T()</code>.</td>
</tr>
<tr>
<td><code>scalar_matrix&lt;T&gt;<br />&nbsp;&nbsp; m(size1, size2,
value);</code></td>
<td>a matrix of type <code>T</code> with the given size that has the
value <code>value</code> everywhere.</td>
</tr>
<tr>
<td><code>triangular_matrix&lt;T [, TRI, F, A]&gt;<br />&nbsp;&nbsp;
m(size);</code></td>
<td>a triangular matrix of values of type <code>T</code> of
variable size. Only the nonzero elements are stored in the given
order <code>F</code>. ("triangular packed storage") The triangular
type <code>F</code> defaults to <code>lower</code>, the orientation
type <code>F</code> defaults to <code>row_major</code>.</td>
</tr>
<tr>
<td><code>banded_matrix&lt;T [, F, A]&gt;<br />&nbsp;&nbsp; m(size1, size2, n_lower,
n_upper);</code></td>
<td>a banded matrix of values of type <code>T</code> of variable
size with <code>n_lower</code> sub diagonals and
<code>n_upper</code> super diagonals. Only the nonzero elements are
stored in the given order <code>F</code>. ("packed storage")</td>
</tr>
<tr>
<td><code>symmetric_matrix&lt;T [, TRI, F, A]&gt;<br />&nbsp;&nbsp;
m(size);</code></td>
<td>a symmetric matrix of values of type <code>T</code> of
variable size. Only the given triangular matrix is stored in the
given order <code>F</code>.</td>
</tr>
<tr>
<td><code>hermitian_matrix&lt;T [, TRI, F, A]&gt;<br />&nbsp;&nbsp;
m(size);</code></td>
<td>a hermitian matrix of values of type <code>T</code> of
variable size. Only the given triangular matrix is stored using
the order <code>F</code>.</td>
</tr>
<tr>
<td><code>sparse_matrix&lt;T, [F, S]&gt;<br />&nbsp;&nbsp; m(size1, size2 [,
non_zeros]);</code></td>
<td>a sparse matrix of values of type <code>T</code> of variable
size. The sparse storage type <code>S</code> can be either <code>std::map&lt;size_t,
std::map&lt;size_t, T&gt;&nbsp;&gt;</code> or
<code>map_array&lt;size_t, map_array&lt;size_t,
T&gt;&nbsp;&gt;</code>.</td>
</tr>
<tr>
<td><code>sparse_vector_of_sparse_vector&lt;T, [F, C]&gt;<br />&nbsp;&nbsp; m(size1,
size2 [, non_zeros]);</code></td>
<td>a sparse matrix of values of type <code>T</code> of variable
size.</td>
</tr>
<tr>
<td><code>compressed_matrix&lt;T, [F, IB, IA, TA]&gt;<br />&nbsp;&nbsp; m(size1,
size2 [, non_zeros]);</code></td>
<td>a sparse matrix of values of type <code>T</code> of variable
size. The values are stored in compressed row/column storage.</td>
</tr>
<tr>
<td><code>coordinate_matrix&lt;T, [F, IB, IA, TA]&gt;<br />&nbsp;&nbsp; m(size1,
size2 [, non_zeros]);</code></td>
<td>a sparse matrix of values of type <code>T</code> of variable
size. The values are stored in 3 parallel array as triples (i, j,
value). More than one value for each pair of indices is possible,
the real value is the sum of all.</td>
</tr>
<tr>
<td><code>generalized_vector_of_vector&lt;T, F, A&gt;<br />&nbsp;&nbsp; m(size1,
size2 [, non_zeros]);</code></td>
<td>a sparse matrix of values of type <code>T</code> of variable
size. The values are stored as a vector of sparse vectors, e.g.
<code>generalized_vector_of_vector&lt;double, row_major,
unbounded_array&lt;coordinate_vector&lt;double&gt;&nbsp;&gt;&nbsp;&gt;</code></td>
</tr>
</tbody>
</table>
<p><em>Note:</em> the default types are defined in
<code>boost/numeric/ublas/fwd.hpp</code>.</p>
<h2><a name="matrix_proxies">Matrix Proxies</a></h2>
<table border="1" summary="matrix proxies">
<thead>
<tr>
<th width="30%">Definition</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>triangular_adaptor&lt;MAT, TRI&gt;<br />&nbsp;&nbsp; ta(m);</code></td>
<td>a triangular matrix referencing a selection of elements of the
matrix <code>m</code>.</td>
</tr>
<tr>
<td><code>symmetric_adaptor&lt;MAT, TRI&gt;<br />&nbsp;&nbsp; sa(m);</code></td>
<td>a symmetric matrix referencing a selection of elements of the
matrix <code>m</code>.</td>
</tr>
<tr>
<td><code>hermitian_adaptor&lt;MAT, TRI&gt;<br />&nbsp;&nbsp; ha(m);</code></td>
<td>a hermitian matrix referencing a selection of elements of the
matrix <code>m</code>.</td>
</tr>
<tr>
<td><code>banded_adaptor&lt;MAT&gt;<br />&nbsp;&nbsp; ba(m, n_lower,
n_upper);</code></td>
<td>a banded matrix referencing a selection of elements of the
matrix <code>m</code>.</td>
</tr>
<tr>
<td><code>matrix_range&lt;MAT, TRI&gt;<br />&nbsp;&nbsp; mr(m, range1,
range2);</code></td>
<td>a matrix referencing a submatrix of elements in the matrix
<code>m</code>.</td>
</tr>
<tr>
<td><code>matrix_slice&lt;MAT, TRI&gt;<br />&nbsp;&nbsp; ms(m, slice1,
slice2);</code></td>
<td>a matrix referencing a non continues submatrix of elements in
the matrix <code>m</code>.</td>
</tr>
</tbody>
</table>
<h2><a name="storage_layout">Special Storage Layouts</a></h2>
<p>The library supports conventional dense, packed and basic sparse
vector and matrix storage layouts. The description of the most
common constructions of vectors and matrices comes next.</p>
<table border="1" summary="storage layouts">
<tbody>
<tr>
<th width="30%">Construction</th>
<th>Comment</th>
</tr>
<tr>
<td><code>vector&lt;T,<br />
&nbsp;std::vector&lt;T&gt; &gt;<br />
&nbsp;&nbsp;v (size)</code></td>
<td>a dense vector, storage is provided by a standard
vector.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>vector&lt;T,<br />
&nbsp;unbounded_array&lt;T&gt; &gt;<br />
&nbsp;&nbsp;v (size)</code></td>
<td>a dense vector, storage is provided by a heap-based
array.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>vector&lt;T,<br />
&nbsp;bounded_array&lt;T, N&gt; &gt;<br />
&nbsp;&nbsp;v (size)</code></td>
<td>a dense vector, storage is provided by a stack-based
array.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>sparse_vector&lt;T,<br />
&nbsp;std::map&lt;std::size_t, T&gt; &gt;<br />
&nbsp;&nbsp;v (size, non_zeros)</code></td>
<td>a sparse vector, storage is provided by a standard
map.</td>
</tr>
<tr>
<td><code>sparse_vector&lt;T,<br />
&nbsp;map_array&lt;std::size_t, T&gt; &gt;<br />
&nbsp;&nbsp;v (size, non_zeros)</code></td>
<td>a sparse vector, storage is provided by a map
array.</td>
</tr>
<tr>
<td><code>matrix&lt;T,<br />
&nbsp;row_major,<br />
&nbsp;std::vector&lt;T&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2)</code></td>
<td>a dense matrix, orientation is row major, storage is
provided by a standard vector.</td>
</tr>
<tr>
<td><code>matrix&lt;T,<br />
&nbsp;column_major,<br />
&nbsp;std::vector&lt;T&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2)</code></td>
<td>a dense matrix, orientation is column major, storage
is provided by a standard vector.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>matrix&lt;T,<br />
&nbsp;row_major,<br />
&nbsp;unbounded_array&lt;T&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2)</code></td>
<td>a dense matrix, orientation is row major, storage is
provided by a heap-based array.</td>
</tr>
<tr>
<td><code>matrix&lt;T,<br />
&nbsp;column_major,<br />
&nbsp;unbounded_array&lt;T&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2)</code></td>
<td>a dense matrix, orientation is column major, storage
is provided by a heap-based array.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>matrix&lt;T,<br />
&nbsp;row_major,<br />
&nbsp;bounded_array&lt;T, N1 * N2&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2)</code></td>
<td>a dense matrix, orientation is row major, storage is
provided by a stack-based array.</td>
</tr>
<tr>
<td><code>matrix&lt;T,<br />
&nbsp;column_major,<br />
&nbsp;bounded_array&lt;T, N1 * N2&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2)</code></td>
<td>a dense matrix, orientation is column major, storage
is provided by a stack-based array.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>triangular_matrix&lt;T,<br />
&nbsp;row_major, F, A&gt;<br />
&nbsp;&nbsp;m (size)</code></td>
<td>a packed triangular matrix, orientation is row
major.</td>
</tr>
<tr>
<td><code>triangular_matrix&lt;T,<br />
&nbsp;column_major, F, A&gt;<br />
&nbsp;&nbsp;m (size)</code></td>
<td>a packed triangular matrix, orientation is column
major.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>banded_matrix&lt;T,<br />
&nbsp;row_major, A&gt;<br />
&nbsp;&nbsp;m (size1, size2, lower, upper)</code></td>
<td>a packed banded matrix, orientation is row
major.</td>
</tr>
<tr>
<td><code>banded_matrix&lt;T,<br />
&nbsp;column_major, A&gt;<br />
&nbsp;&nbsp;m (size1, size2, lower, upper)</code></td>
<td>a packed banded matrix, orientation is column
major.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>symmetric_matrix&lt;T,<br />
&nbsp;row_major, F, A&gt;<br />
&nbsp;&nbsp;m (size)</code></td>
<td>a packed symmetric matrix, orientation is row
major.</td>
</tr>
<tr>
<td><code>symmetric_matrix&lt;T,<br />
&nbsp;column_major, F, A&gt;<br />
&nbsp;&nbsp;m (size)</code></td>
<td>a packed symmetric matrix, orientation is column
major.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>hermitian_matrix&lt;T,<br />
&nbsp;row_major, F, A&gt;<br />
&nbsp;&nbsp;m (size)</code></td>
<td>a packed hermitian matrix, orientation is row
major.</td>
</tr>
<tr>
<td><code>hermitian_matrix&lt;T,<br />
&nbsp;column_major, F, A&gt;<br />
&nbsp;&nbsp;m (size)</code></td>
<td>a packed hermitian matrix, orientation is column
major.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>sparse_matrix&lt;T,<br />
&nbsp;row_major,<br />
&nbsp;std::map&lt;std::size_t, T&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2, non_zeros)</code></td>
<td>a sparse matrix, orientation is row major, storage
is provided by a standard map.</td>
</tr>
<tr>
<td><code>sparse_matrix&lt;T,<br />
&nbsp;column_major,<br />
&nbsp;std::map&lt;std::size_t, T&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2, non_zeros)</code></td>
<td>a sparse matrix, orientation is column major,
storage is provided by a standard map.</td>
</tr>
<tr>
<td><code>sparse_matrix&lt;T,<br />
&nbsp;row_major,<br />
&nbsp;map_array&lt;std::size_t, T&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2, non_zeros)</code></td>
<td>a sparse matrix, orientation is row major, storage
is provided by a map array.</td>
</tr>
<tr>
<td><code>sparse_matrix&lt;T,<br />
&nbsp;column_major,<br />
&nbsp;map_array&lt;std::size_t, T&gt; &gt;<br />
&nbsp;&nbsp;m (size1, size2, non_zeros)</code></td>
<td>a sparse matrix, orientation is column major,
storage is provided by a map array.</td>
</tr>
<tr>
<td><code>compressed_matrix&lt;T,<br />
&nbsp;row_major&gt;<br />
&nbsp;&nbsp;m (size1, size2, non_zeros)</code></td>
<td>a compressed matrix, orientation is row major.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>compressed_matrix&lt;T,<br />
&nbsp;column_major&gt;<br />
&nbsp;&nbsp;m (size1, size2, non_zeros)</code></td>
<td>a compressed matrix, orientation is column
major.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>coordinate_matrix&lt;T,<br />
&nbsp;row_major&gt;<br />
&nbsp;&nbsp;m (size1, size2, non_zeros)</code></td>
<td>a coordinate matrix, orientation is row major.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
<tr>
<td><code>coordinate_matrix&lt;T,<br />
&nbsp;column_major&gt;<br />
&nbsp;&nbsp;m (size1, size2, non_zeros)</code></td>
<td>a coordinate matrix, orientation is column
major.<br />
The storage layout usually is BLAS compliant.</td>
</tr>
</tbody>
</table>
<hr />
<p>Copyright (&copy;) 2000-2004 Joerg Walter, Mathias Koch, Gunter
Winkler, Michael Stevens<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: 2004-08-08</p>
</body>
</html>

View File

@@ -21,16 +21,16 @@ vector and <em>0 &lt;= i &lt; n</em> every element
element of the container.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v (3);<br />
for (unsigned i = 0; i &lt; v.size (); ++ i)<br />
v (i) = i;<br />
std::cout &lt;&lt; v &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v (3);
for (unsigned i = 0; i &lt; v.size (); ++ i)
v (i) = i;
std::cout &lt;&lt; v &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header vector.hpp.</p>
@@ -254,16 +254,16 @@ n</em> holds <em>u</em><sup><em>k</em></sup><sub><em>i</em></sub>
1</em>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
for (int i = 0; i &lt; 3; ++ i) {<br />
unit_vector&lt;double&gt; v (3, i);<br />
std::cout &lt;&lt; v &lt;&lt; std::endl;<br />
}<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
for (int i = 0; i &lt; 3; ++ i) {
unit_vector&lt;double&gt; v (3, i);
std::cout &lt;&lt; v &lt;&lt; std::endl;
}
}
</pre>
<h4>Definition</h4>
<p>Defined in the header vector.hpp.</p>
@@ -381,14 +381,14 @@ zero vectors. For a <em>n</em>-dimensional zero vector and <em>0
0</em>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
zero_vector&lt;double&gt; v (3);<br />
std::cout &lt;&lt; v &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
zero_vector&lt;double&gt; v (3);
std::cout &lt;&lt; v &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header vector.hpp.</p>
@@ -503,14 +503,14 @@ vector and <em>0 &lt;= i &lt; n</em> holds
<em>z</em><sub><em>i</em></sub> <em>= s</em>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
scalar_vector&lt;double&gt; v (3);<br />
std::cout &lt;&lt; v &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
scalar_vector&lt;double&gt; v (3);
std::cout &lt;&lt; v &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header vector.hpp.</p>

View File

@@ -317,40 +317,40 @@ end of the reversed expression.</td>
<h3>Unary Operations</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class E, class F&gt;<br />
struct vector_unary_traits {<br />
typedef vector_unary&lt;typename E::const_closure_type, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (- v) [i] = - v [i]<br />
template&lt;class E&gt;<br />
typename vector_unary_traits&lt;E, scalar_negate&lt;typename E::value_type&gt; &gt;::result_type<br />
operator - (const vector_expression&lt;E&gt; &amp;e);<br />
<br />
// (conj v) [i] = conj (v [i])<br />
template&lt;class E&gt;<br />
typename vector_unary_traits&lt;E, scalar_conj&lt;typename E::value_type&gt; &gt;::result_type<br />
conj (const vector_expression&lt;E&gt; &amp;e);<br />
<br />
// (real v) [i] = real (v [i])<br />
template&lt;class E&gt;<br />
typename vector_unary_traits&lt;E, scalar_real&lt;typename E::value_type&gt; &gt;::result_type<br />
real (const vector_expression&lt;E&gt; &amp;e);<br />
<br />
// (imag v) [i] = imag (v [i])<br />
template&lt;class E&gt;<br />
typename vector_unary_traits&lt;E, scalar_imag&lt;typename E::value_type&gt; &gt;::result_type<br />
imag (const vector_expression&lt;E&gt; &amp;e);<br />
<br />
// (trans v) [i] = v [i]<br />
template&lt;class E&gt;<br />
typename vector_unary_traits&lt;E, scalar_identity&lt;typename E::value_type&gt; &gt;::result_type<br />
trans (const vector_expression&lt;E&gt; &amp;e);<br />
<br />
// (herm v) [i] = conj (v [i])<br />
template&lt;class E&gt;<br />
typename vector_unary_traits&lt;E, scalar_conj&lt;typename E::value_type&gt; &gt;::result_type<br />
<code>template&lt;class E, class F&gt;
struct vector_unary_traits {
typedef vector_unary&lt;typename E::const_closure_type, F&gt; expression_type;
typedef expression_type result_type;
};
// (- v) [i] = - v [i]
template&lt;class E&gt;
typename vector_unary_traits&lt;E, scalar_negate&lt;typename E::value_type&gt; &gt;::result_type
operator - (const vector_expression&lt;E&gt; &amp;e);
// (conj v) [i] = conj (v [i])
template&lt;class E&gt;
typename vector_unary_traits&lt;E, scalar_conj&lt;typename E::value_type&gt; &gt;::result_type
conj (const vector_expression&lt;E&gt; &amp;e);
// (real v) [i] = real (v [i])
template&lt;class E&gt;
typename vector_unary_traits&lt;E, scalar_real&lt;typename E::value_type&gt; &gt;::result_type
real (const vector_expression&lt;E&gt; &amp;e);
// (imag v) [i] = imag (v [i])
template&lt;class E&gt;
typename vector_unary_traits&lt;E, scalar_imag&lt;typename E::value_type&gt; &gt;::result_type
imag (const vector_expression&lt;E&gt; &amp;e);
// (trans v) [i] = v [i]
template&lt;class E&gt;
typename vector_unary_traits&lt;E, scalar_identity&lt;typename E::value_type&gt; &gt;::result_type
trans (const vector_expression&lt;E&gt; &amp;e);
// (herm v) [i] = conj (v [i])
template&lt;class E&gt;
typename vector_unary_traits&lt;E, scalar_conj&lt;typename E::value_type&gt; &gt;::result_type
herm (const vector_expression&lt;E&gt; &amp;e);</code>
</pre>
<h4>Description</h4>
@@ -374,21 +374,21 @@ conjugate of the transpose of a vector expression.</p>
<p>Linear depending from the size of the vector expression.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;std::complex&lt;double&gt; &gt; v (3);<br />
for (unsigned i = 0; i &lt; v.size (); ++ i)<br />
v (i) = std::complex&lt;double&gt; (i, i);<br />
<br />
std::cout &lt;&lt; - v &lt;&lt; std::endl;<br />
std::cout &lt;&lt; conj (v) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; real (v) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; imag (v) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; trans (v) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; herm (v) &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;std::complex&lt;double&gt; &gt; v (3);
for (unsigned i = 0; i &lt; v.size (); ++ i)
v (i) = std::complex&lt;double&gt; (i, i);
std::cout &lt;&lt; - v &lt;&lt; std::endl;
std::cout &lt;&lt; conj (v) &lt;&lt; std::endl;
std::cout &lt;&lt; real (v) &lt;&lt; std::endl;
std::cout &lt;&lt; imag (v) &lt;&lt; std::endl;
std::cout &lt;&lt; trans (v) &lt;&lt; std::endl;
std::cout &lt;&lt; herm (v) &lt;&lt; std::endl;
}
</pre>
<h3>Binary Operation Description</h3>
@@ -477,25 +477,25 @@ end of the reversed expression.</td>
<h3>Binary Operations</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class E1, class E2, class F&gt;<br />
struct vector_binary_traits {<br />
typedef vector_binary&lt;typename E1::const_closure_type,<br />
typename E2::const_closure_type, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (v1 + v2) [i] = v1 [i] + v2 [i]<br />
template&lt;class E1, class E2&gt;<br />
typename vector_binary_traits&lt;E1, E2, scalar_plus&lt;typename E1::value_type,<br />
typename E2::value_type&gt; &gt;::result_type<br />
operator + (const vector_expression&lt;E1&gt; &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2);<br />
<br />
// (v1 - v2) [i] = v1 [i] - v2 [i]<br />
template&lt;class E1, class E2&gt;<br />
typename vector_binary_traits&lt;E1, E2, scalar_minus&lt;typename E1::value_type,<br />
typename E2::value_type&gt; &gt;::result_type<br />
operator - (const vector_expression&lt;E1&gt; &amp;e1,<br />
<code>template&lt;class E1, class E2, class F&gt;
struct vector_binary_traits {
typedef vector_binary&lt;typename E1::const_closure_type,
typename E2::const_closure_type, F&gt; expression_type;
typedef expression_type result_type;
};
// (v1 + v2) [i] = v1 [i] + v2 [i]
template&lt;class E1, class E2&gt;
typename vector_binary_traits&lt;E1, E2, scalar_plus&lt;typename E1::value_type,
typename E2::value_type&gt; &gt;::result_type
operator + (const vector_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);
// (v1 - v2) [i] = v1 [i] - v2 [i]
template&lt;class E1, class E2&gt;
typename vector_binary_traits&lt;E1, E2, scalar_minus&lt;typename E1::value_type,
typename E2::value_type&gt; &gt;::result_type
operator - (const vector_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);</code>
</pre>
<h4>Description</h4>
@@ -519,17 +519,17 @@ vector expressions.</p>
<p>Linear depending from the size of the vector expressions.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v1 (3), v2 (3);<br />
for (unsigned i = 0; i &lt; std::min (v1.size (), v2.size ()); ++ i)<br />
v1 (i) = v2 (i) = i;<br />
<br />
std::cout &lt;&lt; v1 + v2 &lt;&lt; std::endl;<br />
std::cout &lt;&lt; v1 - v2 &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v1 (3), v2 (3);
for (unsigned i = 0; i &lt; std::min (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout &lt;&lt; v1 + v2 &lt;&lt; std::endl;
std::cout &lt;&lt; v1 - v2 &lt;&lt; std::endl;
}
</pre>
<h3>Binary Outer Operation Description</h3>
@@ -643,17 +643,17 @@ end of the reversed expression.</td>
<h3>Binary Outer Operations</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class E1, class E2, class F&gt;<br />
struct vector_matrix_binary_traits {<br />
typedef vector_matrix_binary&lt;typename E1::const_closure_type,<br />
typename E2::const_closure_type, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (outer_prod (v1, v2)) [i] [j] = v1 [i] * v2 [j]<br />
template&lt;class E1, class E2&gt;<br />
typename vector_matrix_binary_traits&lt;E1, E2, scalar_multiplies&lt;typename E1::value_type, typename E2::value_type&gt; &gt;::result_type<br />
outer_prod (const vector_expression&lt;E1&gt; &amp;e1,<br />
<code>template&lt;class E1, class E2, class F&gt;
struct vector_matrix_binary_traits {
typedef vector_matrix_binary&lt;typename E1::const_closure_type,
typename E2::const_closure_type, F&gt; expression_type;
typedef expression_type result_type;
};
// (outer_prod (v1, v2)) [i] [j] = v1 [i] * v2 [j]
template&lt;class E1, class E2&gt;
typename vector_matrix_binary_traits&lt;E1, E2, scalar_multiplies&lt;typename E1::value_type, typename E2::value_type&gt; &gt;::result_type
outer_prod (const vector_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);</code>
</pre>
<h4>Description</h4>
@@ -674,17 +674,17 @@ expressions.</p>
<p>Quadratic depending from the size of the vector expressions.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/matrix.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v1 (3), v2 (3);<br />
for (unsigned i = 0; i &lt; std::min (v1.size (), v2.size ()); ++ i)<br />
v1 (i) = v2 (i) = i;<br />
<br />
std::cout &lt;&lt; outer_prod (v1, v2) &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v1 (3), v2 (3);
for (unsigned i = 0; i &lt; std::min (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout &lt;&lt; outer_prod (v1, v2) &lt;&lt; std::endl;
}
</pre>
<h3>Scalar Vector Operation Description</h3>
<h4>Description</h4>
@@ -781,36 +781,36 @@ end of the reversed expression.</td>
<h3>Scalar Vector Operations</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class T1, class E2, class F&gt;<br />
struct vector_binary_scalar1_traits {<br />
typedef vector_binary_scalar1&lt;scalar_const_reference&lt;T1&gt;,<br />
typename E2::const_closure_type, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (t * v) [i] = t * v [i]<br />
template&lt;class T1, class E2&gt;<br />
typename vector_binary_scalar1_traits&lt;T1, E2, scalar_multiplies&lt;T1, typename E2::value_type&gt; &gt;::result_type<br />
operator * (const T1 &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class E1, class T2, class F&gt;<br />
struct vector_binary_scalar2_traits {<br />
typedef vector_binary_scalar2&lt;typename E1::const_closure_type,<br />
scalar_const_reference&lt;T2&gt;, F&gt; expression_type;<br />
typedef expression_type result_type;<br />
};<br />
<br />
// (v * t) [i] = v [i] * t<br />
template&lt;class E1, class T2&gt;<br />
typename vector_binary_scalar2_traits&lt;E1, T2, scalar_multiplies&lt;typename E1::value_type, T2&gt; &gt;::result_type<br />
operator * (const vector_expression&lt;E1&gt; &amp;e1,<br />
const T2 &amp;e2);<br />
<br />
// (v / t) [i] = v [i] / t<br />
template&lt;class E1, class T2&gt;<br />
typename vector_binary_scalar2_traits&lt;E1, T2, scalar_divides&lt;typename E1::value_type, T2&gt; &gt;::result_type<br />
operator / (const vector_expression&lt;E1&gt; &amp;e1,<br />
<code>template&lt;class T1, class E2, class F&gt;
struct vector_binary_scalar1_traits {
typedef vector_binary_scalar1&lt;scalar_const_reference&lt;T1&gt;,
typename E2::const_closure_type, F&gt; expression_type;
typedef expression_type result_type;
};
// (t * v) [i] = t * v [i]
template&lt;class T1, class E2&gt;
typename vector_binary_scalar1_traits&lt;T1, E2, scalar_multiplies&lt;T1, typename E2::value_type&gt; &gt;::result_type
operator * (const T1 &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);
template&lt;class E1, class T2, class F&gt;
struct vector_binary_scalar2_traits {
typedef vector_binary_scalar2&lt;typename E1::const_closure_type,
scalar_const_reference&lt;T2&gt;, F&gt; expression_type;
typedef expression_type result_type;
};
// (v * t) [i] = v [i] * t
template&lt;class E1, class T2&gt;
typename vector_binary_scalar2_traits&lt;E1, T2, scalar_multiplies&lt;typename E1::value_type, T2&gt; &gt;::result_type
operator * (const vector_expression&lt;E1&gt; &amp;e1,
const T2 &amp;e2);
// (v / t) [i] = v [i] / t
template&lt;class E1, class T2&gt;
typename vector_binary_scalar2_traits&lt;E1, T2, scalar_divides&lt;typename E1::value_type, T2&gt; &gt;::result_type
operator / (const vector_expression&lt;E1&gt; &amp;e1,
const T2 &amp;e2);</code>
</pre>
<h4>Description</h4>
@@ -832,52 +832,52 @@ with the reciprocal of the scalar.</p>
<p>Linear depending from the size of the vector expression.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v (3);<br />
for (unsigned i = 0; i &lt; v.size (); ++ i)<br />
v (i) = i;<br />
<br />
std::cout &lt;&lt; 2.0 * v &lt;&lt; std::endl;<br />
std::cout &lt;&lt; v * 2.0 &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v (3);
for (unsigned i = 0; i &lt; v.size (); ++ i)
v (i) = i;
std::cout &lt;&lt; 2.0 * v &lt;&lt; std::endl;
std::cout &lt;&lt; v * 2.0 &lt;&lt; std::endl;
}
</pre>
<h2><a name="vector_reductions" id="vector_reductions"></a> Vector
Reductions</h2>
<h3>Unary Reductions</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class E, class F&gt;<br />
struct vector_scalar_unary_traits {<br />
typedef typename F::result_type result_type;<br />
};<br />
<br />
// sum v = sum (v [i])<br />
template&lt;class E&gt;<br />
typename vector_scalar_unary_traits&lt;E, vector_sum&lt;typename E::value_type&gt; &gt;::result_type<br />
sum (const vector_expression&lt;E&gt; &amp;e);<br />
<br />
// norm_1 v = sum (abs (v [i]))<br />
template&lt;class E&gt;<br />
typename vector_scalar_unary_traits&lt;E, vector_norm_1&lt;typename E::value_type&gt; &gt;::result_type<br />
norm_1 (const vector_expression&lt;E&gt; &amp;e);<br />
<br />
// norm_2 v = sqrt (sum (v [i] * v [i]))<br />
template&lt;class E&gt;<br />
typename vector_scalar_unary_traits&lt;E, vector_norm_2&lt;typename E::value_type&gt; &gt;::result_type<br />
norm_2 (const vector_expression&lt;E&gt; &amp;e);<br />
<br />
// norm_inf v = max (abs (v [i]))<br />
template&lt;class E&gt;<br />
typename vector_scalar_unary_traits&lt;E, vector_norm_inf&lt;typename E::value_type&gt; &gt;::result_type<br />
norm_inf (const vector_expression&lt;E&gt; &amp;e);<br />
<br />
// index_norm_inf v = min (i: abs (v [i]) == max (abs (v [i])))<br />
template&lt;class E&gt;<br />
typename vector_scalar_unary_traits&lt;E, vector_index_norm_inf&lt;typename E::value_type&gt; &gt;::result_type<br />
<code>template&lt;class E, class F&gt;
struct vector_scalar_unary_traits {
typedef typename F::result_type result_type;
};
// sum v = sum (v [i])
template&lt;class E&gt;
typename vector_scalar_unary_traits&lt;E, vector_sum&lt;typename E::value_type&gt; &gt;::result_type
sum (const vector_expression&lt;E&gt; &amp;e);
// norm_1 v = sum (abs (v [i]))
template&lt;class E&gt;
typename vector_scalar_unary_traits&lt;E, vector_norm_1&lt;typename E::value_type&gt; &gt;::result_type
norm_1 (const vector_expression&lt;E&gt; &amp;e);
// norm_2 v = sqrt (sum (v [i] * v [i]))
template&lt;class E&gt;
typename vector_scalar_unary_traits&lt;E, vector_norm_2&lt;typename E::value_type&gt; &gt;::result_type
norm_2 (const vector_expression&lt;E&gt; &amp;e);
// norm_inf v = max (abs (v [i]))
template&lt;class E&gt;
typename vector_scalar_unary_traits&lt;E, vector_norm_inf&lt;typename E::value_type&gt; &gt;::result_type
norm_inf (const vector_expression&lt;E&gt; &amp;e);
// index_norm_inf v = min (i: abs (v [i]) == max (abs (v [i])))
template&lt;class E&gt;
typename vector_scalar_unary_traits&lt;E, vector_index_norm_inf&lt;typename E::value_type&gt; &gt;::result_type
index_norm_inf (const vector_expression&lt;E&gt; &amp;e);</code>
</pre>
<h4>Description</h4>
@@ -902,44 +902,44 @@ expression's first element having maximal absolute value.</p>
<p>Linear depending from the size of the vector expression.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v (3);<br />
for (unsigned i = 0; i &lt; v.size (); ++ i)<br />
v (i) = i;<br />
<br />
std::cout &lt;&lt; sum (v) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; norm_1 (v) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; norm_2 (v) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; norm_inf (v) &lt;&lt; std::endl;<br />
std::cout &lt;&lt; index_norm_inf (v) &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v (3);
for (unsigned i = 0; i &lt; v.size (); ++ i)
v (i) = i;
std::cout &lt;&lt; sum (v) &lt;&lt; std::endl;
std::cout &lt;&lt; norm_1 (v) &lt;&lt; std::endl;
std::cout &lt;&lt; norm_2 (v) &lt;&lt; std::endl;
std::cout &lt;&lt; norm_inf (v) &lt;&lt; std::endl;
std::cout &lt;&lt; index_norm_inf (v) &lt;&lt; std::endl;
}
</pre>
<h3>Binary Reductions</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class E1, class E2, class F&gt;<br />
struct vector_scalar_binary_traits {<br />
typedef typename F::result_type result_type;<br />
};<br />
<br />
// inner_prod (v1, v2) = sum (v1 [i] * v2 [i])<br />
template&lt;class E1, class E2&gt;<br />
typename vector_scalar_binary_traits&lt;E1, E2, vector_inner_prod&lt;typename E1::value_type,<br />
typename E2::value_type,<br />
typename promote_traits&lt;typename E1::value_type,<br />
typename E2::value_type&gt;::promote_type&gt; &gt;::result_type<br />
inner_prod (const vector_expression&lt;E1&gt; &amp;e1,<br />
const vector_expression&lt;E2&gt; &amp;e2);<br />
<br />
template&lt;class E1, class E2&gt;<br />
typename vector_scalar_binary_traits&lt;E1, E2, vector_inner_prod&lt;typename E1::value_type,<br />
typename E2::value_type,<br />
typename type_traits&lt;typename promote_traits&lt;typename E1::value_type,<br />
typename E2::value_type&gt;::promote_type&gt;::precision_type&gt; &gt;::result_type<br />
prec_inner_prod (const vector_expression&lt;E1&gt; &amp;e1,<br />
<code>template&lt;class E1, class E2, class F&gt;
struct vector_scalar_binary_traits {
typedef typename F::result_type result_type;
};
// inner_prod (v1, v2) = sum (v1 [i] * v2 [i])
template&lt;class E1, class E2&gt;
typename vector_scalar_binary_traits&lt;E1, E2, vector_inner_prod&lt;typename E1::value_type,
typename E2::value_type,
typename promote_traits&lt;typename E1::value_type,
typename E2::value_type&gt;::promote_type&gt; &gt;::result_type
inner_prod (const vector_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);
template&lt;class E1, class E2&gt;
typename vector_scalar_binary_traits&lt;E1, E2, vector_inner_prod&lt;typename E1::value_type,
typename E2::value_type,
typename type_traits&lt;typename promote_traits&lt;typename E1::value_type,
typename E2::value_type&gt;::promote_type&gt;::precision_type&gt; &gt;::result_type
prec_inner_prod (const vector_expression&lt;E1&gt; &amp;e1,
const vector_expression&lt;E2&gt; &amp;e2);</code>
</pre>
<h4>Description</h4>
@@ -963,16 +963,16 @@ precision inner product of the vector expressions<code>.</code></p>
<p>Linear depending from the size of the vector expressions.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v1 (3), v2 (3);<br />
for (unsigned i = 0; i &lt; std::min (v1.size (), v2.size ()); ++ i)<br />
v1 (i) = v2 (i) = i;<br />
<br />
std::cout &lt;&lt; inner_prod (v1, v2) &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v1 (3), v2 (3);
for (unsigned i = 0; i &lt; std::min (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout &lt;&lt; inner_prod (v1, v2) &lt;&lt; std::endl;
}
</pre>
<hr />
<p>Copyright (&copy;) 2000-2002 Joerg Walter, Mathias Koch<br />

View File

@@ -18,17 +18,17 @@ Vector Proxies</h1>
addressing a sub-range of a vector's element.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v (3);<br />
vector_range&lt;vector&lt;double&gt; &gt; vr (v, range (0, 3));<br />
for (unsigned i = 0; i &lt; vr.size (); ++ i)<br />
vr (i) = i;<br />
std::cout &lt;&lt; vr &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v (3);
vector_range&lt;vector&lt;double&gt; &gt; vr (v, range (0, 3));
for (unsigned i = 0; i &lt; vr.size (); ++ i)
vr (i) = i;
std::cout &lt;&lt; vr &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header vector_proxy.hpp.</p>
@@ -210,11 +210,11 @@ the reversed <code>vector_range</code>.</td>
<h3>Projections</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class V&gt;<br />
vector_range&lt;V&gt; project (V &amp;data, const range &amp;r);<br />
template&lt;class V&gt;<br />
const vector_range&lt;const V&gt; project (const V &amp;data, const range &amp;r);<br />
template&lt;class V&gt;<br />
<code>template&lt;class V&gt;
vector_range&lt;V&gt; project (V &amp;data, const range &amp;r);
template&lt;class V&gt;
const vector_range&lt;const V&gt; project (const V &amp;data, const range &amp;r);
template&lt;class V&gt;
vector_range&lt;V&gt; project (const vector_range&lt;V&gt; &amp;data, const range &amp;r);</code>
</pre>
<h4>Description</h4>
@@ -231,15 +231,15 @@ of vector ranges.</p>
<p>Linear depending from the size of the range.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v (3);<br />
for (int i = 0; i &lt; 3; ++ i)<br />
project (v, range (0, 3)) (i) = i;<br />
std::cout &lt;&lt; project (v, range (0, 3)) &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v (3);
for (int i = 0; i &lt; 3; ++ i)
project (v, range (0, 3)) (i) = i;
std::cout &lt;&lt; project (v, range (0, 3)) &lt;&lt; std::endl;
}
</pre>
<h2><a name="vector_slice" id="vector_slice"></a> Vector Slice</h2>
@@ -248,17 +248,17 @@ int main () {<br />
addressing a slice of a vector.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v (3);<br />
vector_slice&lt;vector&lt;double&gt; &gt; vs (v, slice (0, 1, 3));<br />
for (unsigned i = 0; i &lt; vs.size (); ++ i)<br />
vs (i) = i;<br />
std::cout &lt;&lt; vs &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v (3);
vector_slice&lt;vector&lt;double&gt; &gt; vs (v, slice (0, 1, 3));
for (unsigned i = 0; i &lt; vs.size (); ++ i)
vs (i) = i;
std::cout &lt;&lt; vs &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header vector_proxy.hpp.</p>
@@ -436,13 +436,13 @@ the reversed <code>vector_slice</code>.</td>
<h3>Projections</h3>
<h4>Prototypes</h4>
<pre>
<code>template&lt;class V&gt;<br />
vector_slice&lt;V&gt; project (const vector_slice&lt;V&gt; &amp;data, const range &amp;r);<br />
template&lt;class V&gt;<br />
vector_slice&lt;V&gt; project (V &amp;data, const slice &amp;s);<br />
template&lt;class V&gt;<br />
const vector_slice&lt;const V&gt; project (const V &amp;data, const slice &amp;s);<br />
template&lt;class V&gt;<br />
<code>template&lt;class V&gt;
vector_slice&lt;V&gt; project (const vector_slice&lt;V&gt; &amp;data, const range &amp;r);
template&lt;class V&gt;
vector_slice&lt;V&gt; project (V &amp;data, const slice &amp;s);
template&lt;class V&gt;
const vector_slice&lt;const V&gt; project (const V &amp;data, const slice &amp;s);
template&lt;class V&gt;
vector_slice&lt;V&gt; project (const vector_slice&lt;V&gt; &amp;data, const slice &amp;s);</code>
</pre>
<h4>Description</h4>
@@ -459,16 +459,16 @@ of vector slices.</p>
<p>Linear depending from the size of the slice.</p>
<h4>Examples</h4>
<pre>
#include &lt;boost/numeric/ublas/vector.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
vector&lt;double&gt; v (3);<br />
for (int i = 0; i &lt; 3; ++ i)<br />
project (v, slice (0, 1, 3)) (i) = i;<br />
std::cout &lt;&lt; project (v, slice (0, 1, 3)) &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
vector&lt;double&gt; v (3);
for (int i = 0; i &lt; 3; ++ i)
project (v, slice (0, 1, 3)) (i) = i;
std::cout &lt;&lt; project (v, slice (0, 1, 3)) &lt;&lt; std::endl;
}
</pre>
<hr />
<p>Copyright (&copy;) 2000-2002 Joerg Walter, Mathias Koch<br />

View File

@@ -29,16 +29,16 @@ container holds <em>i</em><sub><em>1</em></sub> <em>&lt;
i</em><sub><em>2</em></sub>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/vector_sparse.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
sparse_vector&lt;double&gt; v (3, 3);<br />
for (unsigned i = 0; i &lt; v.size (); ++ i)<br />
v (i) = i;<br />
std::cout &lt;&lt; v &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector_sparse.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
sparse_vector&lt;double&gt; v (3, 3);
for (unsigned i = 0; i &lt; v.size (); ++ i)
v (i) = i;
std::cout &lt;&lt; v &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header vector_sparse.hpp.</p>
@@ -273,15 +273,15 @@ containers holds <em>i</em><sub><em>1</em></sub> <em>&lt;
i</em><sub><em>2</em></sub>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/vector_sparse.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
compressed_vector&lt;double&gt; v (3, 3);<br />
for (unsigned i = 0; i &lt; v.size (); ++ i)<br />
v (i) = i;<br />
std::cout &lt;&lt; v &lt;&lt; std::endl;<br />
#include &lt;boost/numeric/ublas/vector_sparse.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
compressed_vector&lt;double&gt; v (3, 3);
for (unsigned i = 0; i &lt; v.size (); ++ i)
v (i) = i;
std::cout &lt;&lt; v &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
@@ -533,16 +533,16 @@ containers holds <em>i</em><sub><em>1</em></sub> <em>&lt;
i</em><sub><em>2</em></sub>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/vector_sparse.hpp&gt;<br />
#include &lt;boost/numeric/ublas/io.hpp&gt;<br />
<br />
int main () {<br />
using namespace boost::numeric::ublas;<br />
coordinate_vector&lt;double&gt; v (3, 3);<br />
for (unsigned i = 0; i &lt; v.size (); ++ i)<br />
v (i) = i;<br />
std::cout &lt;&lt; v &lt;&lt; std::endl;<br />
}<br />
#include &lt;boost/numeric/ublas/vector_sparse.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;
int main () {
using namespace boost::numeric::ublas;
coordinate_vector&lt;double&gt; v (3, 3);
for (unsigned i = 0; i &lt; v.size (); ++ i)
v (i) = i;
std::cout &lt;&lt; v &lt;&lt; std::endl;
}
</pre>
<h4>Definition</h4>
<p>Defined in the header vector_sparse.hpp.</p>