Compare commits

..

1 Commits

Author SHA1 Message Date
nobody
275fed6505 This commit was manufactured by cvs2svn to create tag
'Version_1_34_1_RC3'.

[SVN r38225]
2007-07-16 13:13:26 +00:00
30 changed files with 221 additions and 449 deletions

View File

@@ -24,8 +24,8 @@
width="277" align="middle" height="86"></td>
<td><a href="../../../index.htm"><font face="Arial" color="#ffffff"><big>Home</big></font></a></td>
<td><a href="../../../libs/libraries.htm"><font face="Arial" color="#ffffff"><big>Libraries</big></font></a></td>
<td><a href="http://www.boost.org/people/people.htm"><font face="Arial" color="#ffffff"><big>People</big></font></a></td>
<td><a href="http://www.boost.org/more/faq.htm"><font face="Arial" color="#ffffff"><big>FAQ</big></font></a></td>
<td><a href="../../../people/people.htm"><font face="Arial" color="#ffffff"><big>People</big></font></a></td>
<td><a href="../../../more/faq.htm"><font face="Arial" color="#ffffff"><big>FAQ</big></font></a></td>
<td><a href="../../../more/index.htm"><font face="Arial" color="#ffffff"><big>More</big></font></a></td>
</tr>
</tbody></table>
@@ -45,13 +45,13 @@ definition and common implementations of that interface.
<table>
<tr valign=top>
<td nowrap>Copyright &copy 2000-2001</td><td>
<a href="http://www.osl.iu.edu/~garcia">Ronald Garcia</a>,
<a href=http://www.osl.iu.edu/~garcia>Ronald Garcia</a>,
Indiana University (<a
HREF="mailto:garcia@osl.iu.edu">garcia@osl.iu.edu</a>)<br>
<a href="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</a>,
<a href="../../../people/jeremy_siek.htm">Jeremy Siek</a>,
Indiana University (<a
HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</a>)<br>
<a href="http://www.osl.iu.edu/~lums">Andrew Lumsdaine</a>,
<a href=http://www.osl.iu.edu/~lums>Andrew Lumsdaine</a>,
Indiana University (<a
HREF="mailto:lums@osl.iu.edu">lums@osl.iu.edu</a>)
</td></tr></table>

View File

@@ -38,7 +38,7 @@ gives a summary of the current dereference return type requirements in the
iterator categories.
<p>
</p><center>
<a name="table:1">
<a name="table:2">
<b>Table 1.</b> Summary of current dereference return type
requirements.</a><table border="1">
<tbody>
@@ -794,4 +794,4 @@ Comparable</a> where <tt>&lt;</tt> is a total ordering
--><!-- LocalWords: Postdecrement
--></body></html>
--></body></html>

View File

