mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-19 10:32:02 -05:00
528 lines
17 KiB
HTML
528 lines
17 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta name="generator" content=
|
|
"HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" />
|
|
<meta http-equiv="Content-Type" content=
|
|
"text/html; charset=us-ascii" />
|
|
<link rel="stylesheet" href="../../../../boost.css" type="text/css"/>
|
|
<link rel="stylesheet" href="ublas.css" type="text/css" />
|
|
<script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script>
|
|
<script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script>
|
|
<title>Vector Proxies</title>
|
|
</head>
|
|
<body>
|
|
<h1><img src="../../../../boost.png" align="middle" />Vector Proxies</h1>
|
|
<div class="toc" id="toc"></div>
|
|
<h2><a name="vector_range"></a>Vector Range</h2>
|
|
<h4>Description</h4>
|
|
<p>The templated class <code>vector_range<V></code> allows
|
|
addressing a sub-range of a vector's element.</p>
|
|
<h4>Example</h4>
|
|
<pre>
|
|
#include <boost/numeric/ublas/vector.hpp>
|
|
#include <boost/numeric/ublas/vector_proxy.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>
|
|
<h4>Template parameters</h4>
|
|
<table border="1" summary="parameters">
|
|
<tbody>
|
|
<tr>
|
|
<th>Parameter</th>
|
|
<th>Description</th>
|
|
<th>Default</th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>V</code></td>
|
|
<td>The type of vector referenced.</td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h4>Model of</h4>
|
|
<p><a href="expression_concept.html#vector_expression">Vector Expression</a>
|
|
.</p>
|
|
<p>If the specified range falls outside that of the index range of
|
|
the vector, then the <code>vector_range</code> is not a well formed
|
|
Vector Expression. That is, access to an element which is outside
|
|
of index range of the vector is <i>undefined</i>.</p>
|
|
<h4>Type requirements</h4>
|
|
<p>None, except for those imposed by the requirements of <a href=
|
|
"expression_concept.html#vector_expression">Vector Expression</a> .</p>
|
|
<h4>Public base classes</h4>
|
|
<p><code>vector_expression<vector_range<V> ></code></p>
|
|
<h4>Members</h4>
|
|
<table border="1" summary="members">
|
|
<tbody>
|
|
<tr>
|
|
<th>Member</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>vector_range (vector_type &data, const range
|
|
&r)</code></td>
|
|
<td>Constructs a sub vector.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>size_type start () const</code></td>
|
|
<td>Returns the start of the sub vector.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>size_type size () const</code></td>
|
|
<td>Returns the size of the sub vector.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_reference operator () (size_type i)
|
|
const</code></td>
|
|
<td>Returns the value of the <code>i</code>-th element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>reference operator () (size_type i)</code></td>
|
|
<td>Returns a reference of the <code>i</code>-th element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_reference operator [] (size_type i)
|
|
const</code></td>
|
|
<td>Returns the value of the <code>i</code>-th element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>reference operator [] (size_type i)</code></td>
|
|
<td>Returns a reference of the <code>i</code>-th element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>vector_range &operator = (const vector_range
|
|
&vr)</code></td>
|
|
<td>The assignment operator.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>vector_range &assign_temporary (vector_range
|
|
&vr)</code></td>
|
|
<td>Assigns a temporary. May change the vector range
|
|
<code>vr</code> .</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_range &operator = (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>The extended assignment operator.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_range &assign (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>Assigns a vector expression to the sub vector. Left and right
|
|
hand side of the assignment should be independent.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_range &operator += (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>A computed assignment operator. Adds the vector expression to
|
|
the sub vector.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_range &plus_assign (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>Adds a vector expression to the sub vector. Left and right hand
|
|
side of the assignment should be independent.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_range &operator -= (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>A computed assignment operator. Subtracts the vector expression
|
|
from the sub vector.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_range &minus_assign (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>Subtracts a vector expression from the sub vector. Left and
|
|
right hand side of the assignment should be independent.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AT><br />
|
|
vector_range &operator *= (const AT &at)</code></td>
|
|
<td>A computed assignment operator. Multiplies the sub vector with
|
|
a scalar.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AT><br />
|
|
vector_range &operator /= (const AT &at)</code></td>
|
|
<td>A computed assignment operator. Divides the sub vector through
|
|
a scalar.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>void swap (vector_range &vr)</code></td>
|
|
<td>Swaps the contents of the sub vectors.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_iterator begin () const</code></td>
|
|
<td>Returns a <code>const_iterator</code> pointing to the beginning
|
|
of the <code>vector_range</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_iterator end () const</code></td>
|
|
<td>Returns a <code>const_iterator</code> pointing to the end of
|
|
the <code>vector_range</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>iterator begin ()</code></td>
|
|
<td>Returns a <code>iterator</code> pointing to the beginning of
|
|
the <code>vector_range</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>iterator end ()</code></td>
|
|
<td>Returns a <code>iterator</code> pointing to the end of the
|
|
<code>vector_range</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_reverse_iterator rbegin () const</code></td>
|
|
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
|
beginning of the reversed <code>vector_range</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_reverse_iterator rend () const</code></td>
|
|
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
|
end of the reversed <code>vector_range</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>reverse_iterator rbegin ()</code></td>
|
|
<td>Returns a <code>reverse_iterator</code> pointing to the
|
|
beginning of the reversed <code>vector_range</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>reverse_iterator rend ()</code></td>
|
|
<td>Returns a <code>reverse_iterator</code> pointing to the end of
|
|
the reversed <code>vector_range</code>.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h3>Simple Projections</h3>
|
|
<h4>Description</h4>
|
|
<p>The free <code>subrange</code> functions support the construction
|
|
of vector ranges.</p>
|
|
<h4>Prototypes</h4>
|
|
<pre><code>
|
|
template<class V>
|
|
vector_range<V> subrange (V &data,
|
|
V::size_type start, V::size_type stop);
|
|
template<class V>
|
|
const vector_range<const V> subrange (const V &data,
|
|
V::size_type start, V::size_type stop);
|
|
</code></pre>
|
|
<h3>Generic Projections</h3>
|
|
<h4>Description</h4>
|
|
<p>The free <code>project</code> functions support the construction
|
|
of vector ranges. Existing <code>matrix_range</code>'s can be composed with a further range. The resulting range is computed using this existing range's <code>compose</code> function.</p>
|
|
<h4>Prototypes</h4>
|
|
<pre><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 (vector_range<V> &data, const range &r);
|
|
template<class V>
|
|
const vector_range<V> project (const vector_range<V> &data, const range &r);
|
|
</code></pre>
|
|
<h4>Definition</h4>
|
|
<p>Defined in the header vector_proxy.hpp.</p>
|
|
<h4>Type requirements</h4>
|
|
<ul>
|
|
<li><code>V</code> is a model of <a href=
|
|
"expression_concept.html#vector_expression">Vector Expression</a> .</li>
|
|
</ul>
|
|
<h4>Complexity</h4>
|
|
<p>Linear depending from the size of the range.</p>
|
|
<h4>Examples</h4>
|
|
<pre>
|
|
#include <boost/numeric/ublas/vector.hpp>
|
|
#include <boost/numeric/ublas/vector_proxy.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"></a>Vector Slice</h2>
|
|
<h4>Description</h4>
|
|
<p>The templated class <code>vector_slice<V></code> allows
|
|
addressing a slice of a vector.</p>
|
|
<h4>Example</h4>
|
|
<pre>
|
|
#include <boost/numeric/ublas/vector.hpp>
|
|
#include <boost/numeric/ublas/vector_proxy.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>
|
|
<h4>Template parameters</h4>
|
|
<table border="1" summary="parameters">
|
|
<tbody>
|
|
<tr>
|
|
<th>Parameter</th>
|
|
<th>Description</th>
|
|
<th>Default</th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>V</code></td>
|
|
<td>The type of vector referenced.</td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h4>Model of</h4>
|
|
<p><a href="expression_concept.html#vector_expression">Vector Expression</a>
|
|
.</p>
|
|
<p>If the specified slice falls outside that of the index range of
|
|
the vector, then the <code>vector_slice</code> is not a well formed
|
|
Vector Expression. That is, access to an element which is outside
|
|
of index range of the vector is <i>undefined</i>.</p>
|
|
<h4>Type requirements</h4>
|
|
<p>None, except for those imposed by the requirements of <a href=
|
|
"expression_concept.html#vector_expression">Vector Expression</a> .</p>
|
|
<h4>Public base classes</h4>
|
|
<p><code>vector_expression<vector_slice<V> ></code></p>
|
|
<h4>Members</h4>
|
|
<table border="1" summary="members">
|
|
<tbody>
|
|
<tr>
|
|
<th>Member</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>vector_slice (vector_type &data, const slice
|
|
&s)</code></td>
|
|
<td>Constructs a sub vector.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>size_type size () const</code></td>
|
|
<td>Returns the size of the sub vector.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_reference operator () (size_type i)
|
|
const</code></td>
|
|
<td>Returns the value of the <code>i</code>-th element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>reference operator () (size_type i)</code></td>
|
|
<td>Returns a reference of the <code>i</code>-th element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_reference operator [] (size_type i)
|
|
const</code></td>
|
|
<td>Returns the value of the <code>i</code>-th element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>reference operator [] (size_type i)</code></td>
|
|
<td>Returns a reference of the <code>i</code>-th element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>vector_slice &operator = (const vector_slice
|
|
&vs)</code></td>
|
|
<td>The assignment operator.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>vector_slice &assign_temporary (vector_slice
|
|
&vs)</code></td>
|
|
<td>Assigns a temporary. May change the vector slice
|
|
<code>vs</code> .</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_slice &operator = (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>The extended assignment operator.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_slice &assign (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>Assigns a vector expression to the sub vector. Left and right
|
|
hand side of the assignment should be independent.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_slice &operator += (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>A computed assignment operator. Adds the vector expression to
|
|
the sub vector.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_slice &plus_assign (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>Adds a vector expression to the sub vector. Left and right hand
|
|
side of the assignment should be independent.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_slice &operator -= (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>A computed assignment operator. Subtracts the vector expression
|
|
from the sub vector.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AE><br />
|
|
vector_slice &minus_assign (const vector_expression<AE>
|
|
&ae)</code></td>
|
|
<td>Subtracts a vector expression from the sub vector. Left and
|
|
right hand side of the assignment should be independent.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AT><br />
|
|
vector_slice &operator *= (const AT &at)</code></td>
|
|
<td>A computed assignment operator. Multiplies the sub vector with
|
|
a scalar.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>template<class AT><br />
|
|
vector_slice &operator /= (const AT &at)</code></td>
|
|
<td>A computed assignment operator. Divides the sub vector through
|
|
a scalar.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>void swap (vector_slice &vs)</code></td>
|
|
<td>Swaps the contents of the sub vectors.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_iterator begin () const</code></td>
|
|
<td>Returns a <code>const_iterator</code> pointing to the beginning
|
|
of the <code>vector_slice</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_iterator end () const</code></td>
|
|
<td>Returns a <code>const_iterator</code> pointing to the end of
|
|
the <code>vector_slice</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>iterator begin ()</code></td>
|
|
<td>Returns a <code>iterator</code> pointing to the beginning of
|
|
the <code>vector_slice</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>iterator end ()</code></td>
|
|
<td>Returns a <code>iterator</code> pointing to the end of the
|
|
<code>vector_slice</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_reverse_iterator rbegin () const</code></td>
|
|
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
|
beginning of the reversed <code>vector_slice</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>const_reverse_iterator rend () const</code></td>
|
|
<td>Returns a <code>const_reverse_iterator</code> pointing to the
|
|
end of the reversed <code>vector_slice</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>reverse_iterator rbegin ()</code></td>
|
|
<td>Returns a <code>reverse_iterator</code> pointing to the
|
|
beginning of the reversed <code>vector_slice</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>reverse_iterator rend ()</code></td>
|
|
<td>Returns a <code>reverse_iterator</code> pointing to the end of
|
|
the reversed <code>vector_slice</code>.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h3>Simple Projections</h3>
|
|
<h4>Description</h4>
|
|
<p>The free <code>subslice</code> functions support the construction
|
|
of vector slices.</p>
|
|
<h4>Prototypes</h4>
|
|
<pre><code>
|
|
template<class V>
|
|
vector_slice<V> subslice (V &data,
|
|
V::size_type start, V::difference_type stride, V::size_type size);
|
|
template<class V>
|
|
const vector_slice<const V> subslice (const V &data,
|
|
V::size_type start, V::difference_type stride, V::size_type size);
|
|
</code></pre>
|
|
<h3>Generic Projections</h3>
|
|
<h4>Description</h4>
|
|
<p>The free <code>project</code> functions support the construction
|
|
of vector slices. Existing <code>vector_slice</code>'s can be composed with a further range or slices. The resulting slice is computed using this existing slices's <code>compose</code> function.</p>
|
|
<h4>Prototypes</h4>
|
|
<pre><code>
|
|
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 (vector_slice<V> &data, const range &r);
|
|
template<class V>
|
|
const vector_slice<V> project (const vector_slice<V> &data, const range &r);
|
|
template<class V>
|
|
vector_slice<V> project (vector_slice<V> &data, const slice &s);
|
|
template<class V>
|
|
const vector_slice<V> project (const vector_slice<V> &data, const slice &s);
|
|
</code></pre>
|
|
<h4>Definition</h4>
|
|
<p>Defined in the header vector_proxy.hpp.</p>
|
|
<h4>Type requirements</h4>
|
|
<ul>
|
|
<li><code>V</code> is a model of <a href=
|
|
"expression_concept.html#vector_expression">Vector Expression</a> .</li>
|
|
</ul>
|
|
<h4>Complexity</h4>
|
|
<p>Linear depending from the size of the slice.</p>
|
|
<h4>Examples</h4>
|
|
<pre>
|
|
#include <boost/numeric/ublas/vector.hpp>
|
|
#include <boost/numeric/ublas/vector_proxy.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 />
|
|
Use, modification and distribution are subject to the
|
|
Boost Software License, Version 1.0.
|
|
(See accompanying file LICENSE_1_0.txt
|
|
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
|
http://www.boost.org/LICENSE_1_0.txt
|
|
</a>).
|
|
</p>
|
|
<script type="text/javascript">
|
|
(function($) {
|
|
$('#toc').toc();
|
|
})(jQuery);
|
|
</script>
|
|
</body>
|
|
</html>
|