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:
@@ -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 <boost/numeric/ublas/banded.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
banded_matrix<double> m (3, 3, 1, 1);<br />
|
||||
for (signed i = 0; i < signed (m.size1 ()); ++ i)<br />
|
||||
for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (m.size2 ())); ++ j)<br />
|
||||
m (i, j) = 3 * i + j;<br />
|
||||
std::cout << m << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/banded.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
banded_matrix<double> m (3, 3, 1, 1);
|
||||
for (signed i = 0; i < signed (m.size1 ()); ++ i)
|
||||
for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (m.size2 ())); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
std::cout << m << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/banded.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
banded_adaptor<matrix<double> > ba (m, 1, 1);<br />
|
||||
for (signed i = 0; i < signed (ba.size1 ()); ++ i)<br />
|
||||
for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (ba.size2 ())); ++ j)<br />
|
||||
ba (i, j) = 3 * i + j;<br />
|
||||
std::cout << ba << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/banded.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
banded_adaptor<matrix<double> > ba (m, 1, 1);
|
||||
for (signed i = 0; i < signed (ba.size1 ()); ++ i)
|
||||
for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (ba.size2 ())); ++ j)
|
||||
ba (i, j) = 3 * i + j;
|
||||
std::cout << ba << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header banded.hpp.</p>
|
||||
|
||||
446
doc/blas.htm
Normal file
446
doc/blas.htm
Normal 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<class M1, class T, class M2, class M3> M1 & </td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga0">boost::numeric::ublas::blas_3::tmm</a> (M1 &m1, const T &t, const M2 &m2, const M3 &m3)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </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<class M1, class T, class M2, class C> M1 & </td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga1">boost::numeric::ublas::blas_3::tsm</a> (M1 &m1, const T &t, const M2 &m2, C)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </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<class M1, class T1, class T2, class M2, class M3> M1 & </td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga2">boost::numeric::ublas::blas_3::gmm</a> (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </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<class M1, class T1, class T2, class M2> M1 & </td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga3">boost::numeric::ublas::blas_3::srk</a> (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </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<class M1, class T1, class T2, class M2> M1 & </td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga4">boost::numeric::ublas::blas_3::hrk</a> (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </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<class M1, class T1, class T2, class M2, class M3> M1 & </td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga5">boost::numeric::ublas::blas_3::sr2k</a> (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </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<class M1, class T1, class T2, class M2, class M3> M1 & </td><td class="memItemRight" valign=bottom><a class="el" href="../../d3/d2/group__blas3.html#ga6">boost::numeric::ublas::blas_3::hr2k</a> (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </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<class M, class E1, class E2> BOOST_UBLAS_INLINE M & </td><td class="memItemRight" valign=bottom><a class="el" href="operations.htm#ga7">boost::numeric::ublas::axpy_prod</a> (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </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<class M, class E1, class E2> BOOST_UBLAS_INLINE M & </td><td class="memItemRight" valign=bottom><a class="el" href="operations.htm#ga8">boost::numeric::ublas::opb_prod</a> (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true)</td></tr>
|
||||
|
||||
<tr><td class="mdescLeft"> </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& tmm </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">M1 & </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 & </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 & </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 & </td>
|
||||
<td class="mdname" nowrap> <em>m3</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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& tsm </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">M1 & </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 & </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 & </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 </td>
|
||||
<td class="mdname" nowrap></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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& gmm </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">M1 & </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 & </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 & </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 & </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 & </td>
|
||||
<td class="mdname" nowrap> <em>m3</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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& srk </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">M1 & </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 & </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 & </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 & </td>
|
||||
<td class="mdname" nowrap> <em>m2</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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& hrk </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">M1 & </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 & </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 & </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 & </td>
|
||||
<td class="mdname" nowrap> <em>m2</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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& sr2k </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">M1 & </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 & </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 & </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 & </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 & </td>
|
||||
<td class="mdname" nowrap> <em>m3</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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& hr2k </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">M1 & </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 & </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 & </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 & </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 & </td>
|
||||
<td class="mdname" nowrap> <em>m3</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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 (©) 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
218
doc/doxygen.css
Normal 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;
|
||||
}
|
||||
@@ -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 <= i <
|
||||
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<matrix_type, 64> (A, u); // w = A * u
|
||||
w = block_prod<matrix_type, 64> (u, A); // w = trans(A) * u
|
||||
C = block_prod<matrix_type, 64> (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 <= i <
|
||||
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<matrix_type> (A, r1, r2);
|
||||
<pre><code>matrix_vector_range<matrix_type> (A, r1, r2);
|
||||
matrix_vector_slice<matrix_type> (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<matrix_type> (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<const MATRIX&> 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<const VEC&>(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 (©) 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>
|
||||
|
||||
@@ -24,26 +24,26 @@ i</em></sub><sup><em>-</em></sup>. The storage of hermitian
|
||||
matrices is packed.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/hermitian.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
hermitian_matrix<std::complex<double>, lower> ml (3, 3);<br />
|
||||
for (unsigned i = 0; i < ml.size1 (); ++ i) {<br />
|
||||
for (unsigned j = 0; j < i; ++ j)<br />
|
||||
ml (i, j) = std::complex<double> (3 * i + j, 3 * i + j);<br />
|
||||
ml (i, i) = std::complex<double> (4 * i, 0);<br />
|
||||
}<br />
|
||||
std::cout << ml << std::endl;<br />
|
||||
hermitian_matrix<std::complex<double>, upper> mu (3, 3);<br />
|
||||
for (unsigned i = 0; i < mu.size1 (); ++ i) {<br />
|
||||
mu (i, i) = std::complex<double> (4 * i, 0);<br />
|
||||
for (unsigned j = i + 1; j < mu.size2 (); ++ j)<br />
|
||||
mu (i, j) = std::complex<double> (3 * i + j, 3 * i + j);<br />
|
||||
}<br />
|
||||
std::cout << mu << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/hermitian.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
hermitian_matrix<std::complex<double>, lower> ml (3, 3);
|
||||
for (unsigned i = 0; i < ml.size1 (); ++ i) {
|
||||
for (unsigned j = 0; j < i; ++ j)
|
||||
ml (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
|
||||
ml (i, i) = std::complex<double> (4 * i, 0);
|
||||
}
|
||||
std::cout << ml << std::endl;
|
||||
hermitian_matrix<std::complex<double>, upper> mu (3, 3);
|
||||
for (unsigned i = 0; i < mu.size1 (); ++ i) {
|
||||
mu (i, i) = std::complex<double> (4 * i, 0);
|
||||
for (unsigned j = i + 1; j < mu.size2 (); ++ j)
|
||||
mu (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
|
||||
}
|
||||
std::cout << mu << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/hermitian.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<std::complex<double> > m (3, 3);<br />
|
||||
hermitian_adaptor<matrix<std::complex<double> >, lower> hal (m);<br />
|
||||
for (unsigned i = 0; i < hal.size1 (); ++ i) {<br />
|
||||
for (unsigned j = 0; j < i; ++ j)<br />
|
||||
hal (i, j) = std::complex<double> (3 * i + j, 3 * i + j);<br />
|
||||
hal (i, i) = std::complex<double> (4 * i, 0);<br />
|
||||
}<br />
|
||||
std::cout << hal << std::endl;<br />
|
||||
hermitian_adaptor<matrix<std::complex<double> >, upper> hau (m);<br />
|
||||
for (unsigned i = 0; i < hau.size1 (); ++ i) {<br />
|
||||
hau (i, i) = std::complex<double> (4 * i, 0);<br />
|
||||
for (unsigned j = i + 1; j < hau.size2 (); ++ j)<br />
|
||||
hau (i, j) = std::complex<double> (3 * i + j, 3 * i + j);<br />
|
||||
}<br />
|
||||
std::cout << hau << std::endl;<br />
|
||||
#include <boost/numeric/ublas/hermitian.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<std::complex<double> > m (3, 3);
|
||||
hermitian_adaptor<matrix<std::complex<double> >, lower> hal (m);
|
||||
for (unsigned i = 0; i < hal.size1 (); ++ i) {
|
||||
for (unsigned j = 0; j < i; ++ j)
|
||||
hal (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
|
||||
hal (i, i) = std::complex<double> (4 * i, 0);
|
||||
}
|
||||
std::cout << hal << std::endl;
|
||||
hermitian_adaptor<matrix<std::complex<double> >, upper> hau (m);
|
||||
for (unsigned i = 0; i < hau.size1 (); ++ i) {
|
||||
hau (i, i) = std::complex<double> (4 * i, 0);
|
||||
for (unsigned j = i + 1; j < hau.size2 (); ++ j)
|
||||
hau (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
|
||||
}
|
||||
std::cout << hau << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
|
||||
@@ -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 & 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>
|
||||
|
||||
@@ -24,17 +24,17 @@ m)-</em>th element of the container for column major
|
||||
orientation.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
m (i, j) = 3 * i + j;<br />
|
||||
std::cout << m << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
std::cout << m << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
identity_matrix<double> m (3);<br />
|
||||
std::cout << m << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
identity_matrix<double> m (3);
|
||||
std::cout << m << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
zero_matrix<double> m (3, 3);<br />
|
||||
std::cout << m << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
zero_matrix<double> m (3, 3);
|
||||
std::cout << m << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header matrix.hpp.</p>
|
||||
@@ -592,14 +592,14 @@ scalar matrix and <em>0 <= i < m</em>, <em>0 <= j <
|
||||
n</em> holds <em>z</em><sub><em>i, j</em></sub> <em>= s</em>.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
scalar_matrix<double> m (3, 3);<br />
|
||||
std::cout << m << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
scalar_matrix<double> m (3, 3);
|
||||
std::cout << m << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header matrix.hpp.</p>
|
||||
|
||||
@@ -420,46 +420,46 @@ end of the reversed expression.</td>
|
||||
<h3>Unary Operations</h3>
|
||||
<h4>Prototypes</h4>
|
||||
<pre>
|
||||
<code>template<class E, class F><br />
|
||||
struct matrix_unary1_traits {<br />
|
||||
typedef matrix_unary1<typename E::const_closure_type, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (- m) [i] [j] = - m [i] [j]<br />
|
||||
template<class E><br />
|
||||
typename matrix_unary1_traits<E, scalar_negate<typename E::value_type> >::result_type<br />
|
||||
operator - (const matrix_expression<E> &e);<br />
|
||||
<br />
|
||||
// (conj m) [i] [j] = conj (m [i] [j])<br />
|
||||
template<class E><br />
|
||||
typename matrix_unary1_traits<E, scalar_conj<typename E::value_type> >::result_type<br />
|
||||
conj (const matrix_expression<E> &e);<br />
|
||||
<br />
|
||||
// (real m) [i] [j] = real (m [i] [j])<br />
|
||||
template<class E><br />
|
||||
typename matrix_unary1_traits<E, scalar_real<typename E::value_type> >::result_type<br />
|
||||
real (const matrix_expression<E> &e);<br />
|
||||
<br />
|
||||
// (imag m) [i] [j] = imag (m [i] [j])<br />
|
||||
template<class E><br />
|
||||
typename matrix_unary1_traits<E, scalar_imag<typename E::value_type> >::result_type<br />
|
||||
imag (const matrix_expression<E> &e);<br />
|
||||
<br />
|
||||
template<class E, class F><br />
|
||||
struct matrix_unary2_traits {<br />
|
||||
typedef matrix_unary2<typename E::const_closure_type, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (trans m) [i] [j] = m [j] [i]<br />
|
||||
template<class E><br />
|
||||
typename matrix_unary2_traits<E, scalar_identity<typename E::value_type> >::result_type<br />
|
||||
trans (const matrix_expression<E> &e);<br />
|
||||
<br />
|
||||
// (herm m) [i] [j] = conj (m [j] [i])<br />
|
||||
template<class E><br />
|
||||
typename matrix_unary2_traits<E, scalar_conj<typename E::value_type> >::result_type<br />
|
||||
<code>template<class E, class F>
|
||||
struct matrix_unary1_traits {
|
||||
typedef matrix_unary1<typename E::const_closure_type, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (- m) [i] [j] = - m [i] [j]
|
||||
template<class E>
|
||||
typename matrix_unary1_traits<E, scalar_negate<typename E::value_type> >::result_type
|
||||
operator - (const matrix_expression<E> &e);
|
||||
|
||||
// (conj m) [i] [j] = conj (m [i] [j])
|
||||
template<class E>
|
||||
typename matrix_unary1_traits<E, scalar_conj<typename E::value_type> >::result_type
|
||||
conj (const matrix_expression<E> &e);
|
||||
|
||||
// (real m) [i] [j] = real (m [i] [j])
|
||||
template<class E>
|
||||
typename matrix_unary1_traits<E, scalar_real<typename E::value_type> >::result_type
|
||||
real (const matrix_expression<E> &e);
|
||||
|
||||
// (imag m) [i] [j] = imag (m [i] [j])
|
||||
template<class E>
|
||||
typename matrix_unary1_traits<E, scalar_imag<typename E::value_type> >::result_type
|
||||
imag (const matrix_expression<E> &e);
|
||||
|
||||
template<class E, class F>
|
||||
struct matrix_unary2_traits {
|
||||
typedef matrix_unary2<typename E::const_closure_type, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (trans m) [i] [j] = m [j] [i]
|
||||
template<class E>
|
||||
typename matrix_unary2_traits<E, scalar_identity<typename E::value_type> >::result_type
|
||||
trans (const matrix_expression<E> &e);
|
||||
|
||||
// (herm m) [i] [j] = conj (m [j] [i])
|
||||
template<class E>
|
||||
typename matrix_unary2_traits<E, scalar_conj<typename E::value_type> >::result_type
|
||||
herm (const matrix_expression<E> &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<std::complex<double> > m (3, 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
m (i, j) = std::complex<double> (3 * i + j, 3 * i + j);<br />
|
||||
<br />
|
||||
std::cout << - m << std::endl;<br />
|
||||
std::cout << conj (m) << std::endl;<br />
|
||||
std::cout << real (m) << std::endl;<br />
|
||||
std::cout << imag (m) << std::endl;<br />
|
||||
std::cout << trans (m) << std::endl;<br />
|
||||
std::cout << herm (m) << std::endl;<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<std::complex<double> > m (3, 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
|
||||
|
||||
std::cout << - m << std::endl;
|
||||
std::cout << conj (m) << std::endl;
|
||||
std::cout << real (m) << std::endl;
|
||||
std::cout << imag (m) << std::endl;
|
||||
std::cout << trans (m) << std::endl;
|
||||
std::cout << herm (m) << std::endl;
|
||||
}
|
||||
</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<class E1, class E2, class F><br />
|
||||
struct matrix_binary_traits {<br />
|
||||
typedef matrix_binary<typename E1::const_closure_type,<br />
|
||||
typename E2::const_closure_type, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (m1 + m2) [i] [j] = m1 [i] [j] + m2 [i] [j]<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_binary_traits<E1, E2, scalar_plus<typename E1::value_type,<br />
|
||||
typename E2::value_type> >::result_type<br />
|
||||
operator + (const matrix_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2);<br />
|
||||
<br />
|
||||
// (m1 - m2) [i] [j] = m1 [i] [j] - m2 [i] [j]<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_binary_traits<E1, E2, scalar_minus<typename E1::value_type,<br />
|
||||
typename E2::value_type> >::result_type<br />
|
||||
operator - (const matrix_expression<E1> &e1,<br />
|
||||
<code>template<class E1, class E2, class F>
|
||||
struct matrix_binary_traits {
|
||||
typedef matrix_binary<typename E1::const_closure_type,
|
||||
typename E2::const_closure_type, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (m1 + m2) [i] [j] = m1 [i] [j] + m2 [i] [j]
|
||||
template<class E1, class E2>
|
||||
typename matrix_binary_traits<E1, E2, scalar_plus<typename E1::value_type,
|
||||
typename E2::value_type> >::result_type
|
||||
operator + (const matrix_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2);
|
||||
|
||||
// (m1 - m2) [i] [j] = m1 [i] [j] - m2 [i] [j]
|
||||
template<class E1, class E2>
|
||||
typename matrix_binary_traits<E1, E2, scalar_minus<typename E1::value_type,
|
||||
typename E2::value_type> >::result_type
|
||||
operator - (const matrix_expression<E1> &e1,
|
||||
const matrix_expression<E2> &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m1 (3, 3), m2 (3, 3);<br />
|
||||
for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)<br />
|
||||
for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j)<br />
|
||||
m1 (i, j) = m2 (i, j) = 3 * i + j;<br />
|
||||
<br />
|
||||
std::cout << m1 + m2 << std::endl;<br />
|
||||
std::cout << m1 - m2 << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m1 (3, 3), m2 (3, 3);
|
||||
for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)
|
||||
for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j)
|
||||
m1 (i, j) = m2 (i, j) = 3 * i + j;
|
||||
|
||||
std::cout << m1 + m2 << std::endl;
|
||||
std::cout << m1 - m2 << std::endl;
|
||||
}
|
||||
</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<class T1, class E2, class F><br />
|
||||
struct matrix_binary_scalar1_traits {<br />
|
||||
typedef matrix_binary_scalar1<scalar_const_reference<T1>,<br />
|
||||
typename E2::const_closure_type, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (t * m) [i] [j] = t * m [i] [j]<br />
|
||||
template<class T1, class E2><br />
|
||||
typename matrix_binary_scalar1_traits<T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type<br />
|
||||
operator * (const T1 &e1,<br />
|
||||
const matrix_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class E1, class T2, class F><br />
|
||||
struct matrix_binary_scalar2_traits {<br />
|
||||
typedef matrix_binary_scalar2<typename E1::const_closure_type,<br />
|
||||
scalar_const_reference<T2>, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (m * t) [i] [j] = m [i] [j] * t<br />
|
||||
template<class E1, class T2><br />
|
||||
typename matrix_binary_scalar2_traits<E1, T2, scalar_multiplies<typename E1::value_type, T2> >::result_type<br />
|
||||
operator * (const matrix_expression<E1> &e1,<br />
|
||||
const T2 &e2);<br />
|
||||
<br />
|
||||
// (m / t) [i] [j] = m [i] [j] / t<br />
|
||||
template<class E1, class T2><br />
|
||||
typename matrix_binary_scalar2_traits<E1, T2, scalar_divides<typename E1::value_type, T2> >::result_type<br />
|
||||
operator / (const matrix_expression<E1> &e1,<br />
|
||||
<code>template<class T1, class E2, class F>
|
||||
struct matrix_binary_scalar1_traits {
|
||||
typedef matrix_binary_scalar1<scalar_const_reference<T1>,
|
||||
typename E2::const_closure_type, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (t * m) [i] [j] = t * m [i] [j]
|
||||
template<class T1, class E2>
|
||||
typename matrix_binary_scalar1_traits<T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type
|
||||
operator * (const T1 &e1,
|
||||
const matrix_expression<E2> &e2);
|
||||
|
||||
template<class E1, class T2, class F>
|
||||
struct matrix_binary_scalar2_traits {
|
||||
typedef matrix_binary_scalar2<typename E1::const_closure_type,
|
||||
scalar_const_reference<T2>, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (m * t) [i] [j] = m [i] [j] * t
|
||||
template<class E1, class T2>
|
||||
typename matrix_binary_scalar2_traits<E1, T2, scalar_multiplies<typename E1::value_type, T2> >::result_type
|
||||
operator * (const matrix_expression<E1> &e1,
|
||||
const T2 &e2);
|
||||
|
||||
// (m / t) [i] [j] = m [i] [j] / t
|
||||
template<class E1, class T2>
|
||||
typename matrix_binary_scalar2_traits<E1, T2, scalar_divides<typename E1::value_type, T2> >::result_type
|
||||
operator / (const matrix_expression<E1> &e1,
|
||||
const T2 &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
m (i, j) = 3 * i + j;<br />
|
||||
<br />
|
||||
std::cout << 2.0 * m << std::endl;<br />
|
||||
std::cout << m * 2.0 << std::endl;<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
|
||||
std::cout << 2.0 * m << std::endl;
|
||||
std::cout << m * 2.0 << std::endl;
|
||||
}
|
||||
</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<class T1, class E1, class T2, class E2><br />
|
||||
struct matrix_vector_binary1_traits {<br />
|
||||
typedef row_major_tag dispatch_category;<br />
|
||||
typedef typename promote_traits<T1, T2>::promote_type promote_type;<br />
|
||||
typedef matrix_vector_binary1<typename E1::const_closure_type,<br />
|
||||
typename E2::const_closure_type,<br />
|
||||
matrix_vector_prod1<T1, T2, promote_type> > expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_vector_binary1_traits<typename E1::value_type, E1,<br />
|
||||
typename E2::value_type, E2>::result_type<br />
|
||||
prod (const matrix_expression<E1> &e1,<br />
|
||||
const vector_expression<E2> &e2,<br />
|
||||
row_major_tag);<br />
|
||||
<br />
|
||||
// Dispatcher<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_vector_binary1_traits<typename E1::value_type, E1,<br />
|
||||
typename E2::value_type, E2>::result_type<br />
|
||||
prod (const matrix_expression<E1> &e1,<br />
|
||||
const vector_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_vector_binary1_traits<typename type_traits<typename E1::value_type>::precision_type, E1,<br />
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type<br />
|
||||
prec_prod (const matrix_expression<E1> &e1,<br />
|
||||
const vector_expression<E2> &e2,<br />
|
||||
row_major_tag);<br />
|
||||
<br />
|
||||
// Dispatcher<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_vector_binary1_traits<typename type_traits<typename E1::value_type>::precision_type, E1,<br />
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type<br />
|
||||
prec_prod (const matrix_expression<E1> &e1,<br />
|
||||
const vector_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class V, class E1, class E2><br />
|
||||
V<br />
|
||||
prod (const matrix_expression<E1> &e1,<br />
|
||||
const vector_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class V, class E1, class E2><br />
|
||||
V<br />
|
||||
prec_prod (const matrix_expression<E1> &e1,<br />
|
||||
const vector_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class T1, class E1, class T2, class E2><br />
|
||||
struct matrix_vector_binary2_traits {<br />
|
||||
typedef column_major_tag dispatch_category;<br />
|
||||
typedef typename promote_traits<T1, T2>::promote_type promote_type;<br />
|
||||
typedef matrix_vector_binary2<typename E1::const_closure_type,<br />
|
||||
typename E2::const_closure_type,<br />
|
||||
matrix_vector_prod2<T1, T2, promote_type> > expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_vector_binary2_traits<typename E1::value_type, E1,<br />
|
||||
typename E2::value_type, E2>::result_type<br />
|
||||
prod (const vector_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
column_major_tag);<br />
|
||||
<br />
|
||||
// Dispatcher<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_vector_binary2_traits<typename E1::value_type, E1,<br />
|
||||
typename E2::value_type, E2>::result_type<br />
|
||||
prod (const vector_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_vector_binary2_traits<typename type_traits<typename E1::value_type>::precision_type, E1,<br />
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type<br />
|
||||
prec_prod (const vector_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
column_major_tag);<br />
|
||||
<br />
|
||||
// Dispatcher<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_vector_binary2_traits<typename type_traits<typename E1::value_type>::precision_type, E1,<br />
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type<br />
|
||||
prec_prod (const vector_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class V, class E1, class E2><br />
|
||||
V<br />
|
||||
prod (const vector_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class V, class E1, class E2><br />
|
||||
V<br />
|
||||
prec_prod (const vector_expression<E1> &e1,<br />
|
||||
<code>template<class T1, class E1, class T2, class E2>
|
||||
struct matrix_vector_binary1_traits {
|
||||
typedef row_major_tag dispatch_category;
|
||||
typedef typename promote_traits<T1, T2>::promote_type promote_type;
|
||||
typedef matrix_vector_binary1<typename E1::const_closure_type,
|
||||
typename E2::const_closure_type,
|
||||
matrix_vector_prod1<T1, T2, promote_type> > expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
template<class E1, class E2>
|
||||
typename matrix_vector_binary1_traits<typename E1::value_type, E1,
|
||||
typename E2::value_type, E2>::result_type
|
||||
prod (const matrix_expression<E1> &e1,
|
||||
const vector_expression<E2> &e2,
|
||||
row_major_tag);
|
||||
|
||||
// Dispatcher
|
||||
template<class E1, class E2>
|
||||
typename matrix_vector_binary1_traits<typename E1::value_type, E1,
|
||||
typename E2::value_type, E2>::result_type
|
||||
prod (const matrix_expression<E1> &e1,
|
||||
const vector_expression<E2> &e2);
|
||||
|
||||
template<class E1, class E2>
|
||||
typename matrix_vector_binary1_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
|
||||
prec_prod (const matrix_expression<E1> &e1,
|
||||
const vector_expression<E2> &e2,
|
||||
row_major_tag);
|
||||
|
||||
// Dispatcher
|
||||
template<class E1, class E2>
|
||||
typename matrix_vector_binary1_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
|
||||
prec_prod (const matrix_expression<E1> &e1,
|
||||
const vector_expression<E2> &e2);
|
||||
|
||||
template<class V, class E1, class E2>
|
||||
V
|
||||
prod (const matrix_expression<E1> &e1,
|
||||
const vector_expression<E2> &e2);
|
||||
|
||||
template<class V, class E1, class E2>
|
||||
V
|
||||
prec_prod (const matrix_expression<E1> &e1,
|
||||
const vector_expression<E2> &e2);
|
||||
|
||||
template<class T1, class E1, class T2, class E2>
|
||||
struct matrix_vector_binary2_traits {
|
||||
typedef column_major_tag dispatch_category;
|
||||
typedef typename promote_traits<T1, T2>::promote_type promote_type;
|
||||
typedef matrix_vector_binary2<typename E1::const_closure_type,
|
||||
typename E2::const_closure_type,
|
||||
matrix_vector_prod2<T1, T2, promote_type> > expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
template<class E1, class E2>
|
||||
typename matrix_vector_binary2_traits<typename E1::value_type, E1,
|
||||
typename E2::value_type, E2>::result_type
|
||||
prod (const vector_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2,
|
||||
column_major_tag);
|
||||
|
||||
// Dispatcher
|
||||
template<class E1, class E2>
|
||||
typename matrix_vector_binary2_traits<typename E1::value_type, E1,
|
||||
typename E2::value_type, E2>::result_type
|
||||
prod (const vector_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2);
|
||||
|
||||
template<class E1, class E2>
|
||||
typename matrix_vector_binary2_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
|
||||
prec_prod (const vector_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2,
|
||||
column_major_tag);
|
||||
|
||||
// Dispatcher
|
||||
template<class E1, class E2>
|
||||
typename matrix_vector_binary2_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
|
||||
prec_prod (const vector_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2);
|
||||
|
||||
template<class V, class E1, class E2>
|
||||
V
|
||||
prod (const vector_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2);
|
||||
|
||||
template<class V, class E1, class E2>
|
||||
V
|
||||
prec_prod (const vector_expression<E1> &e1,
|
||||
const matrix_expression<E2> &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
vector<double> v (3);<br />
|
||||
for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) {<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
m (i, j) = 3 * i + j;<br />
|
||||
v (i) = i;<br />
|
||||
}<br />
|
||||
<br />
|
||||
std::cout << prod (m, v) << std::endl;<br />
|
||||
std::cout << prod (v, m) << std::endl;<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
vector<double> v (3);
|
||||
for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) {
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
v (i) = i;
|
||||
}
|
||||
|
||||
std::cout << prod (m, v) << std::endl;
|
||||
std::cout << prod (v, m) << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h3>Triangular Solver</h3>
|
||||
<h4>Prototypes</h4>
|
||||
<pre>
|
||||
<code>template<class E1, class E2><br />
|
||||
struct matrix_vector_solve_traits {<br />
|
||||
typedef typename promote_traits<typename E1::value_type, typename E2::value_type>::promote_type promote_type;<br />
|
||||
typedef vector<promote_type> result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (const matrix_expression<E1> &e1,<br />
|
||||
E2 &e2,<br />
|
||||
lower_tag,<br />
|
||||
vector_tag);<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (const matrix_expression<E1> &e1,<br />
|
||||
E2 &e2,<br />
|
||||
upper_tag,<br />
|
||||
vector_tag);<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (const matrix_expression<E1> &e1,<br />
|
||||
E2 &e2,<br />
|
||||
unit_lower_tag,<br />
|
||||
vector_tag);<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (const matrix_expression<E1> &e1,<br />
|
||||
E2 &e2,<br />
|
||||
unit_upper_tag,<br />
|
||||
vector_tag);<br />
|
||||
<br />
|
||||
template<class E1, class E2, class C><br />
|
||||
typename matrix_vector_solve_traits<E1, E2>::result_type<br />
|
||||
solve (const matrix_expression<E1> &e1,<br />
|
||||
const vector_expression<E2> &e2,<br />
|
||||
C);<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (E1 &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
vector_tag,<br />
|
||||
lower_tag);<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (E1 &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
vector_tag,<br />
|
||||
upper_tag);<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (E1 &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
vector_tag,<br />
|
||||
unit_lower_tag);<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (E1 &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
vector_tag,<br />
|
||||
unit_upper_tag);<br />
|
||||
<br />
|
||||
template<class E1, class E2, class C><br />
|
||||
typename matrix_vector_solve_traits<E1, E2>::result_type<br />
|
||||
solve (const vector_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
<code>template<class E1, class E2>
|
||||
struct matrix_vector_solve_traits {
|
||||
typedef typename promote_traits<typename E1::value_type, typename E2::value_type>::promote_type promote_type;
|
||||
typedef vector<promote_type> result_type;
|
||||
};
|
||||
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (const matrix_expression<E1> &e1,
|
||||
E2 &e2,
|
||||
lower_tag,
|
||||
vector_tag);
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (const matrix_expression<E1> &e1,
|
||||
E2 &e2,
|
||||
upper_tag,
|
||||
vector_tag);
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (const matrix_expression<E1> &e1,
|
||||
E2 &e2,
|
||||
unit_lower_tag,
|
||||
vector_tag);
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (const matrix_expression<E1> &e1,
|
||||
E2 &e2,
|
||||
unit_upper_tag,
|
||||
vector_tag);
|
||||
|
||||
template<class E1, class E2, class C>
|
||||
typename matrix_vector_solve_traits<E1, E2>::result_type
|
||||
solve (const matrix_expression<E1> &e1,
|
||||
const vector_expression<E2> &e2,
|
||||
C);
|
||||
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (E1 &e1,
|
||||
const matrix_expression<E2> &e2,
|
||||
vector_tag,
|
||||
lower_tag);
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (E1 &e1,
|
||||
const matrix_expression<E2> &e2,
|
||||
vector_tag,
|
||||
upper_tag);
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (E1 &e1,
|
||||
const matrix_expression<E2> &e2,
|
||||
vector_tag,
|
||||
unit_lower_tag);
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (E1 &e1,
|
||||
const matrix_expression<E2> &e2,
|
||||
vector_tag,
|
||||
unit_upper_tag);
|
||||
|
||||
template<class E1, class E2, class C>
|
||||
typename matrix_vector_solve_traits<E1, E2>::result_type
|
||||
solve (const vector_expression<E1> &e1,
|
||||
const matrix_expression<E2> &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 <boost/numeric/ublas/triangular.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
vector<double> v (3);<br />
|
||||
for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) {<br />
|
||||
for (unsigned j = 0; j <= i; ++ j)<br />
|
||||
m (i, j) = 3 * i + j + 1;<br />
|
||||
v (i) = i;<br />
|
||||
}<br />
|
||||
<br />
|
||||
std::cout << solve (m, v, lower_tag ()) << std::endl;<br />
|
||||
std::cout << solve (v, m, lower_tag ()) << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/triangular.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
vector<double> v (3);
|
||||
for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) {
|
||||
for (unsigned j = 0; j <= i; ++ j)
|
||||
m (i, j) = 3 * i + j + 1;
|
||||
v (i) = i;
|
||||
}
|
||||
|
||||
std::cout << solve (m, v, lower_tag ()) << std::endl;
|
||||
std::cout << solve (v, m, lower_tag ()) << std::endl;
|
||||
}
|
||||
</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<class T1, class E1, class T2, class E2><br />
|
||||
struct matrix_matrix_binary_traits {<br />
|
||||
typedef unknown_orientation_tag dispatch_category;<br />
|
||||
typedef typename promote_traits<T1, T2>::promote_type promote_type;<br />
|
||||
typedef matrix_matrix_binary<typename E1::const_closure_type,<br />
|
||||
typename E2::const_closure_type,<br />
|
||||
matrix_matrix_prod<T1, T2, promote_type> > expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_matrix_binary_traits<typename E1::value_type, E1,<br />
|
||||
typename E2::value_type, E2>::result_type<br />
|
||||
prod (const matrix_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
unknown_orientation_tag);<br />
|
||||
<br />
|
||||
// Dispatcher<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_matrix_binary_traits<typename E1::value_type, E1,<br />
|
||||
typename E2::value_type, E2>::result_type<br />
|
||||
prod (const matrix_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_matrix_binary_traits<typename type_traits<typename E1::value_type>::precision_type, E1,<br />
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type<br />
|
||||
prec_prod (const matrix_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
unknown_orientation_tag);<br />
|
||||
<br />
|
||||
// Dispatcher<br />
|
||||
template<class E1, class E2><br />
|
||||
typename matrix_matrix_binary_traits<typename type_traits<typename E1::value_type>::precision_type, E1,<br />
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type<br />
|
||||
prec_prod (const matrix_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class M, class E1, class E2><br />
|
||||
M<br />
|
||||
prod (const matrix_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class M, class E1, class E2><br />
|
||||
M<br />
|
||||
prec_prod (const matrix_expression<E1> &e1,<br />
|
||||
<code>template<class T1, class E1, class T2, class E2>
|
||||
struct matrix_matrix_binary_traits {
|
||||
typedef unknown_orientation_tag dispatch_category;
|
||||
typedef typename promote_traits<T1, T2>::promote_type promote_type;
|
||||
typedef matrix_matrix_binary<typename E1::const_closure_type,
|
||||
typename E2::const_closure_type,
|
||||
matrix_matrix_prod<T1, T2, promote_type> > expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
template<class E1, class E2>
|
||||
typename matrix_matrix_binary_traits<typename E1::value_type, E1,
|
||||
typename E2::value_type, E2>::result_type
|
||||
prod (const matrix_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2,
|
||||
unknown_orientation_tag);
|
||||
|
||||
// Dispatcher
|
||||
template<class E1, class E2>
|
||||
typename matrix_matrix_binary_traits<typename E1::value_type, E1,
|
||||
typename E2::value_type, E2>::result_type
|
||||
prod (const matrix_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2);
|
||||
|
||||
template<class E1, class E2>
|
||||
typename matrix_matrix_binary_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
|
||||
prec_prod (const matrix_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2,
|
||||
unknown_orientation_tag);
|
||||
|
||||
// Dispatcher
|
||||
template<class E1, class E2>
|
||||
typename matrix_matrix_binary_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
|
||||
typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
|
||||
prec_prod (const matrix_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2);
|
||||
|
||||
template<class M, class E1, class E2>
|
||||
M
|
||||
prod (const matrix_expression<E1> &e1,
|
||||
const matrix_expression<E2> &e2);
|
||||
|
||||
template<class M, class E1, class E2>
|
||||
M
|
||||
prec_prod (const matrix_expression<E1> &e1,
|
||||
const matrix_expression<E2> &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m1 (3, 3), m2 (3, 3);<br />
|
||||
for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)<br />
|
||||
for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j)<br />
|
||||
m1 (i, j) = m2 (i, j) = 3 * i + j;<br />
|
||||
<br />
|
||||
std::cout << prod (m1, m2) << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m1 (3, 3), m2 (3, 3);
|
||||
for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)
|
||||
for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j)
|
||||
m1 (i, j) = m2 (i, j) = 3 * i + j;
|
||||
|
||||
std::cout << prod (m1, m2) << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h3>Triangular Solvers</h3>
|
||||
<h4>Prototypes</h4>
|
||||
<pre>
|
||||
<code>template<class E1, class E2><br />
|
||||
struct matrix_matrix_solve_traits {<br />
|
||||
typedef typename promote_traits<typename E1::value_type, typename E2::value_type>::promote_type promote_type;<br />
|
||||
typedef matrix<promote_type> result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (const matrix_expression<E1> &e1,<br />
|
||||
E2 &e2,<br />
|
||||
lower_tag,<br />
|
||||
matrix_tag);<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (const matrix_expression<E1> &e1,<br />
|
||||
E2 &e2,<br />
|
||||
upper_tag,<br />
|
||||
matrix_tag);<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (const matrix_expression<E1> &e1,<br />
|
||||
E2 &e2,<br />
|
||||
unit_lower_tag,<br />
|
||||
matrix_tag);<br />
|
||||
template<class E1, class E2><br />
|
||||
void inplace_solve (const matrix_expression<E1> &e1,<br />
|
||||
E2 &e2,<br />
|
||||
unit_upper_tag,<br />
|
||||
matrix_tag);<br />
|
||||
<br />
|
||||
template<class E1, class E2, class C><br />
|
||||
typename matrix_matrix_solve_traits<E1, E2>::result_type<br />
|
||||
solve (const matrix_expression<E1> &e1,<br />
|
||||
const matrix_expression<E2> &e2,<br />
|
||||
<code>template<class E1, class E2>
|
||||
struct matrix_matrix_solve_traits {
|
||||
typedef typename promote_traits<typename E1::value_type, typename E2::value_type>::promote_type promote_type;
|
||||
typedef matrix<promote_type> result_type;
|
||||
};
|
||||
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (const matrix_expression<E1> &e1,
|
||||
E2 &e2,
|
||||
lower_tag,
|
||||
matrix_tag);
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (const matrix_expression<E1> &e1,
|
||||
E2 &e2,
|
||||
upper_tag,
|
||||
matrix_tag);
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (const matrix_expression<E1> &e1,
|
||||
E2 &e2,
|
||||
unit_lower_tag,
|
||||
matrix_tag);
|
||||
template<class E1, class E2>
|
||||
void inplace_solve (const matrix_expression<E1> &e1,
|
||||
E2 &e2,
|
||||
unit_upper_tag,
|
||||
matrix_tag);
|
||||
|
||||
template<class E1, class E2, class C>
|
||||
typename matrix_matrix_solve_traits<E1, E2>::result_type
|
||||
solve (const matrix_expression<E1> &e1,
|
||||
const matrix_expression<E2> &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 <boost/numeric/ublas/triangular.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m1 (3, 3), m2 (3, 3);<br />
|
||||
for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)<br />
|
||||
for (unsigned j = 0; j <= i; ++ j)<br />
|
||||
m1 (i, j) = m2 (i, j) = 3 * i + j + 1;<br />
|
||||
<br />
|
||||
std::cout << solve (m1, m2, lower_tag ()) << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/triangular.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m1 (3, 3), m2 (3, 3);
|
||||
for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)
|
||||
for (unsigned j = 0; j <= i; ++ j)
|
||||
m1 (i, j) = m2 (i, j) = 3 * i + j + 1;
|
||||
|
||||
std::cout << solve (m1, m2, lower_tag ()) << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<hr />
|
||||
<p>Copyright (©) 2000-2002 Joerg Walter, Mathias Koch<br />
|
||||
|
||||
@@ -18,18 +18,18 @@ Matrix Proxies</h1>
|
||||
addressing a row of a matrix.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i) {<br />
|
||||
matrix_row<matrix<double> > mr (m, i);<br />
|
||||
for (unsigned j = 0; j < mr.size (); ++ j)<br />
|
||||
mr (j) = 3 * i + j;<br />
|
||||
std::cout << mr << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i) {
|
||||
matrix_row<matrix<double> > mr (m, i);
|
||||
for (unsigned j = 0; j < mr.size (); ++ j)
|
||||
mr (j) = 3 * i + j;
|
||||
std::cout << mr << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
@@ -199,9 +199,9 @@ the reversed <code>matrix_row</code>.</td>
|
||||
<h3>Projections</h3>
|
||||
<h4>Prototypes</h4>
|
||||
<pre>
|
||||
<code>template<class M><br />
|
||||
matrix_row<M> row (M &data, std::size_t i);<br />
|
||||
template<class M><br />
|
||||
<code>template<class M>
|
||||
matrix_row<M> row (M &data, std::size_t i);
|
||||
template<class M>
|
||||
const matrix_row<const M> row (const M &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i) {<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
row (m, i) (j) = 3 * i + j;<br />
|
||||
std::cout << row (m, i) << std::endl;<br />
|
||||
}<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i) {
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
row (m, i) (j) = 3 * i + j;
|
||||
std::cout << row (m, i) << std::endl;
|
||||
}
|
||||
}
|
||||
</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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j) {<br />
|
||||
matrix_column<matrix<double> > mc (m, j);<br />
|
||||
for (unsigned i = 0; i < mc.size (); ++ i)<br />
|
||||
mc (i) = 3 * i + j;<br />
|
||||
std::cout << mc << std::endl;<br />
|
||||
}<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j) {
|
||||
matrix_column<matrix<double> > mc (m, j);
|
||||
for (unsigned i = 0; i < mc.size (); ++ i)
|
||||
mc (i) = 3 * i + j;
|
||||
std::cout << mc << std::endl;
|
||||
}
|
||||
}
|
||||
</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<class M><br />
|
||||
matrix_column<M> column (M &data, std::size_t j);<br />
|
||||
template<class M><br />
|
||||
<code>template<class M>
|
||||
matrix_column<M> column (M &data, std::size_t j);
|
||||
template<class M>
|
||||
const matrix_column<const M> column (const M &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j) {<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
column (m, j) (i) = 3 * i + j;<br />
|
||||
std::cout << column (m, j) << std::endl;<br />
|
||||
}<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j) {
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
column (m, j) (i) = 3 * i + j;
|
||||
std::cout << column (m, j) << std::endl;
|
||||
}
|
||||
}
|
||||
</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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
m (i, j) = 3 * i + j;<br />
|
||||
<br />
|
||||
matrix_vector_range<matrix<double> > mvr (m, range (0, 3), range (0, 3));<br />
|
||||
std::cout << mvr << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
|
||||
matrix_vector_range<matrix<double> > mvr (m, range (0, 3), range (0, 3));
|
||||
std::cout << mvr << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
m (i, j) = 3 * i + j;<br />
|
||||
<br />
|
||||
matrix_vector_slice<matrix<double> > mvs (m, slice (0, 1, 3), slice (0, 1, 3));<br />
|
||||
std::cout << mvs << std::endl;<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
|
||||
matrix_vector_slice<matrix<double> > mvs (m, slice (0, 1, 3), slice (0, 1, 3));
|
||||
std::cout << mvs << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
matrix_range<matrix<double> > mr (m, range (0, 3), range (0, 3));<br />
|
||||
for (unsigned i = 0; i < mr.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < mr.size2 (); ++ j)<br />
|
||||
mr (i, j) = 3 * i + j;<br />
|
||||
std::cout << mr << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
matrix_range<matrix<double> > mr (m, range (0, 3), range (0, 3));
|
||||
for (unsigned i = 0; i < mr.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < mr.size2 (); ++ j)
|
||||
mr (i, j) = 3 * i + j;
|
||||
std::cout << mr << std::endl;
|
||||
}
|
||||
</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<class M><br />
|
||||
matrix_range<M> project (M &data, const range &r1, const range &r2);<br />
|
||||
template<class M><br />
|
||||
const matrix_range<const M> project (const M &data, const range &r1, const range &r2);<br />
|
||||
template<class M><br />
|
||||
<code>template<class M>
|
||||
matrix_range<M> project (M &data, const range &r1, const range &r2);
|
||||
template<class M>
|
||||
const matrix_range<const M> project (const M &data, const range &r1, const range &r2);
|
||||
template<class M>
|
||||
matrix_range<M> project (const matrix_range<M> &data, const range &r1, const range &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
project (m, range (0, 3), range (0, 3)) (i, j) = 3 * i + j;<br />
|
||||
std::cout << project (m, range (0, 3), range (0, 3)) << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
project (m, range (0, 3), range (0, 3)) (i, j) = 3 * i + j;
|
||||
std::cout << project (m, range (0, 3), range (0, 3)) << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
matrix_slice<matrix<double> > ms (m, slice (0, 1, 3), slice (0, 1, 3));<br />
|
||||
for (unsigned i = 0; i < ms.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < ms.size2 (); ++ j)<br />
|
||||
ms (i, j) = 3 * i + j;<br />
|
||||
std::cout << ms << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
matrix_slice<matrix<double> > ms (m, slice (0, 1, 3), slice (0, 1, 3));
|
||||
for (unsigned i = 0; i < ms.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < ms.size2 (); ++ j)
|
||||
ms (i, j) = 3 * i + j;
|
||||
std::cout << ms << std::endl;
|
||||
}
|
||||
</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<class M><br />
|
||||
matrix_slice<M> project (const matrix_slice<M> &data, const range &r1, const range &r2);<br />
|
||||
template<class M><br />
|
||||
matrix_slice<M> project (M &data, const slice &s1, const slice &s2);<br />
|
||||
template<class M><br />
|
||||
const matrix_slice<const M> project (const M &data, const slice &s1, const slice &s2);<br />
|
||||
template<class M><br />
|
||||
<code>template<class M>
|
||||
matrix_slice<M> project (const matrix_slice<M> &data, const range &r1, const range &r2);
|
||||
template<class M>
|
||||
matrix_slice<M> project (M &data, const slice &s1, const slice &s2);
|
||||
template<class M>
|
||||
const matrix_slice<const M> project (const M &data, const slice &s1, const slice &s2);
|
||||
template<class M>
|
||||
matrix_slice<M> project (const matrix_slice<M> &data, const slice &s1, const slice &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
project (m, slice (0, 1, 3), slice (0, 1, 3)) (i, j) = 3 * i + j;<br />
|
||||
std::cout << project (m, slice (0, 1, 3), slice (0, 1, 3)) << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
project (m, slice (0, 1, 3), slice (0, 1, 3)) (i, j) = 3 * i + j;
|
||||
std::cout << project (m, slice (0, 1, 3), slice (0, 1, 3)) << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<hr />
|
||||
<p>Copyright (©) 2000-2002 Joerg Walter, Mathias Koch<br />
|
||||
|
||||
@@ -41,16 +41,16 @@ i</em><sub><em>2</em></sub><em>)</em> with column major
|
||||
orientation.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/matrix_sparse.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
sparse_matrix<double> m (3, 3, 3 * 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
m (i, j) = 3 * i + j;<br />
|
||||
std::cout << m << std::endl;<br />
|
||||
#include <boost/numeric/ublas/matrix_sparse.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
sparse_matrix<double> m (3, 3, 3 * 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
std::cout << m << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/matrix_sparse.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
compressed_matrix<double> m (3, 3, 3 * 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
m (i, j) = 3 * i + j;<br />
|
||||
std::cout << m << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix_sparse.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
compressed_matrix<double> m (3, 3, 3 * 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
std::cout << m << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/matrix_sparse.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
coordinate_matrix<double> m (3, 3, 3 * 3);<br />
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)<br />
|
||||
m (i, j) = 3 * i + j;<br />
|
||||
std::cout << m << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix_sparse.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
coordinate_matrix<double> m (3, 3, 3 * 3);
|
||||
for (unsigned i = 0; i < m.size1 (); ++ i)
|
||||
for (unsigned j = 0; j < m.size2 (); ++ j)
|
||||
m (i, j) = 3 * i + j;
|
||||
std::cout << m << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header matrix_sparse.hpp.</p>
|
||||
|
||||
201
doc/operations_overview.htm
Normal file
201
doc/operations_overview.htm
Normal 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<matrix_type, 64> (A, u); // w = A * u
|
||||
w = block_prod<matrix_type, 64> (u, A); // w = trans(A) * u
|
||||
C = block_prod<matrix_type, 64> (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 <= i <
|
||||
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<matrix_type> (A, r1, r2);
|
||||
matrix_vector_slice<matrix_type> (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<matrix_type> (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<const VEC&>(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 (©) 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
312
doc/products.htm
Normal 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<class V, class E1, class E2> BOOST_UBLAS_INLINE V & </td>
|
||||
<td class="memItemRight" valign=bottom><a class="el" href="#ga8">axpy_prod</a> (const matrix_expression< E1 > &e1, const vector_expression< E2 > &e2, V &v, bool init=true)</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="mdescLeft"> </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<class V, class E1, class E2> BOOST_UBLAS_INLINE V & </td>
|
||||
<td class="memItemRight" valign=bottom><a class="el" href="#ga9">axpy_prod</a> (const vector_expression< E1 > &e1, const matrix_expression< E2 > &e2, V &v, bool init=true)</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="mdescLeft"> </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<class M, class E1, class E2> BOOST_UBLAS_INLINE M & </td>
|
||||
<td class="memItemRight" valign=bottom><a class="el" href="#ga7">axpy_prod</a> (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true)</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="mdescLeft"> </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<class M, class E1, class E2> BOOST_UBLAS_INLINE M & </td>
|
||||
<td class="memItemRight" valign=bottom><a class="el" href="#ga6">opb_prod</a> (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true)</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="mdescLeft"> </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& axpy_prod </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">const matrix_expression< E1 > & </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< E2 > & </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 & </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 </td>
|
||||
<td class="mdname" nowrap> <em>init</em> = <code>true</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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> </td><td>the matrix expression <code>A</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>e2</em> </td><td>the vector expression <code>x</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>v</em> </td><td>the result vector <code>v</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>init</em> </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& axpy_prod </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">const vector_expression< E1 > & </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< E2 > & </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 & </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 </td>
|
||||
<td class="mdname" nowrap> <em>init</em> = <code>true</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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> </td><td>the vector expression <code>x</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>e2</em> </td><td>the matrix expression <code>A</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>v</em> </td><td>the result vector <code>v</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>init</em> </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& axpy_prod </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">const matrix_expression< E1 > & </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< E2 > & </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 & </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 </td>
|
||||
<td class="mdname" nowrap> <em>init</em> = <code>true</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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> </td><td>the matrix expression <code>A</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>e2</em> </td><td>the matrix expression <code>X</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>m</em> </td><td>the result matrix <code>M</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>init</em> </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& opb_prod </td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">const matrix_expression< E1 > & </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< E2 > & </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 & </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 </td>
|
||||
<td class="mdname" nowrap> <em>init</em> = <code>true</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="md">) </td>
|
||||
<td class="md" colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table summary="" cellspacing=5 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</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> </td><td>the matrix expression <code>A</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>e2</em> </td><td>the matrix expression <code>X</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>m</em> </td><td>the result matrix <code>M</code> </td></tr>
|
||||
<tr><td></td><td valign=top><em>init</em> </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 (©) 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>
|
||||
@@ -20,15 +20,15 @@ implements a simple C-like array using allocation via
|
||||
<code>new/delete</code>.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/storage.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
unbounded_array<double> a (3);<br />
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {<br />
|
||||
a [i] = i;<br />
|
||||
std::cout << a [i] << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/storage.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
unbounded_array<double> a (3);
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {
|
||||
a [i] = i;
|
||||
std::cout << a [i] << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
@@ -178,16 +178,16 @@ Array</h2>
|
||||
implements a simple C-like array.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/storage.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
bounded_array<double, 3> a (3);<br />
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {<br />
|
||||
a [i] = i;<br />
|
||||
std::cout << a [i] << std::endl;<br />
|
||||
}<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/storage.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
bounded_array<double, 3> a (3);
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {
|
||||
a [i] = i;
|
||||
std::cout << a [i] << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header storage.hpp.</p>
|
||||
@@ -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 <boost/numeric/ublas/storage.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
range r (0, 3);<br />
|
||||
for (unsigned i = 0; i < r.size (); ++ i) {<br />
|
||||
std::cout << r (i) << std::endl;<br />
|
||||
}<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/storage.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
range r (0, 3);
|
||||
for (unsigned i = 0; i < r.size (); ++ i) {
|
||||
std::cout << r (i) << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header storage.hpp.</p>
|
||||
@@ -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 <boost/numeric/ublas/storage.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
slice s (0, 1, 3);<br />
|
||||
for (unsigned i = 0; i < s.size (); ++ i) {<br />
|
||||
std::cout << s (i) << std::endl;<br />
|
||||
}<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/storage.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
slice s (0, 1, 3);
|
||||
for (unsigned i = 0; i < s.size (); ++ i) {
|
||||
std::cout << s (i) << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header storage.hpp.</p>
|
||||
|
||||
@@ -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 <boost/numeric/ublas/storage_sparse.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
map_std<int, double> a (3);<br />
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {<br />
|
||||
a [i] = i;<br />
|
||||
std::cout << a [i] << std::endl;<br />
|
||||
}<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/storage_sparse.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
map_std<int, double> a (3);
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {
|
||||
a [i] = i;
|
||||
std::cout << a [i] << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header storage_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 <boost/numeric/ublas/storage_sparse.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
map_array<int, double> a (3);<br />
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {<br />
|
||||
a [i] = i;<br />
|
||||
std::cout << a [i] << std::endl;<br />
|
||||
}<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/storage_sparse.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
map_array<int, double> a (3);
|
||||
for (unsigned i = 0; i < a.size (); ++ i) {
|
||||
a [i] = i;
|
||||
std::cout << a [i] << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header storage_sparse.hpp.</p>
|
||||
|
||||
@@ -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 <boost/numeric/ublas/symmetric.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
symmetric_matrix<double, lower> ml (3, 3);<br />
|
||||
for (unsigned i = 0; i < ml.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j <= i; ++ j)<br />
|
||||
ml (i, j) = 3 * i + j;<br />
|
||||
std::cout << ml << std::endl;<br />
|
||||
symmetric_matrix<double, upper> mu (3, 3);<br />
|
||||
for (unsigned i = 0; i < mu.size1 (); ++ i)<br />
|
||||
for (unsigned j = i; j < mu.size2 (); ++ j)<br />
|
||||
mu (i, j) = 3 * i + j;<br />
|
||||
std::cout << mu << std::endl;<br />
|
||||
#include <boost/numeric/ublas/symmetric.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
symmetric_matrix<double, lower> ml (3, 3);
|
||||
for (unsigned i = 0; i < ml.size1 (); ++ i)
|
||||
for (unsigned j = 0; j <= i; ++ j)
|
||||
ml (i, j) = 3 * i + j;
|
||||
std::cout << ml << std::endl;
|
||||
symmetric_matrix<double, upper> mu (3, 3);
|
||||
for (unsigned i = 0; i < mu.size1 (); ++ i)
|
||||
for (unsigned j = i; j < mu.size2 (); ++ j)
|
||||
mu (i, j) = 3 * i + j;
|
||||
std::cout << mu << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/symmetric.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
symmetric_adaptor<matrix<double>, lower> sal (m);<br />
|
||||
for (unsigned i = 0; i < sal.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j <= i; ++ j)<br />
|
||||
sal (i, j) = 3 * i + j;<br />
|
||||
std::cout << sal << std::endl;<br />
|
||||
symmetric_adaptor<matrix<double>, upper> sau (m);<br />
|
||||
for (unsigned i = 0; i < sau.size1 (); ++ i)<br />
|
||||
for (unsigned j = i; j < sau.size2 (); ++ j)<br />
|
||||
sau (i, j) = 3 * i + j;<br />
|
||||
std::cout << sau << std::endl;<br />
|
||||
#include <boost/numeric/ublas/symmetric.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
symmetric_adaptor<matrix<double>, lower> sal (m);
|
||||
for (unsigned i = 0; i < sal.size1 (); ++ i)
|
||||
for (unsigned j = 0; j <= i; ++ j)
|
||||
sal (i, j) = 3 * i + j;
|
||||
std::cout << sal << std::endl;
|
||||
symmetric_adaptor<matrix<double>, upper> sau (m);
|
||||
for (unsigned i = 0; i < sau.size1 (); ++ i)
|
||||
for (unsigned j = i; j < sau.size2 (); ++ j)
|
||||
sau (i, j) = 3 * i + j;
|
||||
std::cout << sau << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
|
||||
@@ -332,23 +332,23 @@ Triangular Adaptor</h2>
|
||||
is a triangular matrix adaptor for other matrices.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/triangular.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
matrix<double> m (3, 3);<br />
|
||||
triangular_adaptor<matrix<double>, lower> tal (m);<br />
|
||||
for (unsigned i = 0; i < tal.size1 (); ++ i)<br />
|
||||
for (unsigned j = 0; j <= i; ++ j)<br />
|
||||
tal (i, j) = 3 * i + j;<br />
|
||||
std::cout << tal << std::endl;<br />
|
||||
triangular_adaptor<matrix<double>, upper> tau (m);<br />
|
||||
for (unsigned i = 0; i < tau.size1 (); ++ i)<br />
|
||||
for (unsigned j = i; j < tau.size2 (); ++ j)<br />
|
||||
tau (i, j) = 3 * i + j;<br />
|
||||
std::cout << tau << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/triangular.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
matrix<double> m (3, 3);
|
||||
triangular_adaptor<matrix<double>, lower> tal (m);
|
||||
for (unsigned i = 0; i < tal.size1 (); ++ i)
|
||||
for (unsigned j = 0; j <= i; ++ j)
|
||||
tal (i, j) = 3 * i + j;
|
||||
std::cout << tal << std::endl;
|
||||
triangular_adaptor<matrix<double>, upper> tau (m);
|
||||
for (unsigned i = 0; i < tau.size1 (); ++ i)
|
||||
for (unsigned j = i; j < tau.size2 (); ++ j)
|
||||
tau (i, j) = 3 * i + j;
|
||||
std::cout << tau << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header triangular.hpp.</p>
|
||||
|
||||
571
doc/types_overview.htm
Normal file
571
doc/types_overview.htm
Normal 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<T [, A]><br /> 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<T, N><br /> 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<T, M><br /> 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<T><br /> v(size);</code></td>
|
||||
<td>the zero vector of type <code>T</code> with the given
|
||||
size.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>unit_vector<T><br /> v(size, 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<T [, S]><br /> v(size);</code></td>
|
||||
<td>a sparse vector of values of type <code>T</code> of variable
|
||||
size. The sparse storage type <code>S</code> can be <code>std::map<size_t,
|
||||
T></code> or <code>map_array<size_t, T></code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>compressed_vector<T [,IB, IA, TA]><br /> 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<T [,IB, IA, TA]><br /> 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<VEC><br /> 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<VEC><br /> 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<MAT><br /> 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<MAT><br /> 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<T [, F, A]><br /> 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<T, M, N [, F]><br /> 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<T, M, N><br /> 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<T [, F, A]><br /> 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<unbounded_array<T> ></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>zero_matrix<T><br /> 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<T><br /> 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<T><br /> 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<T [, TRI, F, A]><br />
|
||||
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<T [, F, A]><br /> 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<T [, TRI, F, A]><br />
|
||||
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<T [, TRI, F, A]><br />
|
||||
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<T, [F, S]><br /> m(size1, size2 [,
|
||||
non_zeros]);</code></td>
|
||||
<td>a sparse matrix of values of type <code>T</code> of variable
|
||||
size. The sparse storage type <code>S</code> can be either <code>std::map<size_t,
|
||||
std::map<size_t, T> ></code> or
|
||||
<code>map_array<size_t, map_array<size_t,
|
||||
T> ></code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector_of_sparse_vector<T, [F, C]><br /> 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<T, [F, IB, IA, TA]><br /> 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<T, [F, IB, IA, TA]><br /> 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<T, F, A><br /> 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<double, row_major,
|
||||
unbounded_array<coordinate_vector<double> > ></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<MAT, TRI><br /> 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<MAT, TRI><br /> 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<MAT, TRI><br /> 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<MAT><br /> 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<MAT, TRI><br /> 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<MAT, TRI><br /> 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<T,<br />
|
||||
std::vector<T> ><br />
|
||||
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<T,<br />
|
||||
unbounded_array<T> ><br />
|
||||
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<T,<br />
|
||||
bounded_array<T, N> ><br />
|
||||
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<T,<br />
|
||||
std::map<std::size_t, T> ><br />
|
||||
v (size, non_zeros)</code></td>
|
||||
<td>a sparse vector, storage is provided by a standard
|
||||
map.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>sparse_vector<T,<br />
|
||||
map_array<std::size_t, T> ><br />
|
||||
v (size, non_zeros)</code></td>
|
||||
<td>a sparse vector, storage is provided by a map
|
||||
array.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>matrix<T,<br />
|
||||
row_major,<br />
|
||||
std::vector<T> ><br />
|
||||
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<T,<br />
|
||||
column_major,<br />
|
||||
std::vector<T> ><br />
|
||||
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<T,<br />
|
||||
row_major,<br />
|
||||
unbounded_array<T> ><br />
|
||||
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<T,<br />
|
||||
column_major,<br />
|
||||
unbounded_array<T> ><br />
|
||||
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<T,<br />
|
||||
row_major,<br />
|
||||
bounded_array<T, N1 * N2> ><br />
|
||||
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<T,<br />
|
||||
column_major,<br />
|
||||
bounded_array<T, N1 * N2> ><br />
|
||||
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<T,<br />
|
||||
row_major, F, A><br />
|
||||
m (size)</code></td>
|
||||
<td>a packed triangular matrix, orientation is row
|
||||
major.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>triangular_matrix<T,<br />
|
||||
column_major, F, A><br />
|
||||
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<T,<br />
|
||||
row_major, A><br />
|
||||
m (size1, size2, lower, upper)</code></td>
|
||||
<td>a packed banded matrix, orientation is row
|
||||
major.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>banded_matrix<T,<br />
|
||||
column_major, A><br />
|
||||
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<T,<br />
|
||||
row_major, F, A><br />
|
||||
m (size)</code></td>
|
||||
<td>a packed symmetric matrix, orientation is row
|
||||
major.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>symmetric_matrix<T,<br />
|
||||
column_major, F, A><br />
|
||||
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<T,<br />
|
||||
row_major, F, A><br />
|
||||
m (size)</code></td>
|
||||
<td>a packed hermitian matrix, orientation is row
|
||||
major.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>hermitian_matrix<T,<br />
|
||||
column_major, F, A><br />
|
||||
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<T,<br />
|
||||
row_major,<br />
|
||||
std::map<std::size_t, T> ><br />
|
||||
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<T,<br />
|
||||
column_major,<br />
|
||||
std::map<std::size_t, T> ><br />
|
||||
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<T,<br />
|
||||
row_major,<br />
|
||||
map_array<std::size_t, T> ><br />
|
||||
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<T,<br />
|
||||
column_major,<br />
|
||||
map_array<std::size_t, T> ><br />
|
||||
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<T,<br />
|
||||
row_major><br />
|
||||
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<T,<br />
|
||||
column_major><br />
|
||||
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<T,<br />
|
||||
row_major><br />
|
||||
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<T,<br />
|
||||
column_major><br />
|
||||
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 (©) 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>
|
||||
@@ -21,16 +21,16 @@ vector and <em>0 <= i < n</em> every element
|
||||
element of the container.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v (3);<br />
|
||||
for (unsigned i = 0; i < v.size (); ++ i)<br />
|
||||
v (i) = i;<br />
|
||||
std::cout << v << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v (3);
|
||||
for (unsigned i = 0; i < v.size (); ++ i)
|
||||
v (i) = i;
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header vector.hpp.</p>
|
||||
@@ -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 <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
for (int i = 0; i < 3; ++ i) {<br />
|
||||
unit_vector<double> v (3, i);<br />
|
||||
std::cout << v << std::endl;<br />
|
||||
}<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
for (int i = 0; i < 3; ++ i) {
|
||||
unit_vector<double> v (3, i);
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header vector.hpp.</p>
|
||||
@@ -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 <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
zero_vector<double> v (3);<br />
|
||||
std::cout << v << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
zero_vector<double> v (3);
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header vector.hpp.</p>
|
||||
@@ -503,14 +503,14 @@ vector and <em>0 <= i < n</em> holds
|
||||
<em>z</em><sub><em>i</em></sub> <em>= s</em>.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
scalar_vector<double> v (3);<br />
|
||||
std::cout << v << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
scalar_vector<double> v (3);
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header vector.hpp.</p>
|
||||
|
||||
@@ -317,40 +317,40 @@ end of the reversed expression.</td>
|
||||
<h3>Unary Operations</h3>
|
||||
<h4>Prototypes</h4>
|
||||
<pre>
|
||||
<code>template<class E, class F><br />
|
||||
struct vector_unary_traits {<br />
|
||||
typedef vector_unary<typename E::const_closure_type, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (- v) [i] = - v [i]<br />
|
||||
template<class E><br />
|
||||
typename vector_unary_traits<E, scalar_negate<typename E::value_type> >::result_type<br />
|
||||
operator - (const vector_expression<E> &e);<br />
|
||||
<br />
|
||||
// (conj v) [i] = conj (v [i])<br />
|
||||
template<class E><br />
|
||||
typename vector_unary_traits<E, scalar_conj<typename E::value_type> >::result_type<br />
|
||||
conj (const vector_expression<E> &e);<br />
|
||||
<br />
|
||||
// (real v) [i] = real (v [i])<br />
|
||||
template<class E><br />
|
||||
typename vector_unary_traits<E, scalar_real<typename E::value_type> >::result_type<br />
|
||||
real (const vector_expression<E> &e);<br />
|
||||
<br />
|
||||
// (imag v) [i] = imag (v [i])<br />
|
||||
template<class E><br />
|
||||
typename vector_unary_traits<E, scalar_imag<typename E::value_type> >::result_type<br />
|
||||
imag (const vector_expression<E> &e);<br />
|
||||
<br />
|
||||
// (trans v) [i] = v [i]<br />
|
||||
template<class E><br />
|
||||
typename vector_unary_traits<E, scalar_identity<typename E::value_type> >::result_type<br />
|
||||
trans (const vector_expression<E> &e);<br />
|
||||
<br />
|
||||
// (herm v) [i] = conj (v [i])<br />
|
||||
template<class E><br />
|
||||
typename vector_unary_traits<E, scalar_conj<typename E::value_type> >::result_type<br />
|
||||
<code>template<class E, class F>
|
||||
struct vector_unary_traits {
|
||||
typedef vector_unary<typename E::const_closure_type, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (- v) [i] = - v [i]
|
||||
template<class E>
|
||||
typename vector_unary_traits<E, scalar_negate<typename E::value_type> >::result_type
|
||||
operator - (const vector_expression<E> &e);
|
||||
|
||||
// (conj v) [i] = conj (v [i])
|
||||
template<class E>
|
||||
typename vector_unary_traits<E, scalar_conj<typename E::value_type> >::result_type
|
||||
conj (const vector_expression<E> &e);
|
||||
|
||||
// (real v) [i] = real (v [i])
|
||||
template<class E>
|
||||
typename vector_unary_traits<E, scalar_real<typename E::value_type> >::result_type
|
||||
real (const vector_expression<E> &e);
|
||||
|
||||
// (imag v) [i] = imag (v [i])
|
||||
template<class E>
|
||||
typename vector_unary_traits<E, scalar_imag<typename E::value_type> >::result_type
|
||||
imag (const vector_expression<E> &e);
|
||||
|
||||
// (trans v) [i] = v [i]
|
||||
template<class E>
|
||||
typename vector_unary_traits<E, scalar_identity<typename E::value_type> >::result_type
|
||||
trans (const vector_expression<E> &e);
|
||||
|
||||
// (herm v) [i] = conj (v [i])
|
||||
template<class E>
|
||||
typename vector_unary_traits<E, scalar_conj<typename E::value_type> >::result_type
|
||||
herm (const vector_expression<E> &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 <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<std::complex<double> > v (3);<br />
|
||||
for (unsigned i = 0; i < v.size (); ++ i)<br />
|
||||
v (i) = std::complex<double> (i, i);<br />
|
||||
<br />
|
||||
std::cout << - v << std::endl;<br />
|
||||
std::cout << conj (v) << std::endl;<br />
|
||||
std::cout << real (v) << std::endl;<br />
|
||||
std::cout << imag (v) << std::endl;<br />
|
||||
std::cout << trans (v) << std::endl;<br />
|
||||
std::cout << herm (v) << std::endl;<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<std::complex<double> > v (3);
|
||||
for (unsigned i = 0; i < v.size (); ++ i)
|
||||
v (i) = std::complex<double> (i, i);
|
||||
|
||||
std::cout << - v << std::endl;
|
||||
std::cout << conj (v) << std::endl;
|
||||
std::cout << real (v) << std::endl;
|
||||
std::cout << imag (v) << std::endl;
|
||||
std::cout << trans (v) << std::endl;
|
||||
std::cout << herm (v) << std::endl;
|
||||
}
|
||||
</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<class E1, class E2, class F><br />
|
||||
struct vector_binary_traits {<br />
|
||||
typedef vector_binary<typename E1::const_closure_type,<br />
|
||||
typename E2::const_closure_type, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (v1 + v2) [i] = v1 [i] + v2 [i]<br />
|
||||
template<class E1, class E2><br />
|
||||
typename vector_binary_traits<E1, E2, scalar_plus<typename E1::value_type,<br />
|
||||
typename E2::value_type> >::result_type<br />
|
||||
operator + (const vector_expression<E1> &e1,<br />
|
||||
const vector_expression<E2> &e2);<br />
|
||||
<br />
|
||||
// (v1 - v2) [i] = v1 [i] - v2 [i]<br />
|
||||
template<class E1, class E2><br />
|
||||
typename vector_binary_traits<E1, E2, scalar_minus<typename E1::value_type,<br />
|
||||
typename E2::value_type> >::result_type<br />
|
||||
operator - (const vector_expression<E1> &e1,<br />
|
||||
<code>template<class E1, class E2, class F>
|
||||
struct vector_binary_traits {
|
||||
typedef vector_binary<typename E1::const_closure_type,
|
||||
typename E2::const_closure_type, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (v1 + v2) [i] = v1 [i] + v2 [i]
|
||||
template<class E1, class E2>
|
||||
typename vector_binary_traits<E1, E2, scalar_plus<typename E1::value_type,
|
||||
typename E2::value_type> >::result_type
|
||||
operator + (const vector_expression<E1> &e1,
|
||||
const vector_expression<E2> &e2);
|
||||
|
||||
// (v1 - v2) [i] = v1 [i] - v2 [i]
|
||||
template<class E1, class E2>
|
||||
typename vector_binary_traits<E1, E2, scalar_minus<typename E1::value_type,
|
||||
typename E2::value_type> >::result_type
|
||||
operator - (const vector_expression<E1> &e1,
|
||||
const vector_expression<E2> &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 <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v1 (3), v2 (3);<br />
|
||||
for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)<br />
|
||||
v1 (i) = v2 (i) = i;<br />
|
||||
<br />
|
||||
std::cout << v1 + v2 << std::endl;<br />
|
||||
std::cout << v1 - v2 << std::endl;<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v1 (3), v2 (3);
|
||||
for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)
|
||||
v1 (i) = v2 (i) = i;
|
||||
|
||||
std::cout << v1 + v2 << std::endl;
|
||||
std::cout << v1 - v2 << std::endl;
|
||||
}
|
||||
</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<class E1, class E2, class F><br />
|
||||
struct vector_matrix_binary_traits {<br />
|
||||
typedef vector_matrix_binary<typename E1::const_closure_type,<br />
|
||||
typename E2::const_closure_type, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (outer_prod (v1, v2)) [i] [j] = v1 [i] * v2 [j]<br />
|
||||
template<class E1, class E2><br />
|
||||
typename vector_matrix_binary_traits<E1, E2, scalar_multiplies<typename E1::value_type, typename E2::value_type> >::result_type<br />
|
||||
outer_prod (const vector_expression<E1> &e1,<br />
|
||||
<code>template<class E1, class E2, class F>
|
||||
struct vector_matrix_binary_traits {
|
||||
typedef vector_matrix_binary<typename E1::const_closure_type,
|
||||
typename E2::const_closure_type, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (outer_prod (v1, v2)) [i] [j] = v1 [i] * v2 [j]
|
||||
template<class E1, class E2>
|
||||
typename vector_matrix_binary_traits<E1, E2, scalar_multiplies<typename E1::value_type, typename E2::value_type> >::result_type
|
||||
outer_prod (const vector_expression<E1> &e1,
|
||||
const vector_expression<E2> &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 <boost/numeric/ublas/matrix.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v1 (3), v2 (3);<br />
|
||||
for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)<br />
|
||||
v1 (i) = v2 (i) = i;<br />
|
||||
<br />
|
||||
std::cout << outer_prod (v1, v2) << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v1 (3), v2 (3);
|
||||
for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)
|
||||
v1 (i) = v2 (i) = i;
|
||||
|
||||
std::cout << outer_prod (v1, v2) << std::endl;
|
||||
}
|
||||
</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<class T1, class E2, class F><br />
|
||||
struct vector_binary_scalar1_traits {<br />
|
||||
typedef vector_binary_scalar1<scalar_const_reference<T1>,<br />
|
||||
typename E2::const_closure_type, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (t * v) [i] = t * v [i]<br />
|
||||
template<class T1, class E2><br />
|
||||
typename vector_binary_scalar1_traits<T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type<br />
|
||||
operator * (const T1 &e1,<br />
|
||||
const vector_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class E1, class T2, class F><br />
|
||||
struct vector_binary_scalar2_traits {<br />
|
||||
typedef vector_binary_scalar2<typename E1::const_closure_type,<br />
|
||||
scalar_const_reference<T2>, F> expression_type;<br />
|
||||
typedef expression_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// (v * t) [i] = v [i] * t<br />
|
||||
template<class E1, class T2><br />
|
||||
typename vector_binary_scalar2_traits<E1, T2, scalar_multiplies<typename E1::value_type, T2> >::result_type<br />
|
||||
operator * (const vector_expression<E1> &e1,<br />
|
||||
const T2 &e2);<br />
|
||||
<br />
|
||||
// (v / t) [i] = v [i] / t<br />
|
||||
template<class E1, class T2><br />
|
||||
typename vector_binary_scalar2_traits<E1, T2, scalar_divides<typename E1::value_type, T2> >::result_type<br />
|
||||
operator / (const vector_expression<E1> &e1,<br />
|
||||
<code>template<class T1, class E2, class F>
|
||||
struct vector_binary_scalar1_traits {
|
||||
typedef vector_binary_scalar1<scalar_const_reference<T1>,
|
||||
typename E2::const_closure_type, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (t * v) [i] = t * v [i]
|
||||
template<class T1, class E2>
|
||||
typename vector_binary_scalar1_traits<T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type
|
||||
operator * (const T1 &e1,
|
||||
const vector_expression<E2> &e2);
|
||||
|
||||
template<class E1, class T2, class F>
|
||||
struct vector_binary_scalar2_traits {
|
||||
typedef vector_binary_scalar2<typename E1::const_closure_type,
|
||||
scalar_const_reference<T2>, F> expression_type;
|
||||
typedef expression_type result_type;
|
||||
};
|
||||
|
||||
// (v * t) [i] = v [i] * t
|
||||
template<class E1, class T2>
|
||||
typename vector_binary_scalar2_traits<E1, T2, scalar_multiplies<typename E1::value_type, T2> >::result_type
|
||||
operator * (const vector_expression<E1> &e1,
|
||||
const T2 &e2);
|
||||
|
||||
// (v / t) [i] = v [i] / t
|
||||
template<class E1, class T2>
|
||||
typename vector_binary_scalar2_traits<E1, T2, scalar_divides<typename E1::value_type, T2> >::result_type
|
||||
operator / (const vector_expression<E1> &e1,
|
||||
const T2 &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 <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v (3);<br />
|
||||
for (unsigned i = 0; i < v.size (); ++ i)<br />
|
||||
v (i) = i;<br />
|
||||
<br />
|
||||
std::cout << 2.0 * v << std::endl;<br />
|
||||
std::cout << v * 2.0 << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v (3);
|
||||
for (unsigned i = 0; i < v.size (); ++ i)
|
||||
v (i) = i;
|
||||
|
||||
std::cout << 2.0 * v << std::endl;
|
||||
std::cout << v * 2.0 << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h2><a name="vector_reductions" id="vector_reductions"></a> Vector
|
||||
Reductions</h2>
|
||||
<h3>Unary Reductions</h3>
|
||||
<h4>Prototypes</h4>
|
||||
<pre>
|
||||
<code>template<class E, class F><br />
|
||||
struct vector_scalar_unary_traits {<br />
|
||||
typedef typename F::result_type result_type;<br />
|
||||
};<br />
|
||||
<br />
|
||||
// sum v = sum (v [i])<br />
|
||||
template<class E><br />
|
||||
typename vector_scalar_unary_traits<E, vector_sum<typename E::value_type> >::result_type<br />
|
||||
sum (const vector_expression<E> &e);<br />
|
||||
<br />
|
||||
// norm_1 v = sum (abs (v [i]))<br />
|
||||
template<class E><br />
|
||||
typename vector_scalar_unary_traits<E, vector_norm_1<typename E::value_type> >::result_type<br />
|
||||
norm_1 (const vector_expression<E> &e);<br />
|
||||
<br />
|
||||
// norm_2 v = sqrt (sum (v [i] * v [i]))<br />
|
||||
template<class E><br />
|
||||
typename vector_scalar_unary_traits<E, vector_norm_2<typename E::value_type> >::result_type<br />
|
||||
norm_2 (const vector_expression<E> &e);<br />
|
||||
<br />
|
||||
// norm_inf v = max (abs (v [i]))<br />
|
||||
template<class E><br />
|
||||
typename vector_scalar_unary_traits<E, vector_norm_inf<typename E::value_type> >::result_type<br />
|
||||
norm_inf (const vector_expression<E> &e);<br />
|
||||
<br />
|
||||
// index_norm_inf v = min (i: abs (v [i]) == max (abs (v [i])))<br />
|
||||
template<class E><br />
|
||||
typename vector_scalar_unary_traits<E, vector_index_norm_inf<typename E::value_type> >::result_type<br />
|
||||
<code>template<class E, class F>
|
||||
struct vector_scalar_unary_traits {
|
||||
typedef typename F::result_type result_type;
|
||||
};
|
||||
|
||||
// sum v = sum (v [i])
|
||||
template<class E>
|
||||
typename vector_scalar_unary_traits<E, vector_sum<typename E::value_type> >::result_type
|
||||
sum (const vector_expression<E> &e);
|
||||
|
||||
// norm_1 v = sum (abs (v [i]))
|
||||
template<class E>
|
||||
typename vector_scalar_unary_traits<E, vector_norm_1<typename E::value_type> >::result_type
|
||||
norm_1 (const vector_expression<E> &e);
|
||||
|
||||
// norm_2 v = sqrt (sum (v [i] * v [i]))
|
||||
template<class E>
|
||||
typename vector_scalar_unary_traits<E, vector_norm_2<typename E::value_type> >::result_type
|
||||
norm_2 (const vector_expression<E> &e);
|
||||
|
||||
// norm_inf v = max (abs (v [i]))
|
||||
template<class E>
|
||||
typename vector_scalar_unary_traits<E, vector_norm_inf<typename E::value_type> >::result_type
|
||||
norm_inf (const vector_expression<E> &e);
|
||||
|
||||
// index_norm_inf v = min (i: abs (v [i]) == max (abs (v [i])))
|
||||
template<class E>
|
||||
typename vector_scalar_unary_traits<E, vector_index_norm_inf<typename E::value_type> >::result_type
|
||||
index_norm_inf (const vector_expression<E> &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 <boost/numeric/ublas/vector.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v (3);<br />
|
||||
for (unsigned i = 0; i < v.size (); ++ i)<br />
|
||||
v (i) = i;<br />
|
||||
<br />
|
||||
std::cout << sum (v) << std::endl;<br />
|
||||
std::cout << norm_1 (v) << std::endl;<br />
|
||||
std::cout << norm_2 (v) << std::endl;<br />
|
||||
std::cout << norm_inf (v) << std::endl;<br />
|
||||
std::cout << index_norm_inf (v) << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v (3);
|
||||
for (unsigned i = 0; i < v.size (); ++ i)
|
||||
v (i) = i;
|
||||
|
||||
std::cout << sum (v) << std::endl;
|
||||
std::cout << norm_1 (v) << std::endl;
|
||||
std::cout << norm_2 (v) << std::endl;
|
||||
std::cout << norm_inf (v) << std::endl;
|
||||
std::cout << index_norm_inf (v) << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h3>Binary Reductions</h3>
|
||||
<h4>Prototypes</h4>
|
||||
<pre>
|
||||
<code>template<class E1, class E2, class F><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<class E1, class E2><br />
|
||||
typename vector_scalar_binary_traits<E1, E2, vector_inner_prod<typename E1::value_type,<br />
|
||||
typename E2::value_type,<br />
|
||||
typename promote_traits<typename E1::value_type,<br />
|
||||
typename E2::value_type>::promote_type> >::result_type<br />
|
||||
inner_prod (const vector_expression<E1> &e1,<br />
|
||||
const vector_expression<E2> &e2);<br />
|
||||
<br />
|
||||
template<class E1, class E2><br />
|
||||
typename vector_scalar_binary_traits<E1, E2, vector_inner_prod<typename E1::value_type,<br />
|
||||
typename E2::value_type,<br />
|
||||
typename type_traits<typename promote_traits<typename E1::value_type,<br />
|
||||
typename E2::value_type>::promote_type>::precision_type> >::result_type<br />
|
||||
prec_inner_prod (const vector_expression<E1> &e1,<br />
|
||||
<code>template<class E1, class E2, class F>
|
||||
struct vector_scalar_binary_traits {
|
||||
typedef typename F::result_type result_type;
|
||||
};
|
||||
|
||||
// inner_prod (v1, v2) = sum (v1 [i] * v2 [i])
|
||||
template<class E1, class E2>
|
||||
typename vector_scalar_binary_traits<E1, E2, vector_inner_prod<typename E1::value_type,
|
||||
typename E2::value_type,
|
||||
typename promote_traits<typename E1::value_type,
|
||||
typename E2::value_type>::promote_type> >::result_type
|
||||
inner_prod (const vector_expression<E1> &e1,
|
||||
const vector_expression<E2> &e2);
|
||||
|
||||
template<class E1, class E2>
|
||||
typename vector_scalar_binary_traits<E1, E2, vector_inner_prod<typename E1::value_type,
|
||||
typename E2::value_type,
|
||||
typename type_traits<typename promote_traits<typename E1::value_type,
|
||||
typename E2::value_type>::promote_type>::precision_type> >::result_type
|
||||
prec_inner_prod (const vector_expression<E1> &e1,
|
||||
const vector_expression<E2> &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 <boost/numeric/ublas/vector.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v1 (3), v2 (3);<br />
|
||||
for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)<br />
|
||||
v1 (i) = v2 (i) = i;<br />
|
||||
<br />
|
||||
std::cout << inner_prod (v1, v2) << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v1 (3), v2 (3);
|
||||
for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)
|
||||
v1 (i) = v2 (i) = i;
|
||||
|
||||
std::cout << inner_prod (v1, v2) << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<hr />
|
||||
<p>Copyright (©) 2000-2002 Joerg Walter, Mathias Koch<br />
|
||||
|
||||
@@ -18,17 +18,17 @@ Vector Proxies</h1>
|
||||
addressing a sub-range of a vector's element.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v (3);<br />
|
||||
vector_range<vector<double> > vr (v, range (0, 3));<br />
|
||||
for (unsigned i = 0; i < vr.size (); ++ i)<br />
|
||||
vr (i) = i;<br />
|
||||
std::cout << vr << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v (3);
|
||||
vector_range<vector<double> > vr (v, range (0, 3));
|
||||
for (unsigned i = 0; i < vr.size (); ++ i)
|
||||
vr (i) = i;
|
||||
std::cout << vr << std::endl;
|
||||
}
|
||||
</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<class V><br />
|
||||
vector_range<V> project (V &data, const range &r);<br />
|
||||
template<class V><br />
|
||||
const vector_range<const V> project (const V &data, const range &r);<br />
|
||||
template<class V><br />
|
||||
<code>template<class V>
|
||||
vector_range<V> project (V &data, const range &r);
|
||||
template<class V>
|
||||
const vector_range<const V> project (const V &data, const range &r);
|
||||
template<class V>
|
||||
vector_range<V> project (const vector_range<V> &data, const range &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 <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v (3);<br />
|
||||
for (int i = 0; i < 3; ++ i)<br />
|
||||
project (v, range (0, 3)) (i) = i;<br />
|
||||
std::cout << project (v, range (0, 3)) << std::endl;<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v (3);
|
||||
for (int i = 0; i < 3; ++ i)
|
||||
project (v, range (0, 3)) (i) = i;
|
||||
std::cout << project (v, range (0, 3)) << std::endl;
|
||||
}
|
||||
</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 <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v (3);<br />
|
||||
vector_slice<vector<double> > vs (v, slice (0, 1, 3));<br />
|
||||
for (unsigned i = 0; i < vs.size (); ++ i)<br />
|
||||
vs (i) = i;<br />
|
||||
std::cout << vs << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v (3);
|
||||
vector_slice<vector<double> > vs (v, slice (0, 1, 3));
|
||||
for (unsigned i = 0; i < vs.size (); ++ i)
|
||||
vs (i) = i;
|
||||
std::cout << vs << std::endl;
|
||||
}
|
||||
</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<class V><br />
|
||||
vector_slice<V> project (const vector_slice<V> &data, const range &r);<br />
|
||||
template<class V><br />
|
||||
vector_slice<V> project (V &data, const slice &s);<br />
|
||||
template<class V><br />
|
||||
const vector_slice<const V> project (const V &data, const slice &s);<br />
|
||||
template<class V><br />
|
||||
<code>template<class V>
|
||||
vector_slice<V> project (const vector_slice<V> &data, const range &r);
|
||||
template<class V>
|
||||
vector_slice<V> project (V &data, const slice &s);
|
||||
template<class V>
|
||||
const vector_slice<const V> project (const V &data, const slice &s);
|
||||
template<class V>
|
||||
vector_slice<V> project (const vector_slice<V> &data, const slice &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 <boost/numeric/ublas/vector.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
vector<double> v (3);<br />
|
||||
for (int i = 0; i < 3; ++ i)<br />
|
||||
project (v, slice (0, 1, 3)) (i) = i;<br />
|
||||
std::cout << project (v, slice (0, 1, 3)) << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
vector<double> v (3);
|
||||
for (int i = 0; i < 3; ++ i)
|
||||
project (v, slice (0, 1, 3)) (i) = i;
|
||||
std::cout << project (v, slice (0, 1, 3)) << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<hr />
|
||||
<p>Copyright (©) 2000-2002 Joerg Walter, Mathias Koch<br />
|
||||
|
||||
@@ -29,16 +29,16 @@ container holds <em>i</em><sub><em>1</em></sub> <em><
|
||||
i</em><sub><em>2</em></sub>.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector_sparse.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
sparse_vector<double> v (3, 3);<br />
|
||||
for (unsigned i = 0; i < v.size (); ++ i)<br />
|
||||
v (i) = i;<br />
|
||||
std::cout << v << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector_sparse.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
sparse_vector<double> v (3, 3);
|
||||
for (unsigned i = 0; i < v.size (); ++ i)
|
||||
v (i) = i;
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
</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><
|
||||
i</em><sub><em>2</em></sub>.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector_sparse.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
compressed_vector<double> v (3, 3);<br />
|
||||
for (unsigned i = 0; i < v.size (); ++ i)<br />
|
||||
v (i) = i;<br />
|
||||
std::cout << v << std::endl;<br />
|
||||
#include <boost/numeric/ublas/vector_sparse.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
compressed_vector<double> v (3, 3);
|
||||
for (unsigned i = 0; i < v.size (); ++ i)
|
||||
v (i) = i;
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
@@ -533,16 +533,16 @@ containers holds <em>i</em><sub><em>1</em></sub> <em><
|
||||
i</em><sub><em>2</em></sub>.</p>
|
||||
<h4>Example</h4>
|
||||
<pre>
|
||||
#include <boost/numeric/ublas/vector_sparse.hpp><br />
|
||||
#include <boost/numeric/ublas/io.hpp><br />
|
||||
<br />
|
||||
int main () {<br />
|
||||
using namespace boost::numeric::ublas;<br />
|
||||
coordinate_vector<double> v (3, 3);<br />
|
||||
for (unsigned i = 0; i < v.size (); ++ i)<br />
|
||||
v (i) = i;<br />
|
||||
std::cout << v << std::endl;<br />
|
||||
}<br />
|
||||
#include <boost/numeric/ublas/vector_sparse.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
|
||||
int main () {
|
||||
using namespace boost::numeric::ublas;
|
||||
coordinate_vector<double> v (3, 3);
|
||||
for (unsigned i = 0; i < v.size (); ++ i)
|
||||
v (i) = i;
|
||||
std::cout << v << std::endl;
|
||||
}
|
||||
</pre>
|
||||
<h4>Definition</h4>
|
||||
<p>Defined in the header vector_sparse.hpp.</p>
|
||||
|
||||
Reference in New Issue
Block a user