Squashed 'third_party/boostorg/multi_array/' content from commit abcb283
Change-Id: I4b93f75f0b15b00216d918bd6db5fc4fcb9c4cc2
git-subtree-dir: third_party/boostorg/multi_array
git-subtree-split: abcb2839d56669d1b5bb8a240ec644f47c66beb2
diff --git a/doc/xml/Jamfile.v2 b/doc/xml/Jamfile.v2
new file mode 100644
index 0000000..e52e5e9
--- /dev/null
+++ b/doc/xml/Jamfile.v2
@@ -0,0 +1,19 @@
+# Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+
+# Distributed under 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)
+project multi_array/doc ;
+import boostbook : boostbook ;
+
+path-constant here : . ;
+
+boostbook multi_array-doc
+ :
+ bbref.xml
+ :
+ <xsl:param>boost.root=../../../../..
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
+ <format>pdf:<xsl:param>img.src.path=$(here)/../
+ ;
+
diff --git a/doc/xml/MultiArray.xml b/doc/xml/MultiArray.xml
new file mode 100644
index 0000000..5978b07
--- /dev/null
+++ b/doc/xml/MultiArray.xml
@@ -0,0 +1,1019 @@
+<sect1 id="MultiArray"><title>MultiArray Concept</title>
+
+
+<para>The MultiArray
+concept defines an interface to hierarchically nested
+containers. It specifies operations for accessing elements,
+traversing containers, and creating views
+of array data.
+MultiArray defines
+a flexible memory model that accomodates
+a variety of data layouts.
+</para>
+
+<para>
+At each level (or dimension) of a MultiArray's
+container hierarchy lie a set of ordered containers, each of which
+contains the same number and type of values. The depth of this
+container hierarchy is the MultiArray's <emphasis>dimensionality</emphasis>.
+MultiArray is recursively defined; the
+containers at each level of the container hierarchy model
+MultiArray as well. While each dimension of a MultiArray
+has its own size, the list of sizes for all dimensions
+defines the <emphasis>shape</emphasis> of the entire MultiArray.
+At the base of this hierarchy lie 1-dimensional
+MultiArrays. Their values are the contained
+objects of interest and not part of the container hierarchy. These are
+the MultiArray's elements.
+</para>
+
+
+<para>
+Like other container concepts, MultiArray exports
+iterators to traverse its values. In addition, values can be
+addressed directly using the familiar bracket notation.
+</para>
+
+<para>
+MultiArray also specifies
+routines for creating
+specialized views. A <emphasis>view</emphasis> lets you treat a
+subset of the underlying
+elements in a MultiArray as though it were a separate
+MultiArray. Since a view refers to the same underlying elements,
+changes made to a view's elements will be reflected in the original
+MultiArray. For
+example, given a 3-dimensional "cube" of elements, a 2-dimensional
+slice can be viewed as if it were an independent
+MultiArray.
+
+Views are created using <literal>index_gen</literal> and
+<literal>index_range</literal> objects.
+<literal>index_range</literal>s denote elements from a certain
+dimension that are to be included in a
+view. <literal>index_gen</literal> aggregates range data and performs
+bookkeeping to determine the view type to be returned.
+
+MultiArray's <literal>operator[]</literal>
+ must be passed the result
+of <literal>N</literal> chained calls to
+<literal>index_gen::operator[]</literal>, i.e.
+
+<programlisting>indices[a0][a1]...[aN];
+</programlisting>
+
+where <literal>N</literal> is the
+MultiArray's dimensionality and
+<literal>indices</literal> an object of type <literal>index_gen</literal>.
+
+The view type is dependent upon the number of degenerate dimensions
+specified to <literal>index_gen</literal>. A degenerate dimension
+occurs when a single-index is specified to
+<literal>index_gen</literal> for a certain dimension. For example, if
+<literal>indices</literal> is an object of type
+<literal>index_gen</literal>, then the following example:
+
+<programlisting>indices[index_range(0,5)][2][index_range(0,4)];
+</programlisting>
+
+has a degenerate second dimension. The view generated from the above
+specification will have 2 dimensions with shape <literal>5 x 4</literal>.
+If the "<literal>2</literal>" above were replaced with
+another <literal>index_range</literal> object, for example:
+
+<programlisting>indices[index_range(0,5)][index_range(0,2)][index_range(0,4)];
+</programlisting>
+
+then the view would have 3 dimensions.</para>
+
+<para>
+MultiArray exports
+information regarding the memory
+layout of its contained elements. Its memory model for elements is
+completely defined by 4 properties: the origin, shape, index bases,
+and strides. The origin is the address in memory of the element
+accessed as <literal>a[0][0]...[0]</literal>, where
+<literal>a</literal> is a MultiArray. The shape is a list of numbers
+specifying the size of containers at each dimension. For example, the
+first extent is the size of the outermost container, the second extent
+is the size of its subcontainers, and so on. The index bases are a
+list of signed values specifying the index of the first value in a
+container. All containers at the same dimension share the same index
+base. Note that since positive index bases are
+possible, the origin need not exist in order to determine the location
+in memory of the MultiArray's elements.
+ The strides determine how index values are mapped to memory offsets.
+They accomodate a
+number of possible element layouts. For example, the elements of a 2
+dimensional array can be stored by row (i.e., the elements of each row
+are stored contiguously) or by column (i.e., the elements of each
+column are stored contiguously).
+</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
+to describe the MultiArray interface.</para>
+ <table>
+ <title>Notation</title>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry><literal>A</literal></entry>
+ <entry>A type that is a model of MultiArray
+</entry>
+ </row>
+ <row>
+ <entry><literal>a,b</literal></entry>
+ <entry>Objects of type <literal>A</literal></entry>
+ </row>
+ <row>
+ <entry><literal>NumDims</literal></entry>
+ <entry>The numeric dimension parameter associated with
+<literal>A</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>Dims</literal></entry>
+ <entry>Some numeric dimension parameter such that
+<literal>0<Dims<NumDims</literal>.
+</entry>
+ </row>
+ <row>
+ <entry><literal>indices</literal></entry>
+ <entry>An object created by some number of chained calls
+to <literal>index_gen::operator[](index_range)</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>index_list</literal></entry>
+ <entry>An object whose type models
+<ulink url="../../utility/Collection.html">Collection</ulink>
+</entry>
+ </row>
+ <row>
+ <entry><literal>idx</literal></entry>
+ <entry>A signed integral value.</entry>
+ </row>
+ <row>
+ <entry><literal>tmp</literal></entry>
+ <entry>An object of type
+ <literal>boost::array<index,NumDims></literal></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+</sect2>
+
+<sect2><title>Associated Types</title>
+<para>
+</para>
+<table><title>Associated Types</title>
+<tgroup cols="2">
+
+<thead>
+<row>
+<entry>Type</entry>
+<entry>Description</entry>
+</row>
+</thead>
+
+<tbody>
+
+<row>
+<entry><literal>value_type</literal></entry>
+
+<entry>This is the value type of the container.
+ If <literal>NumDims == 1</literal>, then this is
+<literal>element</literal>. Otherwise, this is the value type of the
+immediately nested containers.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>reference</literal>
+</entry>
+
+<entry>
+This is the reference type of the contained value.
+If <literal>NumDims == 1</literal>, then this is
+<literal>element&</literal>. Otherwise, this is the same type as
+<literal>template subarray<NumDims-1>::type</literal>.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>const_reference</literal>
+</entry>
+<entry>
+This is the const reference type of the contained value.
+If <literal>NumDims == 1</literal>, then this is
+<literal>const element&</literal>. Otherwise, this is the same
+type as
+<literal>template const_subarray<NumDims-1>::type</literal>.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>size_type</literal>
+</entry>
+<entry>
+This is an unsigned integral type. It is primarily used to specify array shape.
+</entry>
+</row>
+
+
+<row>
+<entry>
+<literal>difference_type</literal>
+</entry>
+<entry>
+This is a signed integral type used to represent the distance between two
+iterators. It is the same type as
+<literal>std::iterator_traits<iterator>::difference_type</literal>.
+</entry>
+</row>
+
+<row>
+<entry><literal>iterator</literal></entry>
+<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">
+<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>,
+<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>.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>const_iterator</literal>
+</entry>
+<entry>
+This is the const iterator over the values of <literal>A</literal>.
+</entry>
+</row>
+<row>
+
+<entry>
+<literal>reverse_iterator</literal>
+</entry>
+<entry>
+This is the reversed iterator, used to iterate backwards over the values of
+<literal>A</literal>.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>const_reverse_iterator</literal>
+</entry>
+<entry>
+This is the reversed const iterator.
+<literal>A</literal>.
+</entry>
+</row>
+<row>
+
+<entry>
+<literal>element</literal>
+</entry>
+<entry>
+This is the type of objects stored at the base of the
+hierarchy of MultiArrays. It is the same as
+<literal>template subarray<1>::value_type</literal>
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>index</literal>
+</entry>
+<entry>
+This is a signed integral type used for indexing into <literal>A</literal>. It
+is also used to represent strides and index bases.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>index_gen</literal>
+</entry>
+<entry>
+This type is used to create a tuple of <literal>index_range</literal>s
+passed to <literal>operator[]</literal> to create
+an <literal>array_view<Dims>::type</literal> object.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>index_range</literal>
+</entry>
+<entry>
+This type specifies a range of indices over some dimension of a
+MultiArray. This range will be visible through an
+<literal>array_view<Dims>::type</literal> object.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>template subarray<Dims>::type</literal>
+</entry>
+<entry>
+This is subarray type with <literal>Dims</literal> dimensions.
+It is the reference type of the <literal>(NumDims - Dims)</literal>
+dimension of <literal>A</literal> and also models
+MultiArray.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>template const_subarray<Dims>::type</literal>
+</entry>
+<entry>
+This is the const subarray type.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>template array_view<Dims>::type</literal>
+</entry>
+<entry>
+This is the view type with <literal>Dims</literal> dimensions. It is
+returned by calling <literal>operator[](<literal>indices</literal>)</literal>.
+It models MultiArray.
+</entry>
+</row>
+
+<row>
+<entry>
+<literal>template
+const_array_view<Dims>::type</literal>
+</entry>
+<entry>
+This is the const view type with <literal>Dims</literal> dimensions.
+</entry>
+</row>
+
+</tbody>
+</tgroup>
+</table>
+
+</sect2>
+
+
+ <sect2><title>Valid expressions</title>
+
+ <table><title>Valid Expressions</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Expression</entry>
+ <entry>Return type</entry>
+ <entry>Semantics</entry>
+ </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>
+ <entry>
+This returns a list of <literal>NumDims</literal> elements specifying the
+extent of each array dimension.
+</entry>
+ </row>
+
+ <row>
+ <entry><literal>a.strides()</literal></entry>
+ <entry><literal>const index*</literal></entry>
+ <entry>
+This returns a list of <literal>NumDims</literal> elements specifying the
+stride associated with each array dimension. When accessing values,
+strides is used to calculate an element's location in memory.
+</entry>
+ </row>
+
+ <row>
+ <entry><literal>a.index_bases()</literal></entry>
+ <entry><literal>const index*</literal></entry>
+ <entry>
+This returns a list of <literal>NumDims</literal> elements specifying the
+numeric index of the first element for each array dimension.
+</entry>
+ </row>
+ <row>
+ <entry><literal>a.origin()</literal></entry>
+ <entry>
+<literal>element*</literal> if <literal>a</literal> is mutable,
+<literal>const element*</literal> otherwise.
+</entry>
+<entry>
+This returns the address of the element accessed by the expression
+<literal>a[0][0]...[0].</literal>. If the index bases are positive,
+this element won't exist, but the address can still be used to locate
+a valid element given its indices.
+</entry>
+ </row>
+ <row>
+ <entry><literal>a.num_dimensions()</literal></entry>
+ <entry><literal>size_type</literal></entry>
+ <entry>This returns the number of dimensions of the array
+(note that <literal>a.num_dimensions() == NumDims</literal>).</entry>
+ </row>
+
+ <row>
+ <entry><literal>a.num_elements()</literal></entry>
+ <entry><literal>size_type</literal></entry>
+ <entry>This returns the number of elements contained
+in the array. It is equivalent to the following code:
+<programlisting>
+std::accumulate(a.shape(),a.shape+a.num_dimensions(),
+ size_type(1),std::multiplies<size_type>());
+</programlisting>
+</entry>
+ </row>
+
+ <row>
+ <entry><literal>a.size()</literal></entry>
+ <entry><literal>size_type</literal></entry>
+ <entry>
+This returns the number of values contained in
+<literal>a</literal>. It is equivalent to <literal>a.shape()[0];</literal>
+</entry>
+ </row>
+ <row>
+ <entry><literal>a(index_list)</literal></entry>
+ <entry>
+<literal>element&</literal>; if <literal>a</literal> is mutable,
+<literal>const element&</literal> otherwise.
+ </entry>
+ <entry>
+This expression accesses a specific element of
+<literal>a</literal>.<literal>index_list</literal> is the unique set
+of indices that address the element returned. It is
+equivalent to the following code (disregarding intermediate temporaries):
+<programlisting>
+ // multiply indices by strides
+ std::transform(index_list.begin(), index_list.end(),
+ a.strides(), tmp.begin(), std::multiplies<index>()),
+
+ // add the sum of the products to the origin
+ *std::accumulate(tmp.begin(), tmp.end(), a.origin());
+</programlisting>
+</entry>
+ </row>
+
+ <row>
+ <entry><literal>a.begin()</literal></entry>
+ <entry>
+<literal>iterator</literal> if <literal>a</literal> is mutable,
+<literal>const_iterator</literal> otherwise.
+ </entry>
+ <entry>This returns an iterator pointing to the beginning of
+<literal>a</literal>.</entry>
+ </row>
+
+ <row>
+ <entry><literal>a.end()</literal></entry>
+ <entry>
+<literal>iterator</literal> if <literal>a</literal> is mutable,
+<literal>const_iterator</literal> otherwise.
+ </entry>
+ <entry>This returns an iterator pointing to the end of
+<literal>a</literal>.</entry>
+ </row>
+
+ <row>
+ <entry><literal>a.rbegin()</literal></entry>
+ <entry>
+<literal>reverse_iterator</literal> if <literal>a</literal> is mutable,
+<literal>const_reverse_iterator</literal> otherwise.
+ </entry>
+ <entry>This returns a reverse iterator pointing to the
+beginning of <literal>a</literal> reversed.
+</entry>
+ </row>
+
+ <row>
+ <entry><literal>a.rend()</literal></entry>
+ <entry>
+<literal>reverse_iterator</literal> if <literal>a</literal> is mutable,
+<literal>const_reverse_iterator</literal> otherwise.
+</entry>
+ <entry>
+This returns a reverse iterator pointing to the end of <literal>a</literal>
+reversed.
+</entry>
+</row>
+ <row>
+ <entry><literal>a[idx]</literal></entry>
+ <entry>
+<literal>reference</literal> if <literal>a</literal> is mutable,
+<literal>const_reference</literal> otherwise.
+ </entry>
+ <entry>
+This returns a reference type that is bound to the index
+<literal>idx</literal> value of <literal>a</literal>. Note that if
+<literal>i</literal> is the index base for this dimension, the above
+expression returns the <literal>(idx-i)</literal>th element (counting
+from zero). The expression is equivalent to
+<literal>*(a.begin()+idx-a.index_bases()[0]);</literal>.
+</entry>
+ </row>
+
+ <row>
+ <entry><literal>a[indices]</literal></entry>
+ <entry>
+<literal>array_view<Dims>::type</literal> if
+<literal>a</literal> is mutable,
+<literal>const_array_view<Dims>::type</literal> otherwise.
+ </entry>
+ <entry>
+This expression generates a view of the array determined by the
+<literal>index_range</literal> and <literal>index</literal> values
+ used to construct <literal>indices</literal>.
+</entry>
+ </row>
+ <row>
+ <entry><literal>a == b</literal></entry>
+ <entry>bool</entry>
+ <entry>This performs a lexicographical comparison of the
+values of <literal>a</literal> and <literal>b</literal>. The element
+type must model <ulink url="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</ulink> for this
+expression to be valid.</entry>
+ </row>
+ <row>
+ <entry><literal>a < b</literal></entry>
+ <entry>bool</entry>
+ <entry>This performs a lexicographical comparison of the
+values of <literal>a</literal> and <literal>b</literal>. The element
+type must model <ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink> for this
+expression to be valid.</entry>
+ </row>
+ <row>
+ <entry><literal>a <= b</literal></entry>
+ <entry>bool</entry>
+ <entry>This performs a lexicographical comparison of the
+values of <literal>a</literal> and <literal>b</literal>. The element
+type must model <ulink url="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</ulink> and
+<ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink> for this
+expression to be valid.</entry>
+ </row>
+ <row>
+ <entry><literal>a > b</literal></entry>
+ <entry>bool</entry>
+ <entry>This performs a lexicographical comparison of the
+values of <literal>a</literal> and <literal>b</literal>. The element
+type must model <ulink url="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</ulink> and
+<ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink> for this
+expression to be valid.</entry>
+ </row>
+ <row>
+ <entry><literal>a >= b</literal></entry>
+ <entry>bool</entry>
+ <entry>This performs a lexicographical comparison of the
+values of <literal>a</literal> and <literal>b</literal>. The element
+type must model <ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink> for this
+expression to be valid.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+
+
+<sect2><title>Complexity guarantees</title>
+
+<literal>begin()</literal> and <literal>end()</literal> execute in amortized
+constant time.
+<literal>size()</literal> executes in at most linear time in the
+MultiArray's size.
+</sect2>
+
+<sect2>
+<title>Invariants</title>
+<table><title>Invariants</title>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>Valid range</entry>
+ <entry><literal>[a.begin(),a.end())</literal> is a valid range.
+ </entry>
+ </row>
+
+ <row>
+ <entry>Range size</entry>
+ <entry>
+<literal>a.size() == std::distance(a.begin(),a.end());</literal>.
+</entry>
+ </row>
+
+ <row>
+ <entry>Completeness</entry>
+ <entry>
+Iteration through the range
+<literal>[a.begin(),a.end())</literal> will traverse across every
+<literal>value_type</literal> of <literal>a</literal>.
+</entry>
+ </row>
+ <row>
+ <entry>Accessor Equivalence</entry>
+ <entry>
+Calling <literal>a[a1][a2]...[aN]</literal> where <literal>N==NumDims</literal>
+yields the same result as calling
+<literal>a(index_list)</literal>, where <literal>index_list</literal>
+is a <ulink url="../../utility/Collection.html">Collection</ulink> containing the values <literal>a1...aN</literal>.
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect2>
+
+<sect2 id="view_types">
+ <title>Associated Types for Views</title>
+ <para>The following MultiArray associated
+types define the interface for creating views of existing
+MultiArrays. Their interfaces and roles in the
+concept are described below.</para>
+
+ <sect3 id="index_range">
+ <title><literal>index_range</literal></title>
+
+ <para><literal>index_range</literal> objects represent half-open
+strided intervals. They are aggregated (using an
+<literal>index_gen</literal> object) and passed to
+a MultiArray's <literal>operator[]</literal>
+to create an array view. When creating a view,
+each <literal>index_range</literal> denotes a range of
+valid indices along one dimension of a MultiArray.
+Elements that are accessed through the set of ranges specified will be
+included in the constructed view. In some cases, an
+<literal>index_range</literal> is created without specifying start
+or finish values. In those cases, the object is interpreted to
+start at the beginning of a MultiArray dimension
+and end at its end.</para>
+
+<para>
+<literal>index_range</literal> objects can be constructed and modified
+several ways in order to allow convenient and clear expression of a
+range of indices. To specify ranges, <literal>index_range</literal>
+supports a set of constructors, mutating member functions, and a novel
+specification involving inequality operators. Using inequality
+operators, a half open range [5,10) can be specified as follows:
+<programlisting>5 <= index_range() < 10;</programlisting> or
+<programlisting>4 < index_range() <= 9;</programlisting> and so on.
+
+The following describes the
+<literal>index_range</literal> interface.
+</para>
+
+ <table>
+ <title>Notation</title>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry><literal>i</literal></entry>
+ <entry>An object of type <literal>index_range</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>idx,idx1,idx2,idx3</literal></entry>
+ <entry>Objects of type <literal>index</literal>.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table><title>Associated Types</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Type</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>index</literal></entry>
+ <entry>This is a signed integral type. It is used to
+specify the start, finish, and stride values.</entry>
+ </row>
+ <row>
+ <entry><literal>size_type</literal></entry>
+ <entry>This is an unsigned integral type. It is used to
+report the size of the range an <literal>index_range</literal>
+represents.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+
+ <table><title>Valid Expressions</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Expression</entry>
+ <entry>Return type</entry>
+ <entry>Semantics</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>index_range(idx1,idx2,idx3)</literal></entry>
+ <entry><literal>index_range</literal></entry>
+ <entry>This constructs an <literal>index_range</literal>
+ representing the interval <literal>[idx1,idx2)</literal>
+ with stride <literal>idx3</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>index_range(idx1,idx2)</literal></entry>
+ <entry><literal>index_range</literal></entry>
+ <entry>This constructs an <literal>index_range</literal>
+ representing the interval <literal>[idx1,idx2)</literal>
+ with unit stride. It is equivalent to
+ <literal>index_range(idx1,idx2,1)</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>index_range()</literal></entry>
+ <entry><literal>index_range</literal></entry>
+ <entry>This construct an <literal>index_range</literal>
+with unspecified start and finish values.</entry>
+ </row>
+ <row>
+ <entry><literal>i.start(idx1)</literal></entry>
+ <entry><literal>index&</literal></entry>
+ <entry>This sets the start index of <literal>i</literal> to
+ <literal>idx</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i.finish(idx)</literal></entry>
+ <entry><literal>index&</literal></entry>
+ <entry>This sets the finish index of <literal>i</literal> to
+ <literal>idx</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i.stride(idx)</literal></entry>
+ <entry><literal>index&</literal></entry>
+ <entry>This sets the stride length of <literal>i</literal> to
+ <literal>idx</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i.start()</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>This returns the start index of <literal>i</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i.finish()</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>This returns the finish index of <literal>i</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i.stride()</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>This returns the stride length of <literal>i</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i.get_start(idx)</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>If <literal>i</literal> specifies a start
+value, this is equivalent to <literal>i.start()</literal>. Otherwise it
+returns <literal>idx</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i.get_finish(idx)</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>If <literal>i</literal> specifies a finish
+value, this is equivalent to <literal>i.finish()</literal>. Otherwise it
+returns <literal>idx</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i.size(idx)</literal></entry>
+ <entry><literal>size_type</literal></entry>
+ <entry>If <literal>i</literal> specifies a both finish and
+start values, this is equivalent to
+<literal>(i.finish()-i.start())/i.stride()</literal>. Otherwise it
+returns <literal>idx</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i < idx</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>This is another syntax for specifying the finish
+value. This notation does not include
+<literal>idx</literal> in the range of valid indices. It is equivalent to
+<literal>index_range(r.start(), idx, r.stride())</literal></entry>
+ </row>
+ <row>
+ <entry><literal>i <= idx</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>This is another syntax for specifying the finish
+value. This notation includes
+<literal>idx</literal> in the range of valid indices. It is equivalent to
+<literal>index_range(r.start(), idx + 1, r.stride())</literal></entry>
+ </row>
+ <row>
+ <entry><literal>idx < i</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>This is another syntax for specifying the start
+value. This notation does not include
+<literal>idx</literal> in the range of valid indices. It is equivalent to
+<literal>index_range(idx + 1, i.finish(), i.stride())</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>idx <= i</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>This is another syntax for specifying the start
+value. This notation includes
+<literal>idx1</literal> in the range of valid indices. It is equivalent to
+<literal>index_range(idx, i.finish(), i.stride())</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i + idx</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>This expression shifts the start and finish values
+of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to
+<literal>index_range(r.start()+idx1, r.finish()+idx, r.stride())</literal></entry>
+ </row>
+ <row>
+ <entry><literal>i - idx</literal></entry>
+ <entry><literal>index</literal></entry>
+ <entry>This expression shifts the start and finish values
+of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to
+<literal>index_range(r.start()-idx1, r.finish()-idx, r.stride())</literal></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect3>
+
+ <sect3 id="index_gen">
+ <title><literal>index_gen</literal></title>
+ <para> <literal>index_gen</literal> aggregates
+<literal>index_range</literal> objects in order to specify view
+parameters. Chained calls to <literal>operator[]</literal> store
+range and dimension information used to
+instantiate a new view into a MultiArray.
+</para>
+ <table>
+ <title>Notation</title>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry><literal>Dims,Ranges</literal></entry>
+ <entry>Unsigned integral values.</entry>
+ </row>
+ <row>
+ <entry><literal>x</literal></entry>
+ <entry>An object of type
+<literal>template gen_type<Dims,Ranges>::type</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>i</literal></entry>
+ <entry>An object of type
+<literal>index_range</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>idx</literal></entry>
+ <entry>Objects of type <literal>index</literal>.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table><title>Associated Types</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Type</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>index</literal></entry>
+ <entry>This is a signed integral type. It is used to
+specify degenerate dimensions.</entry>
+ </row>
+ <row>
+ <entry><literal>size_type</literal></entry>
+ <entry>This is an unsigned integral type. It is used to
+report the size of the range an <literal>index_range</literal>
+represents.</entry>
+ </row>
+ <row>
+ <entry>
+<literal>template gen_type::<Dims,Ranges>::type</literal></entry>
+ <entry>This type generator names the result of
+<literal>Dims</literal> chained calls to
+<literal>index_gen::operator[]</literal>. The
+<literal>Ranges</literal> parameter is determined by the number of
+degenerate ranges specified (i.e. calls to
+<literal>operator[](index)</literal>). Note that
+<classname>index_gen</classname> and
+<classname>gen_type<0,0>::type</classname> are the same type.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+
+
+
+ <table><title>Valid Expressions</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Expression</entry>
+ <entry>Return type</entry>
+ <entry>Semantics</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>index_gen()</literal></entry>
+ <entry><literal>gen_type<0,0>::type</literal></entry>
+ <entry>This constructs an <literal>index_gen</literal>
+object. This object can then be used to generate tuples of
+<literal>index_range</literal> values.</entry>
+ </row>
+
+ <row>
+ <entry><literal>x[i]</literal></entry>
+ <entry><literal>gen_type<Dims+1,Ranges+1>::type</literal>
+</entry>
+ <entry>Returns a new object containing all previous
+<classname>index_range</classname> objects in addition to
+<literal>i.</literal> Chained calls to
+<function>operator[]</function> are the means by which
+<classname>index_range</classname> objects are aggregated.</entry>
+ </row>
+ <row>
+ <entry><literal>x[idx]</literal></entry>
+ <entry><literal>gen_type<Dims,Ranges+1>::type</literal>
+</entry>
+ <entry>Returns a new object containing all previous
+<classname>index_range</classname> objects in addition to a degenerate
+range, <literal>index_range(idx,idx).</literal> Note that this is NOT
+equivalent to <literal>x[index_range(idx,idx)].</literal>, which will
+return an object of type
+<literal>gen_type<Dims+1,Ranges+1>::type</literal>.
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect3>
+
+ </sect2>
+
+<sect2>
+<title>Models</title>
+
+ <itemizedlist>
+ <listitem> <literal>multi_array</literal> </listitem>
+ <listitem> <literal>multi_array_ref</literal> </listitem>
+ <listitem> <literal>const_multi_array_ref</literal> </listitem>
+ <listitem>
+ <literal>template array_view<Dims>::type</literal>
+ </listitem>
+ <listitem>
+ <literal>template const_array_view<Dims>::type</literal>
+ </listitem>
+ <listitem>
+ <literal>template subarray<Dims>::type</literal>
+ </listitem>
+ <listitem>
+ <literal>template const_subarray<Dims>::type</literal>
+ </listitem>
+ </itemizedlist>
+</sect2>
+
+</sect1>
diff --git a/doc/xml/bbref.xml b/doc/xml/bbref.xml
new file mode 100644
index 0000000..7b29d94
--- /dev/null
+++ b/doc/xml/bbref.xml
@@ -0,0 +1,806 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
+ "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd" [
+ <!ENTITY concepts SYSTEM "MultiArray.xml">
+ <!ENTITY multi_array SYSTEM "multi_array.xml">
+ <!ENTITY multi_array_ref SYSTEM "multi_array_ref.xml">
+ <!ENTITY const_multi_array_ref SYSTEM "const_multi_array_ref.xml">
+]>
+<library name="MultiArray" dirname="multi_array" id="multi_array"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ last-revision="$Date$">
+ <libraryinfo>
+ <author>
+ <firstname>Ronald</firstname>
+ <surname>Garcia</surname>
+ <affiliation>
+ <orgname>Indiana University</orgname>
+ <orgdiv>Open Systems Lab</orgdiv>
+ </affiliation>
+ </author>
+ <orgname>BOOST</orgname>
+ <copyright>
+ <year>2002</year>
+ <holder>The Trustees of Indiana University</holder>
+ </copyright>
+ <librarypurpose>Multidimensional containers and adaptors for
+ arrays of contiguous data</librarypurpose>
+ <librarycategory name="category:math"/>
+ <librarycategory name="category:containers"/>
+ </libraryinfo>
+
+<title>Boost.MultiArray Reference Manual</title>
+
+
+<para>Boost.MultiArray is composed of several components.
+The MultiArray concept defines a generic interface to multidimensional
+containers.
+<literal>multi_array</literal> is a general purpose container class
+that models MultiArray. <literal>multi_array_ref</literal>
+and <literal>const_multi_array_ref</literal> are adapter
+classes. Using them,
+you can manipulate any block of contiguous data as though it were a
+<literal>multi_array</literal>.
+<literal>const_multi_array_ref</literal> differs from
+<literal>multi_array_ref</literal> in that its elements cannot
+be modified through its interface. Finally, several auxiliary classes are used
+to create and specialize arrays and some global objects are defined as
+part of the library interface.</para>
+
+<sect1 id="synopsis">
+<title>Library Synopsis</title>
+ <para>To use Boost.MultiArray, you must include the header
+<filename>boost/multi_array.hpp</filename> in your source. This file
+brings the following declarations into scope:</para>
+<programlisting>
+<![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;
+ }
+
+ template <typename ValueType,
+ std::size_t NumDims,
+ typename Allocator = std::allocator<ValueType> >
+ class multi_array;
+
+ template <typename ValueType,
+ std::size_t NumDims>
+ class multi_array_ref;
+
+ template <typename ValueType,
+ std::size_t NumDims>
+ class const_multi_array_ref;
+
+ multi_array_types::extent_gen extents;
+ multi_array_types::index_gen indices;
+
+ template <typename Array, int N> class subarray_gen;
+ template <typename Array, int N> class const_subarray_gen;
+ template <typename Array, int N> class array_view_gen;
+ template <typename Array, int N> class const_array_view_gen;
+
+ class c_storage_order;
+ class fortran_storage_order;
+ template <std::size_t NumDims> class general_storage_order;
+
+}]]>
+</programlisting>
+</sect1>
+
+&concepts;
+
+<sect1 id="array_types">
+<title>Array Components</title>
+<para>
+Boost.MultiArray defines an array class,
+<literal>multi_array</literal>, and two adapter classes,
+<literal>multi_array_ref</literal> and
+<literal>const_multi_array_ref</literal>. The three classes model
+MultiArray and so they share a lot of functionality.
+<literal>multi_array_ref</literal> differs from
+<literal>multi_array</literal> in that the
+<literal>multi_array</literal> manages its own memory, while
+<literal>multi_array_ref</literal> is passed a block of memory that it
+expects to be externally managed.
+<literal>const_multi_array_ref</literal> differs from
+<literal>multi_array_ref</literal> in that the underlying elements it
+adapts cannot be modified through its interface, though some array
+properties, including the array shape and index bases, can be altered.
+Functionality the classes have in common is described
+below.
+</para>
+
+<formalpara>
+<title>Note: Preconditions, Effects, and Implementation</title>
+<para>
+Throughout the following sections, small pieces of C++ code are
+used to specify constraints such as preconditions, effects, and
+postconditions. These do not necessarily describe the underlying
+implementation of array components; rather, they describe the
+expected input to and
+behavior of the specified operations. Failure to meet
+preconditions results in undefined behavior. Not all effects
+(i.e. copy constructors, etc.) must be mimicked exactly. The code
+snippets for effects intend to capture the essence of the described
+operation.
+</para>
+</formalpara>
+
+<formalpara>
+<title>Queries</title>
+
+<variablelist>
+<varlistentry>
+<term><programlisting>element* data();
+const element* data() const;</programlisting></term>
+<listitem>
+<para>This returns a pointer to the beginning of the
+contiguous block that contains the array's data. If all dimensions of
+the array are 0-indexed and stored in ascending order, this is
+equivalent to <literal>origin()</literal>. Note that
+<literal>const_multi_array_ref</literal> only provides the const
+version of this function.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><programlisting>element* origin();
+const element* origin() const;</programlisting></term>
+<listitem>
+<para>This returns the origin element of the
+<literal>multi_array</literal>. Note that
+<literal>const_multi_array_ref</literal> only provides the const
+version of this function. (Required by MultiArray)
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>const index* index_bases();</function></term>
+<listitem>
+<para>This returns the index bases for the
+<literal>multi_array</literal>. (Required by MultiArray)
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>const index* strides();</function></term>
+<listitem>
+<para>This returns the strides for the
+<literal>multi_array</literal>. (Required by MultiArray)
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>const size_type* shape();</function></term>
+<listitem>
+<para>This returns the shape of the
+<literal>multi_array</literal>. (Required by MultiArray)
+</para>
+</listitem>
+</varlistentry>
+</variablelist>
+
+</formalpara>
+
+<formalpara>
+<title>Comparators</title>
+<variablelist>
+<varlistentry>
+<term><programlisting><![CDATA[
+bool operator==(const *array-type*& rhs);
+bool operator!=(const *array-type*& rhs);
+bool operator<(const *array-type*& rhs);
+bool operator>(const *array-type*& rhs);
+bool operator>=(const *array-type*& rhs);
+bool operator<=(const *array-type*& rhs);]]></programlisting></term>
+
+<listitem>
+<para>Each comparator executes a lexicographical compare over
+the value types of the two arrays.
+(Required by MultiArray)
+</para>
+<formalpara>
+<title>Preconditions</title>
+<para><literal>element</literal> must support the
+comparator corresponding to that called on
+<literal>multi_array</literal>.</para>
+</formalpara>
+
+<formalpara>
+<title>Complexity</title>
+<para>O(<literal>num_elements()</literal>).</para>
+</formalpara>
+
+</listitem>
+</varlistentry>
+
+</variablelist>
+</formalpara>
+
+<formalpara>
+<title>Modifiers</title>
+
+<variablelist>
+
+<varlistentry>
+<term>
+<programlisting>
+<![CDATA[
+template <typename SizeList>
+void reshape(const SizeList& sizes)
+]]>
+</programlisting>
+</term>
+
+<listitem>
+<para>This changes the shape of the <literal>multi_array</literal>. The
+number of elements and the index bases remain the same, but the number
+of values at each level of the nested container hierarchy may
+change.</para>
+
+<formalpara><title><literal>SizeList</literal> Requirements</title>
+<para><literal>SizeList</literal> must model
+<ulink url="../../utility/Collection.html">Collection</ulink>.</para>
+</formalpara>
+
+<formalpara><title>Preconditions</title>
+<para>
+<programlisting>
+<![CDATA[std::accumulate(sizes.begin(),sizes.end(),size_type(1),std::times<size_type>()) == this->num_elements();
+sizes.size() == NumDims;]]>
+</programlisting></para>
+</formalpara>
+
+
+<formalpara><title>Postconditions</title>
+<para>
+<literal>std::equal(sizes.begin(),sizes.end(),this->shape) == true;</literal>
+</para>
+</formalpara>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<programlisting>
+<![CDATA[
+template <typename BaseList>
+void reindex(const BaseList& values);
+]]>
+</programlisting>
+</term>
+<listitem>
+<para>This changes the index bases of the <literal>multi_array</literal> to
+correspond to the the values in <literal>values</literal>.</para>
+
+<formalpara>
+<title><literal>BaseList</literal> Requirements</title>
+<para><literal>BaseList</literal> must model
+<ulink url="../../utility/Collection.html">Collection</ulink>.</para>
+</formalpara>
+
+<formalpara>
+<title>Preconditions</title>
+<para><literal>values.size() == NumDims;</literal></para>
+</formalpara>
+
+
+<formalpara>
+<title>Postconditions</title>
+<para><literal>std::equal(values.begin(),values.end(),this->index_bases());
+</literal></para>
+</formalpara>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<programlisting>
+<![CDATA[
+void reindex(index value);
+]]>
+</programlisting>
+</term>
+<listitem>
+<para>This changes the index bases of all dimensions of the
+<literal>multi_array</literal> to <literal>value</literal>.</para>
+
+<formalpara>
+<title>Postconditions</title>
+<para>
+<programlisting>
+<![CDATA[
+std::count_if(this->index_bases(),this->index_bases()+this->num_dimensions(),
+ std::bind_2nd(std::equal_to<index>(),value)) ==
+ this->num_dimensions();
+]]>
+</programlisting>
+</para>
+</formalpara>
+</listitem>
+</varlistentry>
+
+</variablelist>
+</formalpara>
+
+&multi_array;
+&multi_array_ref;
+&const_multi_array_ref;
+
+</sect1>
+
+
+<sect1 id="auxiliary">
+ <title>Auxiliary Components</title>
+
+<sect2 id="multi_array_types">
+<title><literal>multi_array_types</literal></title>
+
+<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;
+}]]>
+</programlisting>
+
+<para>Namespace <literal>multi_array_types</literal> defines types
+associated with <literal>multi_array</literal>,
+<literal>multi_array_ref</literal>, and
+<literal>const_multi_array_ref</literal> that are not
+dependent upon template parameters. These types find common use with
+all Boost.Multiarray components. They are defined
+in a namespace from which they can be accessed conveniently.
+With the exception of <literal>extent_gen</literal> and
+<literal>extent_range</literal>, these types fulfill the roles of the
+same name required by MultiArray and are described in its
+concept definition. <literal>extent_gen</literal> and
+<literal>extent_range</literal> are described below.
+</para>
+</sect2>
+
+
+<sect2 id="extent_range">
+ <title><classname>extent_range</classname></title>
+
+<para><classname>extent_range</classname> objects define half open
+intervals. They provide shape and index base information to
+<literal>multi_array</literal>, <literal>multi_array_ref</literal>,
+ and <literal>const_multi_array_ref</literal> constructors.
+<classname>extent_range</classname>s are passed in
+aggregate to an array constructor (see
+<classname>extent_gen</classname> for more details).
+</para>
+
+<formalpara>
+ <title>Synopsis</title>
+<programlisting><![CDATA[
+class extent_range {
+public:
+ typedef multi_array_types::index index;
+ typedef multi_array_types::size_type size_type;
+
+ // Structors
+ extent_range(index start, index finish);
+ extent_range(index finish);
+ ~extent_range();
+
+ // Queries
+ index start();
+ index finish();
+ size_type size();
+};]]></programlisting>
+</formalpara>
+
+ <formalpara>
+ <title>Model Of</title>
+ <para>DefaultConstructible,CopyConstructible</para>
+ </formalpara>
+
+<formalpara><title>Methods and Types</title>
+<variablelist>
+<varlistentry>
+<term><function>extent_range(index start, index finish)</function></term>
+<listitem>
+<para> This constructor defines the half open interval
+<literal>[start,finish)</literal>. The expression
+<literal>finish</literal> must be greater than <literal>start</literal>.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry><term><function>extent_range(index finish)</function></term>
+<listitem>
+<para>This constructor defines the half open interval
+<literal>[0,finish)</literal>. The value of <literal>finish</literal>
+must be positive.</para>
+</listitem>
+</varlistentry>
+
+<varlistentry><term><function>index start()</function></term>
+<listitem>
+<para>This function returns the first index represented by the range</para>
+</listitem>
+</varlistentry>
+
+<varlistentry><term><function>index finish()</function></term>
+<listitem>
+<para>This function returns the upper boundary value of the half-open
+interval. Note that the range does not include this value.</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>size_type size()</function></term>
+<listitem>
+<para>This function returns the size of the specified range. It is
+equivalent to <literal>finish()-start()</literal>.</para>
+</listitem>
+</varlistentry>
+
+</variablelist>
+</formalpara>
+</sect2>
+
+<sect2 id="extent_gen">
+ <title><classname>extent_gen</classname></title>
+ <para>The <classname>extent_gen</classname> class defines an
+interface for aggregating array shape and indexing information to be
+passed to a <literal>multi_array</literal>,
+<literal>multi_array_ref</literal>, or <literal>const_multi_array_ref</literal>
+constructor. Its interface mimics
+ the syntax used to declare built-in array types
+in C++. For example, while a 3-dimensional array of
+<classname>int</classname> values in C++ would be
+declared as:
+<programlisting>int A[3][4][5],</programlisting>
+a similar <classname>multi_array</classname> would be declared:
+<programlisting>multi_array<int,3> A(extents[3][4][5]).</programlisting>
+</para>
+
+<formalpara><title>Synopsis</title>
+<programlisting>< const;
+ gen_type<NumRanges+1>::type operator[](index idx) const;
+};
+
+typedef *implementation_defined*<0> extent_gen;
+]]></programlisting>
+</formalpara>
+
+<formalpara><title>Methods and Types</title>
+<variablelist>
+<varlistentry>
+<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
+<literal>extent_gen::operator[].</literal> The types
+<classname>extent_gen</classname> and
+<classname>gen_type<0>::type</classname> are the same.</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>gen_type<NumRanges+1>::type
+operator[](const extent_range& a_range) const;</function></term>
+<listitem>
+<para>This function returns a new object containing all previous
+<classname>extent_range</classname> objects in addition to
+<literal>a_range.</literal> <classname>extent_range</classname>
+objects are aggregated by chained calls to
+<function>operator[]</function>.</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>gen_type<NumRanges+1>::type
+operator[](index idx) const;</function></term>
+<listitem>
+<para>This function returns a new object containing all previous
+<classname>extent_range</classname> objects in addition to
+<literal>extent_range(0,idx).</literal> This function gives the array
+constructors a similar syntax to traditional C multidimensional array
+declaration.</para>
+</listitem>
+</varlistentry>
+
+</variablelist>
+</formalpara>
+</sect2>
+
+<sect2>
+ <title>Global Objects</title>
+ <para>For syntactic convenience, Boost.MultiArray defines two
+global objects as part of its
+interface. These objects play the role of object generators;
+expressions involving them create other objects of interest.
+</para>
+
+ <para> Under some circumstances, the two global objects may be
+considered excessive overhead. Their construction can be prevented by
+defining the preprocessor symbol
+<literal>BOOST_MULTI_ARRAY_NO_GENERATORS</literal> before including
+<filename>boost/multi_array.hpp.</filename></para>
+
+<sect3 id="extents">
+<title><literal>extents</literal></title>
+
+<programlisting>
+<![CDATA[namespace boost {
+ multi_array_base::extent_gen extents;
+}]]>
+</programlisting>
+
+ <para>Boost.MultiArray's array classes use the
+<literal>extents</literal> global object to specify
+array shape during their construction.
+For example,
+a 3 by 3 by 3 <classname>multi_array</classname> is constructed as follows:
+<programlisting>multi_array<int,3> A(extents[3][3][3]);</programlisting>
+The same array could also be created by explicitly declaring an <literal>extent_gen</literal>
+object locally,, but the global object makes this declaration unnecessary.
+</para>
+</sect3>
+
+<sect3 id="indices">
+<title><literal>indices</literal></title>
+
+<programlisting>
+<![CDATA[namespace boost {
+ multi_array_base::index_gen indices;
+}]]>
+</programlisting>
+
+ <para>The MultiArray concept specifies an
+<literal>index_gen</literal> associated type that is used to
+create views.
+<literal>indices</literal> is a global object that serves the role of
+<literal>index_gen</literal> for all array components provided by this
+library and their associated subarrays and views.
+</para>
+<para>For example, using the <literal>indices</literal> object,
+a view of an array <literal>A</literal> is constructed as follows:
+<programlisting>
+A[indices[index_range(0,5)][2][index_range(2,4)]];
+</programlisting>
+</para>
+</sect3>
+</sect2>
+
+<sect2 id="generators">
+<title>View and SubArray Generators</title>
+<para>
+Boost.MultiArray provides traits classes, <literal>subarray_gen</literal>,
+<literal>const_subarray_gen</literal>,
+<literal>array_view_gen</literal>,
+and <literal>const_array_view_gen</literal>, for naming of
+array associated types within function templates.
+In general this is no more convenient to use than the nested
+type generators, but the library author found that some C++ compilers do not
+properly handle templates nested within function template parameter types.
+These generators constitute a workaround for this deficit.
+The following code snippet illustrates
+the correspondence between the <literal>array_view_gen</literal>
+traits class and the <literal>array_view</literal> type associated to
+an array:
+
+<programlisting>
+template <typename Array>
+void my_function() {
+ typedef typename Array::template array_view<3>::type view1_t;
+ typedef typename boost::array_view_gen<Array,3>::type view2_t;
+ // ...
+}
+</programlisting>
+
+In the above example, <literal>view1_t</literal> and
+<literal>view2_t</literal> have the same type.
+</para>
+</sect2>
+
+
+<sect2 id="memory_layout">
+<title>Memory Layout Specifiers</title>
+<para>
+While a multidimensional array represents a hierarchy of containers of
+elements, at some point the elements must be laid out in
+memory. As a result, a single multidimensional array
+can be represented in memory more than one way.
+</para>
+
+<para>For example, consider the two dimensional array shown below in
+matrix notation:
+
+<graphic fileref="matrix.gif"/>
+
+Here is how the above array is expressed in C++:
+<programlisting>
+int a[3][4] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+</programlisting>
+This is an example of row-major storage, where elements of each row
+are stored contiguously.
+
+While C++ transparently handles accessing elements of an array, you
+can also manage the array and its indexing manually. One way that
+this may be expressed in memory is as follows:
+<programlisting>
+int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+int s[] = { 4, 1 };
+</programlisting>
+
+With the latter declaration of <literal>a</literal> and
+strides <literal>s</literal>, element <literal>a(i,j)</literal>
+of the array can be
+accessed using the expression
+<programlisting>*a+i*s[0]+j*s[1]</programlisting>.
+</para>
+
+<para>The same two dimensional array could be laid out by column as follows:
+
+<programlisting>
+int a[] = { 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11 };
+int s[] = { 3, 1 };
+</programlisting>
+Notice that the strides here are different. As a result,
+The expression given above to access values will work with this pair
+of data and strides as well.
+</para>
+
+<para>In addition to dimension order, it is also possible to
+store any dimension in descending order. For example, returning to the
+first example, the first dimension of the example array, the
+rows, could be stored in
+reverse, resulting in the following:
+
+<programlisting>
+int data[] = { 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3 };
+int *a = data + 8;
+int s[] = { -4, 1 };
+</programlisting>
+
+Note that in this example <literal>a</literal> must be explicitly set
+to the origin. In the previous examples, the
+first element stored in memory was the origin; here this is no longer
+the case.
+</para>
+
+<para>
+Alternatively, the second dimension, or the columns, could be reversed
+and the rows stored in ascending order:
+
+<programlisting>
+int data[] = { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8 };
+int *a = data + 3;
+int s[] = { 4, -1 };
+</programlisting>
+</para>
+
+<para>
+Finally, both dimensions could be stored in descending order:
+
+<programlisting>
+int data[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+int *a = data + 11;
+int s[] = { -4, -1 };
+</programlisting>
+<literal>
+</literal>
+</para>
+
+<para>
+All of the above arrays are equivalent. The expression
+given above for <literal>a(i,j)</literal> will yield the same value
+regardless of the memory layout.
+
+Boost.MultiArray arrays can be created with customized storage
+parameters as described above. Thus, existing data can be adapted
+(with <literal>multi_array_ref</literal> or
+<literal>const_multi_array_ref</literal>) as suited to the array
+abstraction. A common usage of this feature would be to wrap arrays
+that must interoperate with Fortran routines so they can be
+manipulated naturally at both the C++ and Fortran levels. The
+following sections describe the Boost.MultiArray components used to
+specify memory layout.
+</para>
+
+<sect3 id="c_storage_order">
+<title><literal>c_storage_order</literal></title>
+<programlisting>
+<![CDATA[class c_storage_order {
+ c_storage_order();
+};]]>
+</programlisting>
+
+<para><literal>c_storage_order</literal> is used to specify that an
+array should store its elements using the same layout as that used by
+primitive C++ multidimensional arrays, that is, from last dimension
+to first. This is the default storage order for the arrays provided by
+this library.</para>
+</sect3>
+
+<sect3 id="fortran_storage_order">
+<title><literal>fortran_storage_order</literal></title>
+<programlisting>
+<![CDATA[class fortran_storage_order {
+ fortran_storage_order();
+};]]>
+</programlisting>
+
+<para><literal>fortran_storage_order</literal> is used to specify that
+an array should store its elements using the same memory layout as a
+Fortran multidimensional array would, that is, from first dimension to
+last.</para>
+</sect3>
+
+<sect3 id="general_storage_order">
+<title><literal>general_storage_order</literal></title>
+<programlisting>
+<![CDATA[template <std::size_t NumDims>
+class general_storage_order {
+
+ template <typename OrderingIter, typename AscendingIter>
+ general_storage_order(OrderingIter ordering, AscendingIter ascending);
+};]]>
+</programlisting>
+
+<para><literal>general_storage_order</literal> allows the user to
+specify an arbitrary memory layout for the contents of an array. The
+constructed object is passed to the array constructor in order to
+specify storage order.</para>
+
+<para>
+<literal>OrderingIter</literal> and <literal>AscendingIter</literal>
+must model the <literal>InputIterator</literal> concept. Both
+iterators must refer to a range of <literal>NumDims</literal>
+elements. <literal>AscendingIter</literal> points to objects
+convertible to <literal>bool</literal>. A value of
+<literal>true</literal> means that a dimension is stored in ascending
+order while <literal>false</literal> means that a dimension is stored
+in descending order. <literal>OrderingIter</literal> specifies the
+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>
+
+
+</library>
diff --git a/doc/xml/const_multi_array_ref.xml b/doc/xml/const_multi_array_ref.xml
new file mode 100644
index 0000000..edf43bf
--- /dev/null
+++ b/doc/xml/const_multi_array_ref.xml
@@ -0,0 +1,190 @@
+<sect2 id="const_multi_array_ref">
+<title><literal>const_multi_array_ref</literal></title>
+
+<para>
+<literal>const_multi_array_ref</literal> is a multi-dimensional container
+adaptor. It provides the MultiArray interface over any contiguous
+block of elements. <literal>const_multi_array_ref</literal> exports the
+same interface as <literal>multi_array</literal>, with the exception
+of the constructors.
+</para>
+
+
+<formalpara>
+ <title>Model Of.</title>
+<para>
+<literal>const_multi_array_ref</literal> models
+<link linkend="MultiArray">MultiArray</link>,
+<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>.
+and depending on the element type, it may also model
+<ulink url="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</ulink> and <ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink>.
+
+Detailed descriptions are provided here only for operations that are
+not described in the <literal>multi_array</literal> reference.
+</para>
+</formalpara>
+
+<formalpara>
+<title>Synopsis</title>
+
+<programlisting>
+< const;
+ const_array_view<Dims>::type operator[](const indices_tuple& r) const;
+
+ // queries
+ const element* data() const;
+ const element* origin() const;
+ const size_type* shape() const;
+ const index* strides() const;
+ const index* index_bases() const;
+ const storage_order_type& storage_order() const;
+
+ // comparators
+ bool operator==(const const_multi_array_ref& rhs);
+ bool operator!=(const const_multi_array_ref& rhs);
+ bool operator<(const const_multi_array_ref& rhs);
+ bool operator>(const const_multi_array_ref& rhs);
+ bool operator>=(const const_multi_array_ref& rhs);
+ bool operator<=(const const_multi_array_ref& rhs);
+
+ // modifiers:
+ template <typename SizeList>
+ void reshape(const SizeList& sizes)
+ template <typename BaseList> void reindex(const BaseList& values);
+ void reindex(index value);
+};
+]]>
+</programlisting>
+</formalpara>
+
+<formalpara>
+<title>Constructors</title>
+
+<variablelist>
+<varlistentry>
+<term><programlisting>template <typename ExtentList>
+explicit const_multi_array_ref(TPtr data,
+ const ExtentList& sizes,
+ const storage_order& store = c_storage_order());
+</programlisting></term>
+<listitem>
+
+<para>
+This constructs a <literal>const_multi_array_ref</literal> using the specified
+parameters. <literal>sizes</literal> specifies the shape of the
+constructed <literal>const_multi_array_ref</literal>. <literal>store</literal>
+specifies the storage order or layout in memory of the array
+dimensions.
+</para>
+
+<formalpara><title><literal>ExtentList</literal> Requirements</title>
+<para>
+<literal>ExtentList</literal> must model <ulink url="../../utility/Collection.html">Collection</ulink>.
+</para>
+</formalpara>
+
+<formalpara><title>Preconditions</title>
+<para><literal>sizes.size() == NumDims;</literal></para>
+</formalpara>
+
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<programlisting><![CDATA[explicit const_multi_array_ref(TPtr data,
+ extent_gen::gen_type<NumDims>::type ranges,
+ const storage_order& store = c_storage_order());]]>
+</programlisting></term>
+<listitem>
+<formalpara><title>Effects</title>
+<para>
+This constructs a <literal>const_multi_array_ref</literal> using the specified
+ parameters. <literal>ranges</literal> specifies the shape and
+index bases of the constructed const_multi_array_ref. It is the result of
+<literal>NumDims</literal> chained calls to
+ <literal>extent_gen::operator[]</literal>. <literal>store</literal>
+specifies the storage order or layout in memory of the array
+dimensions.
+</para>
+</formalpara>
+</listitem>
+</varlistentry>
+
+
+<varlistentry>
+<term><programlisting>
+<![CDATA[const_multi_array_ref(const const_multi_array_ref& x);]]>
+</programlisting></term>
+<listitem>
+<formalpara>
+<title>Effects</title>
+ <para>This constructs a shallow copy of <literal>x</literal>.
+</para></formalpara>
+</listitem>
+</varlistentry>
+
+</variablelist>
+
+</formalpara>
+
+</sect2>
diff --git a/doc/xml/multi_array.xml b/doc/xml/multi_array.xml
new file mode 100644
index 0000000..db42882
--- /dev/null
+++ b/doc/xml/multi_array.xml
@@ -0,0 +1,375 @@
+<sect2 id="multi_array_class">
+<title><literal>multi_array</literal></title>
+
+<para>
+<literal>multi_array</literal> is a multi-dimensional container that
+supports random access iteration. Its number of dimensions is
+fixed at compile time, but its shape and the number of elements it
+contains are specified during its construction. The number of elements
+will remain fixed for the duration of a
+<literal>multi_array</literal>'s lifetime, but the shape of the container can
+be changed. A <literal>multi_array</literal> manages its data elements
+using a replaceable allocator.
+</para>
+
+
+<formalpara>
+ <title>Model Of.</title>
+<para>
+<link linkend="MultiArray">MultiArray</link>,
+<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>. Depending on the element type,
+it may also model <ulink url="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</ulink> and <ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink>.
+</para>
+</formalpara>
+
+<formalpara>
+<title>Synopsis</title>
+
+<programlisting>
+<;
+ const_reference operator[](index i) const;
+ array_view<Dims>::type operator[](const indices_tuple& r);
+ const_array_view<Dims>::type operator[](const indices_tuple& r) const;
+
+ // queries
+ element* data();
+ const element* data() const;
+ element* origin();
+ const element* origin() const;
+ const size_type* shape() const;
+ const index* strides() const;
+ const index* index_bases() const;
+ const storage_order_type& storage_order() const;
+
+ // comparators
+ bool operator==(const multi_array& rhs);
+ bool operator!=(const multi_array& rhs);
+ bool operator<(const multi_array& rhs);
+ bool operator>(const multi_array& rhs);
+ bool operator>=(const multi_array& rhs);
+ bool operator<=(const multi_array& rhs);
+
+ // modifiers:
+ template <typename InputIterator>
+ void assign(InputIterator begin, InputIterator end);
+ 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);
+ multi_array& resize(extents_tuple& extents);
+};
+]]>
+</programlisting>
+</formalpara>
+
+<formalpara>
+<title>Constructors</title>
+
+<variablelist>
+<varlistentry>
+<term><programlisting>template <typename ExtentList>
+explicit multi_array(const ExtentList& sizes,
+ const storage_order_type& store = c_storage_order(),
+ const Allocator& alloc = Allocator());
+</programlisting></term>
+<listitem>
+
+<para>
+This constructs a <literal>multi_array</literal> using the specified
+parameters. <literal>sizes</literal> specifies the shape of the
+constructed <literal>multi_array</literal>. <literal>store</literal>
+specifies the storage order or layout in memory of the array
+dimensions. <literal>alloc</literal> is used to
+allocate the contained elements.
+</para>
+
+<formalpara><title><literal>ExtentList</literal> Requirements</title>
+<para>
+<literal>ExtentList</literal> must model <ulink url="../../utility/Collection.html">Collection</ulink>.
+</para>
+</formalpara>
+
+<formalpara><title>Preconditions</title>
+<para><literal>sizes.size() == NumDims;</literal></para>
+</formalpara>
+
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<programlisting><![CDATA[explicit multi_array(extent_gen::gen_type<NumDims>::type ranges,
+ const storage_order_type& store = c_storage_order(),
+ const Allocator& alloc = Allocator());]]>
+</programlisting></term>
+<listitem>
+<para>
+This constructs a <literal>multi_array</literal> using the specified
+ parameters. <literal>ranges</literal> specifies the shape and
+index bases of the constructed multi_array. It is the result of
+<literal>NumDims</literal> chained calls to
+ <literal>extent_gen::operator[]</literal>. <literal>store</literal>
+specifies the storage order or layout in memory of the array
+dimensions. <literal>alloc</literal> is the allocator used to
+allocate the memory used to store <literal>multi_array</literal>
+elements.
+</para>
+</listitem>
+</varlistentry>
+
+
+<varlistentry>
+<term><programlisting>
+<![CDATA[multi_array(const multi_array& x);
+multi_array(const const_multi_array_ref<ValueType,NumDims>& x);
+multi_array(const const_subarray<NumDims>::type& x);
+multi_array(const const_array_view<NumDims>::type& x);
+multi_array(const multi_array_ref<ValueType,NumDims>& x);
+multi_array(const subarray<NumDims>::type& x);
+multi_array(const array_view<NumDims>::type& x);]]>
+</programlisting></term>
+<listitem>
+<para>These constructors all constructs a <literal>multi_array</literal> and
+perform a deep copy of <literal>x</literal>.
+</para>
+
+<formalpara>
+<title>Complexity</title>
+<para> This performs O(<literal>x.num_elements()</literal>) calls to
+<literal>element</literal>'s copy
+constructor.
+</para></formalpara>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><programlisting>
+<![CDATA[multi_array();]]>
+</programlisting></term>
+<listitem>
+<para>This constructs a <literal>multi_array</literal> whose shape is (0,...,0) and contains no elements.
+</para>
+</listitem>
+</varlistentry>
+
+</variablelist>
+
+<formalpara><title>Note on Constructors</title>
+<para>
+The <literal>multi_array</literal> construction expressions,
+<programlisting>
+ multi_array<int,3> A(boost::extents[5][4][3]);
+</programlisting>
+and
+<programlisting>
+ boost::array<multi_array_base::index,3> my_extents = {{5, 4, 3}};
+ multi_array<int,3> A(my_extents);
+</programlisting>
+are equivalent.
+</para>
+</formalpara>
+</formalpara>
+
+<formalpara>
+<title>Modifiers</title>
+
+<variablelist>
+
+<varlistentry>
+<term><programlisting>
+<![CDATA[multi_array& operator=(const multi_array& x);
+template <class Array> multi_array& operator=(const Array& x);]]>
+</programlisting>
+</term>
+
+<listitem>
+<para>This performs an element-wise copy of <literal>x</literal>
+into the current <literal>multi_array</literal>.</para>
+
+<formalpara>
+<title><literal>Array</literal> Requirements</title>
+<para><literal>Array</literal> must model MultiArray.
+</para></formalpara>
+
+<formalpara>
+<title>Preconditions</title>
+<para>
+<programlisting>std::equal(this->shape(),this->shape()+this->num_dimensions(),
+x.shape());</programlisting></para>
+</formalpara>
+
+<formalpara>
+<title>Postconditions</title>
+<para>
+<programlisting>(*.this) == x;</programlisting>
+</para>
+</formalpara>
+
+<formalpara>
+<title>Complexity</title>
+<para>The assignment operators perform
+O(<literal>x.num_elements()</literal>) calls to <literal>element</literal>'s
+copy constructor.</para></formalpara>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<programlisting>
+<![CDATA[
+template <typename InputIterator>
+void assign(InputIterator begin, InputIterator end);]]>
+</programlisting>
+</term>
+
+<listitem>
+ <para>This copies the elements in the range
+<literal>[begin,end)</literal> into the array. It is equivalent to
+<literal>std::copy(begin,end,this->data())</literal>.
+</para>
+
+<formalpara><title>Preconditions</title>
+<para><literal>std::distance(begin,end) == this->num_elements();</literal>
+</para>
+</formalpara>
+
+<formalpara>
+<title>Complexity</title>
+<para>
+The <literal>assign</literal> member function performs
+O(<literal>this->num_elements()</literal>) calls to
+<literal>ValueType</literal>'s copy constructor.
+</para>
+</formalpara>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<programlisting><![CDATA[multi_array& resize(extent_gen::gen_type<NumDims>::type extents);
+template <typename ExtentList>
+ multi_array& resize(const ExtentList& extents);
+]]>
+</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.
+</para>
+</listitem>
+</varlistentry>
+
+</variablelist>
+</formalpara>
+
+
+<formalpara>
+<title>Queries</title>
+
+<variablelist>
+
+<varlistentry>
+<term><programlisting>
+<![CDATA[storage_order_type& storage_order() const;]]>
+</programlisting>
+</term>
+
+<listitem>
+<para>This query returns the storage order object associated with the
+<literal>multi_array</literal> in question. It can be used to construct a new array with the same storage order.</para>
+</listitem>
+</varlistentry>
+</variablelist>
+</formalpara>
+</sect2>
diff --git a/doc/xml/multi_array_ref.xml b/doc/xml/multi_array_ref.xml
new file mode 100644
index 0000000..3e21b54
--- /dev/null
+++ b/doc/xml/multi_array_ref.xml
@@ -0,0 +1,257 @@
+<sect2 id="multi_array_ref">
+<title><literal>multi_array_ref</literal></title>
+
+<para>
+<literal>multi_array_ref</literal> is a multi-dimensional container
+adaptor. It provides the MultiArray interface over any contiguous
+block of elements. <literal>multi_array_ref</literal> exports the
+same interface as <literal>multi_array</literal>, with the exception
+of the constructors.
+</para>
+
+
+<formalpara>
+ <title>Model Of.</title>
+<para>
+<literal>multi_array_ref</literal> models
+<link linkend="MultiArray">MultiArray</link>,
+<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>.
+and depending on the element type, it may also model
+<ulink url="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</ulink> and <ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink>.
+Detailed descriptions are provided here only for operations that are
+not described in the <literal>multi_array</literal> reference.
+</para>
+</formalpara>
+
+<formalpara>
+<title>Synopsis</title>
+
+<programlisting>
+<;
+ const_reference operator[](index i) const;
+ array_view<Dims>::type operator[](const indices_tuple& r);
+ const_array_view<Dims>::type operator[](const indices_tuple& r) const;
+
+ // queries
+ element* data();
+ const element* data() const;
+ element* origin();
+ const element* origin() const;
+ const size_type* shape() const;
+ const index* strides() const;
+ const index* index_bases() const;
+ const storage_order_type& storage_order() const;
+
+ // comparators
+ bool operator==(const multi_array_ref& rhs);
+ bool operator!=(const multi_array_ref& rhs);
+ bool operator<(const multi_array_ref& rhs);
+ bool operator>(const multi_array_ref& rhs);
+ bool operator>=(const multi_array_ref& rhs);
+ bool operator<=(const multi_array_ref& rhs);
+
+ // modifiers:
+ template <typename InputIterator>
+ void assign(InputIterator begin, InputIterator end);
+ template <typename SizeList>
+ void reshape(const SizeList& sizes)
+ template <typename BaseList> void reindex(const BaseList& values);
+ void reindex(index value);
+};
+]]>
+</programlisting>
+</formalpara>
+
+<formalpara>
+<title>Constructors</title>
+
+<variablelist>
+<varlistentry>
+<term><programlisting>template <typename ExtentList>
+explicit multi_array_ref(element* data,
+ const ExtentList& sizes,
+ const storage_order& store = c_storage_order(),
+ const Allocator& alloc = Allocator());
+</programlisting></term>
+<listitem>
+
+<para>
+This constructs a <literal>multi_array_ref</literal> using the specified
+parameters. <literal>sizes</literal> specifies the shape of the
+constructed <literal>multi_array_ref</literal>. <literal>store</literal>
+specifies the storage order or layout in memory of the array
+dimensions. <literal>alloc</literal> is used to
+allocate the contained elements.
+</para>
+
+<formalpara><title><literal>ExtentList</literal> Requirements</title>
+<para>
+<literal>ExtentList</literal> must model <ulink url="../../utility/Collection.html">Collection</ulink>.
+</para>
+</formalpara>
+
+<formalpara><title>Preconditions</title>
+<para><literal>sizes.size() == NumDims;</literal></para>
+</formalpara>
+
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<programlisting><![CDATA[explicit multi_array_ref(element* data,
+ extent_gen::gen_type<NumDims>::type ranges,
+ const storage_order& store = c_storage_order());]]>
+</programlisting></term>
+<listitem>
+<para>
+This constructs a <literal>multi_array_ref</literal> using the specified
+ parameters. <literal>ranges</literal> specifies the shape and
+index bases of the constructed multi_array_ref. It is the result of
+<literal>NumDims</literal> chained calls to
+ <literal>extent_gen::operator[]</literal>. <literal>store</literal>
+specifies the storage order or layout in memory of the array
+dimensions.
+</para>
+</listitem>
+</varlistentry>
+
+
+<varlistentry>
+<term><programlisting>
+<![CDATA[multi_array_ref(const multi_array_ref& x);]]>
+</programlisting></term>
+<listitem>
+<para>This constructs a shallow copy of <literal>x</literal>.
+</para>
+
+<formalpara>
+<title>Complexity</title>
+<para> Constant time (for contrast, compare this to
+the <literal>multi_array</literal> class copy constructor.
+</para></formalpara>
+</listitem>
+</varlistentry>
+
+</variablelist>
+
+</formalpara>
+
+
+<formalpara>
+<title>Modifiers</title>
+
+<variablelist>
+<varlistentry>
+
+<term><programlisting>
+<![CDATA[multi_array_ref& operator=(const multi_array_ref& x);
+template <class Array> multi_array_ref& operator=(const Array& x);]]>
+</programlisting>
+</term>
+
+<listitem>
+<para>This performs an element-wise copy of <literal>x</literal>
+into the current <literal>multi_array_ref</literal>.</para>
+
+<formalpara>
+<title><literal>Array</literal> Requirements</title>
+<para><literal>Array</literal> must model MultiArray.
+</para></formalpara>
+
+<formalpara>
+<title>Preconditions</title>
+<para>
+<programlisting>std::equal(this->shape(),this->shape()+this->num_dimensions(),
+x.shape());</programlisting></para>
+</formalpara>
+
+
+<formalpara>
+<title>Postconditions</title>
+<para>
+<programlisting>(*.this) == x;</programlisting>
+</para>
+</formalpara>
+
+<formalpara>
+<title>Complexity</title>
+<para>The assignment operators perform
+O(<literal>x.num_elements()</literal>) calls to <literal>element</literal>'s
+copy constructor.</para></formalpara>
+</listitem>
+</varlistentry>
+</variablelist>
+
+</formalpara>
+</sect2>
diff --git a/doc/xml/reference.xml b/doc/xml/reference.xml
new file mode 100644
index 0000000..3f30fb8
--- /dev/null
+++ b/doc/xml/reference.xml
@@ -0,0 +1,800 @@
+<?xml version='1.0' encoding="ISO-Latin-1" ?>
+<!DOCTYPE article
+ PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd" [
+ <!ENTITY concepts SYSTEM "MultiArray.xml">
+ <!ENTITY multi_array SYSTEM "multi_array.xml">
+ <!ENTITY multi_array_ref SYSTEM "multi_array_ref.xml">
+ <!ENTITY const_multi_array_ref SYSTEM "const_multi_array_ref.xml">
+]>
+
+<article>
+ <articleinfo>
+ <title>Boost.MultiArray Reference Manual</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>The Trustees of Indiana University</holder>
+ </copyright>
+ </articleinfo>
+
+
+<para>Boost.MultiArray is composed of several components.
+The MultiArray concept defines a generic interface to multidimensional
+containers.
+<literal>multi_array</literal> is a general purpose container class
+that models MultiArray. <literal>multi_array_ref</literal>
+and <literal>const_multi_array_ref</literal> are adapter
+classes. Using them,
+you can manipulate any block of contiguous data as though it were a
+<literal>multi_array</literal>.
+<literal>const_multi_array_ref</literal> differs from
+<literal>multi_array_ref</literal> in that its elements cannot
+be modified through its interface. Finally, several auxiliary classes are used
+to create and specialize arrays and some global objects are defined as
+part of the library interface.</para>
+
+<sect1 id="synopsis">
+<title>Library Synopsis</title>
+ <para>To use Boost.MultiArray, you must include the header
+<filename>boost/multi_array.hpp</filename> in your source. This file
+brings the following declarations into scope:</para>
+<programlisting>
+<![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;
+ }
+
+ template <typename ValueType,
+ std::size_t NumDims,
+ typename Allocator = std::allocator<ValueType> >
+ class multi_array;
+
+ template <typename ValueType,
+ std::size_t NumDims>
+ class multi_array_ref;
+
+ template <typename ValueType,
+ std::size_t NumDims>
+ class const_multi_array_ref;
+
+ multi_array_types::extent_gen extents;
+ multi_array_types::index_gen indices;
+
+ template <typename Array, int N> class subarray_gen;
+ template <typename Array, int N> class const_subarray_gen;
+ template <typename Array, int N> class array_view_gen;
+ template <typename Array, int N> class const_array_view_gen;
+
+ class c_storage_order;
+ class fortran_storage_order;
+ template <std::size_t NumDims> class general_storage_order;
+
+}]]>
+</programlisting>
+</sect1>
+
+&concepts;
+
+<sect1 id="array_types">
+<title>Array Components</title>
+<para>
+Boost.MultiArray defines an array class,
+<literal>multi_array</literal>, and two adapter classes,
+<literal>multi_array_ref</literal> and
+<literal>const_multi_array_ref</literal>. The three classes model
+MultiArray and so they share a lot of functionality.
+<literal>multi_array_ref</literal> differs from
+<literal>multi_array</literal> in that the
+<literal>multi_array</literal> manages its own memory, while
+<literal>multi_array_ref</literal> is passed a block of memory that it
+expects to be externally managed.
+<literal>const_multi_array_ref</literal> differs from
+<literal>multi_array_ref</literal> in that the underlying elements it
+adapts cannot be modified through its interface, though some array
+properties, including the array shape and index bases, can be altered.
+Functionality the classes have in common is described
+below.
+</para>
+
+<formalpara>
+<title>Note: Preconditions, Effects, and Implementation</title>
+<para>
+Throughout the following sections, small pieces of C++ code are
+used to specify constraints such as preconditions, effects, and
+postconditions. These do not necessarily describe the underlying
+implementation of array components; rather, they describe the
+expected input to and
+behavior of the specified operations. Failure to meet
+preconditions results in undefined behavior. Not all effects
+(i.e. copy constructors, etc.) must be mimicked exactly. The code
+snippets for effects intend to capture the essence of the described
+operation.
+</para>
+</formalpara>
+
+<formalpara>
+<title>Queries</title>
+
+<variablelist>
+<varlistentry>
+<term><programlisting>element* data();
+const element* data() const;</programlisting></term>
+<listitem>
+<para>This returns a pointer to the beginning of the
+contiguous block that contains the array's data. If all dimensions of
+the array are 0-indexed and stored in ascending order, this is
+equivalent to <literal>origin()</literal>. Note that
+<literal>const_multi_array_ref</literal> only provides the const
+version of this function.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><programlisting>element* origin();
+const element* origin() const;</programlisting></term>
+<listitem>
+<para>This returns the origin element of the
+<literal>multi_array</literal>. Note that
+<literal>const_multi_array_ref</literal> only provides the const
+version of this function. (Required by MultiArray)
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>const index* index_bases();</function></term>
+<listitem>
+<para>This returns the index bases for the
+<literal>multi_array</literal>. (Required by MultiArray)
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>const index* strides();</function></term>
+<listitem>
+<para>This returns the strides for the
+<literal>multi_array</literal>. (Required by MultiArray)
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>const size_type* shape();</function></term>
+<listitem>
+<para>This returns the shape of the
+<literal>multi_array</literal>. (Required by MultiArray)
+</para>
+</listitem>
+</varlistentry>
+</variablelist>
+
+</formalpara>
+
+<formalpara>
+<title>Comparators</title>
+<variablelist>
+<varlistentry>
+<term><programlisting><![CDATA[
+bool operator==(const *array-type*& rhs);
+bool operator!=(const *array-type*& rhs);
+bool operator<(const *array-type*& rhs);
+bool operator>(const *array-type*& rhs);
+bool operator>=(const *array-type*& rhs);
+bool operator<=(const *array-type*& rhs);]]></programlisting></term>
+
+<listitem>
+<para>Each comparator executes a lexicographical compare over
+the value types of the two arrays.
+(Required by MultiArray)
+</para>
+<formalpara>
+<title>Preconditions</title>
+<para><literal>element</literal> must support the
+comparator corresponding to that called on
+<literal>multi_array</literal>.</para>
+</formalpara>
+
+<formalpara>
+<title>Complexity</title>
+<para>O(<literal>num_elements()</literal>).</para>
+</formalpara>
+
+</listitem>
+</varlistentry>
+
+</variablelist>
+</formalpara>
+
+<formalpara>
+<title>Modifiers</title>
+
+<variablelist>
+
+<varlistentry>
+<term>
+<programlisting>
+<![CDATA[
+template <typename SizeList>
+void reshape(const SizeList& sizes)
+]]>
+</programlisting>
+</term>
+
+<listitem>
+<para>This changes the shape of the <literal>multi_array</literal>. The
+number of elements and the index bases remain the same, but the number
+of values at each level of the nested container hierarchy may
+change.</para>
+
+<formalpara><title><literal>SizeList</literal> Requirements</title>
+<para><literal>SizeList</literal> must model
+<ulink url="../../utility/Collection.html">Collection</ulink>.</para>
+</formalpara>
+
+<formalpara><title>Preconditions</title>
+<para>
+<programlisting>
+<![CDATA[std::accumulate(sizes.begin(),sizes.end(),size_type(1),std::times<size_type>()) == this->num_elements();
+sizes.size() == NumDims;]]>
+</programlisting></para>
+</formalpara>
+
+
+<formalpara><title>Postconditions</title>
+<para>
+<literal>std::equal(sizes.begin(),sizes.end(),this->shape) == true;</literal>
+</para>
+</formalpara>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<programlisting>
+<![CDATA[
+template <typename BaseList>
+void reindex(const BaseList& values);
+]]>
+</programlisting>
+</term>
+<listitem>
+<para>This changes the index bases of the <literal>multi_array</literal> to
+correspond to the the values in <literal>values</literal>.</para>
+
+<formalpara>
+<title><literal>BaseList</literal> Requirements</title>
+<para><literal>BaseList</literal> must model
+<ulink url="../../utility/Collection.html">Collection</ulink>.</para>
+</formalpara>
+
+<formalpara>
+<title>Preconditions</title>
+<para><literal>values.size() == NumDims;</literal></para>
+</formalpara>
+
+
+<formalpara>
+<title>Postconditions</title>
+<para><literal>std::equal(values.begin(),values.end(),this->index_bases());
+</literal></para>
+</formalpara>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term>
+<programlisting>
+<![CDATA[
+void reindex(index value);
+]]>
+</programlisting>
+</term>
+<listitem>
+<para>This changes the index bases of all dimensions of the
+<literal>multi_array</literal> to <literal>value</literal>.</para>
+
+<formalpara>
+<title>Postconditions</title>
+<para>
+<programlisting>
+<![CDATA[
+std::count_if(this->index_bases(),this->index_bases()+this->num_dimensions(),
+ std::bind_2nd(std::equal_to<index>(),value)) ==
+ this->num_dimensions();
+]]>
+</programlisting>
+</para>
+</formalpara>
+</listitem>
+</varlistentry>
+
+</variablelist>
+</formalpara>
+
+&multi_array;
+&multi_array_ref;
+&const_multi_array_ref;
+
+</sect1>
+
+
+<sect1 id="auxiliary">
+ <title>Auxiliary Components</title>
+
+<sect2 id="multi_array_types">
+<title><literal>multi_array_types</literal></title>
+
+<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;
+}]]>
+</programlisting>
+
+<para>Namespace <literal>multi_array_types</literal> defines types
+associated with <literal>multi_array</literal>,
+<literal>multi_array_ref</literal>, and
+<literal>const_multi_array_ref</literal> that are not
+dependent upon template parameters. These types find common use with
+all Boost.Multiarray components. They are defined
+in a namespace from which they can be accessed conveniently.
+With the exception of <literal>extent_gen</literal> and
+<literal>extent_range</literal>, these types fulfill the roles of the
+same name required by MultiArray and are described in its
+concept definition. <literal>extent_gen</literal> and
+<literal>extent_range</literal> are described below.
+</para>
+</sect2>
+
+
+<sect2 id="extent_range">
+ <title><classname>extent_range</classname></title>
+
+<para><classname>extent_range</classname> objects define half open
+intervals. They provide shape and index base information to
+<literal>multi_array</literal>, <literal>multi_array_ref</literal>,
+ and <literal>const_multi_array_ref</literal> constructors.
+<classname>extent_range</classname>s are passed in
+aggregate to an array constructor (see
+<classname>extent_gen</classname> for more details).
+</para>
+
+<formalpara>
+ <title>Synopsis</title>
+<programlisting><![CDATA[
+class extent_range {
+public:
+ typedef multi_array_types::index index;
+ typedef multi_array_types::size_type size_type;
+
+ // Structors
+ extent_range(index start, index finish);
+ extent_range(index finish);
+ ~extent_range();
+
+ // Queries
+ index start();
+ index finish();
+ size_type size();
+};]]></programlisting>
+</formalpara>
+
+ <formalpara>
+ <title>Model Of</title>
+ <para>DefaultConstructible,CopyConstructible</para>
+ </formalpara>
+
+<formalpara><title>Methods and Types</title>
+<variablelist>
+<varlistentry>
+<term><function>extent_range(index start, index finish)</function></term>
+<listitem>
+<para> This constructor defines the half open interval
+<literal>[start,finish)</literal>. The expression
+<literal>finish</literal> must be greater than <literal>start</literal>.
+</para>
+</listitem>
+</varlistentry>
+
+<varlistentry><term><function>extent_range(index finish)</function></term>
+<listitem>
+<para>This constructor defines the half open interval
+<literal>[0,finish)</literal>. The value of <literal>finish</literal>
+must be positive.</para>
+</listitem>
+</varlistentry>
+
+<varlistentry><term><function>index start()</function></term>
+<listitem>
+<para>This function returns the first index represented by the range</para>
+</listitem>
+</varlistentry>
+
+<varlistentry><term><function>index finish()</function></term>
+<listitem>
+<para>This function returns the upper boundary value of the half-open
+interval. Note that the range does not include this value.</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>size_type size()</function></term>
+<listitem>
+<para>This function returns the size of the specified range. It is
+equivalent to <literal>finish()-start()</literal>.</para>
+</listitem>
+</varlistentry>
+
+</variablelist>
+</formalpara>
+</sect2>
+
+<sect2 id="extent_gen">
+ <title><classname>extent_gen</classname></title>
+ <para>The <classname>extent_gen</classname> class defines an
+interface for aggregating array shape and indexing information to be
+passed to a <literal>multi_array</literal>,
+<literal>multi_array_ref</literal>, or <literal>const_multi_array_ref</literal>
+constructor. Its interface mimics
+ the syntax used to declare built-in array types
+in C++. For example, while a 3-dimensional array of
+<classname>int</classname> values in C++ would be
+declared as:
+<programlisting>int A[3][4][5],</programlisting>
+a similar <classname>multi_array</classname> would be declared:
+<programlisting>multi_array<int,3> A(extents[3][4][5]).</programlisting>
+</para>
+
+<formalpara><title>Synopsis</title>
+<programlisting>< const;
+ gen_type<NumRanges+1>::type operator[](index idx) const;
+};
+
+typedef *implementation_defined*<0> extent_gen;
+]]></programlisting>
+</formalpara>
+
+<formalpara><title>Methods and Types</title>
+<variablelist>
+<varlistentry>
+<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
+<literal>extent_gen::operator[].</literal> The types
+<classname>extent_gen</classname> and
+<classname>gen_type<0>::type</classname> are the same.</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>gen_type<NumRanges+1>::type
+operator[](const extent_range& a_range) const;</function></term>
+<listitem>
+<para>This function returns a new object containing all previous
+<classname>extent_range</classname> objects in addition to
+<literal>a_range.</literal> <classname>extent_range</classname>
+objects are aggregated by chained calls to
+<function>operator[]</function>.</para>
+</listitem>
+</varlistentry>
+
+<varlistentry>
+<term><function>gen_type<NumRanges+1>::type
+operator[](index idx) const;</function></term>
+<listitem>
+<para>This function returns a new object containing all previous
+<classname>extent_range</classname> objects in addition to
+<literal>extent_range(0,idx).</literal> This function gives the array
+constructors a similar syntax to traditional C multidimensional array
+declaration.</para>
+</listitem>
+</varlistentry>
+
+</variablelist>
+</formalpara>
+</sect2>
+
+<sect2>
+ <title>Global Objects</title>
+ <para>For syntactic convenience, Boost.MultiArray defines two
+global objects as part of its
+interface. These objects play the role of object generators;
+expressions involving them create other objects of interest.
+</para>
+
+ <para> Under some circumstances, the two global objects may be
+considered excessive overhead. Their construction can be prevented by
+defining the preprocessor symbol
+<literal>BOOST_MULTI_ARRAY_NO_GENERATORS</literal> before including
+<filename>boost/multi_array.hpp.</filename></para>
+
+<sect3 id="extents">
+<title><literal>extents</literal></title>
+
+<programlisting>
+<![CDATA[namespace boost {
+ multi_array_base::extent_gen extents;
+}]]>
+</programlisting>
+
+ <para>Boost.MultiArray's array classes use the
+<literal>extents</literal> global object to specify
+array shape during their construction.
+For example,
+a 3 by 3 by 3 <classname>multi_array</classname> is constructed as follows:
+<programlisting>multi_array<int,3> A(extents[3][3][3]);</programlisting>
+The same array could also be created by explicitly declaring an <literal>extent_gen</literal>
+object locally,, but the global object makes this declaration unnecessary.
+</para>
+</sect3>
+
+<sect3 id="indices">
+<title><literal>indices</literal></title>
+
+<programlisting>
+<![CDATA[namespace boost {
+ multi_array_base::index_gen indices;
+}]]>
+</programlisting>
+
+ <para>The MultiArray concept specifies an
+<literal>index_gen</literal> associated type that is used to
+create views.
+<literal>indices</literal> is a global object that serves the role of
+<literal>index_gen</literal> for all array components provided by this
+library and their associated subarrays and views.
+</para>
+<para>For example, using the <literal>indices</literal> object,
+a view of an array <literal>A</literal> is constructed as follows:
+<programlisting>
+A[indices[index_range(0,5)][2][index_range(2,4)]];
+</programlisting>
+</para>
+</sect3>
+</sect2>
+
+<sect2 id="generators">
+<title>View and SubArray Generators</title>
+<para>
+Boost.MultiArray provides traits classes, <literal>subarray_gen</literal>,
+<literal>const_subarray_gen</literal>,
+<literal>array_view_gen</literal>,
+and <literal>const_array_view_gen</literal>, for naming of
+array associated types within function templates.
+In general this is no more convenient to use than the nested
+type generators, but the library author found that some C++ compilers do not
+properly handle templates nested within function template parameter types.
+These generators constitute a workaround for this deficit.
+The following code snippet illustrates
+the correspondence between the <literal>array_view_gen</literal>
+traits class and the <literal>array_view</literal> type associated to
+an array:
+
+<programlisting>
+template <typename Array>
+void my_function() {
+ typedef typename Array::template array_view<3>::type view1_t;
+ typedef typename boost::array_view_gen<Array,3>::type view2_t;
+ // ...
+}
+</programlisting>
+
+In the above example, <literal>view1_t</literal> and
+<literal>view2_t</literal> have the same type.
+</para>
+</sect2>
+
+
+<sect2 id="memory_layout">
+<title>Memory Layout Specifiers</title>
+<para>
+While a multidimensional array represents a hierarchy of containers of
+elements, at some point the elements must be laid out in
+memory. As a result, a single multidimensional array
+can be represented in memory more than one way.
+</para>
+
+<para>For example, consider the two dimensional array shown below in
+matrix notation:
+
+<graphic fileref="matrix.gif"/>
+
+Here is how the above array is expressed in C++:
+<programlisting>
+int a[3][4] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+</programlisting>
+This is an example of row-major storage, where elements of each row
+are stored contiguously.
+
+While C++ transparently handles accessing elements of an array, you
+can also manage the array and its indexing manually. One way that
+this may be expressed in memory is as follows:
+<programlisting>
+int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
+int s[] = { 4, 1 };
+</programlisting>
+
+With the latter declaration of <literal>a</literal> and
+strides <literal>s</literal>, element <literal>a(i,j)</literal>
+of the array can be
+accessed using the expression
+<programlisting>*a+i*s[0]+j*s[1]</programlisting>.
+</para>
+
+<para>The same two dimensional array could be laid out by column as follows:
+
+<programlisting>
+int a[] = { 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11 };
+int s[] = { 3, 1 };
+</programlisting>
+Notice that the strides here are different. As a result,
+The expression given above to access values will work with this pair
+of data and strides as well.
+</para>
+
+<para>In addition to dimension order, it is also possible to
+store any dimension in descending order. For example, returning to the
+first example, the first dimension of the example array, the
+rows, could be stored in
+reverse, resulting in the following:
+
+<programlisting>
+int data[] = { 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3 };
+int *a = data + 8;
+int s[] = { -4, 1 };
+</programlisting>
+
+Note that in this example <literal>a</literal> must be explicitly set
+to the origin. In the previous examples, the
+first element stored in memory was the origin; here this is no longer
+the case.
+</para>
+
+<para>
+Alternatively, the second dimension, or the columns, could be reversed
+and the rows stored in ascending order:
+
+<programlisting>
+int data[] = { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8 };
+int *a = data + 3;
+int s[] = { 4, -1 };
+</programlisting>
+</para>
+
+<para>
+Finally, both dimensions could be stored in descending order:
+
+<programlisting>
+int data[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+int *a = data + 11;
+int s[] = { -4, -1 };
+</programlisting>
+<literal>
+</literal>
+</para>
+
+<para>
+All of the above arrays are equivalent. The expression
+given above for <literal>a(i,j)</literal> will yield the same value
+regardless of the memory layout.
+
+Boost.MultiArray arrays can be created with customized storage
+parameters as described above. Thus, existing data can be adapted
+(with <literal>multi_array_ref</literal> or
+<literal>const_multi_array_ref</literal>) as suited to the array
+abstraction. A common usage of this feature would be to wrap arrays
+that must interoperate with Fortran routines so they can be
+manipulated naturally at both the C++ and Fortran levels. The
+following sections describe the Boost.MultiArray components used to
+specify memory layout.
+</para>
+
+<sect3 id="c_storage_order">
+<title><literal>c_storage_order</literal></title>
+<programlisting>
+<![CDATA[class c_storage_order {
+ c_storage_order();
+};]]>
+</programlisting>
+
+<para><literal>c_storage_order</literal> is used to specify that an
+array should store its elements using the same layout as that used by
+primitive C++ multidimensional arrays, that is, from last dimension
+to first. This is the default storage order for the arrays provided by
+this library.</para>
+</sect3>
+
+<sect3 id="fortran_storage_order">
+<title><literal>fortran_storage_order</literal></title>
+<programlisting>
+<![CDATA[class fortran_storage_order {
+ fortran_storage_order();
+};]]>
+</programlisting>
+
+<para><literal>fortran_storage_order</literal> is used to specify that
+an array should store its elements using the same memory layout as a
+Fortran multidimensional array would, that is, from first dimension to
+last.</para>
+</sect3>
+
+<sect3 id="general_storage_order">
+<title><literal>general_storage_order</literal></title>
+<programlisting>
+<![CDATA[template <std::size_t NumDims>
+class general_storage_order {
+
+ template <typename OrderingIter, typename AscendingIter>
+ general_storage_order(OrderingIter ordering, AscendingIter ascending);
+};]]>
+</programlisting>
+
+<para><literal>general_storage_order</literal> allows the user to
+specify an arbitrary memory layout for the contents of an array. The
+constructed object is passed to the array constructor in order to
+specify storage order.</para>
+
+<para>
+<literal>OrderingIter</literal> and <literal>AscendingIter</literal>
+must model the <literal>InputIterator</literal> concept. Both
+iterators must refer to a range of <literal>NumDims</literal>
+elements. <literal>AscendingIter</literal> points to objects
+convertible to <literal>bool</literal>. A value of
+<literal>true</literal> means that a dimension is stored in ascending
+order while <literal>false</literal> means that a dimension is stored
+in descending order. <literal>OrderingIter</literal> specifies the
+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>
+
+
+</article>