mirror of
https://github.com/boostorg/multi_array.git
synced 2026-01-25 06:22:10 +00:00
Compare commits
3 Commits
boost-1.54
...
boost-1.32
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7117ea2a2e | ||
|
|
909321760e | ||
|
|
5685a3a2ce |
@@ -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 © 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>
|
||||
|
||||
@@ -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>
|
||||
@@ -70,7 +70,7 @@ is so nonintuitive that at least one implementation erroneously assigns
|
||||
not return true references: there is the often cited example of disk-based
|
||||
collections.
|
||||
</p><p>Another example is a counting iterator, an iterator the returns a sequence of
|
||||
integers when incremented and dereferenced (see <a href="http://www.boost.org/libs/iterator/doc/counting_iterator.html"><tt>boost::counting_iterator</tt></a>).
|
||||
integers when incremented and dereferenced (see <a href="http://www.boost.org/libs/utility/counting_iterator.htm"><tt>boost::counting_iterator</tt></a>).
|
||||
There are two ways to implement this iterator, 1) make the <tt>reference</tt>
|
||||
type be a true reference (a reference to an integer data member of the counting
|
||||
iterator) or 2) make the <tt>reference</tt> type be the same as the
|
||||
@@ -79,7 +79,7 @@ iterator) or 2) make the <tt>reference</tt> type be the same as the
|
||||
2) is therefore a better choice, but then we have a counting iterator that
|
||||
cannot be a random access iterator.
|
||||
</p><p>Yet another example is a transform iterator, an iterator adaptor that applies
|
||||
a unary function object to the dereference value of the wrapped iterator (see <a href="http://www.boost.org/libs/iterator/doc/transform_iterator.html"><tt>boost::transform_iterator</tt></a>).
|
||||
a unary function object to the dereference value of the wrapped iterator (see <a href="http://www.boost.org/libs/utility/transform_iterator.htm"><tt>boost::transform_iterator</tt></a>).
|
||||
For unary functions such as <tt>std::times</tt> the return type of
|
||||
<tt>operator*</tt> clearly needs to be the <tt>result_type</tt> of the function
|
||||
object, which is typically not a reference. However, with the current iterator
|
||||
@@ -794,4 +794,4 @@ Comparable</a> where <tt><</tt> is a total ordering
|
||||
|
||||
--><!-- LocalWords: Postdecrement
|
||||
|
||||
--></body></html>
|
||||
--></body></html>
|
||||
1067
doc/reference.html
1067
doc/reference.html
File diff suppressed because it is too large
Load Diff
@@ -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 © 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
|
||||
|
||||
115
doc/user.html
115
doc/user.html
@@ -70,8 +70,6 @@ available (and described below).
|
||||
|
||||
<li><a href="#sec_reshape">Changing an Array's Shape</a>
|
||||
|
||||
<li><a href="#sec_resize">Resizing an Array</a>
|
||||
|
||||
<li><a href="#sec_concepts">MultiArray Concept</a>
|
||||
|
||||
<li><a href="#sec_testcases">Test Cases</a>
|
||||
@@ -156,20 +154,22 @@ main () {
|
||||
<a name="sec_components"></a>
|
||||
<h2>MultiArray Components</h2>
|
||||
|
||||
Boost.MultiArray's implementation (boost/multi_array.hpp) provides three user-level class templates:
|
||||
Boost.MultiArray provides three user-level class templates:
|
||||
|
||||
<ol>
|
||||
<li><a href="./reference.html#multi_array"><tt>multi_array</tt></a>,
|
||||
<li><a href="./reference.html#multi_array"><tt>multi_array</tt></a> -
|
||||
defined in "boost/multi_array.hpp",
|
||||
|
||||
<li><a href="./reference.html#multi_array_ref"><tt>multi_array_ref</tt></a>, and
|
||||
<li><a href="./reference.html#multi_array_ref"><tt>multi_array_ref</tt></a> -
|
||||
defined in "boost/multi_array_ref.hpp", and
|
||||
|
||||
<li><a href="./reference.html#const_multi_array_ref"><tt>const_multi_array_ref</tt></a>
|
||||
<li><a href="./reference.html#const_multi_array_ref"><tt>const_multi_array_ref</tt></a> -
|
||||
defined in "boost/multi_array_ref.hpp"
|
||||
</ol>
|
||||
|
||||
<tt>multi_array</tt> is a container template. When instantiated, it
|
||||
allocates space for the number of elements corresponding to the
|
||||
dimensions specified at construction time. A <tt>multi_array</tt> may
|
||||
also be default constructed and resized as needed.
|
||||
dimensions specified at construction time.
|
||||
|
||||
<p>
|
||||
<tt>multi_array_ref</tt> adapts an existing array of data to provide
|
||||
@@ -185,8 +185,8 @@ thus wrap pointers of type <i>T const*</i>.
|
||||
The three components exhibit very similar behavior. Aside from
|
||||
constructor parameters, <tt>multi_array</tt> and
|
||||
<tt>multi_array_ref</tt> export the same interface.
|
||||
<tt>const_multi_array_ref</tt> provides only the constness-preserving
|
||||
portions of the <tt>multi_array_ref</tt> interface.
|
||||
<tt>const_multi_array_ref</tt> provides only the const portions
|
||||
of the <tt>multi_array_ref</tt> interface.
|
||||
|
||||
<a name="sec_assignment"></a>
|
||||
<h2>Construction and Assignment</h2>
|
||||
@@ -232,9 +232,8 @@ void my_function() {
|
||||
|
||||
<a name="sec_dimensions"></a>
|
||||
<h2>Specifying Array Dimensions</h2>
|
||||
When creating most of the Boost.MultiArray components, it is necessary
|
||||
to specify both the number of dimensions and the extent of each
|
||||
(<tt>boost::multi_array</tt> also provides a default constructor).
|
||||
When creating one of the Boost.MultiArray components, it is necessary
|
||||
to specify both the number of dimensions and the extent of each.
|
||||
Though the number of dimensions is always specified as a template
|
||||
parameter, two separate mechanisms have been provided to specify the
|
||||
extent of each.
|
||||
@@ -255,9 +254,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
|
||||
@@ -303,14 +300,6 @@ from the Collection for the N dimensions of the container.
|
||||
This can be useful for writing dimension-independent code, and under
|
||||
some compilers may yield higher performance than <tt>operator[].</tt>
|
||||
|
||||
<p>
|
||||
By default, both of the above element access methods perform range
|
||||
checking. If a supplied index is out of the range defined for an
|
||||
array, an assertion will abort the program. To disable range
|
||||
checking (for performance reasons in production releases), define
|
||||
the <tt>BOOST_DISABLE_ASSERTS</tt> preprocessor macro prior to
|
||||
including multi_array.hpp in your application.
|
||||
|
||||
<a name="sec_views"></a>
|
||||
<h2>Creating Views</h2>
|
||||
Boost.MultiArray provides the facilities for creating a sub-view of an
|
||||
@@ -318,17 +307,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 +326,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<3>::type myview =
|
||||
myarray[ boost::indices[range(0,2)][range(1,3)][range(0,4,2)] ];
|
||||
|
||||
@@ -368,7 +352,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<2>::type myview =
|
||||
myarray[ indices[range(0,2)][1][range(0,4,2)] ];
|
||||
@@ -389,7 +373,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 +393,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 +443,7 @@ indices will remain zero-based.
|
||||
<blockquote>
|
||||
<pre>
|
||||
typedef boost::multi_array<double,3> 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 +473,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<double, 3> 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 +498,7 @@ reset the bases. To set all bases to the same value, use the
|
||||
<blockquote>
|
||||
<pre>
|
||||
typedef boost::multi_array<double, 3> array_type;
|
||||
typedef array_type::extent_range range;
|
||||
|
||||
array_type::extent_gen extents;
|
||||
|
||||
@@ -533,6 +515,7 @@ An alternative is to set each base separately using the
|
||||
<blockquote>
|
||||
<pre>
|
||||
typedef boost::multi_array<double, 3> array_type;
|
||||
typedef array_type::extent_range range;
|
||||
|
||||
array_type::extent_gen extents;
|
||||
|
||||
@@ -556,6 +539,7 @@ elements contained remains the same.
|
||||
<blockquote>
|
||||
<pre>
|
||||
typedef boost::multi_array<double, 3> array_type;
|
||||
typedef array_type::extent_range range;
|
||||
|
||||
array_type::extent_gen extents;
|
||||
array_type A(extents[2][3][4]);
|
||||
@@ -567,35 +551,6 @@ elements contained remains the same.
|
||||
<p>
|
||||
Note that reshaping an array does not affect the indexing.
|
||||
|
||||
<a name="sec_resize"></a>
|
||||
<h2>Resizing an Array</h2>
|
||||
|
||||
The <tt>boost::multi_array</tt> class provides an element-preserving
|
||||
resize operation. The number of dimensions must remain the same, but
|
||||
the extent of each dimension may be increased and decreased as
|
||||
desired. When an array is made strictly larger, the existing elements
|
||||
will be preserved by copying them into the new underlying memory and
|
||||
subsequently destructing the elements in the old underlying memory.
|
||||
Any new elements in the array are default constructed. However, if
|
||||
the new array size shrinks some of the dimensions, some elements will
|
||||
no longer be available.
|
||||
|
||||
<h3>Example</h3>
|
||||
<blockquote>
|
||||
<pre>
|
||||
typedef boost::multi_array<int, 3> array_type;
|
||||
|
||||
array_type::extent_gen extents;
|
||||
array_type A(extents[3][3][3]);
|
||||
A[0][0][0] = 4;
|
||||
A[2][2][2] = 5;
|
||||
A.resize(extents[2][3][4]);
|
||||
assert(A[0][0][0] == 4);
|
||||
// A[2][2][2] is no longer valid.
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<a name="sec_concepts"></a>
|
||||
<h2>MultiArray Concept</h2>
|
||||
Boost.MultiArray defines and uses the
|
||||
@@ -627,7 +582,7 @@ cases can be found <a href="./test_cases.html">here</a>.
|
||||
arrays.
|
||||
|
||||
This library is analogous to
|
||||
<a href="../../array/index.html">boost::array</a> in that it augments C style N-dimensional
|
||||
<a href="">boost::array</a> in that it augments C style N-dimensional
|
||||
arrays, as <tt>boost::array</tt> does for C one-dimensional arrays.
|
||||
|
||||
|
||||
@@ -638,7 +593,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++.
|
||||
|
||||
@@ -669,7 +624,9 @@ arrays, as <tt>boost::array</tt> does for C one-dimensional arrays.
|
||||
<a href="mailto:garcia@.cs.indiana.edu">Ronald Garcia</a>
|
||||
</address>
|
||||
<!-- Created: Fri Jun 29 10:53:07 EST 2001 -->
|
||||
<!-- hhmts start -->Last modified: Tue Feb 7 17:15:50 EST 2006 <!-- hhmts end -->
|
||||
<!-- hhmts start -->
|
||||
Last modified: Tue Sep 10 11:14:15 EST 2002
|
||||
<!-- hhmts end -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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><boost/multi_array/concept_checks.hpp></literal>.
|
||||
</para>
|
||||
|
||||
|
||||
<sect2><title>Notation</title>
|
||||
<para>What follows are the descriptions of symbols that will be used
|
||||
@@ -132,8 +124,8 @@ to describe the MultiArray interface.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>a,b</literal></entry>
|
||||
<entry>Objects of type <literal>A</literal></entry>
|
||||
<entry><literal>a</literal></entry>
|
||||
<entry>An object of type <literal>A</literal></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>NumDims</literal></entry>
|
||||
@@ -248,17 +240,15 @@ iterators. It is the same type as
|
||||
<entry>
|
||||
This is an iterator over the values of <literal>A</literal>.
|
||||
If <literal>NumDims == 1</literal>, then it models
|
||||
<ulink url="http://www.boost.org/doc/html/RandomAccessIterator.html">
|
||||
<ulink url="http://www.sgi.com/tech/stl/RandomAccessIterator.html">
|
||||
<literal>Random Access Iterator</literal></ulink>.
|
||||
Otherwise it models
|
||||
<ulink url="./iterator_categories.html#concept_RandomAccessTraversalIterator">
|
||||
Random Access Traversal Iterator</ulink>,
|
||||
<ulink url="./iterator_categories.html#concept_ReadableIterator">
|
||||
Readable Iterator</ulink>,
|
||||
Readable Iterator</ulink>, and
|
||||
<ulink url="./iterator_categories.html#concept_WritableIterator">
|
||||
Writable Iterator</ulink>, and
|
||||
<ulink url="http://www.boost.org/doc/html/OutputIterator.html">
|
||||
<literal>Output Iterator</literal></ulink>.
|
||||
Writable Iterator</ulink>.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
@@ -395,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>
|
||||
@@ -977,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<Dims,Ranges+1>::type</literal>
|
||||
<entry><literal>gen_type<Dims,Ranges>::type</literal>
|
||||
</entry>
|
||||
<entry>Returns a new object containing all previous
|
||||
<classname>index_range</classname> objects in addition to a degenerate
|
||||
|
||||
@@ -33,26 +33,26 @@ 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:
|
||||
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;
|
||||
@@ -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 <typename ExtentList>
|
||||
explicit const_multi_array_ref(TPtr data,
|
||||
explicit const_multi_array_ref(const element* data,
|
||||
const ExtentList& sizes,
|
||||
const storage_order& 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>
|
||||
|
||||
71
doc/xml/main.xml
Normal file
71
doc/xml/main.xml
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version='1.0' encoding="ISO-Latin-1" ?>
|
||||
<!DOCTYPE article
|
||||
PUBLIC "-//OASIS//DTD DocBook XML MathML V4.1.2//EN"
|
||||
"/u/garcia/docbook-xml/docbookx.dtd"
|
||||
>
|
||||
|
||||
<article>
|
||||
<articleinfo>
|
||||
<title>Class template <literal>multi_array</literal></title>
|
||||
<author>
|
||||
<surname>Garcia</surname><firstname>Ronald</firstname>
|
||||
<affiliation>
|
||||
<orgname>Indiana University</orgname>
|
||||
<orgdiv>Open Systems Lab</orgdiv>
|
||||
</affiliation>
|
||||
</author>
|
||||
<orgname>BOOST</orgname>
|
||||
<copyright>
|
||||
<year>2002</year>
|
||||
<holder>Ronald Garcia</holder>
|
||||
</copyright>
|
||||
<legalnotice>
|
||||
<para>blah blah legal blah blah</para>
|
||||
</legalnotice>
|
||||
<revhistory>
|
||||
<revision>
|
||||
<revnumber>1</revnumber>
|
||||
<date>1/18/2002</date>
|
||||
<revdescription>
|
||||
<simpara>Initial Revision.</simpara>
|
||||
</revdescription>
|
||||
</revision>
|
||||
</revhistory>
|
||||
</articleinfo>
|
||||
|
||||
|
||||
Boost.MultiArray
|
||||
|
||||
Headers boost/multi_array.hpp and
|
||||
boost/multi_array_ref.hpp
|
||||
|
||||
|
||||
Motivation
|
||||
Examples
|
||||
Tutorial
|
||||
Reference Manual
|
||||
Comparison to Other Libraries
|
||||
Performance
|
||||
Portability
|
||||
Design Rationale
|
||||
Acknowledgements
|
||||
FAQ
|
||||
|
||||
|
||||
Motivation
|
||||
|
||||
Examples
|
||||
|
||||
*Insert examples here*
|
||||
|
||||
|
||||
(External Tutorial)
|
||||
(External Reference Manual)
|
||||
|
||||
|
||||
Comparison to Other Libraries
|
||||
Performance
|
||||
Portability
|
||||
Design Rationale
|
||||
Acknowledgements
|
||||
FAQ
|
||||
@@ -36,21 +36,21 @@ class multi_array {
|
||||
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
|
||||
@@ -136,9 +136,7 @@ public:
|
||||
template <typename SizeList>
|
||||
void reshape(const SizeList& sizes)
|
||||
template <typename BaseList> void reindex(const BaseList& values);
|
||||
void reindex(index value);
|
||||
template <typename ExtentList>
|
||||
multi_array& resize(const ExtentList& extents);
|
||||
void reindex(index value);
|
||||
multi_array& resize(extents_tuple& extents);
|
||||
};
|
||||
]]>
|
||||
@@ -329,20 +327,15 @@ O(<literal>this->num_elements()</literal>) calls to
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<programlisting><![CDATA[multi_array& resize(extent_gen::gen_type<NumDims>::type extents);
|
||||
template <typename ExtentList>
|
||||
multi_array& resize(const ExtentList& extents);
|
||||
]]>
|
||||
<programlisting><![CDATA[multi_array& resize(extent_gen::gen_type<NumDims>::type ranges);]]>
|
||||
</programlisting></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This function resizes an array to the shape specified by
|
||||
<literal>extents</literal>, which is either a generated list of
|
||||
extents or a model of the <literal>Collection</literal> concept. The
|
||||
contents of the array are preserved whenever possible; if the new
|
||||
array size is smaller, then some data will be lost. Any new elements
|
||||
created by resizing the array are initialized with the
|
||||
<literal>element</literal> default constructor.
|
||||
This function resizes an array to the shape specified by
|
||||
<literal>ranges</literal>. The contents of the array are preserved
|
||||
whenever possible; if the new array size is smaller, then some data will
|
||||
be lost. Any new elements created by resizing the array are initialized with
|
||||
the <literal>element</literal> default constructor.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -50,13 +50,13 @@ brings the following declarations into scope:</para>
|
||||
<![CDATA[namespace boost {
|
||||
|
||||
namespace multi_array_types {
|
||||
typedef *unspecified* index;
|
||||
typedef *unspecified* size_type;
|
||||
typedef *unspecified* difference_type;
|
||||
typedef *unspecified* index_range;
|
||||
typedef *unspecified* extent_range;
|
||||
typedef *unspecified* index_gen;
|
||||
typedef *unspecified* extent_gen;
|
||||
typedef *implementation-defined* index;
|
||||
typedef *implementation-defined* size_type;
|
||||
typedef *implementation-defined* difference_type;
|
||||
typedef *implementation-defined* index_range;
|
||||
typedef *implementation-defined* extent_range;
|
||||
typedef *implementation-defined* index_gen;
|
||||
typedef *implementation-defined* extent_gen;
|
||||
}
|
||||
|
||||
template <typename ValueType,
|
||||
@@ -343,13 +343,13 @@ std::count_if(this->index_bases(),this->index_bases()+this->num_dimensions(),
|
||||
|
||||
<programlisting>
|
||||
<![CDATA[namespace multi_array_types {
|
||||
typedef *unspecified* index;
|
||||
typedef *unspecified* size_type;
|
||||
typedef *unspecified* difference_type;
|
||||
typedef *unspecified* index_range;
|
||||
typedef *unspecified* extent_range;
|
||||
typedef *unspecified* index_gen;
|
||||
typedef *unspecified* extent_gen;
|
||||
typedef *implementation-defined* index;
|
||||
typedef *implementation-defined* size_type;
|
||||
typedef *implementation-defined* difference_type;
|
||||
typedef *implementation-defined* index_range;
|
||||
typedef *implementation-defined* extent_range;
|
||||
typedef *implementation-defined* index_gen;
|
||||
typedef *implementation-defined* extent_gen;
|
||||
}]]>
|
||||
</programlisting>
|
||||
|
||||
@@ -488,7 +488,7 @@ typedef *implementation_defined*<0> extent_gen;
|
||||
<formalpara><title>Methods and Types</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><function>template gen_type<Ranges>::type</function></term>
|
||||
<term><function>template gen_type::<Ranges>::type</function></term>
|
||||
<listitem>
|
||||
<para>This type generator is used to specify the result of
|
||||
<literal>Ranges</literal> chained calls to
|
||||
@@ -779,20 +779,6 @@ order in which dimensions are stored.
|
||||
</para>
|
||||
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="range_checking">
|
||||
<title>Range Checking</title>
|
||||
<para>
|
||||
By default, the array access methods <literal>operator()</literal> and
|
||||
<literal>operator[]</literal> perform range
|
||||
checking. If a supplied index is out of the range defined for an
|
||||
array, an assertion will abort the program. To disable range
|
||||
checking (for performance reasons in production releases), define
|
||||
the <literal>BOOST_DISABLE_ASSERTS</literal> preprocessor macro prior to
|
||||
including multi_array.hpp in an application.
|
||||
</para>
|
||||
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
@@ -42,10 +42,9 @@ namespace boost {
|
||||
|
||||
struct populate_index_ranges {
|
||||
multi_array_types::index_range
|
||||
// RG: underscore on extent_ to stifle strange MSVC warning.
|
||||
operator()(multi_array_types::index base,
|
||||
multi_array_types::size_type extent_) {
|
||||
return multi_array_types::index_range(base,base+extent_);
|
||||
multi_array_types::size_type extent) {
|
||||
return multi_array_types::index_range(base,base+extent);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -208,7 +207,7 @@ public:
|
||||
multi_array(const multi_array& rhs) :
|
||||
super_type(rhs), allocator_(rhs.allocator_) {
|
||||
allocate_space();
|
||||
boost::detail::multi_array::copy_n(rhs.base_,rhs.num_elements(),base_);
|
||||
boost::copy_n(rhs.base_,rhs.num_elements(),base_);
|
||||
}
|
||||
|
||||
|
||||
@@ -380,30 +379,12 @@ public:
|
||||
}
|
||||
|
||||
|
||||
template <typename ExtentList>
|
||||
multi_array& resize(const ExtentList& extents) {
|
||||
boost::function_requires<
|
||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||
|
||||
typedef detail::multi_array::extent_gen<NumDims> gen_type;
|
||||
gen_type ranges;
|
||||
|
||||
for (int i=0; i != NumDims; ++i) {
|
||||
typedef typename gen_type::range range_type;
|
||||
ranges.ranges_[i] = range_type(0,extents[i]);
|
||||
}
|
||||
|
||||
return this->resize(ranges);
|
||||
}
|
||||
|
||||
|
||||
|
||||
multi_array& resize(const detail::multi_array
|
||||
::extent_gen<NumDims>& ranges) {
|
||||
|
||||
|
||||
// build a multi_array with the specs given
|
||||
multi_array new_array(ranges,this->storage_order());
|
||||
multi_array new_array(ranges);
|
||||
|
||||
|
||||
// build a view of tmp with the minimum extents
|
||||
@@ -429,12 +410,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
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
#include "boost/iterator.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace multi_array {
|
||||
|
||||
//--------------------------------------------------
|
||||
// copy_n (not part of the C++ standard)
|
||||
#if 1
|
||||
@@ -96,8 +95,7 @@ copy_n(InputIter first, Size count, OutputIter result) {
|
||||
}
|
||||
|
||||
#endif // 1
|
||||
} // namespace multi_array
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ALGORITHM_RG071801_HPP
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "boost/multi_array/storage_order.hpp"
|
||||
#include "boost/multi_array/types.hpp"
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/multi_array/concept_checks.hpp" //for ignore_unused_...
|
||||
#include "boost/mpl/eval_if.hpp"
|
||||
#include "boost/mpl/if.hpp"
|
||||
#include "boost/mpl/size_t.hpp"
|
||||
@@ -33,7 +32,7 @@
|
||||
#include "boost/iterator/reverse_iterator.hpp"
|
||||
#include "boost/static_assert.hpp"
|
||||
#include "boost/type.hpp"
|
||||
#include "boost/assert.hpp"
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
||||
@@ -81,8 +80,7 @@ class sub_array;
|
||||
template <typename T, std::size_t NumDims, typename TPtr = const T*>
|
||||
class const_sub_array;
|
||||
|
||||
template <typename T, typename TPtr, typename NumDims, typename Reference,
|
||||
typename IteratorCategory>
|
||||
template <typename T, typename TPtr, typename NumDims, typename Reference>
|
||||
class array_iterator;
|
||||
|
||||
template <typename T, std::size_t NumDims, typename TPtr = const T*>
|
||||
@@ -131,13 +129,11 @@ protected:
|
||||
Reference access(boost::type<Reference>,index idx,TPtr base,
|
||||
const size_type* extents,
|
||||
const index* strides,
|
||||
const index* index_bases) const {
|
||||
const index* index_base) const {
|
||||
|
||||
BOOST_ASSERT(idx - index_bases[0] >= 0);
|
||||
BOOST_ASSERT(size_type(idx - index_bases[0]) < extents[0]);
|
||||
// return a sub_array<T,NDims-1> proxy object
|
||||
TPtr newbase = base + idx * strides[0];
|
||||
return Reference(newbase,extents+1,strides+1,index_bases+1);
|
||||
return Reference(newbase,extents+1,strides+1,index_base+1);
|
||||
|
||||
}
|
||||
|
||||
@@ -169,14 +165,9 @@ protected:
|
||||
// used by array operator[] and iterators to get reference types.
|
||||
template <typename Reference, typename TPtr>
|
||||
Reference access(boost::type<Reference>,index idx,TPtr base,
|
||||
const size_type* extents,
|
||||
const size_type*,
|
||||
const index* strides,
|
||||
const index* index_bases) const {
|
||||
|
||||
ignore_unused_variable_warning(index_bases);
|
||||
ignore_unused_variable_warning(extents);
|
||||
BOOST_ASSERT(idx - index_bases[0] >= 0);
|
||||
BOOST_ASSERT(size_type(idx - index_bases[0]) < extents[0]);
|
||||
const index*) const {
|
||||
return *(base + idx * strides[0]);
|
||||
}
|
||||
|
||||
@@ -210,7 +201,7 @@ struct value_accessor_generator {
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1200)
|
||||
|
||||
struct eti_value_accessor
|
||||
{
|
||||
@@ -252,19 +243,7 @@ struct associated_types
|
||||
// choose value accessor ends
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Due to some imprecision in the C++ Standard,
|
||||
// MSVC 2010 is broken in debug mode: it requires
|
||||
// that an Output Iterator have output_iterator_tag in its iterator_category if
|
||||
// that iterator is not bidirectional_iterator or random_access_iterator.
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
|
||||
struct mutable_iterator_tag
|
||||
: boost::random_access_traversal_tag, std::input_iterator_tag
|
||||
{
|
||||
operator std::output_iterator_tag() const {
|
||||
return std::output_iterator_tag();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// multi_array_base
|
||||
@@ -272,7 +251,7 @@ struct mutable_iterator_tag
|
||||
template <typename T, std::size_t NumDims>
|
||||
class multi_array_impl_base
|
||||
:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1200)
|
||||
public mpl::aux::msvc_eti_base<
|
||||
typename value_accessor_generator<T,mpl::size_t<NumDims> >::type
|
||||
>::type
|
||||
@@ -314,16 +293,8 @@ public:
|
||||
//
|
||||
// iterator support
|
||||
//
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
|
||||
// Deal with VC 2010 output_iterator_tag requirement
|
||||
typedef array_iterator<T,T*,mpl::size_t<NumDims>,reference,
|
||||
mutable_iterator_tag> iterator;
|
||||
#else
|
||||
typedef array_iterator<T,T*,mpl::size_t<NumDims>,reference,
|
||||
boost::random_access_traversal_tag> iterator;
|
||||
#endif
|
||||
typedef array_iterator<T,T const*,mpl::size_t<NumDims>,const_reference,
|
||||
boost::random_access_traversal_tag> const_iterator;
|
||||
typedef array_iterator<T,T*,mpl::size_t<NumDims>,reference> iterator;
|
||||
typedef array_iterator<T,T const*,mpl::size_t<NumDims>,const_reference> const_iterator;
|
||||
|
||||
typedef ::boost::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef ::boost::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
@@ -336,33 +307,13 @@ protected:
|
||||
|
||||
// Used by operator() in our array classes
|
||||
template <typename Reference, typename IndexList, typename TPtr>
|
||||
Reference access_element(boost::type<Reference>,
|
||||
Reference access_element(boost::type<Reference>, TPtr base,
|
||||
const IndexList& indices,
|
||||
TPtr base,
|
||||
const size_type* extents,
|
||||
const index* strides,
|
||||
const index* index_bases) const {
|
||||
boost::function_requires<
|
||||
CollectionConcept<IndexList> >();
|
||||
ignore_unused_variable_warning(index_bases);
|
||||
ignore_unused_variable_warning(extents);
|
||||
#if !defined(NDEBUG) && !defined(BOOST_DISABLE_ASSERTS)
|
||||
for (size_type i = 0; i != NumDims; ++i) {
|
||||
BOOST_ASSERT(indices[i] - index_bases[i] >= 0);
|
||||
BOOST_ASSERT(size_type(indices[i] - index_bases[i]) < extents[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
const index* strides) const {
|
||||
index offset = 0;
|
||||
{
|
||||
typename IndexList::const_iterator i = indices.begin();
|
||||
size_type n = 0;
|
||||
while (n != NumDims) {
|
||||
offset += (*i) * strides[n];
|
||||
++n;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
for (size_type n = 0; n != NumDims; ++n)
|
||||
offset += indices[n] * strides[n];
|
||||
|
||||
return base[offset];
|
||||
}
|
||||
|
||||
@@ -459,52 +410,13 @@ 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);
|
||||
|
||||
// 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
|
||||
|
||||
index index_factor = current_range.stride();
|
||||
index len = (finish - start + (index_factor - 1)) / index_factor;
|
||||
|
||||
// the array data pointer is modified to account for non-zero
|
||||
// bases during slicing (see [Garcia] for the math involved)
|
||||
@@ -512,16 +424,16 @@ 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;
|
||||
++dim;
|
||||
}
|
||||
}
|
||||
BOOST_ASSERT(dim == NDims);
|
||||
assert (dim == NDims);
|
||||
|
||||
return
|
||||
ArrayRef(base+offset,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
@@ -131,16 +128,15 @@ namespace detail {
|
||||
function_requires< boost_concepts::WritableIteratorConcept<iterator> >();
|
||||
function_requires< boost_concepts::ForwardTraversalConcept<const_iterator> >();
|
||||
function_requires< boost_concepts::ReadableIteratorConcept<const_iterator> >();
|
||||
function_requires< boost::OutputIterator<iterator,value_type> >();
|
||||
|
||||
// RG - a( CollectionArchetype) when available...
|
||||
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();
|
||||
@@ -161,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();
|
||||
@@ -211,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
|
||||
|
||||
|
||||
|
||||
@@ -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>::
|
||||
|
||||
@@ -29,8 +29,8 @@ class extent_gen {
|
||||
public:
|
||||
typedef boost::detail::multi_array::index index;
|
||||
typedef boost::detail::multi_array::size_type size_type;
|
||||
typedef extent_range<index,size_type> range;
|
||||
private:
|
||||
typedef extent_range<index,size_type> range;
|
||||
typedef typename range_list_generator<range,NumRanges>::type range_list;
|
||||
public:
|
||||
template <std::size_t Ranges>
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace multi_array {
|
||||
template <int NumRanges, int NumDims>
|
||||
struct index_gen {
|
||||
private:
|
||||
typedef ::boost::detail::multi_array::index index;
|
||||
typedef ::boost::detail::multi_array::size_type size_type;
|
||||
typedef index_range<index,size_type> range;
|
||||
typedef ::boost::detail::multi_array::index Index;
|
||||
typedef std::size_t SizeType;
|
||||
typedef index_range<Index,SizeType> range;
|
||||
public:
|
||||
template <int Dims, int Ranges>
|
||||
struct gen_type {
|
||||
@@ -44,27 +44,27 @@ public:
|
||||
|
||||
template <int ND>
|
||||
explicit index_gen(const index_gen<NumRanges-1,ND>& rhs,
|
||||
const range& r)
|
||||
const index_range<Index,SizeType>& range)
|
||||
{
|
||||
std::copy(rhs.ranges_.begin(),rhs.ranges_.end(),ranges_.begin());
|
||||
*ranges_.rbegin() = r;
|
||||
*ranges_.rbegin() = range;
|
||||
}
|
||||
|
||||
index_gen<NumRanges+1,NumDims+1>
|
||||
operator[](const range& r) const
|
||||
operator[](const index_range<Index,SizeType>& range) const
|
||||
{
|
||||
index_gen<NumRanges+1,NumDims+1> tmp;
|
||||
std::copy(ranges_.begin(),ranges_.end(),tmp.ranges_.begin());
|
||||
*tmp.ranges_.rbegin() = r;
|
||||
*tmp.ranges_.rbegin() = range;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
index_gen<NumRanges+1,NumDims>
|
||||
operator[](index idx) const
|
||||
operator[](Index idx) const
|
||||
{
|
||||
index_gen<NumRanges+1,NumDims> tmp;
|
||||
std::copy(ranges_.begin(),ranges_.end(),tmp.ranges_.begin());
|
||||
*tmp.ranges_.rbegin() = range(idx);
|
||||
*tmp.ranges_.rbegin() = index_range<Index,SizeType>(idx);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,15 +35,6 @@ namespace multi_array {
|
||||
typedef Index index;
|
||||
typedef SizeType size_type;
|
||||
|
||||
private:
|
||||
static index from_start()
|
||||
{ return (std::numeric_limits<index>::min)(); }
|
||||
|
||||
static index to_end()
|
||||
{ return (std::numeric_limits<index>::max)(); }
|
||||
|
||||
public:
|
||||
|
||||
index_range()
|
||||
{
|
||||
start_ = from_start();
|
||||
@@ -55,7 +46,7 @@ namespace multi_array {
|
||||
explicit index_range(index pos)
|
||||
{
|
||||
start_ = pos;
|
||||
finish_ = pos+1;
|
||||
finish_ = pos;
|
||||
stride_ = 1;
|
||||
degenerate_ = true;
|
||||
}
|
||||
@@ -69,13 +60,13 @@ namespace multi_array {
|
||||
// These are for chaining assignments to an index_range
|
||||
index_range& start(index s) {
|
||||
start_ = s;
|
||||
degenerate_ = false;
|
||||
degenerate_ = (start_ == finish_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
index_range& finish(index f) {
|
||||
finish_ = f;
|
||||
degenerate_ = false;
|
||||
degenerate_ = (start_ == finish_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -86,7 +77,7 @@ namespace multi_array {
|
||||
return start_;
|
||||
}
|
||||
|
||||
index get_start(index low_index_range = index_range::from_start()) const
|
||||
index get_start(index low_index_range = 0) const
|
||||
{
|
||||
if (start_ == from_start())
|
||||
return low_index_range;
|
||||
@@ -98,15 +89,28 @@ namespace multi_array {
|
||||
return finish_;
|
||||
}
|
||||
|
||||
index get_finish(index high_index_range = index_range::to_end()) const
|
||||
index get_finish(index high_index_range = 0) const
|
||||
{
|
||||
if (finish_ == to_end())
|
||||
return high_index_range;
|
||||
return finish_;
|
||||
}
|
||||
|
||||
size_type size(index recommended_length = 0) const
|
||||
{
|
||||
if ((start_ == from_start()) || (finish_ == to_end()))
|
||||
return recommended_length;
|
||||
else
|
||||
return (finish_ - start_) / stride_;
|
||||
}
|
||||
|
||||
index stride() const { return stride_; }
|
||||
|
||||
bool is_ascending_contiguous() const
|
||||
{
|
||||
return (start_ < finish_) && is_unit_stride();
|
||||
}
|
||||
|
||||
void set_index_range(index start, index finish, index stride=1)
|
||||
{
|
||||
start_ = start;
|
||||
@@ -117,6 +121,9 @@ namespace multi_array {
|
||||
static index_range all()
|
||||
{ return index_range(from_start(), to_end(), 1); }
|
||||
|
||||
bool is_unit_stride() const
|
||||
{ return stride_ == 1; }
|
||||
|
||||
bool is_degenerate() const { return degenerate_; }
|
||||
|
||||
index_range operator-(index shift) const
|
||||
@@ -141,6 +148,12 @@ namespace multi_array {
|
||||
|
||||
// add conversion to std::slice?
|
||||
|
||||
private:
|
||||
static index from_start()
|
||||
{ return (std::numeric_limits<index>::min)(); }
|
||||
|
||||
static index to_end()
|
||||
{ return (std::numeric_limits<index>::max)(); }
|
||||
public:
|
||||
index start_, finish_, stride_;
|
||||
bool degenerate_;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "boost/multi_array/base.hpp"
|
||||
#include "boost/iterator/iterator_facade.hpp"
|
||||
#include "boost/mpl/aux_/msvc_eti_base.hpp"
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
|
||||
@@ -44,26 +43,24 @@ struct operator_arrow_proxy
|
||||
mutable T value_;
|
||||
};
|
||||
|
||||
template <typename T, typename TPtr, typename NumDims, typename Reference,
|
||||
typename IteratorCategory>
|
||||
template <typename T, typename TPtr, typename NumDims, typename Reference>
|
||||
class array_iterator;
|
||||
|
||||
template <typename T, typename TPtr, typename NumDims, typename Reference,
|
||||
typename IteratorCategory>
|
||||
template <typename T, typename TPtr, typename NumDims, typename Reference>
|
||||
class array_iterator
|
||||
: public
|
||||
iterator_facade<
|
||||
array_iterator<T,TPtr,NumDims,Reference,IteratorCategory>
|
||||
array_iterator<T,TPtr,NumDims,Reference>
|
||||
, typename associated_types<T,NumDims>::value_type
|
||||
, IteratorCategory
|
||||
, boost::random_access_traversal_tag
|
||||
, Reference
|
||||
>
|
||||
, private
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,==1200)
|
||||
mpl::aux::msvc_eti_base<typename
|
||||
#endif
|
||||
value_accessor_generator<T,NumDims>::type
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,==1200)
|
||||
>::type
|
||||
#endif
|
||||
{
|
||||
@@ -71,7 +68,7 @@ class array_iterator
|
||||
typedef detail::multi_array::associated_types<T,NumDims> access_t;
|
||||
|
||||
typedef iterator_facade<
|
||||
array_iterator<T,TPtr,NumDims,Reference,IteratorCategory>
|
||||
array_iterator<T,TPtr,NumDims,Reference>
|
||||
, typename detail::multi_array::associated_types<T,NumDims>::value_type
|
||||
, boost::random_access_traversal_tag
|
||||
, Reference
|
||||
@@ -81,7 +78,7 @@ class array_iterator
|
||||
typedef typename access_t::size_type size_type;
|
||||
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
template <typename, typename, typename, typename, typename>
|
||||
template <typename, typename, typename, typename>
|
||||
friend class array_iterator;
|
||||
#else
|
||||
public:
|
||||
@@ -101,15 +98,15 @@ public:
|
||||
|
||||
array_iterator() {}
|
||||
|
||||
array_iterator(index idx, TPtr base, const size_type* extents,
|
||||
array_iterator(int idx, TPtr base, const size_type* extents,
|
||||
const index* strides,
|
||||
const index* index_base) :
|
||||
idx_(idx), base_(base), extents_(extents),
|
||||
strides_(strides), index_base_(index_base) { }
|
||||
|
||||
template <typename OPtr, typename ORef, typename Cat>
|
||||
template <typename OPtr, typename ORef>
|
||||
array_iterator(
|
||||
const array_iterator<T,OPtr,NumDims,ORef,Cat>& rhs
|
||||
const array_iterator<T,OPtr,NumDims,ORef>& rhs
|
||||
, typename boost::enable_if_convertible<OPtr,TPtr>::type* = 0
|
||||
)
|
||||
: idx_(rhs.idx_), base_(rhs.base_), extents_(rhs.extents_),
|
||||
@@ -140,15 +137,11 @@ public:
|
||||
|
||||
template <class IteratorAdaptor>
|
||||
bool equal(IteratorAdaptor& rhs) const {
|
||||
const std::size_t N = NumDims::value;
|
||||
return (idx_ == rhs.idx_) &&
|
||||
(base_ == rhs.base_) &&
|
||||
( (extents_ == rhs.extents_) ||
|
||||
std::equal(extents_,extents_+N,rhs.extents_) ) &&
|
||||
( (strides_ == rhs.strides_) ||
|
||||
std::equal(strides_,strides_+N,rhs.strides_) ) &&
|
||||
( (index_base_ == rhs.index_base_) ||
|
||||
std::equal(index_base_,index_base_+N,rhs.index_base_) );
|
||||
(extents_ == rhs.extents_) &&
|
||||
(strides_ == rhs.strides_) &&
|
||||
(index_base_ == rhs.index_base_);
|
||||
}
|
||||
|
||||
template <class DifferenceType>
|
||||
|
||||
@@ -25,13 +25,12 @@
|
||||
#include "boost/multi_array/subarray.hpp"
|
||||
#include "boost/multi_array/view.hpp"
|
||||
#include "boost/multi_array/algorithm.hpp"
|
||||
#include "boost/type_traits/is_integral.hpp"
|
||||
#include "boost/utility/enable_if.hpp"
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/concept_check.hpp"
|
||||
#include "boost/functional.hpp"
|
||||
#include "boost/limits.hpp"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <numeric>
|
||||
@@ -90,7 +89,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());
|
||||
@@ -101,7 +100,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());
|
||||
@@ -138,17 +137,10 @@ public:
|
||||
}
|
||||
|
||||
template <class BaseList>
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
void
|
||||
#else
|
||||
typename
|
||||
disable_if<typename boost::is_integral<BaseList>::type,void >::type
|
||||
#endif // BOOST_NO_SFINAE
|
||||
reindex(const BaseList& values) {
|
||||
void reindex(const BaseList& values) {
|
||||
boost::function_requires<
|
||||
CollectionConcept<BaseList> >();
|
||||
boost::detail::multi_array::
|
||||
copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
|
||||
detail::multi_array::CollectionConcept<BaseList> >();
|
||||
boost::copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
|
||||
origin_offset_ =
|
||||
this->calculate_origin_offset(stride_list_,extent_list_,
|
||||
storage_,index_base_list_);
|
||||
@@ -164,10 +156,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_);
|
||||
@@ -211,10 +203,10 @@ 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());
|
||||
origin(),
|
||||
indices,strides());
|
||||
}
|
||||
|
||||
// Only allow const element access
|
||||
@@ -250,7 +242,7 @@ public:
|
||||
}
|
||||
|
||||
const_iterator end() const {
|
||||
return const_iterator(*index_bases()+(index)*shape(),origin(),
|
||||
return const_iterator(*index_bases()+*shape(),origin(),
|
||||
shape(),strides(),index_bases());
|
||||
}
|
||||
|
||||
@@ -335,8 +327,7 @@ public:
|
||||
// If index_bases or extents is null, then initialize the corresponding
|
||||
// private data to zeroed lists.
|
||||
if(index_bases) {
|
||||
boost::detail::multi_array::
|
||||
copy_n(index_bases,NumDims,index_base_list_.begin());
|
||||
boost::copy_n(index_bases,NumDims,index_base_list_.begin());
|
||||
} else {
|
||||
std::fill_n(index_base_list_.begin(),NumDims,0);
|
||||
}
|
||||
@@ -394,12 +385,11 @@ public:
|
||||
void init_multi_array_ref(InputIterator extents_iter) {
|
||||
boost::function_requires<InputIteratorConcept<InputIterator> >();
|
||||
|
||||
boost::detail::multi_array::
|
||||
copy_n(extents_iter,num_dimensions(),extent_list_.begin());
|
||||
boost::copy_n(extents_iter,num_dimensions(),extent_list_.begin());
|
||||
|
||||
// Calculate the array size
|
||||
num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(),
|
||||
size_type(1),std::multiplies<size_type>());
|
||||
1,std::multiplies<index>());
|
||||
|
||||
this->compute_strides(stride_list_,extent_list_,storage_);
|
||||
|
||||
@@ -449,7 +439,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>
|
||||
@@ -457,7 +447,7 @@ public:
|
||||
const general_storage_order<NumDims>& so) :
|
||||
super_type(base,extents,so) {
|
||||
boost::function_requires<
|
||||
CollectionConcept<ExtentList> >();
|
||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||
}
|
||||
|
||||
|
||||
@@ -479,13 +469,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;
|
||||
@@ -495,10 +485,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,12 +500,11 @@ public:
|
||||
|
||||
template <class IndexList>
|
||||
element& operator()(const IndexList& indices) {
|
||||
boost::function_requires<
|
||||
CollectionConcept<IndexList> >();
|
||||
return super_type::access_element(boost::type<element&>(),
|
||||
indices,origin(),
|
||||
this->shape(),this->strides(),
|
||||
this->index_bases());
|
||||
boost::function_requires<
|
||||
detail::multi_array::CollectionConcept<IndexList> >();
|
||||
return super_type::access_element(boost::type<element&>(),
|
||||
origin(),
|
||||
indices,this->strides());
|
||||
}
|
||||
|
||||
|
||||
@@ -554,7 +542,7 @@ public:
|
||||
}
|
||||
|
||||
iterator end() {
|
||||
return iterator(*this->index_bases()+(index)*this->shape(),origin(),
|
||||
return iterator(*this->index_bases()+*this->shape(),origin(),
|
||||
this->shape(),this->strides(),
|
||||
this->index_bases());
|
||||
}
|
||||
@@ -579,7 +567,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace boost {
|
||||
template <typename OrderingIter, typename AscendingIter>
|
||||
general_storage_order(OrderingIter ordering,
|
||||
AscendingIter ascending) {
|
||||
boost::detail::multi_array::copy_n(ordering,NumDims,ordering_.begin());
|
||||
boost::detail::multi_array::copy_n(ascending,NumDims,ascending_.begin());
|
||||
boost::copy_n(ordering,NumDims,ordering_.begin());
|
||||
boost::copy_n(ascending,NumDims,ascending_.begin());
|
||||
}
|
||||
|
||||
// RG - ideally these would not be necessary, but some compilers
|
||||
|
||||
@@ -79,11 +79,9 @@ public:
|
||||
|
||||
template <typename IndexList>
|
||||
const element& operator()(const IndexList& indices) const {
|
||||
boost::function_requires<
|
||||
CollectionConcept<IndexList> >();
|
||||
return super_type::access_element(boost::type<const element&>(),
|
||||
indices,origin(),
|
||||
shape(),strides(),index_bases());
|
||||
origin(),
|
||||
indices,strides());
|
||||
}
|
||||
|
||||
// see generate_array_view in base.hpp
|
||||
@@ -144,7 +142,7 @@ public:
|
||||
}
|
||||
|
||||
const_iterator end() const {
|
||||
return const_iterator(*index_bases()+(index)*shape(),origin(),
|
||||
return const_iterator(*index_bases()+*shape(),origin(),
|
||||
shape(),strides(),index_bases());
|
||||
}
|
||||
|
||||
@@ -231,13 +229,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 +245,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());
|
||||
}
|
||||
@@ -287,12 +284,9 @@ public:
|
||||
|
||||
template <class IndexList>
|
||||
element& operator()(const IndexList& indices) {
|
||||
boost::function_requires<
|
||||
CollectionConcept<IndexList> >();
|
||||
return super_type::access_element(boost::type<element&>(),
|
||||
indices,origin(),
|
||||
this->shape(),this->strides(),
|
||||
this->index_bases());
|
||||
origin(),
|
||||
indices,this->strides());
|
||||
}
|
||||
|
||||
iterator begin() {
|
||||
@@ -301,7 +295,7 @@ public:
|
||||
}
|
||||
|
||||
iterator end() {
|
||||
return iterator(*this->index_bases()+(index)*this->shape(),origin(),
|
||||
return iterator(*this->index_bases()+*this->shape(),origin(),
|
||||
this->shape(),this->strides(),this->index_bases());
|
||||
}
|
||||
|
||||
@@ -322,8 +316,6 @@ public:
|
||||
|
||||
template <class IndexList>
|
||||
const element& operator()(const IndexList& indices) const {
|
||||
boost::function_requires<
|
||||
CollectionConcept<IndexList> >();
|
||||
return super_type::operator()(indices);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace multi_array{
|
||||
|
||||
// needed typedefs
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t index;
|
||||
typedef int index;
|
||||
|
||||
} // namespace multi_array
|
||||
} // namespace detail
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include "boost/multi_array/storage_order.hpp"
|
||||
#include "boost/multi_array/subarray.hpp"
|
||||
#include "boost/multi_array/algorithm.hpp"
|
||||
#include "boost/type_traits/is_integral.hpp"
|
||||
#include "boost/utility/enable_if.hpp"
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/limits.hpp"
|
||||
#include <algorithm>
|
||||
@@ -74,17 +72,8 @@ public:
|
||||
|
||||
|
||||
template <class BaseList>
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
void
|
||||
#else
|
||||
typename
|
||||
disable_if<typename boost::is_integral<BaseList>::type,void >::type
|
||||
#endif
|
||||
reindex(const BaseList& values) {
|
||||
boost::function_requires<
|
||||
CollectionConcept<BaseList> >();
|
||||
boost::detail::multi_array::
|
||||
copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
|
||||
void reindex(const BaseList& values) {
|
||||
boost::copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
|
||||
origin_offset_ =
|
||||
this->calculate_indexing_offset(stride_list_,index_base_list_);
|
||||
}
|
||||
@@ -119,11 +108,9 @@ public:
|
||||
|
||||
template <typename IndexList>
|
||||
const element& operator()(IndexList indices) const {
|
||||
boost::function_requires<
|
||||
CollectionConcept<IndexList> >();
|
||||
return super_type::access_element(boost::type<const element&>(),
|
||||
indices,origin(),
|
||||
shape(),strides(),index_bases());
|
||||
origin(),
|
||||
indices,strides());
|
||||
}
|
||||
|
||||
// Only allow const element access
|
||||
@@ -159,7 +146,7 @@ public:
|
||||
}
|
||||
|
||||
const_iterator end() const {
|
||||
return const_iterator(*index_bases()+(index)*shape(),origin(),
|
||||
return const_iterator(*index_bases()+*shape(),origin(),
|
||||
shape(),strides(),index_bases());
|
||||
}
|
||||
|
||||
@@ -238,14 +225,15 @@ public: // should be protected
|
||||
index_base_list_.assign(0);
|
||||
|
||||
// Get the extents and strides
|
||||
boost::detail::multi_array::
|
||||
copy_n(extents.begin(),NumDims,extent_list_.begin());
|
||||
boost::detail::multi_array::
|
||||
copy_n(strides.begin(),NumDims,stride_list_.begin());
|
||||
boost::copy_n(extents.begin(),NumDims,extent_list_.begin());
|
||||
boost::copy_n(strides.begin(),NumDims,stride_list_.begin());
|
||||
|
||||
// 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;
|
||||
@@ -298,13 +286,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;
|
||||
@@ -314,10 +302,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,12 +315,9 @@ public:
|
||||
|
||||
template <class IndexList>
|
||||
element& operator()(const IndexList& indices) {
|
||||
boost::function_requires<
|
||||
CollectionConcept<IndexList> >();
|
||||
return super_type::access_element(boost::type<element&>(),
|
||||
indices,origin(),
|
||||
this->shape(),this->strides(),
|
||||
this->index_bases());
|
||||
origin(),
|
||||
indices,this->strides());
|
||||
}
|
||||
|
||||
|
||||
@@ -372,7 +356,7 @@ public:
|
||||
}
|
||||
|
||||
iterator end() {
|
||||
return iterator(*this->index_bases()+(index)*this->shape(),origin(),
|
||||
return iterator(*this->index_bases()+*this->shape(),origin(),
|
||||
this->shape(),this->strides(),
|
||||
this->index_bases());
|
||||
}
|
||||
@@ -392,8 +376,6 @@ public:
|
||||
|
||||
template <class IndexList>
|
||||
const element& operator()(const IndexList& indices) const {
|
||||
boost::function_requires<
|
||||
CollectionConcept<IndexList> >();
|
||||
return super_type::operator()(indices);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
</head>
|
||||
<body>
|
||||
Automatic redirection failed, please go to
|
||||
<a href="doc/index.html">doc/index.html</a>. <hr>
|
||||
<p>© Copyright Beman Dawes, 2001</p>
|
||||
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
|
||||
at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
|
||||
<a href="doc/index.html">doc/index.html</a>.
|
||||
</body>
|
||||
</html>
|
||||
51
test/Jamfile
Executable file
51
test/Jamfile
Executable file
@@ -0,0 +1,51 @@
|
||||
# Copyright David Abrahams 2003. Permission to copy, use,
|
||||
# modify, sell and distribute this software is granted provided this
|
||||
# copyright notice appears in all copies. This software is provided
|
||||
# "as is" without express or implied warranty, and with no claim as
|
||||
# to its suitability for any purpose.
|
||||
|
||||
subproject libs/multi_array/test ;
|
||||
|
||||
import testing ;
|
||||
|
||||
test-suite multi_array
|
||||
:
|
||||
[ compile-fail fail_cbracket.cpp ]
|
||||
[ compile-fail fail_cdata.cpp ]
|
||||
[ compile-fail fail_citerator.cpp ]
|
||||
[ compile-fail fail_cparen.cpp ]
|
||||
[ compile-fail fail_criterator.cpp ]
|
||||
[ compile-fail fail_csubarray.cpp ]
|
||||
[ compile-fail fail_csubarray2.cpp ]
|
||||
[ compile-fail fail_csubarray3.cpp ]
|
||||
[ compile-fail fail_cview.cpp ]
|
||||
[ compile-fail fail_cview2.cpp ]
|
||||
[ compile-fail fail_cview3.cpp ]
|
||||
[ compile-fail fail_ref_cbracket.cpp ]
|
||||
[ compile-fail fail_ref_cdata.cpp ]
|
||||
[ compile-fail fail_ref_citerator.cpp ]
|
||||
[ compile-fail fail_ref_cparen.cpp ]
|
||||
[ compile-fail fail_ref_criterator.cpp ]
|
||||
[ compile-fail fail_ref_csubarray.cpp ]
|
||||
[ compile-fail fail_ref_csubarray2.cpp ]
|
||||
[ compile-fail fail_ref_csubarray3.cpp ]
|
||||
[ compile-fail fail_ref_cview.cpp ]
|
||||
[ compile-fail fail_ref_cview2.cpp ]
|
||||
[ compile-fail fail_ref_cview3.cpp ]
|
||||
|
||||
[ run constructors.cpp ]
|
||||
[ run access.cpp ]
|
||||
[ run compare.cpp ]
|
||||
[ run iterators.cpp ]
|
||||
[ run slice.cpp ]
|
||||
[ run assign.cpp ]
|
||||
[ run assign_to_array.cpp ]
|
||||
[ run index_bases.cpp ]
|
||||
[ run storage_order.cpp ]
|
||||
[ run reshape.cpp ]
|
||||
[ run range1.cpp ]
|
||||
[ run idxgen1.cpp ]
|
||||
[ run stl_interaction.cpp ]
|
||||
[ run resize.cpp ]
|
||||
[ compile concept_checks.cpp ]
|
||||
;
|
||||
@@ -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 ]
|
||||
;
|
||||
|
||||
@@ -42,18 +42,18 @@ void access(Array& A, const const_array_tag&) {
|
||||
for (index i = idx0; i != idx0+2; ++i)
|
||||
for (index j = idx1; j != idx1+3; ++j)
|
||||
for (index k = idx2; k != idx2+4; ++k) {
|
||||
BOOST_CHECK(A[i][j][k] == cnum++);
|
||||
BOOST_CHECK(CA[i][j][k] == A[i][j][k]);
|
||||
BOOST_TEST(A[i][j][k] == cnum++);
|
||||
BOOST_TEST(CA[i][j][k] == A[i][j][k]);
|
||||
}
|
||||
|
||||
// operator()
|
||||
for (index i2 = idx0; i2 != idx0+2; ++i2)
|
||||
for (index j2 = idx1; j2 != idx1+3; ++j2)
|
||||
for (index k2 = idx2; k2 != idx2+4; ++k2) {
|
||||
for (index i2 = 0; i2 != 2; ++i2)
|
||||
for (index j2 = 0; j2 != 3; ++j2)
|
||||
for (index k2 = 0; k2 != 4; ++k2) {
|
||||
boost::array<index,ndims> indices;
|
||||
indices[0] = i2; indices[1] = j2; indices[2] = k2;
|
||||
BOOST_CHECK(A(indices) == A[i2][j2][k2]);
|
||||
BOOST_CHECK(CA(indices) == A(indices));
|
||||
BOOST_TEST(A(indices) == A[i2][j2][k2]);
|
||||
BOOST_TEST(CA(indices) == A(indices));
|
||||
}
|
||||
++tests_run;
|
||||
}
|
||||
|
||||
@@ -1,59 +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);
|
||||
}
|
||||
|
||||
void assertion_failed_msg(char const * expr, char const * msg,
|
||||
char const * function,
|
||||
char const * file, long line) {
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
|
||||
} // 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;
|
||||
}
|
||||
@@ -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_TEST(equal(A,filler));
|
||||
++tests_run;
|
||||
}
|
||||
|
||||
|
||||
@@ -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_TEST(equal(acopy,A));
|
||||
++tests_run;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ test_main(int, char*[])
|
||||
std::vector<double> vals(num_elements, 4.5);
|
||||
A.assign(vals.begin(),vals.end());
|
||||
array B(A);
|
||||
BOOST_CHECK(A == B);
|
||||
BOOST_CHECK(B == A);
|
||||
BOOST_CHECK(A[0] == B[0]);
|
||||
BOOST_TEST(A == B);
|
||||
BOOST_TEST(B == A);
|
||||
BOOST_TEST(A[0] == B[0]);
|
||||
}
|
||||
// Assignment Operator
|
||||
{
|
||||
@@ -44,15 +44,15 @@ test_main(int, char*[])
|
||||
std::vector<double> vals(num_elements, 4.5);
|
||||
A.assign(vals.begin(),vals.end());
|
||||
B = A;
|
||||
BOOST_CHECK(A == B);
|
||||
BOOST_CHECK(B == A);
|
||||
BOOST_CHECK(B[0] == A[0]);
|
||||
BOOST_TEST(A == B);
|
||||
BOOST_TEST(B == A);
|
||||
BOOST_TEST(B[0] == A[0]);
|
||||
|
||||
typedef array::index_range range;
|
||||
array::index_gen indices;
|
||||
array::array_view<2>::type C = A[indices[2][range()][range()]];
|
||||
array::array_view<2>::type D = B[indices[2][range()][range()]];
|
||||
BOOST_CHECK(C == D);
|
||||
BOOST_TEST(C == D);
|
||||
}
|
||||
// Different Arrays
|
||||
{
|
||||
@@ -62,15 +62,15 @@ test_main(int, char*[])
|
||||
A.assign(valsA.begin(),valsA.end());
|
||||
B.assign(valsB.begin(),valsB.end());
|
||||
|
||||
BOOST_CHECK(A != B);
|
||||
BOOST_CHECK(B != A);
|
||||
BOOST_CHECK(A[0] != B[0]);
|
||||
BOOST_TEST(A != B);
|
||||
BOOST_TEST(B != A);
|
||||
BOOST_TEST(A[0] != B[0]);
|
||||
|
||||
typedef array::index_range range;
|
||||
array::index_gen indices;
|
||||
array::array_view<2>::type C = A[indices[2][range()][range()]];
|
||||
array::array_view<2>::type D = B[indices[2][range()][range()]];
|
||||
BOOST_CHECK(C != D);
|
||||
BOOST_TEST(C != D);
|
||||
}
|
||||
|
||||
// Comparisons galore!
|
||||
@@ -108,30 +108,30 @@ test_main(int, char*[])
|
||||
A.assign(valsA,valsA+num_elements);
|
||||
B.assign(valsB,valsB+num_elements);
|
||||
|
||||
BOOST_CHECK(B < A);
|
||||
BOOST_CHECK(A > B);
|
||||
BOOST_TEST(B < A);
|
||||
BOOST_TEST(A > B);
|
||||
|
||||
BOOST_CHECK(B <= A);
|
||||
BOOST_CHECK(A >= B);
|
||||
BOOST_TEST(B <= A);
|
||||
BOOST_TEST(A >= B);
|
||||
|
||||
BOOST_CHECK(B[0] == A[0]);
|
||||
BOOST_CHECK(B[2] < A[2]);
|
||||
BOOST_TEST(B[0] == A[0]);
|
||||
BOOST_TEST(B[2] < A[2]);
|
||||
|
||||
array C = A;
|
||||
|
||||
BOOST_CHECK(C <= A);
|
||||
BOOST_CHECK(C >= A);
|
||||
BOOST_TEST(C <= A);
|
||||
BOOST_TEST(C >= A);
|
||||
|
||||
BOOST_CHECK(!(C < A));
|
||||
BOOST_CHECK(!(C > A));
|
||||
BOOST_TEST(!(C < A));
|
||||
BOOST_TEST(!(C > A));
|
||||
|
||||
typedef array::index_range range;
|
||||
array::index_gen indices;
|
||||
array::array_view<2>::type D = A[indices[2][range()][range()]];
|
||||
array::array_view<2>::type E = B[indices[2][range()][range()]];
|
||||
|
||||
BOOST_CHECK(E < D);
|
||||
BOOST_CHECK(E <= D);
|
||||
BOOST_TEST(E < D);
|
||||
BOOST_TEST(E <= D);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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,7 +10,7 @@
|
||||
// Andrew Lumsdaine
|
||||
// See http://www.boost.org/libs/multi_array for documentation.
|
||||
|
||||
//
|
||||
//
|
||||
// concept_checks.cpp -
|
||||
// make sure the types meet concept requirements
|
||||
//
|
||||
@@ -19,9 +19,8 @@
|
||||
#include "boost/multi_array/concept_checks.hpp"
|
||||
#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 +37,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> >();
|
||||
|
||||
return 0;
|
||||
boost::detail::multi_array::MutableMultiArrayConcept<subarray,ndims> >();
|
||||
|
||||
return boost::exit_success;
|
||||
}
|
||||
|
||||
@@ -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,15 +25,15 @@ 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)
|
||||
{
|
||||
BOOST_CHECK(A.num_elements() == num_elements);
|
||||
BOOST_CHECK(A.size() == *sizes);
|
||||
BOOST_CHECK(std::equal(sizes, sizes + A.num_dimensions(), A.shape()));
|
||||
BOOST_CHECK(std::equal(strides, strides + A.num_dimensions(), A.strides()));
|
||||
BOOST_TEST(A.num_elements() == num_elements);
|
||||
BOOST_TEST(A.size() == *sizes);
|
||||
BOOST_TEST(std::equal(sizes, sizes + A.num_dimensions(), A.shape()));
|
||||
BOOST_TEST(std::equal(strides, strides + A.num_dimensions(), A.strides()));
|
||||
check_shape(A[0], ++sizes, ++strides, num_elements / A.size());
|
||||
}
|
||||
|
||||
@@ -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,20 +132,20 @@ 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_TEST(equal(A, B));
|
||||
|
||||
double ptr[27];
|
||||
boost::multi_array_ref<double, 3> C(ptr,sizes);
|
||||
A.assign(vals.begin(),vals.end());
|
||||
boost::multi_array_ref<double, 3> D(C);
|
||||
check_shape(D, &sizes[0], strides, num_elements);
|
||||
BOOST_CHECK(C.data() == D.data());
|
||||
BOOST_TEST(C.data() == D.data());
|
||||
|
||||
const double* cptr = ptr;
|
||||
boost::const_multi_array_ref<double, 3> E(cptr,sizes);
|
||||
boost::const_multi_array_ref<double, 3> F(E);
|
||||
check_shape(F, &sizes[0], strides, num_elements);
|
||||
BOOST_CHECK(E.data() == F.data());
|
||||
BOOST_TEST(E.data() == F.data());
|
||||
}
|
||||
|
||||
|
||||
@@ -161,15 +161,15 @@ test_main(int, char*[])
|
||||
boost::const_multi_array_ref<double, 3> C(A);
|
||||
check_shape(B, &sizes[0], strides, num_elements);
|
||||
check_shape(C, &sizes[0], strides, num_elements);
|
||||
BOOST_CHECK(B.data() == A.data());
|
||||
BOOST_CHECK(C.data() == A.data());
|
||||
BOOST_TEST(B.data() == A.data());
|
||||
BOOST_TEST(C.data() == A.data());
|
||||
|
||||
double ptr[27];
|
||||
boost::multi_array_ref<double, 3> D(ptr,sizes);
|
||||
D.assign(vals.begin(),vals.end());
|
||||
boost::const_multi_array_ref<double, 3> E(D);
|
||||
check_shape(E, &sizes[0], strides, num_elements);
|
||||
BOOST_CHECK(E.data() == D.data());
|
||||
BOOST_TEST(E.data() == D.data());
|
||||
}
|
||||
|
||||
// Assignment Operator
|
||||
@@ -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_TEST(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_TEST(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_TEST(equal(A[1][0],C));
|
||||
BOOST_TEST(equal(B[0],C));
|
||||
}
|
||||
return boost::exit_success;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include "boost/type.hpp"
|
||||
#include "boost/cstdlib.hpp"
|
||||
|
||||
int
|
||||
test_main(int,char*[])
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
|
||||
#include <boost/config.hpp> /* BOOST_NO_SFINAE */
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
@@ -239,14 +238,7 @@ struct null_modifier {
|
||||
|
||||
struct set_index_base_modifier {
|
||||
template <typename Array>
|
||||
void modify(Array& A) const {
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
typedef boost::multi_array_types::index index;
|
||||
A.reindex(index(1));
|
||||
#else
|
||||
A.reindex(1);
|
||||
#endif
|
||||
}
|
||||
void modify(Array& A) const { A.reindex(1); }
|
||||
};
|
||||
|
||||
struct reindex_modifier {
|
||||
|
||||
@@ -16,20 +16,21 @@
|
||||
|
||||
#include "boost/multi_array/index_gen.hpp"
|
||||
#include "boost/multi_array/index_range.hpp"
|
||||
#include "boost/multi_array/types.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
|
||||
#include "boost/array.hpp"
|
||||
#include <cstddef>
|
||||
|
||||
typedef boost::detail::multi_array::index index_type;
|
||||
typedef boost::detail::multi_array::size_type size_type;
|
||||
typedef boost::detail::multi_array::index_range<index_type,size_type> range;
|
||||
|
||||
template <int NumRanges, int NumDims>
|
||||
void check(const boost::detail::multi_array::
|
||||
index_gen<NumRanges,NumDims>&) { }
|
||||
|
||||
bool operator==(const range& lhs,const range& rhs) {
|
||||
bool operator==(const boost::detail::multi_array::
|
||||
index_range<int,std::size_t>& lhs,
|
||||
const boost::detail::multi_array::
|
||||
index_range<int,std::size_t>& rhs) {
|
||||
return lhs.start_ == rhs.start_ &&
|
||||
lhs.finish_ == rhs.finish_ &&
|
||||
lhs.stride_ == rhs.stride_ &&
|
||||
@@ -39,6 +40,7 @@ bool operator==(const range& lhs,const range& rhs) {
|
||||
int
|
||||
test_main(int,char*[])
|
||||
{
|
||||
typedef boost::detail::multi_array::index_range<int,std::size_t> range;
|
||||
|
||||
boost::detail::multi_array::index_gen<0,0> indices;
|
||||
|
||||
@@ -62,18 +64,18 @@ test_main(int,char*[])
|
||||
{
|
||||
boost::detail::multi_array::index_gen<3,3> is1 =
|
||||
indices[range(0,1,2)][range(1,2,3)][range(2,3,4)];
|
||||
BOOST_CHECK(is1.ranges_[0] == range(0,1,2));
|
||||
BOOST_CHECK(is1.ranges_[1] == range(1,2,3));
|
||||
BOOST_CHECK(is1.ranges_[2] == range(2,3,4));
|
||||
BOOST_TEST(is1.ranges_[0] == range(0,1,2));
|
||||
BOOST_TEST(is1.ranges_[1] == range(1,2,3));
|
||||
BOOST_TEST(is1.ranges_[2] == range(2,3,4));
|
||||
}
|
||||
|
||||
{
|
||||
boost::detail::multi_array::index_gen<3,2> is2 =
|
||||
indices[range(0,1,2)][2][range(2,3,4)];
|
||||
BOOST_CHECK(is2.ranges_[0] == range(0,1,2));
|
||||
BOOST_CHECK(is2.ranges_[1] == range(2));
|
||||
BOOST_CHECK(is2.ranges_[1].is_degenerate());
|
||||
BOOST_CHECK(is2.ranges_[2] == range(2,3,4));
|
||||
BOOST_TEST(is2.ranges_[0] == range(0,1,2));
|
||||
BOOST_TEST(is2.ranges_[1] == range(2));
|
||||
BOOST_TEST(is2.ranges_[1].is_degenerate());
|
||||
BOOST_TEST(is2.ranges_[2] == range(2,3,4));
|
||||
}
|
||||
|
||||
return boost::exit_success;
|
||||
|
||||
@@ -62,12 +62,12 @@ test_main(int,char*[])
|
||||
boost::array<int,3> bases = { { 1, 2, 3 } };
|
||||
for (size_type a = 0; a < A.shape()[0]; ++a)
|
||||
for (size_type b = 0; b < A.shape()[1]; ++b)
|
||||
for (size_type c = 0; c < A.shape()[2]; ++c) {
|
||||
BOOST_CHECK(A[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_CHECK(C[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_CHECK(D[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
for (size_type c = 0; c < A[b].size(); ++c) {
|
||||
BOOST_TEST(A[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_TEST(C[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_TEST(D[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
// Test that E does not inherit A's index_base
|
||||
BOOST_CHECK(E[a][b][c] == B[a][b][c]);
|
||||
BOOST_TEST(E[a][b][c] == B[a][b][c]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,10 +100,10 @@ test_main(int,char*[])
|
||||
for (size_type a = 0; a < A.shape()[0]; ++a)
|
||||
for (size_type b = 0; b < A.shape()[1]; ++b)
|
||||
for (size_type c = 0; c < A.shape()[2]; ++c) {
|
||||
BOOST_CHECK(A[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_CHECK(C[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_CHECK(D[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_CHECK(E[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_TEST(A[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_TEST(C[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_TEST(D[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
BOOST_TEST(E[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,26 +126,18 @@ test_main(int,char*[])
|
||||
B.assign(vals.begin(),vals.end());
|
||||
C.assign(vals.begin(),vals.end());
|
||||
|
||||
#ifdef BOOST_NO_SFINAE
|
||||
typedef boost::multi_array_types::index index;
|
||||
A.reindex(index(1));
|
||||
C.reindex(index(1));
|
||||
D.reindex(index(1));
|
||||
E.reindex(index(1));
|
||||
#else
|
||||
A.reindex(1);
|
||||
C.reindex(1);
|
||||
D.reindex(1);
|
||||
E.reindex(1);
|
||||
#endif
|
||||
|
||||
for (size_type a = 0; a < A.shape()[0]; ++a)
|
||||
for (size_type b = 0; b < A.shape()[1]; ++b)
|
||||
for (size_type c = 0; c < A.shape()[2]; ++c) {
|
||||
BOOST_CHECK(A[a+1][b+1][c+1] == B[a][b][c]);
|
||||
BOOST_CHECK(C[a+1][b+1][c+1] == B[a][b][c]);
|
||||
BOOST_CHECK(D[a+1][b+1][c+1] == B[a][b][c]);
|
||||
BOOST_CHECK(E[a+1][b+1][c+1] == B[a][b][c]);
|
||||
BOOST_TEST(A[a+1][b+1][c+1] == B[a][b][c]);
|
||||
BOOST_TEST(C[a+1][b+1][c+1] == B[a][b][c]);
|
||||
BOOST_TEST(D[a+1][b+1][c+1] == B[a][b][c]);
|
||||
BOOST_TEST(E[a+1][b+1][c+1] == B[a][b][c]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ void test_iterators(Array& A, const IterTraits&) {
|
||||
typedef typename IterTraits::iterator3 iterator;
|
||||
iterator i1 = A.begin();
|
||||
iterator i2 = A.end();
|
||||
BOOST_CHECK(i1 < i2);
|
||||
BOOST_CHECK((i2 - i1) == typename iterator::difference_type(2));
|
||||
BOOST_TEST(i1 < i2);
|
||||
BOOST_TEST((i2 - i1) == typename iterator::difference_type(2));
|
||||
}
|
||||
|
||||
// Standard Array Iteration
|
||||
@@ -121,7 +121,7 @@ void test_iterators(Array& A, const IterTraits&) {
|
||||
for (iterator3 i = A.begin(); i != A.end(); ++i)
|
||||
for(iterator2 ii = (*i).begin(); ii != (*i).end(); ++ii)
|
||||
for(iterator1 iii = (*ii).begin(); iii != (*ii).end(); ++iii)
|
||||
BOOST_CHECK(*iii == vals++);
|
||||
BOOST_TEST(*iii == vals++);
|
||||
}
|
||||
|
||||
// Using operator->() on iterators
|
||||
@@ -134,7 +134,7 @@ void test_iterators(Array& A, const IterTraits&) {
|
||||
for (iterator3 i = A.begin(); i != A.end(); ++i)
|
||||
for(iterator2 ii = i->begin(); ii != i->end(); ++ii)
|
||||
for(iterator1 iii = ii->begin(); iii != ii->end(); ++iii)
|
||||
BOOST_CHECK(*iii == vals++);
|
||||
BOOST_TEST(*iii == vals++);
|
||||
}
|
||||
|
||||
// Reverse Iterator Hierarchy Test
|
||||
@@ -148,7 +148,7 @@ void test_iterators(Array& A, const IterTraits&) {
|
||||
for(riterator2 ii = (*i).rbegin(); ii != (riterator2)(*i).rend(); ++ii)
|
||||
for(riterator1 iii = (*ii).rbegin(); iii != (riterator1)(*ii).rend();
|
||||
++iii)
|
||||
BOOST_CHECK(*iii == check_iter_val--);
|
||||
BOOST_TEST(*iii == check_iter_val--);
|
||||
}
|
||||
++tests_run;
|
||||
}
|
||||
|
||||
@@ -30,75 +30,75 @@ test_main(int,char*[])
|
||||
{
|
||||
// typical range creation and extraction
|
||||
range r1(-3,5);
|
||||
BOOST_CHECK(r1.start() == -3);
|
||||
BOOST_CHECK(r1.finish() == 5);
|
||||
BOOST_CHECK(r1.stride() == 1);
|
||||
BOOST_CHECK(!r1.is_degenerate());
|
||||
BOOST_CHECK(r1.get_start(0) == -3);
|
||||
BOOST_CHECK(r1.get_finish(100) == 5);
|
||||
BOOST_TEST(r1.start() == -3);
|
||||
BOOST_TEST(r1.finish() == 5);
|
||||
BOOST_TEST(r1.stride() == 1);
|
||||
BOOST_TEST(!r1.is_degenerate());
|
||||
BOOST_TEST(r1.get_start(0) == -3);
|
||||
BOOST_TEST(r1.get_finish(100) == 5);
|
||||
}
|
||||
|
||||
{
|
||||
range r2(-3,5,2);
|
||||
BOOST_CHECK(r2.start() == -3);
|
||||
BOOST_CHECK(r2.finish() == 5);
|
||||
BOOST_CHECK(r2.stride() == 2);
|
||||
BOOST_CHECK(!r2.is_degenerate());
|
||||
BOOST_TEST(r2.start() == -3);
|
||||
BOOST_TEST(r2.finish() == 5);
|
||||
BOOST_TEST(r2.stride() == 2);
|
||||
BOOST_TEST(!r2.is_degenerate());
|
||||
}
|
||||
|
||||
{
|
||||
// degenerate creation
|
||||
range r3(5);
|
||||
BOOST_CHECK(r3.start() == 5);
|
||||
BOOST_CHECK(r3.finish() == 6);
|
||||
BOOST_CHECK(r3.stride() == 1);
|
||||
BOOST_CHECK(r3.is_degenerate());
|
||||
BOOST_TEST(r3.start() == 5);
|
||||
BOOST_TEST(r3.finish() == 5);
|
||||
BOOST_TEST(r3.stride() == 1);
|
||||
BOOST_TEST(r3.is_degenerate());
|
||||
}
|
||||
|
||||
{
|
||||
// default range creation
|
||||
range r4;
|
||||
BOOST_CHECK(r4.get_start(0) == 0);
|
||||
BOOST_CHECK(r4.get_finish(100) == 100);
|
||||
BOOST_CHECK(r4.stride() == 1);
|
||||
BOOST_TEST(r4.get_start(0) == 0);
|
||||
BOOST_TEST(r4.get_finish(100) == 100);
|
||||
BOOST_TEST(r4.stride() == 1);
|
||||
}
|
||||
|
||||
{
|
||||
// create a range using the setter methods
|
||||
range r5 = range().stride(2).start(-3).finish(7);
|
||||
BOOST_CHECK(r5.start() == -3);
|
||||
BOOST_CHECK(r5.stride() == 2);
|
||||
BOOST_CHECK(r5.finish() == 7);
|
||||
BOOST_TEST(r5.start() == -3);
|
||||
BOOST_TEST(r5.stride() == 2);
|
||||
BOOST_TEST(r5.finish() == 7);
|
||||
}
|
||||
|
||||
// try out all the comparison operators
|
||||
{
|
||||
range r6 = -3 <= range().stride(2) < 7;
|
||||
BOOST_CHECK(r6.start() == -3);
|
||||
BOOST_CHECK(r6.stride() == 2);
|
||||
BOOST_CHECK(r6.finish() == 7);
|
||||
BOOST_TEST(r6.start() == -3);
|
||||
BOOST_TEST(r6.stride() == 2);
|
||||
BOOST_TEST(r6.finish() == 7);
|
||||
}
|
||||
|
||||
{
|
||||
range r7 = -3 < range() <= 7;
|
||||
BOOST_CHECK(r7.start() == -2);
|
||||
BOOST_CHECK(r7.stride() == 1);
|
||||
BOOST_CHECK(r7.finish() == 8);
|
||||
BOOST_TEST(r7.start() == -2);
|
||||
BOOST_TEST(r7.stride() == 1);
|
||||
BOOST_TEST(r7.finish() == 8);
|
||||
}
|
||||
|
||||
// arithmetic operators
|
||||
{
|
||||
range r8 = range(0,5) + 2;
|
||||
BOOST_CHECK(r8.start() == 2);
|
||||
BOOST_CHECK(r8.stride() == 1);
|
||||
BOOST_CHECK(r8.finish() == 7);
|
||||
BOOST_TEST(r8.start() == 2);
|
||||
BOOST_TEST(r8.stride() == 1);
|
||||
BOOST_TEST(r8.finish() == 7);
|
||||
}
|
||||
|
||||
{
|
||||
range r9 = range(0,5) - 2;
|
||||
BOOST_CHECK(r9.start() == -2);
|
||||
BOOST_CHECK(r9.stride() == 1);
|
||||
BOOST_CHECK(r9.finish() == 3);
|
||||
BOOST_TEST(r9.start() == -2);
|
||||
BOOST_TEST(r9.stride() == 1);
|
||||
BOOST_TEST(r9.finish() == 3);
|
||||
}
|
||||
|
||||
return boost::exit_success;
|
||||
|
||||
@@ -52,9 +52,9 @@ test_main(int,char*[])
|
||||
for (array::index i = 0; i != 4; ++i)
|
||||
for (array::index j = 0; j != 3; ++j)
|
||||
for (array::index k = 0; k != 2; ++k) {
|
||||
BOOST_CHECK(A[i][j][k] == *ptr);
|
||||
BOOST_CHECK(B[i][j][k] == *ptr);
|
||||
BOOST_CHECK(C[i][j][k] == *ptr++);
|
||||
BOOST_TEST(A[i][j][k] == *ptr);
|
||||
BOOST_TEST(B[i][j][k] == *ptr);
|
||||
BOOST_TEST(C[i][j][k] == *ptr++);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ test_main(int,char*[])
|
||||
for (array::index i = 0; i != 4; ++i)
|
||||
for (array::index j = 1; j != 4; ++j)
|
||||
for (array::index k = -1; k != 1; ++k) {
|
||||
BOOST_CHECK(A[i][j][k] == *ptr);
|
||||
BOOST_CHECK(B[i][j][k] == *ptr);
|
||||
BOOST_CHECK(C[i][j][k] == *ptr++);
|
||||
BOOST_TEST(A[i][j][k] == *ptr);
|
||||
BOOST_TEST(B[i][j][k] == *ptr);
|
||||
BOOST_TEST(C[i][j][k] == *ptr++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,13 @@ int test_main(int,char*[]) {
|
||||
20,21,22,23
|
||||
};
|
||||
|
||||
|
||||
marray A(boost::extents[2][3][4]);
|
||||
|
||||
A.assign(A_data,A_data+(2*3*4));
|
||||
|
||||
A.resize(boost::extents[4][3][2]);
|
||||
|
||||
int A_resize[] = {
|
||||
0,1,
|
||||
4,5,
|
||||
@@ -53,75 +60,14 @@ int test_main(int,char*[]) {
|
||||
0,0
|
||||
};
|
||||
|
||||
// resize through the extent_gen interface
|
||||
{
|
||||
marray A(boost::extents[2][3][4]);
|
||||
A.assign(A_data,A_data+(2*3*4));
|
||||
A.resize(boost::extents[4][3][2]);
|
||||
BOOST_CHECK(std::equal(A_resize,A_resize+(4*3*2),A.data()));
|
||||
}
|
||||
BOOST_TEST(std::equal(A_resize,A_resize+(4*3*2),A.data()));
|
||||
|
||||
// resize through the Collection
|
||||
{
|
||||
marray A(boost::extents[2][3][4]);
|
||||
A.assign(A_data,A_data+(2*3*4));
|
||||
boost::array<int,3> new_extents = {{4,3,2}};
|
||||
A.resize(new_extents);
|
||||
BOOST_CHECK(std::equal(A_resize,A_resize+(4*3*2),A.data()));
|
||||
}
|
||||
|
||||
// default construct all the new elements (in this case, all elements)
|
||||
{
|
||||
marray defaultA;
|
||||
defaultA.resize(boost::extents[2][3][4]);
|
||||
BOOST_CHECK(std::accumulate(defaultA.data(),
|
||||
BOOST_TEST(std::accumulate(defaultA.data(),
|
||||
defaultA.data()+(2*3*4),0) == 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// verify the preservation of storage order
|
||||
{
|
||||
int tiling_graph_storage_order[] = {2, 0, 1};
|
||||
bool tiling_graph_index_order[] = {true, true, true};
|
||||
|
||||
marray A(boost::extents[3][4][2],
|
||||
boost::general_storage_order<3>(tiling_graph_storage_order,
|
||||
tiling_graph_index_order));
|
||||
|
||||
|
||||
int value = 0;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int k = 0; k < 2; k++) {
|
||||
*(A.data() + value) = value;
|
||||
++value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// "Resize" to the same size
|
||||
A.resize(boost::extents[3][4][2]);
|
||||
|
||||
int check = 0;
|
||||
for (int x = 0; x < 3; x++) {
|
||||
for (int y = 0; y < 4; y++) {
|
||||
for (int z = 0; z < 2; z++) {
|
||||
BOOST_CHECK(*(A.data() + check) == check);
|
||||
++check;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -71,10 +71,10 @@ void test_views(Array& A, const ViewTraits&) {
|
||||
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+1][idx2+k*2]);
|
||||
BOOST_TEST(B[i][j][k] == A[idx0+i][idx1+j+1][idx2+k*2]);
|
||||
boost::array<index,3> elmts;
|
||||
elmts[0]=i; elmts[1]=j; elmts[2]=k;
|
||||
BOOST_CHECK(B(elmts) == A[idx0+i][idx1+j+1][idx2+k*2]);
|
||||
BOOST_TEST(B(elmts) == A[idx0+i][idx1+j+1][idx2+k*2]);
|
||||
}
|
||||
}
|
||||
// Degenerate dimensions
|
||||
@@ -84,34 +84,12 @@ void test_views(Array& A, const ViewTraits&) {
|
||||
|
||||
for (index i = 0; i != 2; ++i)
|
||||
for (index j = 0; j != 2; ++j) {
|
||||
BOOST_CHECK(B[i][j] == A[idx0+i][idx1+1][idx2+j*2]);
|
||||
BOOST_TEST(B[i][j] == A[idx0+i][idx1+1][idx2+j*2]);
|
||||
boost::array<index,2> elmts;
|
||||
elmts[0]=i; elmts[1]=j;
|
||||
BOOST_CHECK(B(elmts) == A[idx0+i][idx1+1][idx2+j*2]);
|
||||
BOOST_TEST(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;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ test_main(int, char*[])
|
||||
myarray.assign(data,data+data_size);
|
||||
|
||||
array3vec myvec(5,myarray);
|
||||
BOOST_CHECK(myarray == myvec[1]);
|
||||
BOOST_TEST(myarray == myvec[1]);
|
||||
|
||||
array3::array_view<2>::type myview =
|
||||
myarray[indices[1][range(0,2)][range(1,3)]];
|
||||
@@ -65,8 +65,8 @@ test_main(int, char*[])
|
||||
|
||||
myvec.push_back(myarray);
|
||||
|
||||
BOOST_CHECK(myarray != myvec[1]);
|
||||
BOOST_CHECK(myarray == myvec[5]);
|
||||
BOOST_TEST(myarray != myvec[1]);
|
||||
BOOST_TEST(myarray == myvec[5]);
|
||||
|
||||
return boost::exit_success;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ test_main(int,char*[])
|
||||
for (array::index i = 0; i != 2; ++i)
|
||||
for (array::index j = 0; j != 3; ++j)
|
||||
for (array::index k = 0; k != 4; ++k)
|
||||
BOOST_CHECK(A[i][j][k] == *num++);
|
||||
BOOST_TEST(A[i][j][k] == *num++);
|
||||
}
|
||||
|
||||
// Mimic fortran_storage_order using
|
||||
@@ -88,7 +88,7 @@ test_main(int,char*[])
|
||||
for (array::index i = 0; i != 2; ++i)
|
||||
for (array::index j = 0; j != 3; ++j)
|
||||
for (array::index k = 0; k != 4; ++k)
|
||||
BOOST_CHECK(A[i][j][k] == *num++);
|
||||
BOOST_TEST(A[i][j][k] == *num++);
|
||||
}
|
||||
|
||||
// general_storage_order with arbitrary storage order
|
||||
@@ -119,7 +119,7 @@ test_main(int,char*[])
|
||||
for (array::index i = 0; i != 2; ++i)
|
||||
for (array::index j = 0; j != 3; ++j)
|
||||
for (array::index k = 0; k != 4; ++k)
|
||||
BOOST_CHECK(A[i][j][k] == *num++);
|
||||
BOOST_TEST(A[i][j][k] == *num++);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ test_main(int,char*[])
|
||||
for (array::index i = 0; i != 2; ++i)
|
||||
for (array::index j = 0; j != 3; ++j)
|
||||
for (array::index k = 0; k != 4; ++k)
|
||||
BOOST_CHECK(A[i][j][k] == *num++);
|
||||
BOOST_TEST(A[i][j][k] == *num++);
|
||||
}
|
||||
|
||||
return boost::exit_success;
|
||||
|
||||
@@ -31,8 +31,8 @@ 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;
|
||||
|
||||
Reference in New Issue
Block a user