@@ -1,4 +1,4 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Boost.MultiArray Reference Manual</title><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id730554"></a>Boost.MultiArray Reference Manual</h1></div><div><div class="author"><h3 class="author"><span class="firstname">Ronald</span> <span class="surname">Garcia</span></h3><div class="affiliation"><span class="orgname">Indiana University<br></span> <span class="orgdiv">Open Systems Lab<br></span></div></div></div><div><p class="copyright">Copyright © 2002 The Trustees of Indiana University</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#synopsis">Library Synopsis</a></span></dt><dt><span class="sect1"><a href="#MultiArray">MultiArray Concept</a></span></dt><dd><dl><dt><span class="sect2"><a href="#id835332">Notation</a></span></dt><dt><span class="sect2"><a href="#id835500">Associated Types</a></span></dt><dt><span class="sect2"><a href="#id836010">Valid expressions</a></span></dt><dt><span class="sect2"><a href="#id836828">Complexity guarantees</a></span></dt><dt><span class="sect2"><a href="#id836852">Invariants</a></span></dt><dt><span class="sect2"><a href="#view_types">Associated Types for Views</a></span></dt><dt><span class="sect2"><a href="#id838222">Models</a></span></dt></dl></dd><dt><span class="sect1"><a href="#array_types">Array Components</a></span></dt><dd><dl><dt><span class="sect2"><a href="#multi_array"><code class="literal">multi_array</code></a></span></dt><dt><span class="sect2"><a href="#multi_array_ref"><code class="literal">multi_array_ref</code></a></span></dt><dt><span class="sect2"><a href="#const_multi_array_ref"><code class="literal">const_multi_array_ref</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="#auxiliary">Auxiliary Components</a></span></dt><dd><dl><dt><span class="sect2"><a href="#multi_array_types"><code class="literal">multi_array_types</code></a></span></dt><dt><span class="sect2"><a href="#extent_range"><code class="classname">extent_range</code></a></span></dt><dt><span class="sect2"><a href="#extent_gen"><code class="classname">extent_gen</code></a></span></dt><dt><span class="sect2"><a href="#id862830">Global Objects</a></span></dt><dt><span class="sect2"><a href="#generators">View and SubArray Generators</a></span></dt><dt><span class="sect2"><a href="#memory_layout">Memory Layout Specifiers</a></span></dt><dt><span class="sect2"><a href="#range_checking">Range Checking</a></span></dt></dl></dd></dl></div><p>Boost.MultiArray is composed of several components.
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Boost.MultiArray Reference Manual</title><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id729900"></a>Boost.MultiArray Reference Manual</h1></div><div><div class="author"><h3 class="author"><span class="firstname">Ronald</span> <span class="surname">Garcia</span></h3><div class="affiliation"><span class="orgname">Indiana University<br></span><span class="orgdiv">Open Systems Lab<br></span></div></div></div><div><p class="copyright">Copyright © 2002 The Trustees of Indiana University</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#synopsis">Library Synopsis</a></span></dt><dt><span class="sect1"><a href="#MultiArray">MultiArray Concept</a></span></dt><dd><dl><dt><span class="sect2"><a href="#id834641">Notation</a></span></dt><dt><span class="sect2"><a href="#id834809">Associated Types</a></span></dt><dt><span class="sect2"><a href="#id835319">Valid expressions</a></span></dt><dt><span class="sect2"><a href="#id836109">Complexity guarantees</a></span></dt><dt><span class="sect2"><a href="#id836133">Invariants</a></span></dt><dt><span class="sect2"><a href="#view_types">Associated Types for Views</a></span></dt><dt><span class="sect2"><a href="#id837503">Models</a></span></dt></dl></dd><dt><span class="sect1"><a href="#array_types">Array Components</a></span></dt><dd><dl><dt><span class="sect2"><a href="#multi_array"><code class="literal">multi_array</code></a></span></dt><dt><span class="sect2"><a href="#multi_array_ref"><code class="literal">multi_array_ref</code></a></span></dt><dt><span class="sect2"><a href="#const_multi_array_ref"><code class="literal">const_multi_array_ref</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="#auxiliary">Auxiliary Components</a></span></dt><dd><dl><dt><span class="sect2"><a href="#multi_array_types"><code class="literal">multi_array_types</code></a></span></dt><dt><span class="sect2"><a href="#extent_range"><code class="classname">extent_range</code></a></span></dt><dt><span class="sect2"><a href="#extent_gen"><code class="classname">extent_gen</code></a></span></dt><dt><span class="sect2"><a href="#id862083">Global Objects</a></span></dt><dt><span class="sect2"><a href="#generators">View and SubArray Generators</a></span></dt><dt><span class="sect2"><a href="#memory_layout">Memory Layout Specifiers</a></span></dt><dt><span class="sect2"><a href="#range_checking">Range Checking</a></span></dt></dl></dd></dl></div><p>Boost.MultiArray is composed of several components.
The MultiArray concept defines a generic interface to multidimensional
containers.
<code class="literal">multi_array</code> is a general purpose container class
@@ -150,8 +150,8 @@ number of possible element layouts. For example, the elements of a 2
dimensional array can be stored by row (i.e., the elements of each row
are stored contiguously) or by column (i.e., the elements of each
column are stored contiguously).
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id835332"></a>Notation</h3></div></div></div><p>What follows are the descriptions of symbols that will be used
to describe the MultiArray interface.</p><div class="table"><a name="id835342"></a><p class="title"><b>Table 1. Notation</b></p><div class="table-contents"><table summary="Notation" border="1"><colgroup><col><col></colgroup><tbody><tr><td><code class="literal">A</code></td><td>A type that is a model of MultiArray
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id834641"></a>Notation</h3></div></div></div><p>What follows are the descriptions of symbols that will be used
to describe the MultiArray interface.</p><div class="table"><a name="id834650"></a><p class="title"><b>Table 1. Notation</b></p><table summary="Notation" border="1"><colgroup><col><col></colgroup><tbody><tr><td><code class="literal">A</code></td><td>A type that is a model of MultiArray
</td></tr><tr><td><code class="literal">a,b</code></td><td>Objects of type <code class="literal">A</code></td></tr><tr><td><code class="literal">NumDims</code></td><td>The numeric dimension parameter associated with
<code class="literal">A</code>.</td></tr><tr><td><code class="literal">Dims</code></td><td>Some numeric dimension parameter such that
<code class="literal">0&lt;Dims&lt;NumDims</code>.
@@ -159,8 +159,8 @@ to describe the MultiArray interface.</p><div class="table"><a name="id835342"><
to <code class="literal">index_gen::operator[](index_range)</code>.</td></tr><tr><td><code class="literal">index_list</code></td><td>An object whose type models
<a href="../../utility/Collection.html" target="_top">Collection</a>
</td></tr><tr><td><code class="literal">idx</code></td><td>A signed integral value.</td></tr><tr><td><code class="literal">tmp</code></td><td>An object of type
<code class="literal">boost::array&lt;index,NumDims&gt;</code></td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id835500"></a>Associated Types</h3></div></div></div><p>
</p><div class="table"><a name="id835508"></a><p class="title"><b>Table 2. Associated Types</b></p><div class="table-contents"><table summary="Associated Types" border="1"><colgroup><col><col></colgroup><thead><tr><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">value_type</code></td><td>This is the value type of the container.
<code class="literal">boost::array&lt;index,NumDims&gt;</code></td></tr></tbody></table></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id834809"></a>Associated Types</h3></div></div></div><p>
</p><div class="table"><a name="id834817"></a><p class="title"><b>Table 2. Associated Types</b></p><table summary="Associated Types" border="1"><colgroup><col><col></colgroup><thead><tr><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">value_type</code></td><td>This is the value type of the container.
If <code class="literal">NumDims == 1</code>, then this is
<code class="literal">element</code>. Otherwise, this is the value type of the
immediately nested containers.
@@ -260,9 +260,7 @@ It models MultiArray.
const_array_view&lt;Dims&gt;::type</code>
</td><td>
This is the const view type with <code class="literal">Dims</code> dimensions.
</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id836010"></a>Valid expressions</h3></div></div></div><div class="table"><a name="id836014"></a><p class="title"><b>Table 3. Valid Expressions</b></p><div class="table-contents"><table summary="Valid Expressions" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Expression</th><th>Return type</th><th>Semantics</th></tr></thead><tbody><tr><td><code class="literal">A::dimensionality</code></td><td><code class="literal">size_type</code></td><td>This compile-time constant represents the number of
dimensions of the array (note that
<code class="literal">A::dimensionality == NumDims</code>).</td></tr><tr><td><code class="literal">a.shape()</code></td><td><code class="literal">const size_type*</code></td><td>
</td></tr></tbody></table></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id835319"></a>Valid expressions</h3></div></div></div><div class="table"><a name="id835323"></a><p class="title"><b>Table 3. Valid Expressions</b></p><table summary="Valid Expressions" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Expression</th><th>Return type</th><th>Semantics</th></tr></thead><tbody><tr><td><code class="literal">a.shape()</code></td><td><code class="literal">const size_type*</code></td><td>
This returns a list of <code class="literal">NumDims</code> elements specifying the
extent of each array dimension.
</td></tr><tr><td><code class="literal">a.strides()</code></td><td><code class="literal">const index*</code></td><td>
@@ -360,11 +358,11 @@ type must model <a href="http://www.sgi.com/tech/stl/EqualityComparable.html" ta
expression to be valid.</td></tr><tr><td><code class="literal">a &gt;= b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
values of <code class="literal">a</code> and <code class="literal">b</code>. The element
type must model <a href="http://www.sgi.com/tech/stl/LessThanComparable.html" target="_top">LessThanComparable</a> for this
expression to be valid.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id836828"></a>Complexity guarantees</h3></div></div></div><code class="literal">begin()</code> and <code class="literal">end()</code> execute in amortized
expression to be valid.</td></tr></tbody></table></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id836109"></a>Complexity guarantees</h3></div></div></div><code class="literal">begin()</code> and <code class="literal">end()</code> execute in amortized
constant time.
<code class="literal">size()</code> executes in at most linear time in the
MultiArray's size.
</div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id836852"></a>Invariants</h3></div></div></div><div class="table"><a name="id836858"></a><p class="title"><b>Table 4. Invariants</b></p><div class="table-contents"><table summary="Invariants" border="1"><colgroup><col><col></colgroup><tbody><tr><td>Valid range</td><td><code class="literal">[a.begin(),a.end())</code> is a valid range.
</div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id836133"></a>Invariants</h3></div></div></div><div class="table"><a name="id836139"></a><p class="title"><b>Table 4. Invariants</b></p><table summary="Invariants" border="1"><colgroup><col><col></colgroup><tbody><tr><td>Valid range</td><td><code class="literal">[a.begin(),a.end())</code> is a valid range.
</td></tr><tr><td>Range size</td><td>
<code class="literal">a.size() == std::distance(a.begin(),a.end());</code>.
</td></tr><tr><td>Completeness</td><td>
@@ -376,7 +374,7 @@ Calling <code class="literal">a[a1][a2]...[aN]</code> where <code class="literal
yields the same result as calling
<code class="literal">a(index_list)</code>, where <code class="literal">index_list</code>
is a <a href="../../utility/Collection.html" target="_top">Collection</a> containing the values <code class="literal">a1...aN</code>.
</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="view_types"></a>Associated Types for Views</h3></div></div></div><p>The following MultiArray associated
</td></tr></tbody></table></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="view_types"></a>Associated Types for Views</h3></div></div></div><p>The following MultiArray associated
types define the interface for creating views of existing
MultiArrays. Their interfaces and roles in the
concept are described below.</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="index_range"></a><code class="literal">index_range</code></h4></div></div></div><p><code class="literal">index_range</code> objects represent half-open
@@ -403,10 +401,10 @@ operators, a half open range [5,10) can be specified as follows:
The following describes the
<code class="literal">index_range</code> interface.
</p><div class="table"><a name="id837086"></a><p class="title"><b>Table 5. Notation</b></p><div class="table-contents"><table summary="Notation" border="1"><colgroup><col><col></colgroup><tbody><tr><td><code class="literal">i</code></td><td>An object of type <code class="literal">index_range</code>.</td></tr><tr><td><code class="literal">idx,idx1,idx2,idx3</code></td><td>Objects of type <code class="literal">index</code>.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="id837139"></a><p class="title"><b>Table 6. Associated Types</b></p><div class="table-contents"><table summary="Associated Types" border="1"><colgroup><col><col></colgroup><thead><tr><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">index</code></td><td>This is a signed integral type. It is used to
</p><div class="table"><a name="id836367"></a><p class="title"><b>Table 5. Notation</b></p><table summary="Notation" border="1"><colgroup><col><col></colgroup><tbody><tr><td><code class="literal">i</code></td><td>An object of type <code class="literal">index_range</code>.</td></tr><tr><td><code class="literal">idx,idx1,idx2,idx3</code></td><td>Objects of type <code class="literal">index</code>.</td></tr></tbody></table></div><div class="table"><a name="id836420"></a><p class="title"><b>Table 6. Associated Types</b></p><table summary="Associated Types" border="1"><colgroup><col><col></colgroup><thead><tr><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">index</code></td><td>This is a signed integral type. It is used to
specify the start, finish, and stride values.</td></tr><tr><td><code class="literal">size_type</code></td><td>This is an unsigned integral type. It is used to
report the size of the range an <code class="literal">index_range</code>
represents.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="id837202"></a><p class="title"><b>Table 7. Valid Expressions</b></p><div class="table-contents"><table summary="Valid Expressions" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Expression</th><th>Return type</th><th>Semantics</th></tr></thead><tbody><tr><td><code class="literal">index_range(idx1,idx2,idx3)</code></td><td><code class="literal">index_range</code></td><td>This constructs an <code class="literal">index_range</code>
represents.</td></tr></tbody></table></div><div class="table"><a name="id836483"></a><p class="title"><b>Table 7. Valid Expressions</b></p><table summary="Valid Expressions" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Expression</th><th>Return type</th><th>Semantics</th></tr></thead><tbody><tr><td><code class="literal">index_range(idx1,idx2,idx3)</code></td><td><code class="literal">index_range</code></td><td>This constructs an <code class="literal">index_range</code>
representing the interval <code class="literal">[idx1,idx2)</code>
with stride <code class="literal">idx3</code>.</td></tr><tr><td><code class="literal">index_range(idx1,idx2)</code></td><td><code class="literal">index_range</code></td><td>This constructs an <code class="literal">index_range</code>
representing the interval <code class="literal">[idx1,idx2)</code>
@@ -438,14 +436,14 @@ value. This notation includes
of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to
<code class="literal">index_range(r.start()+idx1, r.finish()+idx, r.stride())</code></td></tr><tr><td><code class="literal">i - idx</code></td><td><code class="literal">index</code></td><td>This expression shifts the start and finish values
of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to
<code class="literal">index_range(r.start()-idx1, r.finish()-idx, r.stride())</code></td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="index_gen"></a><code class="literal">index_gen</code></h4></div></div></div><p> <code class="literal">index_gen</code> aggregates
<code class="literal">index_range(r.start()-idx1, r.finish()-idx, r.stride())</code></td></tr></tbody></table></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="index_gen"></a><code class="literal">index_gen</code></h4></div></div></div><p> <code class="literal">index_gen</code> aggregates
<code class="literal">index_range</code> objects in order to specify view
parameters. Chained calls to <code class="literal">operator[]</code> store
range and dimension information used to
instantiate a new view into a MultiArray.
</p><div class="table"><a name="id837868"></a><p class="title"><b>Table 8. Notation</b></p><div class="table-contents"><table summary="Notation" border="1"><colgroup><col><col></colgroup><tbody><tr><td><code class="literal">Dims,Ranges</code></td><td>Unsigned integral values.</td></tr><tr><td><code class="literal">x</code></td><td>An object of type
</p><div class="table"><a name="id837149"></a><p class="title"><b>Table 8. Notation</b></p><table summary="Notation" border="1"><colgroup><col><col></colgroup><tbody><tr><td><code class="literal">Dims,Ranges</code></td><td>Unsigned integral values.</td></tr><tr><td><code class="literal">x</code></td><td>An object of type
<code class="literal">template gen_type&lt;Dims,Ranges&gt;::type</code>.</td></tr><tr><td><code class="literal">i</code></td><td>An object of type
<code class="literal">index_range</code>.</td></tr><tr><td><code class="literal">idx</code></td><td>Objects of type <code class="literal">index</code>.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="id837954"></a><p class="title"><b>Table 9. Associated Types</b></p><div class="table-contents"><table summary="Associated Types" border="1"><colgroup><col><col></colgroup><thead><tr><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">index</code></td><td>This is a signed integral type. It is used to
<code class="literal">index_range</code>.</td></tr><tr><td><code class="literal">idx</code></td><td>Objects of type <code class="literal">index</code>.</td></tr></tbody></table></div><div class="table"><a name="id837235"></a><p class="title"><b>Table 9. Associated Types</b></p><table summary="Associated Types" border="1"><colgroup><col><col></colgroup><thead><tr><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code class="literal">index</code></td><td>This is a signed integral type. It is used to
specify degenerate dimensions.</td></tr><tr><td><code class="literal">size_type</code></td><td>This is an unsigned integral type. It is used to
report the size of the range an <code class="literal">index_range</code>
represents.</td></tr><tr><td>
@@ -456,21 +454,21 @@ represents.</td></tr><tr><td>
degenerate ranges specified (i.e. calls to
<code class="literal">operator[](index)</code>). Note that
<code class="classname">index_gen</code> and
<code class="classname">gen_type&lt;0,0&gt;::type</code> are the same type.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="id838066"></a><p class="title"><b>Table 10. Valid Expressions</b></p><div class="table-contents"><table summary="Valid Expressions" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Expression</th><th>Return type</th><th>Semantics</th></tr></thead><tbody><tr><td><code class="literal">index_gen()</code></td><td><code class="literal">gen_type&lt;0,0&gt;::type</code></td><td>This constructs an <code class="literal">index_gen</code>
<code class="classname">gen_type&lt;0,0&gt;::type</code> are the same type.</td></tr></tbody></table></div><div class="table"><a name="id837347"></a><p class="title"><b>Table 10. Valid Expressions</b></p><table summary="Valid Expressions" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Expression</th><th>Return type</th><th>Semantics</th></tr></thead><tbody><tr><td><code class="literal">index_gen()</code></td><td><code class="literal">gen_type&lt;0,0&gt;::type</code></td><td>This constructs an <code class="literal">index_gen</code>
object. This object can then be used to generate tuples of
<code class="literal">index_range</code> values.</td></tr><tr><td><code class="literal">x[i]</code></td><td><code class="literal">gen_type&lt;Dims+1,Ranges+1&gt;::type</code>
</td><td>Returns a new object containing all previous
<code class="classname">index_range</code> objects in addition to
<code class="literal">i.</code> Chained calls to
<code class="function">operator[]</code> are the means by which
<code class="classname">index_range</code> objects are aggregated.</td></tr><tr><td><code class="literal">x[idx]</code></td><td><code class="literal">gen_type&lt;Dims,Ranges+1&gt;::type</code>
<code class="classname">index_range</code> objects are aggregated.</td></tr><tr><td><code class="literal">x[idx]</code></td><td><code class="literal">gen_type&lt;Dims,Ranges&gt;::type</code>
</td><td>Returns a new object containing all previous
<code class="classname">index_range</code> objects in addition to a degenerate
range, <code class="literal">index_range(idx,idx).</code> Note that this is NOT
equivalent to <code class="literal">x[index_range(idx,idx)].</code>, which will
return an object of type
<code class="literal">gen_type&lt;Dims+1,Ranges+1&gt;::type</code>.
</td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id838222"></a>Models</h3></div></div></div><div class="itemizedlist"><ul type="disc"><li><code class="literal">multi_array</code></li><li><code class="literal">multi_array_ref</code></li><li><code class="literal">const_multi_array_ref</code></li><li><code class="literal">template array_view&lt;Dims&gt;::type</code></li><li><code class="literal">template const_array_view&lt;Dims&gt;::type</code></li><li><code class="literal">template subarray&lt;Dims&gt;::type</code></li><li><code class="literal">template const_subarray&lt;Dims&gt;::type</code></li></ul></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="array_types"></a>Array Components</h2></div></div></div><p>
</td></tr></tbody></table></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id837503"></a>Models</h3></div></div></div><div class="itemizedlist"><ul type="disc"><li><code class="literal">multi_array</code></li><li><code class="literal">multi_array_ref</code></li><li><code class="literal">const_multi_array_ref</code></li><li><code class="literal">template array_view&lt;Dims&gt;::type</code></li><li><code class="literal">template const_array_view&lt;Dims&gt;::type</code></li><li><code class="literal">template subarray&lt;Dims&gt;::type</code></li><li><code class="literal">template const_subarray&lt;Dims&gt;::type</code></li></ul></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="array_types"></a>Array Components</h2></div></div></div><p>
Boost.MultiArray defines an array class,
<code class="literal">multi_array</code>, and two adapter classes,
<code class="literal">multi_array_ref</code> and
@@ -540,7 +538,7 @@ of values at each level of the nested container hierarchy may
change.</p><p><b><code class="literal">SizeList</code> Requirements. </b><code class="literal">SizeList</code> must model
<a href="../../utility/Collection.html" target="_top">Collection</a>.</p><p><b>Preconditions. </b>
</p><pre class="programlisting">
std::accumulate(sizes.begin(),sizes.end(),size_type(1),std::multiplies&lt;size_type&gt;()) == this-&gt;num_elements();
std::accumulate(sizes.begin(),sizes.end(),size_type(1),std::times&lt;size_type&gt;()) == this-&gt;num_elements();
sizes.size() == NumDims;
</pre><p><b>Postconditions. </b>
<code class="literal">std::equal(sizes.begin(),sizes.end(),this-&gt;shape) == true;</code>
@@ -815,7 +813,8 @@ not described in the <code class="literal">multi_array</code> reference.
namespace boost {
template &lt;typename ValueType,
std::size_t NumDims&gt;
std::size_t NumDims,
typename Allocator = std::allocator&lt;ValueType&gt; &gt;
class multi_array_ref {
public:
// types:
@@ -974,7 +973,7 @@ namespace boost {
template &lt;typename ValueType,
std::size_t NumDims,
typename TPtr = const T*&gt;
typename Allocator = std::allocator&lt;ValueType&gt; &gt;
class const_multi_array_ref {
public:
// types:
@@ -1005,9 +1004,9 @@ public:
// structors
template &lt;typename ExtentList&gt;
explicit const_multi_array_ref(TPtr data, const ExtentList&amp; sizes,
explicit const_multi_array_ref(const element* data, const ExtentList&amp; sizes,
const storage_order_type&amp; store = c_storage_order());
explicit const_multi_array_ref(TPtr data, const extents_tuple&amp; ranges,
explicit const_multi_array_ref(const element* data, const extents_tuple&amp; ranges,
const storage_order_type&amp; store = c_storage_order());
const_multi_array_ref(const const_multi_array_ref&amp; x);
~const_multi_array_ref();
@@ -1055,7 +1054,7 @@ public:
};
</pre><p><b>Constructors. </b></p><div class="variablelist"><dl><dt><span class="term"><pre class="programlisting">template &lt;typename ExtentList&gt;
explicit const_multi_array_ref(TPtr data,
explicit const_multi_array_ref(const element* data,
const ExtentList&amp; sizes,
const storage_order&amp; store = c_storage_order());
</pre></span></dt><dd><p>
@@ -1067,7 +1066,7 @@ dimensions.
</p><p><b><code class="literal">ExtentList</code> Requirements. </b>
<code class="literal">ExtentList</code> must model <a href="../../utility/Collection.html" target="_top">Collection</a>.
</p><p><b>Preconditions. </b><code class="literal">sizes.size() == NumDims;</code></p></dd><dt><span class="term">
<pre class="programlisting">explicit const_multi_array_ref(TPtr data,
<pre class="programlisting">explicit const_multi_array_ref(const element* data,
extent_gen::gen_type&lt;NumDims&gt;::type ranges,
const storage_order&amp; store = c_storage_order());
</pre></span></dt><dd><p><b>Effects. </b>
@@ -1158,7 +1157,7 @@ public:
};
typedef *implementation_defined*&lt;0&gt; extent_gen;
</pre><p><b>Methods and Types. </b></p><div class="variablelist"><dl><dt><span class="term"><code class="function">template gen_type&lt;Ranges&gt;::type</code></span></dt><dd><p>This type generator is used to specify the result of
</pre><p><b>Methods and Types. </b></p><div class="variablelist"><dl><dt><span class="term"><code class="function">template gen_type::&lt;Ranges&gt;::type</code></span></dt><dd><p>This type generator is used to specify the result of
<code class="literal">Ranges</code> chained calls to
<code class="literal">extent_gen::operator[].</code> The types
<code class="classname">extent_gen</code> and
@@ -1172,7 +1171,7 @@ operator[](index idx) const;</code></span></dt><dd><p>This function returns a ne
<code class="classname">extent_range</code> objects in addition to
<code class="literal">extent_range(0,idx).</code> This function gives the array
constructors a similar syntax to traditional C multidimensional array
declaration.</p></dd></dl></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id862830"></a>Global Objects</h3></div></div></div><p>For syntactic convenience, Boost.MultiArray defines two
declaration.</p></dd></dl></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id862083"></a>Global Objects</h3></div></div></div><p>For syntactic convenience, Boost.MultiArray defines two
global objects as part of its
interface. These objects play the role of object generators;
expressions involving them create other objects of interest.

View File

@@ -20,7 +20,7 @@ Boost.MultiArray: Test Descriptions
</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<IMG SRC="../../../boost.png"
<IMG SRC="http://www.boost.org/boost.png"
ALT="C++ Boost" width="277" height="86">
<h1>Boost.MultiArray: Test Descriptions</h1>
@@ -114,13 +114,6 @@ Test re-indexing functionality for the B.M primary components.
</td>
</tr>
<tr>
<td><a href="../test/storage_order_convert.cpp">libs/multi_array/test/storage_order_convert.cpp</a></td>
<td>
Test out conversions among the storage orders data types.
</td>
</tr>
<tr>
<td><a href="../test/storage_order.cpp">libs/multi_array/test/storage_order.cpp</a></td>
<td>
@@ -171,14 +164,6 @@ Ensure that all the array types meet the defined Concepts.
</td>
</tr>
<tr>
<td><a href="../test/assert.cpp">libs/multi_array/test/assert.cpp</a></td>
<td>
Ensure that uses of BOOST_ASSERT within the library can be customized
by library users.
</td>
</tr>
<tr>
<td><a href="../test/generative_tests.hpp">libs/multi_array/test/generative_tests.hpp</a></td>
<td>
@@ -300,10 +285,10 @@ summary="This table describes the tests in the multi array test suite
<table summary="Copyright information">
<tr valign="top">
<td nowrap>Copyright &copy; 2001</td>
<td><a href="http://www.boost.org/people/ronald_garcia.htm">Ronald Garcia</a>,
<td><a href="../../../people/ronald_garcia.htm">Ronald Garcia</a>,
Indiana University (<a href=
"mailto:garcia@cs.indiana.edu">garcia@cs.indiana.edu</a>)<br>
<a href="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</a>, Indiana
<a href="../../../people/jeremy_siek.htm">Jeremy Siek</a>, Indiana
University (<a href=
"mailto:jsiek@cs.indiana.edu">jsiek@cs.indiana.edu</a>)<br>
<a href="http://www.lsc.nd.edu/~lums">Andrew Lumsdaine</a>, Indiana

View File

@@ -255,9 +255,7 @@ useful for writing dimension-independent code.
</blockquote>
<p>The second method involves passing the constructor an <tt>extent_gen</tt>
object, specifying the matrix dimensions. The <tt>extent_gen</tt> type
is defined in the <tt>multi_array_types</tt> namespace and as a
member of every array type, but by default, the library constructs a
object, specifying the matrix dimensions. By default, the library constructs a
global <tt>extent_gen</tt> object <tt>boost::extents</tt>. In case of
concern about memory used by these objects, defining
<tt>BOOST_MULTI_ARRAY_NO_GENERATORS</tt> before including the library
@@ -318,17 +316,13 @@ already existing array component. It allows you to create a sub-view that
retains the same number of dimensions as the original array or one
that has less dimensions than the original as well.
<p>Sub-view creation occurs by placing a call to operator[], passing
it an <tt>index_gen</tt> type. The <tt>index_gen</tt> is populated by
passing <tt>index_range</tt> objects to its <tt>operator[]</tt>.
The <tt>index_range</tt> and <tt>index_gen</tt> types are defined in
the <tt>multi_array_types</tt> namespace and as nested members of
every array type. Similar to <tt>boost::extents</tt>, the library by
default constructs the object <tt>boost::indices</tt>. You can
suppress this object by
defining <tt>BOOST_MULTI_ARRAY_NO_GENERATORS</tt> before including the
library header. A simple sub-view creation example follows.
<p>Sub-view creation occurs by placing a call to operator[], passing it
an <tt>index_gen</tt> type. The <tt>index_gen</tt> is populated by
passing <tt>index_range</tt> objects to its <tt>operator[]</tt>.
Similar to <tt>boost::extents</tt>, the library by default constructs
the object <tt>boost::indices</tt>. You can suppress this object
by defining <tt>BOOST_MULTI_ARRAY_NO_GENERATORS</tt> before
including the library header. A simple sub-view creation example follows.
<h3>Example</h3>
<blockquote>
<pre>
@@ -341,8 +335,7 @@ library header. A simple sub-view creation example follows.
// dim 2: [0,4) (strided by 2),
//
typedef boost::multi_array_types::index_range range;
// OR typedef array_type::index_range range;
typedef array_type::index_range range;
array_type::array_view&lt;3&gt;::type myview =
myarray[ boost::indices[range(0,2)][range(1,3)][range(0,4,2)] ];
@@ -368,7 +361,7 @@ called slicing).
// [0,1,2), 1, [0,2,4)
//
typedef boost::multi_array_types::index_range range;
typedef array_type::index_range range;
array_type::index_gen indices;
array_type::array_view&lt;2&gt;::type myview =
myarray[ indices[range(0,2)][1][range(0,4,2)] ];
@@ -389,7 +382,7 @@ that specify the same range.
// [base,stride,bound)
// [0,2,4)
typedef boost::multi_array_types::index_range range;
typedef array_type::index_range range;
range a_range;
a_range = range(0,4,2);
a_range = range().start(0).finish(4).stride(2);
@@ -409,7 +402,7 @@ dimension it is used to specify.
<h3>Example</h3>
<blockquote>
<pre>
typedef boost::multi_array_types::index_range range;
typedef array_type::index_range range;
range a_range;
// All elements in this dimension
@@ -459,7 +452,7 @@ indices will remain zero-based.
<blockquote>
<pre>
typedef boost::multi_array&lt;double,3&gt; array_type;
array_type A(boost::extents[3][4][2],boost::fortran_storage_order());
array_type A(boost::extents[3][4][2],boost::fortran_storage_order);
call_fortran_function(A.data());
</pre>
</blockquote>
@@ -489,16 +482,13 @@ stored in ascending or descending order.
In some situations, it may be inconvenient or awkward to use an
array that is zero-based.
the Boost.MultiArray components provide two facilities for changing the
bases of an array. One may specify a pair of range values, with
the <tt>extent_range</tt> type, to
the <tt>extent_gen</tt> constructor in order to set the base value.
bases of an array. One may specify a pair of range values to
the extent_gen constructor in order to set the base value.
<h3>Example</h3>
<blockquote>
<pre>
typedef boost::multi_array&lt;double, 3&gt; array_type;
typedef boost::multi_array_types::extent_range range;
// OR typedef array_type::extent_range range;
typedef array_type::extent_range range;
array_type::extent_gen extents;
@@ -517,6 +507,7 @@ reset the bases. To set all bases to the same value, use the
<blockquote>
<pre>
typedef boost::multi_array&lt;double, 3&gt; array_type;
typedef array_type::extent_range range;
array_type::extent_gen extents;
@@ -533,6 +524,7 @@ An alternative is to set each base separately using the
<blockquote>
<pre>
typedef boost::multi_array&lt;double, 3&gt; array_type;
typedef array_type::extent_range range;
array_type::extent_gen extents;
@@ -556,6 +548,7 @@ elements contained remains the same.
<blockquote>
<pre>
typedef boost::multi_array&lt;double, 3&gt; array_type;
typedef array_type::extent_range range;
array_type::extent_gen extents;
array_type A(extents[2][3][4]);
@@ -584,6 +577,7 @@ no longer be available.
<blockquote>
<pre>
typedef boost::multi_array&lt;int, 3&gt; array_type;
typedef array_type::extent_range range;
array_type::extent_gen extents;
array_type A(extents[3][3][3]);
@@ -638,7 +632,7 @@ arrays, as <tt>boost::array</tt> does for C one-dimensional arrays.
<li><a href="mailto:garcia@osl.iu.edu">Ronald Garcia</a>
is the primary author of the library.
<li><a href="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</a>
<li><a href="../../../people/jeremy_siek.htm">Jeremy Siek</a>
helped with the library and provided a sounding board for ideas,
advice, and assistance porting to Microsoft Visual C++.

View File

@@ -110,14 +110,6 @@ are stored contiguously) or by column (i.e., the elements of each
column are stored contiguously).
</para>
<para>
Two concept checking classes for the MultiArray concepts
(<literal>ConstMultiArrayConcept</literal> and
<literal>MutableMultiArrayConcept</literal>) are in the namespace
<literal>boost::multi_array_concepts</literal> in
<literal>&lt;boost/multi_array/concept_checks.hpp&gt;</literal>.
</para>
<sect2><title>Notation</title>
<para>What follows are the descriptions of symbols that will be used
@@ -393,13 +385,6 @@ This is the const view type with <literal>Dims</literal> dimensions.
</row>
</thead>
<tbody>
<row>
<entry><literal>A::dimensionality</literal></entry>
<entry><literal>size_type</literal></entry>
<entry>This compile-time constant represents the number of
dimensions of the array (note that
<literal>A::dimensionality == NumDims</literal>).</entry>
</row>
<row>
<entry><literal>a.shape()</literal></entry>
<entry><literal>const size_type*</literal></entry>
@@ -975,7 +960,7 @@ object. This object can then be used to generate tuples of
</row>
<row>
<entry><literal>x[idx]</literal></entry>
<entry><literal>gen_type&lt;Dims,Ranges+1&gt;::type</literal>
<entry><literal>gen_type&lt;Dims,Ranges&gt;::type</literal>
</entry>
<entry>Returns a new object containing all previous
<classname>index_range</classname> objects in addition to a degenerate

View File

@@ -33,7 +33,7 @@ namespace boost {
template <typename ValueType,
std::size_t NumDims,
typename TPtr = const T*>
typename Allocator = std::allocator<ValueType> >
class const_multi_array_ref {
public:
// types:
@@ -64,9 +64,9 @@ public:
// structors
template <typename ExtentList>
explicit const_multi_array_ref(TPtr data, const ExtentList& sizes,
explicit const_multi_array_ref(const element* data, const ExtentList& sizes,
const storage_order_type& store = c_storage_order());
explicit const_multi_array_ref(TPtr data, const extents_tuple& ranges,
explicit const_multi_array_ref(const element* data, const extents_tuple& ranges,
const storage_order_type& store = c_storage_order());
const_multi_array_ref(const const_multi_array_ref& x);
~const_multi_array_ref();
@@ -122,7 +122,7 @@ public:
<variablelist>
<varlistentry>
<term><programlisting>template &lt;typename ExtentList&gt;
explicit const_multi_array_ref(TPtr data,
explicit const_multi_array_ref(const element* data,
const ExtentList&amp; sizes,
const storage_order&amp; store = c_storage_order());
</programlisting></term>
@@ -151,7 +151,7 @@ dimensions.
<varlistentry>
<term>
<programlisting><![CDATA[explicit const_multi_array_ref(TPtr data,
<programlisting><![CDATA[explicit const_multi_array_ref(const element* data,
extent_gen::gen_type<NumDims>::type ranges,
const storage_order& store = c_storage_order());]]>
</programlisting></term>

View File

@@ -31,26 +31,27 @@ not described in the <literal>multi_array</literal> reference.
namespace boost {
template <typename ValueType,
std::size_t NumDims>
std::size_t NumDims,
typename Allocator = std::allocator<ValueType> >
class multi_array_ref {
public:
// types:
typedef ValueType element;
typedef *unspecified* value_type;
typedef *unspecified* reference;
typedef *unspecified* const_reference;
typedef *unspecified* difference_type;
typedef *unspecified* iterator;
typedef *unspecified* const_iterator;
typedef *unspecified* reverse_iterator;
typedef *unspecified* const_reverse_iterator;
typedef *implementation-defined* value_type;
typedef *implementation-defined* reference;
typedef *implementation-defined* const_reference;
typedef *implementation-defined* difference_type;
typedef *implementation-defined* iterator;
typedef *implementation-defined* const_iterator;
typedef *implementation-defined* reverse_iterator;
typedef *implementation-defined* const_reverse_iterator;
typedef multi_array_types::size_type size_type;
typedef multi_array_types::index index;
typedef multi_array_types::index_gen index_gen;
typedef multi_array_types::index_range index_range;
typedef multi_array_types::extent_gen extent_gen;
typedef multi_array_types::extent_range extent_range;
typedef *unspecified* storage_order_type;
typedef *implementation-defined* storage_order_type;
// template typedefs
template <std::size_t Dims> struct subarray;

View File

@@ -488,7 +488,7 @@ typedef *implementation_defined*<0> extent_gen;
<formalpara><title>Methods and Types</title>
<variablelist>
<varlistentry>
<term><function>template gen_type&lt;Ranges&gt;::type</function></term>
<term><function>template gen_type::&lt;Ranges&gt;::type</function></term>
<listitem>
<para>This type generator is used to specify the result of
<literal>Ranges</literal> chained calls to

View File

@@ -45,7 +45,7 @@ void for_each (const boost::type<Element>& type_dispatch,
template <typename Array, typename Functor>
void for_each (Array& A, Functor xform) {
// Dispatch to the proper function
for_each(boost::type<typename Array::element>(),A.begin(),A.end(),xform);
for_each(boost::type<Array::element>(),A.begin(),A.end(),xform);
}

View File

@@ -1,57 +0,0 @@
// Copyright 2008 The Trustees of Indiana University.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Boost.MultiArray Library
// Authors: Ronald Garcia
// Jeremy Siek
// Andrew Lumsdaine
// See http://www.boost.org/libs/multi_array for documentation.
//
// resize_from_other.cpp - an experiment in writing a resize function for
// multi_arrays that will use the extents from another to build itself.
//
#include <boost/multi_array.hpp>
#include <boost/static_assert.hpp>
#include <boost/array.hpp>
#include <algorithm>
template <typename T, typename U, std::size_t N>
void
resize_from_MultiArray(boost::multi_array<T,N>& marray, U& other) {
// U must be a model of MultiArray
boost::function_requires<
boost::multi_array_concepts::ConstMultiArrayConcept<U,U::dimensionality> >();
// U better have U::dimensionality == N
BOOST_STATIC_ASSERT(U::dimensionality == N);
boost::array<typename boost::multi_array<T,N>::size_type, N> shape;
std::copy(other.shape(), other.shape()+N, shape.begin());
marray.resize(shape);
}
#include <iostream>
int main () {
boost::multi_array<int,2> A(boost::extents[5][4]), B;
boost::multi_array<int,3> C;
resize_from_MultiArray(B,A);
#if 0
resize_from_MultiArray(C,A); // Compile-time error
#endif
std::cout << B.shape()[0] << ", " << B.shape()[1] << '\n';
}

View File

@@ -429,12 +429,12 @@ public:
std::transform(new_array.index_base_list_.begin(),
new_array.index_base_list_.end(),
min_extents.begin(),new_idxes.ranges_.begin(),
min_extents.begin(),old_idxes.ranges_.begin(),
detail::multi_array::populate_index_ranges());
std::transform(this->index_base_list_.begin(),
this->index_base_list_.end(),
min_extents.begin(),old_idxes.ranges_.begin(),
min_extents.begin(),new_idxes.ranges_.begin(),
detail::multi_array::populate_index_ranges());
// Build same-shape views of the two arrays

View File

@@ -431,52 +431,19 @@ protected:
index offset = 0;
size_type dim = 0;
for (size_type n = 0; n != NumDims; ++n) {
// Use array specs and input specs to produce real specs.
const index default_start = index_bases[n];
const index default_finish = default_start+extents[n];
const index_range& current_range = indices.ranges_[n];
index start = current_range.get_start(default_start);
index finish = current_range.get_finish(default_finish);
index stride = current_range.stride();
BOOST_ASSERT(stride != 0);
index index_factor = current_range.stride();
index len = (finish - start + (index_factor - 1)) / index_factor;
// An index range indicates a half-open strided interval
// [start,finish) (with stride) which faces upward when stride
// is positive and downward when stride is negative,
// RG: The following code for calculating length suffers from
// some representation issues: if finish-start cannot be represented as
// by type index, then overflow may result.
index len;
if ((finish - start) / stride < 0) {
// [start,finish) is empty according to the direction imposed by
// the stride.
len = 0;
} else {
// integral trick for ceiling((finish-start) / stride)
// taking into account signs.
index shrinkage = stride > 0 ? 1 : -1;
len = (finish - start + (stride - shrinkage)) / stride;
}
// start marks the closed side of the range, so it must lie
// exactly in the set of legal indices
// with a special case for empty arrays
BOOST_ASSERT(index_bases[n] <= start &&
((start <= index_bases[n]+index(extents[n])) ||
(start == index_bases[n] && extents[n] == 0)));
#ifndef BOOST_DISABLE_ASSERTS
// finish marks the open side of the range, so it can go one past
// the "far side" of the range (the top if stride is positive, the bottom
// if stride is negative).
index bound_adjustment = stride < 0 ? 1 : 0;
BOOST_ASSERT(((index_bases[n] - bound_adjustment) <= finish) &&
(finish <= (index_bases[n] + index(extents[n]) - bound_adjustment)));
#endif // BOOST_DISABLE_ASSERTS
start <= index_bases[n]+index(extents[n]));
BOOST_ASSERT(index_bases[n] <= finish &&
finish <= index_bases[n]+index(extents[n]));
BOOST_ASSERT(index_factor > 0);
// the array data pointer is modified to account for non-zero
// bases during slicing (see [Garcia] for the math involved)
@@ -484,9 +451,9 @@ protected:
if (!current_range.is_degenerate()) {
// The stride for each dimension is included into the
// The index_factor for each dimension is included into the
// strides for the array_view (see [Garcia] for the math involved).
new_strides[dim] = stride * strides[n];
new_strides[dim] = index_factor * strides[n];
// calculate new extents
new_extents[dim] = len;

View File

@@ -17,10 +17,46 @@
namespace boost {
namespace detail {
namespace multi_array { // Old location for this
using boost::CollectionConcept;
}
}
namespace multi_array {
//===========================================================================
// Collection Concept
template <class Collection>
struct CollectionConcept
{
typedef typename Collection::value_type value_type;
typedef typename Collection::iterator iterator;
typedef typename Collection::const_iterator const_iterator;
typedef typename Collection::reference reference;
typedef typename Collection::const_reference const_reference;
// typedef typename Collection::pointer pointer;
typedef typename Collection::difference_type difference_type;
typedef typename Collection::size_type size_type;
void constraints() {
boost::function_requires<boost::InputIteratorConcept<iterator> >();
boost::function_requires<boost::InputIteratorConcept<const_iterator> >();
boost::function_requires<boost::CopyConstructibleConcept<value_type> >();
const_constraints(c);
i = c.begin();
i = c.end();
c.swap(c);
}
void const_constraints(const Collection& c) {
ci = c.begin();
ci = c.end();
n = c.size();
b = c.empty();
}
Collection c;
bool b;
iterator i;
const_iterator ci;
size_type n;
};
}
}
}
#endif // COLLECTION_CONCEPT_RG103101_HPP

View File

@@ -22,9 +22,9 @@
#include "boost/iterator/iterator_concepts.hpp"
namespace boost {
namespace multi_array_concepts {
namespace detail {
namespace multi_array {
//
// idgen_helper -
// This is a helper for generating index_gen instantiations with
@@ -56,8 +56,6 @@ namespace detail {
}
};
} // namespace detail
template <typename Array, std::size_t NumDims >
struct ConstMultiArrayConcept
@@ -72,14 +70,13 @@ namespace detail {
// RG - a( CollectionArchetype) when available...
a[ id ];
// Test slicing, keeping only the first dimension, losing the rest
detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
idgen_helper<NumDims-1>::call(a,idgen[range],id);
// Test slicing, keeping all dimensions.
detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
idgen_helper<NumDims-1>::call(a,idgen[range],range);
st = a.size();
st = a.num_dimensions();
st = Array::dimensionality;
st = a.num_elements();
stp = a.shape();
idp = a.strides();
@@ -136,10 +133,10 @@ namespace detail {
value_type vt = a[ id ];
// Test slicing, keeping only the first dimension, losing the rest
detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
idgen_helper<NumDims-1>::call(a,idgen[range],id);
// Test slicing, keeping all dimensions.
detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
idgen_helper<NumDims-1>::call(a,idgen[range],range);
st = a.size();
st = a.num_dimensions();
@@ -160,10 +157,10 @@ namespace detail {
// value_type vt = a[ id ];
// Test slicing, keeping only the first dimension, losing the rest
detail::idgen_helper<NumDims-1>::call(a,idgen[range],id);
idgen_helper<NumDims-1>::call(a,idgen[range],id);
// Test slicing, keeping all dimensions.
detail::idgen_helper<NumDims-1>::call(a,idgen[range],range);
idgen_helper<NumDims-1>::call(a,idgen[range],range);
st = a.size();
st = a.num_dimensions();
@@ -210,14 +207,7 @@ namespace detail {
} // namespace multi_array
namespace detail {
namespace multi_array { // Old locations for these
using boost::multi_array_concepts::ConstMultiArrayConcept;
using boost::multi_array_concepts::MutableMultiArrayConcept;
}
}
} // namespace detail
} // namespace boost

View File

@@ -19,7 +19,7 @@
// shape
//
#include "boost/type.hpp"
#include "boost/assert.hpp"
#include <cassert>
namespace boost {
namespace detail {
@@ -52,8 +52,8 @@ private:
template <typename Array1, typename Array2>
void copy_array (Array1& source, Array2& dest) {
BOOST_ASSERT(std::equal(source.shape(),source.shape()+source.num_dimensions(),
dest.shape()));
assert(std::equal(source.shape(),source.shape()+source.num_dimensions(),
dest.shape()));
// Dispatch to the proper function
typedef typename Array1::element element_type;
copy_dispatch<element_type>::

View File

@@ -31,6 +31,7 @@
#include "boost/functional.hpp"
#include "boost/limits.hpp"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <functional>
#include <numeric>
@@ -89,7 +90,7 @@ public:
explicit const_multi_array_ref(TPtr base, const ExtentList& extents) :
base_(base), storage_(c_storage_order()) {
boost::function_requires<
CollectionConcept<ExtentList> >();
detail::multi_array::CollectionConcept<ExtentList> >();
index_base_list_.assign(0);
init_multi_array_ref(extents.begin());
@@ -100,7 +101,7 @@ public:
const general_storage_order<NumDims>& so) :
base_(base), storage_(so) {
boost::function_requires<
CollectionConcept<ExtentList> >();
detail::multi_array::CollectionConcept<ExtentList> >();
index_base_list_.assign(0);
init_multi_array_ref(extents.begin());
@@ -145,7 +146,7 @@ public:
#endif // BOOST_NO_SFINAE
reindex(const BaseList& values) {
boost::function_requires<
CollectionConcept<BaseList> >();
detail::multi_array::CollectionConcept<BaseList> >();
boost::detail::multi_array::
copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
origin_offset_ =
@@ -163,10 +164,10 @@ public:
template <typename SizeList>
void reshape(const SizeList& extents) {
boost::function_requires<
CollectionConcept<SizeList> >();
BOOST_ASSERT(num_elements_ ==
std::accumulate(extents.begin(),extents.end(),
size_type(1),std::multiplies<size_type>()));
detail::multi_array::CollectionConcept<SizeList> >();
assert(num_elements_ ==
std::accumulate(extents.begin(),extents.end(),
size_type(1),std::multiplies<size_type>()));
std::copy(extents.begin(),extents.end(),extent_list_.begin());
this->compute_strides(stride_list_,extent_list_,storage_);
@@ -210,7 +211,7 @@ public:
template <typename IndexList>
const element& operator()(IndexList indices) const {
boost::function_requires<
CollectionConcept<IndexList> >();
detail::multi_array::CollectionConcept<IndexList> >();
return super_type::access_element(boost::type<const element&>(),
indices,origin(),
shape(),strides(),index_bases());
@@ -448,7 +449,7 @@ public:
explicit multi_array_ref(T* base, const ExtentList& extents) :
super_type(base,extents) {
boost::function_requires<
CollectionConcept<ExtentList> >();
detail::multi_array::CollectionConcept<ExtentList> >();
}
template <class ExtentList>
@@ -456,7 +457,7 @@ public:
const general_storage_order<NumDims>& so) :
super_type(base,extents,so) {
boost::function_requires<
CollectionConcept<ExtentList> >();
detail::multi_array::CollectionConcept<ExtentList> >();
}
@@ -478,13 +479,13 @@ public:
template <typename ConstMultiArray>
multi_array_ref& operator=(const ConstMultiArray& other) {
function_requires<
multi_array_concepts::
detail::multi_array::
ConstMultiArrayConcept<ConstMultiArray,NumDims> >();
// make sure the dimensions agree
BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
assert(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy
std::copy(other.begin(),other.end(),this->begin());
return *this;
@@ -494,10 +495,9 @@ public:
if (&other != this) {
// make sure the dimensions agree
BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
BOOST_ASSERT(std::equal(other.shape(),
other.shape()+this->num_dimensions(),
this->shape()));
assert(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy
std::copy(other.begin(),other.end(),this->begin());
}
@@ -511,7 +511,7 @@ public:
template <class IndexList>
element& operator()(const IndexList& indices) {
boost::function_requires<
CollectionConcept<IndexList> >();
detail::multi_array::CollectionConcept<IndexList> >();
return super_type::access_element(boost::type<element&>(),
indices,origin(),
this->shape(),this->strides(),
@@ -578,7 +578,7 @@ public:
template <class IndexList>
const element& operator()(const IndexList& indices) const {
boost::function_requires<
CollectionConcept<IndexList> >();
detail::multi_array::CollectionConcept<IndexList> >();
return super_type::operator()(indices);
}

View File

@@ -80,7 +80,7 @@ public:
template <typename IndexList>
const element& operator()(const IndexList& indices) const {
boost::function_requires<
CollectionConcept<IndexList> >();
detail::multi_array::CollectionConcept<IndexList> >();
return super_type::access_element(boost::type<const element&>(),
indices,origin(),
shape(),strides(),index_bases());
@@ -231,13 +231,13 @@ public:
// Assignment from other ConstMultiArray types.
template <typename ConstMultiArray>
sub_array& operator=(const ConstMultiArray& other) {
function_requires< boost::multi_array_concepts::ConstMultiArrayConcept<
function_requires< boost::detail::multi_array::ConstMultiArrayConcept<
ConstMultiArray, NumDims> >();
// make sure the dimensions agree
BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
assert(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy
std::copy(other.begin(),other.end(),begin());
return *this;
@@ -247,10 +247,9 @@ public:
sub_array& operator=(const sub_array& other) {
if (&other != this) {
// make sure the dimensions agree
BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
BOOST_ASSERT(std::equal(other.shape(),
other.shape()+this->num_dimensions(),
this->shape()));
assert(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy
std::copy(other.begin(),other.end(),begin());
}
@@ -288,7 +287,7 @@ public:
template <class IndexList>
element& operator()(const IndexList& indices) {
boost::function_requires<
CollectionConcept<IndexList> >();
detail::multi_array::CollectionConcept<IndexList> >();
return super_type::access_element(boost::type<element&>(),
indices,origin(),
this->shape(),this->strides(),
@@ -323,7 +322,7 @@ public:
template <class IndexList>
const element& operator()(const IndexList& indices) const {
boost::function_requires<
CollectionConcept<IndexList> >();
detail::multi_array::CollectionConcept<IndexList> >();
return super_type::operator()(indices);
}

View File

@@ -81,7 +81,7 @@ public:
#endif
reindex(const BaseList& values) {
boost::function_requires<
CollectionConcept<BaseList> >();
detail::multi_array::CollectionConcept<BaseList> >();
boost::detail::multi_array::
copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
origin_offset_ =
@@ -119,7 +119,7 @@ public:
template <typename IndexList>
const element& operator()(IndexList indices) const {
boost::function_requires<
CollectionConcept<IndexList> >();
detail::multi_array::CollectionConcept<IndexList> >();
return super_type::access_element(boost::type<const element&>(),
indices,origin(),
shape(),strides(),index_bases());
@@ -244,7 +244,10 @@ public: // should be protected
// Calculate the array size
num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(),
size_type(1),std::multiplies<size_type>());
size_type(1),std::multiplies<size_type>());
#if 0
assert(num_elements_ != 0);
#endif
}
typedef boost::array<size_type,NumDims> size_list;
@@ -297,13 +300,13 @@ public:
template <typename ConstMultiArray>
multi_array_view& operator=(const ConstMultiArray& other) {
function_requires<
boost::multi_array_concepts::
boost::detail::multi_array::
ConstMultiArrayConcept<ConstMultiArray,NumDims> >();
// make sure the dimensions agree
BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
assert(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy
std::copy(other.begin(),other.end(),begin());
return *this;
@@ -313,10 +316,9 @@ public:
multi_array_view& operator=(const multi_array_view& other) {
if (&other != this) {
// make sure the dimensions agree
BOOST_ASSERT(other.num_dimensions() == this->num_dimensions());
BOOST_ASSERT(std::equal(other.shape(),
other.shape()+this->num_dimensions(),
this->shape()));
assert(other.num_dimensions() == this->num_dimensions());
assert(std::equal(other.shape(),other.shape()+this->num_dimensions(),
this->shape()));
// iterator-based copy
std::copy(other.begin(),other.end(),begin());
}
@@ -328,7 +330,7 @@ public:
template <class IndexList>
element& operator()(const IndexList& indices) {
boost::function_requires<
CollectionConcept<IndexList> >();
detail::multi_array::CollectionConcept<IndexList> >();
return super_type::access_element(boost::type<element&>(),
indices,origin(),
this->shape(),this->strides(),
@@ -392,7 +394,7 @@ public:
template <class IndexList>
const element& operator()(const IndexList& indices) const {
boost::function_requires<
CollectionConcept<IndexList> >();
detail::multi_array::CollectionConcept<IndexList> >();
return super_type::operator()(indices);
}

View File

@@ -37,15 +37,11 @@ test-suite multi_array
[ run assign.cpp ../../test/build//boost_test_exec_monitor ]
[ run assign_to_array.cpp ../../test/build//boost_test_exec_monitor ]
[ run index_bases.cpp ../../test/build//boost_test_exec_monitor ]
[ run storage_order_convert.cpp ../../test/build//boost_test_exec_monitor ]
[ run storage_order.cpp ../../test/build//boost_test_exec_monitor ]
[ run reshape.cpp ../../test/build//boost_test_exec_monitor ]
[ run range1.cpp ../../test/build//boost_test_exec_monitor ]
[ run idxgen1.cpp ../../test/build//boost_test_exec_monitor ]
[ run stl_interaction.cpp ../../test/build//boost_test_exec_monitor ]
[ run resize.cpp ../../test/build//boost_test_exec_monitor ]
[ run assert.cpp ../../test/build//boost_test_exec_monitor ]
[ run reverse_view.cpp ../../test/build//boost_test_exec_monitor ]
[ compile concept_checks.cpp ]
;

View File

@@ -1,51 +0,0 @@
// Copyright 2007 The Trustees of Indiana University.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Boost.MultiArray Library
// Authors: Ronald Garcia
// Jeremy Siek
// Andrew Lumsdaine
// See http://www.boost.org/libs/multi_array for documentation.
//
// Using the BOOST.ASSERT mechanism to replace library assertions
// with exceptions
//
#include "boost/test/minimal.hpp"
#define BOOST_ENABLE_ASSERT_HANDLER
#include "boost/multi_array.hpp" // includes assert.hpp
#include <stdexcept>
namespace boost {
void assertion_failed(char const* expr, char const* function,
char const* file, long line) {
throw std::runtime_error(expr);
}
} // namespace boost
using namespace boost;
int
test_main(int,char*[]) {
typedef multi_array<int,2> array_t;
array_t A(extents[2][2]);
array_t B(extents[3][3]);
try {
A = B;
BOOST_ERROR("did not throw an exception");
} catch (std::runtime_error&) {
//...all good
}
return boost::exit_success;
}

View File

@@ -1,6 +1,6 @@
// Copyright 2002 The Trustees of Indiana University.
// Use, modification and distribution is subject to the Boost Software
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -10,9 +10,9 @@
// Andrew Lumsdaine
// See http://www.boost.org/libs/multi_array for documentation.
//
//
// assign.cpp - Test out operator=() on the different types
//
//
//
#include "generative_tests.hpp"
#include "boost/array.hpp"
@@ -32,7 +32,7 @@ bool equal(const ArrayA& A, const ArrayB& B)
typename ArrayA::const_iterator ia;
typename ArrayB::const_iterator ib = B.begin();
for (ia = A.begin(); ia != A.end(); ++ia, ++ib)
if (!::equal(*ia, *ib))
if (!equal(*ia, *ib))
return false;
return true;
}
@@ -59,7 +59,7 @@ void access(Array& A, const mutable_array_tag&) {
A = filler;
BOOST_CHECK(::equal(A,filler));
BOOST_CHECK(equal(A,filler));
++tests_run;
}

View File

@@ -1,6 +1,6 @@
// Copyright 2002 The Trustees of Indiana University.
// Use, modification and distribution is subject to the Boost Software
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -10,10 +10,10 @@
// Andrew Lumsdaine
// See http://www.boost.org/libs/multi_array for documentation.
//
//
// assign_to_array.cpp - multi_array should be constructible from any other
// array type in the library.
//
//
//
#include "generative_tests.hpp"
#include "boost/array.hpp"
@@ -33,7 +33,7 @@ bool equal(const ArrayA& A, const ArrayB& B)
typename ArrayA::const_iterator ia;
typename ArrayB::const_iterator ib = B.begin();
for (ia = A.begin(); ia != A.end(); ++ia, ++ib)
if (!::equal(*ia, *ib))
if (!equal(*ia, *ib))
return false;
return true;
}
@@ -50,7 +50,7 @@ template <typename Array>
void access(Array& A, const const_array_tag&) {
typedef boost::multi_array<int,3> array3;
array3 acopy(A);
BOOST_CHECK(::equal(acopy,A));
BOOST_CHECK(equal(acopy,A));
++tests_run;
}

View File

@@ -20,8 +20,8 @@
#include "boost/multi_array.hpp"
#include "boost/cstdlib.hpp"
#include "boost/test/minimal.hpp"
#define BOOST_INCLUDE_MAIN
#include "boost/test/test_tools.hpp"
#include "boost/array.hpp"
@@ -38,28 +38,28 @@ test_main(int,char*[])
typedef array::const_subarray<ndims>::type const_subarray;
boost::function_requires<
boost::multi_array_concepts::ConstMultiArrayConcept<array,ndims> >();
boost::detail::multi_array::ConstMultiArrayConcept<array,ndims> >();
boost::function_requires<
boost::multi_array_concepts::ConstMultiArrayConcept<array_ref,ndims> >();
boost::detail::multi_array::ConstMultiArrayConcept<array_ref,ndims> >();
boost::function_requires<
boost::multi_array_concepts::ConstMultiArrayConcept<const_array_ref,ndims> >();
boost::detail::multi_array::ConstMultiArrayConcept<const_array_ref,ndims> >();
boost::function_requires<
boost::multi_array_concepts::ConstMultiArrayConcept<array_view,ndims> >();
boost::detail::multi_array::ConstMultiArrayConcept<array_view,ndims> >();
boost::function_requires<
boost::multi_array_concepts::ConstMultiArrayConcept<const_array_view,ndims> >();
boost::detail::multi_array::ConstMultiArrayConcept<const_array_view,ndims> >();
boost::function_requires<
boost::multi_array_concepts::ConstMultiArrayConcept<subarray,ndims> >();
boost::detail::multi_array::ConstMultiArrayConcept<subarray,ndims> >();
boost::function_requires<
boost::multi_array_concepts::ConstMultiArrayConcept<const_subarray,ndims> >();
boost::detail::multi_array::ConstMultiArrayConcept<const_subarray,ndims> >();
boost::function_requires<
boost::multi_array_concepts::MutableMultiArrayConcept<array,ndims> >();
boost::detail::multi_array::MutableMultiArrayConcept<array,ndims> >();
boost::function_requires<
boost::multi_array_concepts::MutableMultiArrayConcept<array_ref,ndims> >();
boost::detail::multi_array::MutableMultiArrayConcept<array_ref,ndims> >();
boost::function_requires<
boost::multi_array_concepts::MutableMultiArrayConcept<array_view,ndims> >();
boost::detail::multi_array::MutableMultiArrayConcept<array_view,ndims> >();
boost::function_requires<
boost::multi_array_concepts::MutableMultiArrayConcept<subarray,ndims> >();
boost::detail::multi_array::MutableMultiArrayConcept<subarray,ndims> >();
return 0;
}

View File

@@ -1,6 +1,6 @@
// Copyright 2002 The Trustees of Indiana University.
// Use, modification and distribution is subject to the Boost Software
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -25,8 +25,8 @@ void check_shape(const double&, std::size_t*, int*, unsigned int)
{}
template <class Array>
void check_shape(const Array& A,
std::size_t* sizes,
void check_shape(const Array& A,
std::size_t* sizes,
int* strides,
unsigned int num_elements)
{
@@ -49,7 +49,7 @@ bool equal(const ArrayA& A, const ArrayB& B)
typename ArrayA::const_iterator ia;
typename ArrayB::const_iterator ib = B.begin();
for (ia = A.begin(); ia != A.end(); ++ia, ++ib)
if (!::equal(*ia, *ib))
if (!equal(*ia, *ib))
return false;
return true;
}
@@ -76,7 +76,7 @@ test_main(int, char*[])
double* ptr = 0;
boost::multi_array_ref<double,3> B(ptr,sizes);
check_shape(B, &sizes[0], strides, num_elements);
const double* cptr = ptr;
boost::const_multi_array_ref<double,3> C(cptr,sizes);
check_shape(C, &sizes[0], strides, num_elements);
@@ -132,7 +132,7 @@ test_main(int, char*[])
A.assign(vals.begin(),vals.end());
boost::multi_array<double, 3> B(A);
check_shape(B, &sizes[0], strides, num_elements);
BOOST_CHECK(::equal(A, B));
BOOST_CHECK(equal(A, B));
double ptr[27];
boost::multi_array_ref<double, 3> C(ptr,sizes);
@@ -182,7 +182,7 @@ test_main(int, char*[])
A.assign(vals.begin(),vals.end());
B = A;
check_shape(B, &sizes[0], strides, num_elements);
BOOST_CHECK(::equal(A, B));
BOOST_CHECK(equal(A, B));
double ptr1[27];
double ptr2[27];
@@ -190,12 +190,12 @@ test_main(int, char*[])
C.assign(vals.begin(),vals.end());
D = C;
check_shape(D, &sizes[0], strides, num_elements);
BOOST_CHECK(::equal(C,D));
BOOST_CHECK(equal(C,D));
}
// subarray value_type is multi_array
{
{
typedef boost::multi_array<double,3> array;
typedef array::size_type size_type;
size_type num_elements = 27;
@@ -209,8 +209,8 @@ test_main(int, char*[])
subarray::value_type C = B[0];
// should comparisons between the types work?
BOOST_CHECK(::equal(A[1][0],C));
BOOST_CHECK(::equal(B[0],C));
BOOST_CHECK(equal(A[1][0],C));
BOOST_CHECK(equal(B[0],C));
}
return boost::exit_success;
}

View File

@@ -22,7 +22,6 @@
#include "boost/array.hpp"
#include "boost/type.hpp"
#include "boost/cstdlib.hpp"
int
test_main(int,char*[])

View File

@@ -114,14 +114,6 @@ int test_main(int,char*[]) {
}
}
// Resizing that changes index bases too (impl bug caused an assert)
{
typedef boost::multi_array<int, 1> ar_t;
typedef ar_t::extent_range range;
ar_t ar;
ar.resize(boost::extents[range(-3, 3)]);
}
return boost::exit_success;
}

View File

@@ -1,43 +0,0 @@
// Copyright 2002 The Trustees of Indiana University.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Boost.MultiArray Library
// Authors: Ronald Garcia
// Jeremy Siek
// Andrew Lumsdaine
// See http://www.boost.org/libs/multi_array for documentation.
//
// reverse_view.cpp - a small test of creating a view with negative strides
//
#include "boost/multi_array.hpp"
#include "boost/test/minimal.hpp"
#include "boost/array.hpp"
int
test_main(int,char*[])
{
using namespace boost;
// One-dimensional array with views
double data[] = { 1, 2, 3, 4 };
double rdata[] = { 4, 3, 2, 1 };
typedef multi_array< double, 1 > array;
array A(extents[4]);
A.assign(data,data+4);
typedef array::index_range range;
array::array_view<1>::type B = A[indices[range(3, -1, -1)]];
for(multi_array_types::size_type i = 0; i != B.size(); ++i) {
BOOST_CHECK(B[i] == rdata[i]);
}
return boost::exit_success;
}

View File

@@ -90,28 +90,6 @@ void test_views(Array& A, const ViewTraits&) {
BOOST_CHECK(B(elmts) == A[idx0+i][idx1+1][idx2+j*2]);
}
}
// Flip the third dimension
{
typename ViewTraits::array_view3 B = A[
indices[range(idx0+0,idx0+2)]
[range(idx1+0,idx1+2)]
[range(idx2+2,idx2+0,-1)]
];
// typename ViewTraits::array_view3 B =
// A[indices[range(idx0+0,idx0+2)][idx1+1][range(idx2+0,idx2+4,2)]];
for (index i = 0; i != 2; ++i)
for (index j = 0; j != 2; ++j)
for (index k = 0; k != 2; ++k) {
BOOST_CHECK(B[i][j][k] == A[idx0+i][idx1+j][idx2+2-k]);
boost::array<index,3> elmts;
elmts[0]=i; elmts[1]=j; elmts[2]=k;
BOOST_CHECK(B(elmts) == A[idx0+i][idx1+j][idx2+2-k]);
}
}
++tests_run;
}

View File

@@ -31,9 +31,9 @@ test_main(int,char*[]) {
general_storage_order<5> fortran_storage(fortran_ordering.begin(),
ascending.begin());
BOOST_CHECK(c_storage == (general_storage_order<5>) c_storage_order());
BOOST_CHECK(fortran_storage ==
BOOST_TEST(c_storage == (general_storage_order<5>) c_storage_order());
BOOST_TEST(fortran_storage ==
(general_storage_order<5>) fortran_storage_order());
return boost::exit_success;
return boost::report_errors();
}