Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74029 - in sandbox/maps/maps: . boost boost/maps boost/maps/generic boost/maps/math boost/maps/support libs libs/maps libs/maps/doc libs/maps/doc/html libs/maps/doc/html/maps
From: bjs3141_at_[hidden]
Date: 2011-08-23 16:08:44


Author: brian.smith
Date: 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
New Revision: 74029
URL: http://svn.boost.org/trac/boost/changeset/74029

Log:
recommit
Added:
   sandbox/maps/maps/
   sandbox/maps/maps/boost/
   sandbox/maps/maps/boost/maps/
   sandbox/maps/maps/boost/maps.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/generic/
   sandbox/maps/maps/boost/maps/generic/array.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/generic/array_.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/generic/pointer.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/generic/view.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/generic/view_.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/
   sandbox/maps/maps/boost/maps/math/matrix.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/matrix_matrix.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/matrix_scalar.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/matrix_vector.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/scalar.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/scalar_matrix.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/scalar_scalar.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/scalar_vector.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/vector.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/vector_matrix.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/vector_scalar.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/math/vector_vector.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/support/
   sandbox/maps/maps/boost/maps/support/assigner.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/support/bounds.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/support/expression.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/support/generic.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/support/includes.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/support/math.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/support/preprocessor_bounds.hpp (contents, props changed)
   sandbox/maps/maps/boost/maps/support/preprocessor_ranges.hpp (contents, props changed)
   sandbox/maps/maps/libs/
   sandbox/maps/maps/libs/maps/
   sandbox/maps/maps/libs/maps/doc/
   sandbox/maps/maps/libs/maps/doc/Jamfile.v2 (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/html/
   sandbox/maps/maps/libs/maps/doc/html/index.html (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/html/maps/
   sandbox/maps/maps/libs/maps/doc/html/maps/array.html (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/html/maps/array_.html (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/html/maps/concepts.html (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/html/maps/pointer.html (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/html/maps/reference.html (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/html/maps/tutorial.html (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/html/maps/view.html (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/html/maps/view_.html (contents, props changed)
   sandbox/maps/maps/libs/maps/doc/maps.qbk (contents, props changed)

Added: sandbox/maps/maps/boost/maps.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,37 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_HPP )
+#define BOOST_MAPS_HPP
+
+#include <boost/maps/support/includes.hpp>
+
+#include <boost/maps/generic/array.hpp>
+#include <boost/maps/generic/array_.hpp>
+#include <boost/maps/generic/pointer.hpp>
+
+#include <boost/maps/generic/view.hpp>
+#include <boost/maps/generic/view_.hpp>
+
+#include <boost/maps/math/matrix.hpp>
+#include <boost/maps/math/vector.hpp>
+#include <boost/maps/math/scalar.hpp>
+
+#include <boost/maps/math/matrix_matrix.hpp>
+#include <boost/maps/math/matrix_scalar.hpp>
+#include <boost/maps/math/matrix_vector.hpp>
+
+#include <boost/maps/math/scalar_matrix.hpp>
+#include <boost/maps/math/scalar_scalar.hpp>
+#include <boost/maps/math/scalar_vector.hpp>
+
+#include <boost/maps/math/vector_matrix.hpp>
+#include <boost/maps/math/vector_scalar.hpp>
+#include <boost/maps/math/vector_vector.hpp>
+
+#endif BOOST_MAPS_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/generic/array.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/generic/array.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,1121 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_GENERIC_ARRAY_HPP )
+#define BOOST_MAPS_GENERIC_ARRAY_HPP
+
+#include <boost/maps/support/preprocessor_bounds.hpp>
+#include <boost/maps/support/includes.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class T, std::size_t N, class B, class C, std::size_t S, class A >
+ struct array_allocate
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+ typedef typename array_type< T,N-1,C,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p )
+ {
+ allocator a;
+ p = a.allocate( S );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, class B, class C, std::size_t S, class A >
+ struct array_deallocate
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+ typedef typename array_type< T,N-1,C,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p )
+ {
+ allocator a;
+ a.deallocate( p, S ); p = 0;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, class B, class C, std::size_t S, bool I, class A >
+ struct array_construct
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+ typedef typename array_type< T,N-1,C,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p )
+ {
+ type f = p, l = p+S;
+ allocator a;
+ try
+ { T t = T();
+ while( f != l ) { a.construct( f, t ); ++f; }
+ }catch( ... )
+ { type n = p;
+ while( n != f ) { a.destroy( n ); ++n; }
+ throw;
+ }
+ }
+ };
+
+ template< class T, std::size_t N, class B, class C, std::size_t S, class A >
+ struct array_construct< T,N,B,C,S,false,A >
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+
+ void operator()( type& )
+ {}
+ };
+
+//--
+
+ template< class T, std::size_t N, class B, class C, std::size_t S, bool P, class A >
+ struct array_copy_assign
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+ typedef typename array_type< T,N-1,C,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p, type const& q )
+ {
+ type f = p, l = p+S, r = q;
+ allocator a;
+ try
+ { for (; f != l; ++f, ++r)
+ a.construct(f, *r);
+ }catch( ... )
+ { type n = p;
+ for (; n != r; ++n)
+ a.destroy(n);
+ throw;
+ }
+ }
+ };
+
+ template< class T, std::size_t N, class B, class C, std::size_t S, class A >
+ struct array_copy_assign< T,N,B,C,S,true,A >
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+
+ void operator()( type& p, type const& q )
+ {
+ memcpy( p, q, S * sizeof(T) );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, class B, class C, std::size_t S, bool I, class A >
+ struct array_destroy
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+ typedef typename array_type< T,N-1,C,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p )
+ {
+ allocator a;
+ for( std::size_t i = 0; i != S; ++i ) a.destroy( p+i );
+ }
+ };
+
+ template< class T, std::size_t N, class B, class C, std::size_t S, class A >
+ struct array_destroy< T,N,B,C,S,true,A >
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+
+ void operator()( type& )
+ {}
+ };
+
+//--
+
+ template< class T, std::size_t N, class B, std::size_t S, bool I, class A >
+ struct array_constructor
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+ typedef typename mpl::next< B >::type C;
+ typedef typename mpl::deref< C >::type D;
+
+ void operator()( type& p )
+ {
+ if( S == 0 ) throw std::invalid_argument( "invalid array<> dimension" );
+ array_allocate< T,N,B,C,S,A >()( p );
+ try { array_constructor< T,N-1,C,S*D::value,I,A >()( p[0] ); }
+ catch( ... ) { array_deallocate< T,N,B,C,S,A >()( p ); throw; }
+ for( std::size_t j = 1, k = D::value; j != S; ++j ) p[j] = p[j-1] + k;
+ }
+ };
+
+ template< class T, class B, std::size_t S, bool I, class A >
+ struct array_constructor< T,1,B,S,I,A >
+ {
+ typedef typename array_type< T,1,B,A >::type type;
+ typedef typename mpl::next< B >::type C;
+
+ void operator()( type& p )
+ {
+ if( S == 0 ) throw std::invalid_argument( "invalid array<> dimension" );
+ array_allocate< T,1,B,C,S,A >()( p );
+ try { array_construct< T,1,B,C,S,I,A >()( p ); }
+ catch( ... ) { array_deallocate< T,1,B,C,S,A >()( p ); throw; }
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, class B, std::size_t S, bool I, class A >
+ struct array_destructor
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+ typedef typename mpl::next< B >::type C;
+ typedef typename mpl::deref< C >::type D;
+
+ void operator()( type& p )
+ {
+ array_destructor< T,N-1,C,S*D::value,I,A >()( p[0] );
+ array_deallocate< T,N,B,C,S,A >()( p );
+ }
+ };
+
+ template< class T, class B, std::size_t S, bool I, class A >
+ struct array_destructor< T,1,B,S,I,A >
+ {
+ typedef typename array_type< T,1,B,A >::type type;
+ typedef typename mpl::next< B >::type C;
+
+ void operator()( type& p )
+ {
+ array_destroy< T,1,B,C,S,I,A >()( p );
+ array_deallocate< T,1,B,C,S,A >()( p );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, class B, std::size_t S, class A >
+ struct array_copy
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+ typedef typename mpl::next< B >::type C;
+ typedef typename mpl::deref< C >::type D;
+
+ void operator()( type& p, type const& q )
+ {
+ array_allocate< T,N,B,C,S,A >()( p );
+ try { array_copy< T,N-1,C,S*D::value,A >()( p[0], q[0] ); }
+ catch( ... ) { array_deallocate< T,N,B,C,S,A >()( p ); throw; }
+ for( std::size_t j = 1, k = D::value; j != S; ++j ) p[j] = p[j-1] + k;
+ }
+ };
+
+ template< class T, class B, std::size_t S, class A >
+ struct array_copy< T,1,B,S,A >
+ {
+ typedef typename array_type< T,1,B,A >::type type;
+ typedef typename mpl::next< B >::type C;
+ typedef typename boost::is_pod< T >::type P;
+
+ void operator()( type& p, type const& q )
+ {
+ array_allocate< T,1,B,C,S,A >()( p );
+ try { array_copy_assign< T,1,B,C,S,P::value,A >()( p, q ); }
+ catch( ... ) { array_deallocate< T,1,B,C,S,A >()( p ); throw; }
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, class B, std::size_t S, bool I, class A >
+ struct array_assign
+ {
+ typedef typename array_type< T,N,B,A >::type type;
+ typedef typename mpl::next< B >::type C;
+ typedef typename mpl::deref< C >::type D;
+
+ void operator()( type& p, type const& q )
+ {
+ array_assign< T,N-1,C,S*D::value,I,A >()( p[0], q[0] );
+ }
+ };
+
+ template< class T, class B, std::size_t S, bool I, class A >
+ struct array_assign< T,2,B,S,I,A >
+ {
+ typedef typename array_type< T,2,B,A >::type type;
+ typedef typename mpl::next< B >::type C;
+ typedef typename mpl::deref< C >::type D;
+
+ void operator()( type& p, type const& q )
+ {
+ array_assign< T,1,C,S*D::value,I,A >()( p[0], q[0] );
+ for( std::size_t j = 0, k = 0; j != S; ++j, k += D::value ) p[j] = &p[0][k];
+ }
+ };
+
+ template< class T, class B, std::size_t S, bool I, class A >
+ struct array_assign< T,1,B,S,I,A >
+ {
+ typedef typename array_type< T,1,B,A >::type type;
+ typedef typename mpl::next< B >::type C;
+ typedef typename boost::is_pod< T >::type P;
+
+ void operator()( type& p, type const& q )
+ {
+ type t = 0; array_allocate< T,1,B,C,S,A >()( t );
+ try { array_copy_assign< T,1,B,C,S,P::value,A >()( t, q ); }
+ catch( ... ) { array_deallocate< T,1,B,C,S,A >()( t ); throw; }
+ type r = p; p = t; t = 0; array_destructor< T,1,B,S,I,A >()( r );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, class F, class A >
+ struct array_swap
+ {
+ typedef typename array_type< T,N,F,A >::type type;
+
+ void operator()( type& p, type& q )
+ {
+ std::swap( p, q );
+ }
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N, class B, std::size_t S, bool I >
+ struct array_constructor< T,N,B,S,I,null::allocator >
+ {
+ typedef typename array_type< T,N,B,null::allocator >::type type;
+
+ void operator()( type& a )
+ {
+ memset( a, 0, S * sizeof(T) ); // '\0'
+ }
+ };
+
+ template< class T, class B, std::size_t S, bool I >
+ struct array_constructor< T,1,B,S,I,null::allocator >
+ {
+ typedef typename array_type< T,1,B,null::allocator >::type type;
+
+ void operator()( type& a )
+ {
+ memset( a, 0, S * sizeof(T) );
+ }
+ };
+
+ template< class T, std::size_t N, class B, std::size_t S >
+ struct array_constructor< T,N,B,S,false,null::allocator >
+ {
+ typedef typename array_type< T,N,B,null::allocator >::type type;
+
+ void operator()( type& )
+ {}
+ };
+
+ template< class T, class B, std::size_t S >
+ struct array_constructor< T,1,B,S,false,null::allocator >
+ {
+ typedef typename array_type< T,1,B,null::allocator >::type type;
+
+ void operator()( type& )
+ {}
+ };
+
+//--
+
+ template< class T, std::size_t N, class F >
+ struct array_swap< T,N,F,null::allocator >
+ {
+ typedef typename array_type< T,N,F,null::allocator >::type type;
+ typedef typename mpl::deref< F >::type D;
+ typedef typename mpl::next< F >::type G;
+
+ void operator()( type& p, type& q )
+ {
+ for( std::size_t i = 0; i != D::value; ++i )
+ array_swap< T,N-1,G,null::allocator >()( p[i], q[i] );
+ }
+ };
+
+ template< class T, class F >
+ struct array_swap< T,1,F,null::allocator >
+ {
+ typedef typename array_type< T,1,F,null::allocator >::type type;
+ typedef typename mpl::deref< F >::type D;
+
+ void operator()( type& p, type& q )
+ {
+ for( std::size_t i = 0; i != D::value; ++i )
+ std::swap( p[i], q[i] );
+ }
+ };
+
+//--
+//--
+
+ template< class T, class B, std::size_t N, class F, bool I, class A >
+ struct array_element_const
+ {
+ typedef typename array< T,B,I,A >::const_reference const_reference;
+ typedef typename array_type< T,N,F,A >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename mpl::deref< F >::type D;
+ typedef typename mpl::next< F >::type G;
+
+ const_reference operator()( type const& p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < D::value );
+ return array_element_const< T,B,N-1,G,I,A >()( p[*i], i+1 );
+ }
+ };
+
+ template< class T, class B, class F, bool I, class A >
+ struct array_element_const< T,B,1,F,I,A >
+ {
+ typedef typename array< T,B,I,A >::const_reference const_reference;
+ typedef typename array_type< T,1,F,A >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename mpl::deref< F >::type D;
+
+ const_reference operator()( type const& p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < D::value );
+ return p[*i];
+ }
+ };
+
+ template< class T, class B, std::size_t N, class F, bool I, class A >
+ struct array_element
+ {
+ typedef typename array< T,B,I,A >::reference reference;
+ typedef typename array_type< T,N,F,A >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename mpl::deref< F >::type D;
+ typedef typename mpl::next< F >::type G;
+
+ reference operator()( type& p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < D::value );
+ return array_element< T,B,N-1,G,I,A >()( p[*i], i+1 );
+ }
+ };
+
+ template< class T, class B, class F, bool I, class A >
+ struct array_element< T,B,1,F,I,A >
+ {
+ typedef typename array< T,B,I,A >::reference reference;
+ typedef typename array_type< T,1,F,A >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename mpl::deref< F >::type D;
+
+ reference operator()( type& p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < D::value );
+ return p[*i];
+ }
+ };
+
+//--
+
+ template< class T, class B, std::size_t N, class F, bool I, class A >
+ struct array_element_at_const
+ {
+ typedef typename array< T,B,I,A >::const_reference const_reference;
+ typedef typename array_type< T,N,F,A >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename mpl::deref< F >::type D;
+ typedef typename mpl::next< F >::type G;
+
+ const_reference operator()( type const& p, const_iterator i )
+ {
+ if( !( *i < D::value ) )
+ throw std::out_of_range( "array<> access out of range" );
+ return array_element_at_const< T,B,N-1,G,I,A >()( p[*i], i+1 );
+ }
+ };
+
+ template< class T, class B, class F, bool I, class A >
+ struct array_element_at_const< T,B,1,F,I,A >
+ {
+ typedef typename array< T,B,I,A >::const_reference const_reference;
+ typedef typename array_type< T,1,F,A >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename mpl::deref< F >::type D;
+
+ const_reference operator()( type const& p, const_iterator i )
+ {
+ if( !( *i < D::value ) )
+ throw std::out_of_range( "array<> access out of range" );
+ return p[*i];
+ }
+ };
+
+ template< class T, class B, std::size_t N, class F, bool I, class A >
+ struct array_element_at
+ {
+ typedef typename array< T,B,I,A >::reference reference;
+ typedef typename array_type< T,N,F,A >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename mpl::deref< F >::type D;
+ typedef typename mpl::next< F >::type G;
+
+ reference operator()( type& p, const_iterator i )
+ {
+ if( !( *i < D::value ) )
+ throw std::out_of_range( "array<> access out of range" );
+ return array_element_at< T,B,N-1,G,I,A >()( p[*i], i+1 );
+ }
+ };
+
+ template< class T, class B, class F, bool I, class A >
+ struct array_element_at< T,B,1,F,I,A >
+ {
+ typedef typename array< T,B,I,A >::reference reference;
+ typedef typename array_type< T,1,F,A >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename mpl::deref< F >::type D;
+
+ reference operator()( type& p, const_iterator i )
+ {
+ if( !( *i < D::value ) )
+ throw std::out_of_range( "array<> access out of range" );
+ return p[*i];
+ }
+ };
+
+//--
+
+ template< class T, class B, std::size_t N, class F, bool I, class A >
+ struct array_begin_const
+ {
+ typedef typename array< T,B,I,A >::const_iterator const_iterator;
+ typedef typename array_type< T,N,F,A >::type type;
+ typedef typename mpl::next< F >::type G;
+
+ const_iterator operator()( type const& p )
+ {
+ return array_begin_const< T,B,N-1,G,I,A >()( *p );
+ }
+ };
+
+ template< class T, class B, class F, bool I, class A >
+ struct array_begin_const< T,B,1,F,I,A >
+ {
+ typedef typename array< T,B,I,A >::const_iterator const_iterator;
+ typedef typename array_type< T,1,F,A >::type type;
+
+ const_iterator operator()( type const& p )
+ {
+ return p;
+ }
+ };
+
+ template< class T, class B, std::size_t N, class F, bool I, class A >
+ struct array_begin
+ {
+ typedef typename array< T,B,I,A >::iterator iterator;
+ typedef typename array_type< T,N,F,A >::type type;
+ typedef typename mpl::next< F >::type G;
+
+ iterator operator()( type& p )
+ {
+ return array_begin< T,B,N-1,G,I,A >()( *p );
+ }
+ };
+
+ template< class T, class B, class F, bool I, class A >
+ struct array_begin< T,B,1,F,I,A >
+ {
+ typedef typename array< T,B,I,A >::iterator iterator;
+ typedef typename array_type< T,1,F,A >::type type;
+
+ iterator operator()( type& p )
+ {
+ return p;
+ }
+ };
+
+//--
+
+ // Base type for dynamically allocated array's.
+ template< class T, class B, bool I, class A >
+ class array_base
+ : public expression< array< T,B,I,A > >
+ {
+ public:
+
+ typedef array< T,B,I,A > type;
+ typedef type const& type_const_reference;
+ typedef expression< type > base_type;
+ typedef typename array_member_type< T,B,A >::type member_type;
+ typedef mpl::bool_< I > initialize;
+
+ enum { dimensionality = mpl::size< B >::type::value,
+ size = array_size< B >::type::value };
+
+ array_base();
+
+ array_base( type_const_reference );
+ template< bool I1, class A1 > array_base( array< T,B,I1,A1 > const& );
+
+ void operator=( type_const_reference );
+ template< bool I1, class A1 > void operator=( array< T,B,I1,A1 > const& );
+
+ ~array_base();
+
+ protected:
+
+ typedef typename has_trivial_destructor< T >::type M;
+ typedef typename array_initialize< T,I,A >::type C;
+ typedef typename mpl::size< B >::type N;
+ typedef typename mpl::begin< B >::type F;
+ typedef typename mpl::deref< F >::type D;
+
+ member_type data;
+
+ template< class T1, class B1, bool I1, class A1 >
+ friend class array;
+ };
+
+//--
+//--
+
+ // Base type for statically allocated array's.
+ template< class T, class B, bool I >
+ class array_base< T,B,I,null::allocator >
+ : public expression< array< T,B,I,null::allocator > >
+ {
+ public:
+
+ typedef array< T,B,I,null::allocator > type;
+ typedef expression< type > base_type;
+ typedef typename array_member_type< T,B,null::allocator >::type member_type;
+ typedef mpl::bool_< I > initialize;
+
+ enum { dimensionality = mpl::size< B >::type::value,
+ size = array_size< B >::type::value };
+
+ array_base();
+
+ protected:
+
+ typedef typename has_trivial_destructor< T >::type M;
+ typedef typename array_initialize< T,I,null::allocator >::type C;
+ typedef typename mpl::size< B >::type N;
+ typedef typename mpl::begin< B >::type F;
+ typedef typename mpl::deref< F >::type D;
+
+ member_type data;
+
+ template< class T1, class B1, bool I1, class A1 >
+ friend class array;
+ };
+
+//--
+//--
+
+ /*
+ array class template
+
+ parameters
+
+ required
+
+ T - stored data type
+ type: arbitrary type
+ B - array bounds
+ type: boundsN< ... > : mpl vectorN_c< std::size_t, ... >
+ sequence containing size of each of N dimensions
+
+ optional
+
+ I - initialization parameter
+ type: bool
+ default: true, data elements zero/default initialized
+ A - allocator
+ type: standard conforming allocator, or null::allocator
+ default: null::allocator, statically allocated array
+ */
+
+ template< class T, class B, bool I, class A >
+ class array
+ : public array_base< T,B,I,A >
+ {
+ public:
+
+ typedef array type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef array_base< T,B,I,A > base_type;
+ typedef sub_type< type > subarray_type;
+ typedef typename base_type::member_type member_type;
+ typedef typename array_value_type< T,B,A >::type value_type;
+ typedef value_type const& const_reference_type;
+ typedef value_type& reference_type;
+ typedef value_type const* const_iterator_type;
+ typedef value_type* iterator_type;
+ typedef T element_type;
+ typedef T const& const_reference;
+ typedef T& reference;
+ typedef T const* const_iterator;
+ typedef T* iterator;
+ typedef typename A::template rebind< value_type >::other allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename allocator_type::difference_type difference_type;
+ typedef bounds< base_type::dimensionality > bounds_type;
+ typedef bounds_type const& bounds_const_reference;
+ typedef assigner< type,base_type::size-1 > assigner_type;
+ typedef typename base_type::initialize initialize;
+ typedef B bounds;
+ typedef bounds limits_type;
+
+ array();
+
+ array( type_const_reference );
+ template< bool I1, class A1 > array( array< T,B,I1,A1 > const& );
+
+ type_reference operator=( type_const_reference );
+ template< bool I1, class A1 > type_reference operator=( array< T,B,I1,A1 > const& );
+ assigner_type operator=( const_reference );
+
+ ~array();
+
+ const_reference_type operator[]( size_type ) const;
+ reference_type operator[]( size_type );
+
+ const_reference_type operator*() const;
+ reference_type operator*();
+
+ const_iterator_type operator+( size_type ) const;
+ iterator_type operator+( size_type );
+
+ const_reference operator[]( bounds_const_reference ) const;
+ reference operator[]( bounds_const_reference );
+
+ const_reference at( bounds_const_reference ) const;
+ reference at( bounds_const_reference );
+
+ bool const empty() const;
+ size_type const size() const;
+ template< std::size_t U > size_type const bound() const;
+
+ void swap( type_reference );
+ template< bool I1, class A1 > void swap( array< T,B,I1,A1 >& );
+
+ const_iterator begin() const;
+ iterator begin();
+ const_iterator end() const;
+ iterator end();
+
+ };
+
+//--
+//--
+
+ template< class T, class B, bool I, class A >
+ array< T,B,I,A >::array() : base_type()
+ {} // constructor
+
+ template< class T, class B, bool I, class A >
+ array< T,B,I,A >::array( type_const_reference a ) : base_type( a )
+ {} // copy constructor
+
+ template< class T, class B, bool I, class A > template< bool I1, class A1 >
+ array< T,B,I,A >::array( array< T,B,I1,A1 > const& a ) : base_type( a )
+ {} // copy constructor
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::type_reference array< T,B,I,A >::operator=( type_const_reference a )
+ {
+ if( &a != this ) base_type::operator=( a );
+ return *this;
+ } // ( copy ) assignment operator
+
+ template< class T, class B, bool I, class A > template< bool I1, class A1 >
+ typename array< T,B,I,A >::type_reference array< T,B,I,A >::operator=( array< T,B,I1,A1 > const& a )
+ {
+ base_type::operator=( a );
+ return *this;
+ } // ( copy ) assignment operator
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::assigner_type array< T,B,I,A >::operator=( const_reference t )
+ {
+ return assigner_type( *this, begin(), t );
+ } // assigner assignment
+
+ template< class T, class B, bool I, class A >
+ array< T,B,I,A >::~array()
+ {} // destructor
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::const_reference_type array< T,B,I,A >::operator[]( size_type s ) const
+ {
+ return this->data[s];
+ } // operator[] const
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::reference_type array< T,B,I,A >::operator[]( size_type s )
+ {
+ return this->data[s];
+ } // operator[]
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::const_reference_type array< T,B,I,A >::operator*() const
+ {
+ return *this->data;
+ } // dereference
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::reference_type array< T,B,I,A >::operator*()
+ {
+ return *this->data;
+ } // dereference
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::const_iterator_type array< T,B,I,A >::operator+( size_type s ) const
+ {
+ return this->data+s;
+ } // operator+, enables explicit indirection expressions
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::iterator_type array< T,B,I,A >::operator+( size_type s )
+ {
+ return this->data+s;
+ } // operator+, enables explicit indirection expressions
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::const_reference array< T,B,I,A >::operator[]( bounds_const_reference b ) const
+ {
+ return array_element_const< T,B,base_type::N::value,typename base_type::F,I,A >()( this->data, b.begin() );
+ } // operator[] const
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::reference array< T,B,I,A >::operator[]( bounds_const_reference b )
+ {
+ return array_element< T,B,base_type::N::value,typename base_type::F,I,A >()( this->data, b.begin() );
+ } // operator[]
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::const_reference array< T,B,I,A >::at( bounds_const_reference b ) const
+ {
+ return array_element_at_const< T,B,base_type::N::value,typename base_type::F,I,A >()( this->data, b.begin() );
+ } // at const
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::reference array< T,B,I,A >::at( bounds_const_reference b )
+ {
+ return array_element_at< T,B,base_type::N::value,typename base_type::F,I,A >()( this->data, b.begin() );
+ } // at
+
+ template< class T, class B, bool I, class A >
+ bool const array< T,B,I,A >::empty() const
+ {
+ return false;
+ } // empty
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::size_type const array< T,B,I,A >::size() const
+ {
+ return base_type::size;
+ } // size
+
+ template< class T, class B, bool I, class A > template< std::size_t U >
+ typename array< T,B,I,A >::size_type const array< T,B,I,A >::bound() const
+ {
+ BOOST_STATIC_ASSERT( U < base_type::dimensionality );
+ return mpl::at< B, mpl::size_t< U > >::type::value;
+ } // bound
+
+ template< class T, class B, bool I, class A >
+ void array< T,B,I,A >::swap( type_reference a )
+ {
+ if( &a != this ) array_swap< T,base_type::N::value,typename base_type::F,A >()( this->data, a.data );
+ } // swap
+
+ template< class T, class B, bool I, class A > template< bool I1, class A1 >
+ void array< T,B,I,A >::swap( array< T,B,I1,A1 >& a )
+ {
+ array_swap< T,base_type::N::value,typename base_type::F,A >()( this->data, a.data );
+ } // swap
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::const_iterator array< T,B,I,A >::begin() const
+ {
+ return array_begin_const< T,B,base_type::N::value,typename base_type::F,I,A >()( this->data );
+ } // begin const
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::iterator array< T,B,I,A >::begin()
+ {
+ return array_begin< T,B,base_type::N::value,typename base_type::F,I,A >()( this->data );
+ } // begin
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::const_iterator array< T,B,I,A >::end() const
+ {
+ return begin()+base_type::size;
+ } // end const
+
+ template< class T, class B, bool I, class A >
+ typename array< T,B,I,A >::iterator array< T,B,I,A >::end()
+ {
+ return begin()+base_type::size;
+ } // end
+
+//--
+//--
+
+ template< class T, class B, bool I, class A >
+ array_base< T,B,I,A >::array_base()
+ {
+ array_constructor< T,N::value,F,D::value,C::value,A >()( data );
+ } // constructor
+
+ template< class T, class B, bool I, class A >
+ array_base< T,B,I,A >::array_base( type_const_reference a )
+ {
+ array_copy< T,N::value,F,D::value,A >()( data, a.data );
+ } // copy constructor
+
+ template< class T, class B, bool I, class A > template< bool I1, class A1 >
+ array_base< T,B,I,A >::array_base( array< T,B,I1,A1 > const& a )
+ {
+ array_copy< T,N::value,F,D::value,A >()( data, a.data );
+ } // copy constructor
+
+ template< class T, class B, bool I, class A >
+ void array_base< T,B,I,A >::operator=( type_const_reference a )
+ {
+ array_assign< T,N::value,F,D::value,M::value,A >()( data, a.data );
+ } // ( copy ) assignment operator
+
+ template< class T, class B, bool I, class A > template< bool I1, class A1 >
+ void array_base< T,B,I,A >::operator=( array< T,B,I1,A1 > const& a )
+ {
+ array_assign< T,N::value,F,D::value,M::value,A >()( data, a.data );
+ } // ( copy ) assignment operator
+
+ template< class T, class B, bool I, class A >
+ array_base< T,B,I,A >::~array_base()
+ {
+ array_destructor< T,N::value,F,D::value,M::value,A >()( data );
+ }
+
+//--
+//--
+
+ template< class T, class B, bool I >
+ array_base< T,B,I,null::allocator >::array_base()
+ {
+ array_constructor< T,N::value,F,size,C::value,null::allocator >()( data );
+ } // constructor
+
+//--
+//--
+
+ template< class T, class B, bool I, class A >
+ struct sub_type< array< T,B,I,A > >
+ {
+ typedef array< T,typename mpl::pop_front< B >::type,I,A > type;
+ };
+
+//--
+//--
+
+ template< class T, class B, std::size_t N, class F, bool I, class A, class C, class CT >
+ struct array_out
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename array< T,B,I,A >::const_iterator_type type;
+ typedef typename mpl::pop_front< B >::type P;
+ typedef typename mpl::deref< F >::type D;
+ typedef typename mpl::next< F >::type G;
+
+ stream& operator()( stream& s, type const& a )
+ {
+ s << '(';
+ for( std::size_t i = 0; i != D::value; ++i )
+ { array_out< T,P,N-1,G,I,A,C,CT >()( s, a[i] );
+ if( i != D::value - 1 ) s << ',';
+ }
+ s << ')';
+ return s;
+ }
+ };
+
+ template< class T, class B, class F, bool I, class A, class C, class CT >
+ struct array_out< T,B,1,F,I,A,C,CT >
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename array< T,B,I,A >::const_iterator_type type;
+ typedef typename mpl::deref< F >::type D;
+
+ stream& operator()( stream& s, type const& a )
+ {
+ s << '(';
+ for( std::size_t i = 0; i != D::value - 1; ++i ) s << a[i] << ',';
+ s << a[D::value-1] << ')';
+ return s;
+ }
+ };
+
+//--
+
+ template< std::size_t N, class F, class C, class CT >
+ struct array_out_size
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename mpl::deref< F >::type D;
+ typedef typename mpl::next< F >::type G;
+
+ void operator()( stream& s )
+ {
+ s << '[' << D::value << ']';
+ array_out_size< N-1,G,C,CT >()( s );
+ }
+ };
+
+ template< class F, class C, class CT >
+ struct array_out_size< 1,F,C,CT >
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename mpl::deref< F >::type D;
+
+ void operator()( stream& s )
+ {
+ s << '[' << D::value << ']';
+ }
+ };
+
+//--
+
+ template< class T, class B, bool I, class A, class C, class CT >
+ std::basic_ostream< C,CT >& operator<<( std::basic_ostream< C,CT >& o, array< T,B,I,A > const& a )
+ {
+ typedef typename mpl::size< B >::type N; typedef typename mpl::begin< B >::type F;
+
+ std::basic_ostringstream< C,CT,std::allocator< C > > s;
+ s.flags( o.flags() ); s.imbue( o.getloc() ); s.precision( o.precision() );
+ array_out_size< N::value,F,C,CT >()( s );
+ return o << array_out< T,B,N::value,F,I,A,C,CT >()( s, a+0 ).str().c_str();
+ }
+
+//--
+//--
+
+ template< class T, bool I, class A >
+ class array< T,bounds0,I,A >
+ {
+ public:
+
+ typedef array type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef bounds0 subarray_type;
+ typedef bounds0 member_type;
+ typedef T value_type;
+ typedef value_type const& const_reference_type;
+ typedef value_type& reference_type;
+ typedef value_type const* const_iterator_type;
+ typedef value_type* iterator_type;
+ typedef T element_type;
+ typedef T const& const_reference;
+ typedef T& reference;
+ typedef T const* const_iterator;
+ typedef T* iterator;
+ typedef typename A::template rebind< T >::other allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename allocator_type::difference_type difference_type;
+ typedef bounds< 0 > bounds_type;
+ typedef bounds_type const& bounds_const_reference;
+ typedef mpl::bool_< I > initialize;
+ typedef bounds0 limits;
+
+ enum { dimensionality = 0, size = 0 };
+
+ };
+
+ template< class T, bool I, class A >
+ class array< T,mpl::vector0<>,I,A >
+ : public array< T,bounds0,I,A >
+ {};
+
+//--
+//--
+
+ template< class T, class B, bool I, class A, bool I1, class A1 >
+ bool operator==( array< T,B,I,A > const& x, array< T,B,I1,A1 > const& y )
+ {
+ return std::equal( x.begin(), x.end(), y.begin() );
+ }
+
+ template< class T, class B, bool I, class A, bool I1, class A1 >
+ bool operator<( array< T,B,I,A > const& x, array< T,B,I1,A1 > const& y )
+ {
+ return std::lexicographical_compare( x.begin(), x.end(), y.begin(), y.end() );
+ }
+
+ template< class T, class B, bool I, class A, bool I1, class A1 >
+ bool operator!=( array< T,B,I,A > const& x, array< T,B,I1,A1 > const& y )
+ {
+ return !( x == y );
+ }
+
+ template< class T, class B, bool I, class A, bool I1, class A1 >
+ bool operator>( array< T,B,I,A > const& x, array< T,B,I1,A1 > const& y )
+ {
+ return y < x;
+ }
+
+ template< class T, class B, bool I, class A, bool I1, class A1 >
+ bool operator<=( array< T,B,I,A > const& x, array< T,B,I1,A1 > const& y )
+ {
+ return !( y < x );
+ }
+
+ template< class T, class B, bool I, class A, bool I1, class A1 >
+ bool operator>=( array< T,B,I,A > const& x, array< T,B,I1,A1 > const& y )
+ {
+ return !( x < y );
+ }
+
+//--
+
+ template< class T, class B, bool I, class A >
+ void swap( array< T,B,I,A >& x, array< T,B,I,A >& y )
+ {
+ x.swap( y );
+ }
+
+ template< class T, class B, bool I, class A, bool I1, class A1 >
+ void swap( array< T,B,I,A >& x, array< T,B,I1,A1 >& y )
+ {
+ x.swap( y );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_GENERIC_ARRAY_HPP

Added: sandbox/maps/maps/boost/maps/generic/array_.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/generic/array_.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,1103 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_GENERIC_ARRAY_HPP_ )
+#define BOOST_MAPS_GENERIC_ARRAY_HPP_
+
+#include <boost/maps/support/includes.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, class A >
+ struct array_allocate_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+ typedef typename array_type_< T,N-1,D,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p )
+ {
+ allocator a;
+ p = a.allocate( S );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, class A >
+ struct array_deallocate_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+ typedef typename array_type_< T,N-1,D,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p )
+ {
+ allocator a;
+ a.deallocate( p, S ); p = 0;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, bool I, class A >
+ struct array_construct_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+ typedef typename array_type_< T,N-1,D,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p )
+ {
+ type f = p, l = p+S;
+ allocator a;
+ try
+ { T t = T();
+ while( f != l ) { a.construct( f, t ); ++f; }
+ }catch( ... )
+ { type n = p;
+ while( n != f ) { a.destroy( n ); ++n; }
+ throw;
+ }
+ }
+ };
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, class A >
+ struct array_construct_< T,N,D,S,false,A >
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ void operator()( type& )
+ {}
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, bool P, class A >
+ struct array_copy_assign_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+ typedef typename array_type_< T,N-1,D,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p, type const& q )
+ {
+ type f = p, l = p+S, r = q;
+ allocator a;
+ try
+ { for (; f != l; ++f, ++r)
+ a.construct(f, *r);
+ }catch( ... )
+ { type n = p;
+ for (; n != r; ++n)
+ a.destroy(n);
+ throw;
+ }
+ }
+ };
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, class A >
+ struct array_copy_assign_< T,N,D,S,true,A >
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ void operator()( type& p, type const& q )
+ {
+ memcpy( p, q, S * sizeof(T) );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, bool I, class A >
+ struct array_destroy_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+ typedef typename array_type_< T,N-1,D,A >::type value_type;
+ typedef typename A::template rebind< value_type >::other allocator;
+
+ void operator()( type& p )
+ {
+ allocator a;
+ for( std::size_t i = 0; i != S; ++i ) a.destroy( p+i );
+ }
+ };
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, class A >
+ struct array_destroy_< T,N,D,S,true,A >
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ void operator()( type& )
+ {}
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, bool I, class A >
+ struct array_constructor_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ void operator()( type& p )
+ {
+ array_allocate_< T,N,D,S,A >()( p );
+ try { array_constructor_< T,N-1,D,S*D,I,A >()( p[0] ); }
+ catch( ... ) { array_deallocate_< T,N,D,S,A >()( p ); throw; }
+ for( std::size_t j = 1, k = D; j != S; ++j ) p[j] = p[j-1] + k;
+ }
+ };
+
+ template< class T, std::size_t D, std::size_t S, bool I, class A >
+ struct array_constructor_< T,1,D,S,I,A >
+ {
+ typedef typename array_type_< T,1,D,A >::type type;
+
+ void operator()( type& p )
+ {
+ array_allocate_< T,1,D,S,A >()( p );
+ try { array_construct_< T,1,D,S,I,A >()( p ); }
+ catch( ... ) { array_deallocate_< T,1,D,S,A >()( p ); throw; }
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, bool I, class A >
+ struct array_destructor_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ void operator()( type& p )
+ {
+ array_destructor_< T,N-1,D,S*D,I,A >()( p[0] );
+ array_deallocate_< T,N,D,S,A >()( p );
+ }
+ };
+
+ template< class T, std::size_t D, std::size_t S, bool I, class A >
+ struct array_destructor_< T,1,D,S,I,A >
+ {
+ typedef typename array_type_< T,1,D,A >::type type;
+
+ void operator()( type& p )
+ {
+ array_destroy_< T,1,D,S,I,A >()( p );
+ array_deallocate_< T,1,D,S,A >()( p );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, class A >
+ struct array_copy_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ void operator()( type& p, type const& q )
+ {
+ array_allocate_< T,N,D,S,A >()( p );
+ try { array_copy_< T,N-1,D,S*D,A >()( p[0], q[0] ); }
+ catch( ... ) { array_deallocate_< T,N,D,S,A >()( p ); throw; }
+ for( std::size_t j = 1, k = D; j != S; ++j ) p[j] = p[j-1] + k;
+ }
+ };
+
+ template< class T, std::size_t D, std::size_t S, class A >
+ struct array_copy_< T,1,D,S,A >
+ {
+ typedef typename array_type_< T,1,D,A >::type type;
+ typedef typename boost::is_pod< T >::type P;
+
+ void operator()( type& p, type const& q )
+ {
+ array_allocate_< T,1,D,S,A >()( p );
+ try { array_copy_assign_< T,1,D,S,P::value,A >()( p, q ); }
+ catch( ... ) { array_deallocate_< T,1,D,S,A >()( p ); throw; }
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, bool I, class A >
+ struct array_assign_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ void operator()( type& p, type const& q )
+ {
+ array_assign_< T,N-1,D,S*D,I,A >()( p[0], q[0] );
+ }
+ };
+
+ template< class T, std::size_t D, std::size_t S, bool I, class A >
+ struct array_assign_< T,2,D,S,I,A >
+ {
+ typedef typename array_type_< T,2,D,A >::type type;
+
+ void operator()( type& p, type const& q )
+ {
+ array_assign_< T,1,D,S*D,I,A >()( p[0], q[0] );
+ for( std::size_t j = 0, k = 0; j != S; ++j, k += D ) p[j] = &p[0][k];
+ }
+ };
+
+ template< class T, std::size_t D, std::size_t S, bool I, class A >
+ struct array_assign_< T,1,D,S,I,A >
+ {
+ typedef typename array_type_< T,1,D,A >::type type;
+ typedef typename boost::is_pod< T >::type P;
+
+ void operator()( type& p, type const& q )
+ {
+ type t = 0; array_allocate_< T,1,D,S,A >()( t );
+ try { array_copy_assign_< T,1,D,S,P::value,A >()( t, q ); }
+ catch( ... ) { array_deallocate_< T,1,D,S,A >()( t ); throw; }
+ type r = p; p = t; t = 0; array_destructor_< T,1,D,S,I,A >()( r );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, class A >
+ struct array_swap_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ void operator()( type& p, type& q )
+ {
+ std::swap( p, q );
+ }
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S, bool I >
+ struct array_constructor_< T,N,D,S,I,null::allocator >
+ {
+ typedef typename array_type_< T,N,D,null::allocator >::type type;
+
+ void operator()( type& a )
+ {
+ memset( a, 0, S * sizeof(T) );
+ }
+ };
+
+ template< class T, std::size_t D, std::size_t S, bool I >
+ struct array_constructor_< T,1,D,S,I,null::allocator >
+ {
+ typedef typename array_type_< T,1,D,null::allocator >::type type;
+
+ void operator()( type& a )
+ {
+ memset( a, 0, S * sizeof(T) );
+ }
+ };
+
+ template< class T, std::size_t N, std::size_t D, std::size_t S >
+ struct array_constructor_< T,N,D,S,false,null::allocator >
+ {
+ typedef typename array_type_< T,N,D,null::allocator >::type type;
+
+ void operator()( type& )
+ {}
+ };
+
+ template< class T, std::size_t D, std::size_t S >
+ struct array_constructor_< T,1,D,S,false,null::allocator >
+ {
+ typedef typename array_type_< T,1,D,null::allocator >::type type;
+
+ void operator()( type& )
+ {}
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D >
+ struct array_swap_< T,N,D,null::allocator >
+ {
+ typedef typename array_type_< T,N,D,null::allocator >::type type;
+
+ void operator()( type& p, type& q )
+ {
+ for( std::size_t i = 0; i != D; ++i )
+ array_swap_< T,N-1,D,null::allocator >()( p[i], q[i] );
+ }
+ };
+
+ template< class T, std::size_t D >
+ struct array_swap_< T,1,D,null::allocator >
+ {
+ typedef typename array_type_< T,1,D,null::allocator >::type type;
+
+ void operator()( type& p, type& q )
+ {
+ for( std::size_t i = 0; i != D; ++i )
+ std::swap( p[i], q[i] );
+ }
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ struct array_element_const_
+ {
+ typedef typename array_< T,N,D,I,A >::const_reference const_reference;
+ typedef typename array_type_< T,N,D,A >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+
+ const_reference operator()( type const& p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < D );
+ return array_element_const_< T,N-1,D,I,A >()( p[*i], i+1 );
+ }
+ };
+
+ template< class T, std::size_t D, bool I, class A >
+ struct array_element_const_< T,1,D,I,A >
+ {
+ typedef typename array_< T,1,D,I,A >::const_reference const_reference;
+ typedef typename array_type_< T,1,D,A >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+
+ const_reference operator()( type const& p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < D );
+ return p[*i];
+ }
+ };
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ struct array_element_
+ {
+ typedef typename array_< T,N,D,I,A >::reference reference;
+ typedef typename array_type_< T,N,D,A >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+
+ reference operator()( type& p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < D );
+ return array_element_< T,N-1,D,I,A >()( p[*i], i+1 );
+ }
+ };
+
+ template< class T, std::size_t D, bool I, class A >
+ struct array_element_< T,1,D,I,A >
+ {
+ typedef typename array_< T,1,D,I,A >::reference reference;
+ typedef typename array_type_< T,1,D,A >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+
+ reference operator()( type& p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < D );
+ return p[*i];
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ struct array_element_at_const_
+ {
+ typedef typename array_< T,N,D,I,A >::const_reference const_reference;
+ typedef typename array_type_< T,N,D,A >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+
+ const_reference operator()( type const& p, const_iterator i )
+ {
+ if( !( *i < D ) )
+ throw std::out_of_range( "array_<> access out of range" );
+ return array_element_at_const_< T,N-1,D,I,A >()( p[*i], i+1 );
+ }
+ };
+
+ template< class T, std::size_t D, bool I, class A >
+ struct array_element_at_const_< T,1,D,I,A >
+ {
+ typedef typename array_< T,1,D,I,A >::const_reference const_reference;
+ typedef typename array_type_< T,1,D,A >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+
+ const_reference operator()( type const& p, const_iterator i )
+ {
+ if( !( *i < D ) )
+ throw std::out_of_range( "array_<> access out of range" );
+ return p[*i];
+ }
+ };
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ struct array_element_at_
+ {
+ typedef typename array_< T,N,D,I,A >::reference reference;
+ typedef typename array_type_< T,N,D,A >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+
+ reference operator()( type& p, const_iterator i )
+ {
+ if( !( *i < D ) )
+ throw std::out_of_range( "array_<> access out of range" );
+ return array_element_at_< T,N-1,D,I,A >()( p[*i], i+1 );
+ }
+ };
+
+ template< class T, std::size_t D, bool I, class A >
+ struct array_element_at_< T,1,D,I,A >
+ {
+ typedef typename array_< T,1,D,I,A >::reference reference;
+ typedef typename array_type_< T,1,D,A >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+
+ reference operator()( type& p, const_iterator i )
+ {
+ if( !( *i < D ) )
+ throw std::out_of_range( "array_<> access out of range" );
+ return p[*i];
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ struct array_begin_const_
+ {
+ typedef typename array_< T,N,D,I,A >::const_iterator const_iterator;
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ const_iterator operator()( type const& p )
+ {
+ return array_begin_const_< T,N-1,D,I,A >()( *p );
+ }
+ };
+
+ template< class T, std::size_t D, bool I, class A >
+ struct array_begin_const_< T,1,D,I,A >
+ {
+ typedef typename array_< T,1,D,I,A >::const_iterator const_iterator;
+ typedef typename array_type_< T,1,D,A >::type type;
+
+ const_iterator operator()( type const& p )
+ {
+ return p;
+ }
+ };
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ struct array_begin_
+ {
+ typedef typename array_< T,N,D,I,A >::iterator iterator;
+ typedef typename array_type_< T,N,D,A >::type type;
+
+ iterator operator()( type& p )
+ {
+ return array_begin_< T,N-1,D,I,A >()( *p );
+ }
+ };
+
+ template< class T, std::size_t D, bool I, class A >
+ struct array_begin_< T,1,D,I,A >
+ {
+ typedef typename array_< T,1,D,I,A >::iterator iterator;
+ typedef typename array_type_< T,1,D,A >::type type;
+
+ iterator operator()( type& p )
+ {
+ return p;
+ }
+ };
+
+//--
+
+ // Base type for dynamically allocated array_'s.
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ class array_base_
+ : public expression< array_< T,N,D,I,A > >
+ {
+ public:
+
+ typedef array_< T,N,D,I,A > type;
+ typedef type const& type_const_reference;
+ typedef expression< type > base_type;
+ typedef typename array_member_type_< T,N,D,A >::type member_type;
+
+ enum { dimensionality = N, size = array_size_< N,D >::type::value };
+
+ array_base_();
+
+ array_base_( type_const_reference );
+ template< bool I1, class A1 > array_base_( array_< T,N,D,I1,A1 > const& );
+
+ void operator=( type_const_reference );
+ template< bool I1, class A1 > void operator=( array_< T,N,D,I1,A1 > const& );
+
+ ~array_base_();
+
+ protected:
+
+ typedef typename has_trivial_destructor< T >::type M;
+ typedef typename array_initialize< T,I,A >::type C;
+
+ member_type data;
+
+ template< class T1, std::size_t N1, std::size_t D1, bool I1, class A1 >
+ friend class array_;
+ };
+
+//--
+//--
+
+ // Base type for statically allocated array_'s.
+ template< class T, std::size_t N, std::size_t D, bool I >
+ class array_base_< T,N,D,I,null::allocator >
+ : public expression< array_< T,N,D,I,null::allocator > >
+ {
+ public:
+
+ typedef array_< T,N,D,I,null::allocator > type;
+ typedef expression< type > base_type;
+ typedef typename array_member_type_< T,N,D,null::allocator >::type member_type;
+
+ enum { dimensionality = N, size = array_size_< N,D >::type::value };
+
+ array_base_();
+
+ protected:
+
+ typedef typename array_initialize< T,I,null::allocator >::type C;
+
+ member_type data;
+
+ template< class T1, std::size_t N1, std::size_t D1, bool I1, class A1 >
+ friend class array_;
+ };
+
+//--
+//--
+
+ /*
+ array_ class template
+
+ parameters
+
+ required
+
+ T - stored data type
+ type: arbitrary type
+ N - number of dimensions
+ type: std::size_t
+ D - size of each dimension
+ type: std::size_t
+
+ optional
+
+ I - initialization parameter
+ type: bool
+ default: true, data elements zero/default initialized
+ A - allocator
+ type: standard conforming allocator, or null::allocator
+ default: null::allocator, statically allocated array
+ */
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ class array_
+ : public array_base_< T,N,D,I,A >
+ {
+ public:
+
+ typedef array_ type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef array_base_< T,N,D,I,A > base_type;
+ typedef sub_type< type > subarray_type;
+ typedef typename base_type::member_type member_type;
+ typedef typename array_value_type_< T,N,D,A >::type value_type;
+ typedef value_type const& const_reference_type;
+ typedef value_type& reference_type;
+ typedef value_type const* const_iterator_type;
+ typedef value_type* iterator_type;
+ typedef T element_type;
+ typedef T const& const_reference;
+ typedef T& reference;
+ typedef T const* const_iterator;
+ typedef T* iterator;
+ typedef typename A::template rebind< value_type >::other allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename allocator_type::difference_type difference_type;
+ typedef bounds< base_type::dimensionality > bounds_type;
+ typedef bounds_type const& bounds_const_reference;
+ typedef assigner< type,base_type::size-1 > assigner_type;
+ typedef mpl::bool_< I > initialize;
+ typedef typename array_bounds_< N,D >::type bounds;
+ typedef bounds limits_type;
+
+ array_();
+
+ array_( type_const_reference );
+ template< bool I1, class A1 > array_( array_< T,N,D,I1,A1 > const& );
+
+ type_reference operator=( type_const_reference );
+ template< bool I1, class A1 > type_reference operator=( array_< T,N,D,I1,A1 > const& );
+ assigner_type operator=( const_reference );
+
+ ~array_();
+
+ const_reference_type operator[]( size_type ) const;
+ reference_type operator[]( size_type );
+
+ const_reference_type operator*() const;
+ reference_type operator*();
+
+ const_iterator_type operator+( size_type ) const;
+ iterator_type operator+( size_type );
+
+ const_reference operator[]( bounds_const_reference ) const;
+ reference operator[]( bounds_const_reference );
+
+ const_reference at( bounds_const_reference ) const;
+ reference at( bounds_const_reference );
+
+ bool const empty() const;
+ size_type const size() const;
+ template< std::size_t U > size_type const bound() const;
+
+ void swap( type_reference );
+ template< bool I1, class A1 > void swap( array_< T,N,D,I1,A1 >& );
+
+ const_iterator begin() const;
+ iterator begin();
+ const_iterator end() const;
+ iterator end();
+
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ array_< T,N,D,I,A >::array_() : base_type()
+ {} // constructor
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ array_< T,N,D,I,A >::array_( type_const_reference a ) : base_type( a )
+ {} // copy constructor
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A > template< bool I1, class A1 >
+ array_< T,N,D,I,A >::array_( array_< T,N,D,I1,A1 > const& a ) : base_type( a )
+ {} // copy constructor
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::type_reference array_< T,N,D,I,A >::operator=( type_const_reference a )
+ {
+ if( &a != this ) base_type::operator=( a );
+ return *this;
+ } // ( copy ) assignment operator
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A > template< bool I1, class A1 >
+ typename array_< T,N,D,I,A >::type_reference array_< T,N,D,I,A >::operator=( array_< T,N,D,I1,A1 > const& a )
+ {
+ base_type::operator=( a );
+ return *this;
+ } // ( copy ) assignment operator
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::assigner_type array_< T,N,D,I,A >::operator=( const_reference t )
+ {
+ return assigner_type( *this, begin(), t );
+ } // assigner assignment
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ array_< T,N,D,I,A >::~array_()
+ {} // destructor
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::const_reference_type array_< T,N,D,I,A >::operator[]( size_type s ) const
+ {
+ return this->data[s];
+ } // operator[] const
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::reference_type array_< T,N,D,I,A >::operator[]( size_type s )
+ {
+ return this->data[s];
+ } // operator[]
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::const_reference_type array_< T,N,D,I,A >::operator*() const
+ {
+ return *this->data;
+ } // dereference
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::reference_type array_< T,N,D,I,A >::operator*()
+ {
+ return *this->data;
+ } // dereference
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::const_iterator_type array_< T,N,D,I,A >::operator+( size_type s ) const
+ {
+ return this->data+s;
+ } // operator+, enables explicit indirection expressions
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::iterator_type array_< T,N,D,I,A >::operator+( size_type s )
+ {
+ return this->data+s;
+ } // operator+, enables explicit indirection expressions
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::const_reference array_< T,N,D,I,A >::operator[]( bounds_const_reference b ) const
+ {
+ return array_element_const_< T,N,D,I,A >()( this->data, b.begin() );
+ } // operator[] const
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::reference array_< T,N,D,I,A >::operator[]( bounds_const_reference b )
+ {
+ return array_element_< T,N,D,I,A >()( this->data, b.begin() );
+ } // operator[]
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::const_reference array_< T,N,D,I,A >::at( bounds_const_reference b ) const
+ {
+ return array_element_at_const_< T,N,D,I,A >()( this->data, b.begin() );
+ } // at const
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::reference array_< T,N,D,I,A >::at( bounds_const_reference b )
+ {
+ return array_element_at_< T,N,D,I,A >()( this->data, b.begin() );
+ } // at
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ bool const array_< T,N,D,I,A >::empty() const
+ {
+ return false;
+ } // empty
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::size_type const array_< T,N,D,I,A >::size() const
+ {
+ return base_type::size;
+ } // size
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A > template< std::size_t U >
+ typename array_< T,N,D,I,A >::size_type const array_< T,N,D,I,A >::bound() const
+ {
+ BOOST_STATIC_ASSERT( U < N );
+ return D;
+ } // bound
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ void array_< T,N,D,I,A >::swap( type_reference a )
+ {
+ if( &a != this ) array_swap_< T,N,D,A >()( this->data, a.data );
+ } // swap
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A > template< bool I1, class A1 >
+ void array_< T,N,D,I,A >::swap( array_< T,N,D,I1,A1 >& a )
+ {
+ array_swap_< T,N,D,A >()( this->data, a.data );
+ } // swap
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::const_iterator array_< T,N,D,I,A >::begin() const
+ {
+ return array_begin_const_< T,N,D,I,A >()( this->data );
+ } // begin const
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::iterator array_< T,N,D,I,A >::begin()
+ {
+ return array_begin_< T,N,D,I,A >()( this->data );
+ } // begin
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::const_iterator array_< T,N,D,I,A >::end() const
+ {
+ return begin()+base_type::size;
+ } // end const
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ typename array_< T,N,D,I,A >::iterator array_< T,N,D,I,A >::end()
+ {
+ return begin()+base_type::size;
+ } // end
+
+//--
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ array_base_< T,N,D,I,A >::array_base_()
+ {
+ array_constructor_< T,N,D,D,C::value,A >()( data );
+ } // constructor
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ array_base_< T,N,D,I,A >::array_base_( type_const_reference a )
+ {
+ array_copy_< T,N,D,D,A >()( data, a.data );
+ } // copy constructor
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A > template< bool I1, class A1 >
+ array_base_< T,N,D,I,A >::array_base_( array_< T,N,D,I1,A1 > const& a )
+ {
+ array_copy_< T,N,D,D,A >()( data, a.data );
+ } // copy constructor
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ void array_base_< T,N,D,I,A >::operator=( type_const_reference a )
+ {
+ array_assign_< T,N,D,D,M::value,A >()( data, a.data );
+ } // ( copy ) assignment operator
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A > template< bool I1, class A1 >
+ void array_base_< T,N,D,I,A >::operator=( array_< T,N,D,I1,A1 > const& a )
+ {
+ array_assign_< T,N,D,D,M::value,A >()( data, a.data );
+ } // ( copy ) assignment operator
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ array_base_< T,N,D,I,A >::~array_base_()
+ {
+ array_destructor_< T,N,D,D,M::value,A >()( data );
+ }
+
+//--
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I >
+ array_base_< T,N,D,I,null::allocator >::array_base_()
+ {
+ array_constructor_< T,N,D,size,C::value,null::allocator >()( data );
+ } // constructor
+
+//--
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ struct sub_type< array_< T,N,D,I,A > >
+ {
+ typedef array_< T,N-1,D,I,A > type;
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, class C, class CT >
+ struct array_out_
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename array_< T,N,D,I,A >::const_iterator_type type;
+
+ stream& operator()( stream& s, type const& a )
+ {
+ s << '(';
+ for( std::size_t i = 0; i != D; ++i )
+ { array_out_< T,N-1,D,I,A,C,CT >()( s, a[i] );
+ if( i != D - 1 ) s << ',';
+ }
+ s << ')';
+ return s;
+ }
+ };
+
+ template< class T, std::size_t D, bool I, class A, class C, class CT >
+ struct array_out_< T,1,D,I,A,C,CT >
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename array_< T,1,D,I,A >::const_iterator_type type;
+
+ stream& operator()( stream& s, type const& a )
+ {
+ s << '(';
+ for( std::size_t i = 0; i != D - 1; ++i ) s << a[i] << ',';
+ s << a[D-1] << ')';
+ return s;
+ }
+ };
+
+//--
+
+ template< std::size_t N, std::size_t D, class C, class CT >
+ struct array_out_size_
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+
+ void operator()( stream& s )
+ {
+ s << '[' << D << ']';
+ array_out_size_< N-1,D,C,CT >()( s );
+ }
+ };
+
+ template< std::size_t D, class C, class CT >
+ struct array_out_size_< 1,D,C,CT >
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+
+ void operator()( stream& s )
+ {
+ s << '[' << D << ']';
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, class C, class CT >
+ std::basic_ostream< C,CT >& operator<<( std::basic_ostream< C,CT >& o, array_< T,N,D,I,A > const& a )
+ {
+ std::basic_ostringstream< C,CT,std::allocator< C > > s;
+ s.flags( o.flags() ); s.imbue( o.getloc() ); s.precision( o.precision() );
+ array_out_size_< N,D,C,CT >()( s );
+ return o << array_out_< T,N,D,I,A,C,CT >()( s, a+0 ).str().c_str();
+ }
+
+//--
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ class array_< T,N,0,I,A >
+ {
+ public:
+
+ typedef array_ type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef bounds0 subarray_type;
+ typedef bounds0 member_type;
+ typedef T value_type;
+ typedef value_type const& const_reference_type;
+ typedef value_type& reference_type;
+ typedef value_type const* const_iterator_type;
+ typedef value_type* iterator_type;
+ typedef T element_type;
+ typedef T const& const_reference;
+ typedef T& reference;
+ typedef T const* const_iterator;
+ typedef T* iterator;
+ typedef typename A::template rebind< T >::other allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename allocator_type::difference_type difference_type;
+ typedef bounds< N > bounds_type;
+ typedef bounds_type const& bounds_const_reference;
+ typedef mpl::bool_< I > initialize;
+ typedef mpl::vector0<> limits;
+
+ enum { dimensionality = N, size = 0 };
+
+ };
+
+ template< class T, bool I, class A >
+ class array_< T,0,0,I,A >
+ {
+ public:
+
+ typedef array_ type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef bounds0 subarray_type;
+ typedef bounds0 member_type;
+ typedef T value_type;
+ typedef value_type const& const_reference_type;
+ typedef value_type& reference_type;
+ typedef value_type const* const_iterator_type;
+ typedef value_type* iterator_type;
+ typedef T element_type;
+ typedef T const& const_reference;
+ typedef T& reference;
+ typedef T const* const_iterator;
+ typedef T* iterator;
+ typedef typename A::template rebind< T >::other allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename allocator_type::difference_type difference_type;
+ typedef bounds< 0 > bounds_type;
+ typedef bounds_type const& bounds_const_reference;
+ typedef mpl::bool_< I > initialize;
+ typedef mpl::vector0<> limits;
+
+ enum { dimensionality = 0, size = 0 };
+
+ };
+
+ template< class T, std::size_t D, bool I, class A >
+ class array_< T,0,D,I,A >
+ : public array_< T,0,0,I,A >
+ {};
+
+//--
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, bool I1, class A1 >
+ bool operator==( array_< T,N,D,I,A > const& x, array_< T,N,D,I1,A1 > const& y )
+ {
+ return std::equal( x.begin(), x.end(), y.begin() );
+ }
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, bool I1, class A1 >
+ bool operator<( array_< T,N,D,I,A > const& x, array_< T,N,D,I1,A1 > const& y )
+ {
+ return std::lexicographical_compare( x.begin(), x.end(), y.begin(), y.end() );
+ }
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, bool I1, class A1 >
+ bool operator!=( array_< T,N,D,I,A > const& x, array_< T,N,D,I1,A1 > const& y )
+ {
+ return !( x == y );
+ }
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, bool I1, class A1 >
+ bool operator>( array_< T,N,D,I,A > const& x, array_< T,N,D,I1,A1 > const& y )
+ {
+ return y < x;
+ }
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, bool I1, class A1 >
+ bool operator<=( array_< T,N,D,I,A > const& x, array_< T,N,D,I1,A1 > const& y )
+ {
+ return !( y < x );
+ }
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, bool I1, class A1 >
+ bool operator>=( array_< T,N,D,I,A > const& x, array_< T,N,D,I1,A1 > const& y )
+ {
+ return !( x < y );
+ }
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ void swap( array_< T,N,D,I,A >& x, array_< T,N,D,I,A >& y )
+ {
+ x.swap( y );
+ }
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, bool I1, class A1 >
+ void swap( array_< T,N,D,I,A >& x, array_< T,N,D,I1,A1 >& y )
+ {
+ x.swap( y );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_GENERIC_ARRAY_HPP_

Added: sandbox/maps/maps/boost/maps/generic/pointer.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/generic/pointer.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,1201 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_GENERIC_POINTER_HPP )
+#define BOOST_MAPS_GENERIC_POINTER_HPP
+
+#include <boost/maps/support/includes.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class T, std::size_t N, class A >
+ struct pointer_allocate
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename A::template rebind< typename pointer_type< T,N-1 >::type >::other allocator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, size_type s )
+ {
+ allocator a;
+ p = a.allocate( s );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, class A >
+ struct pointer_deallocate
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename A::template rebind< typename pointer_type< T,N-1 >::type >::other allocator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, size_type s )
+ {
+ allocator a;
+ a.deallocate( p, s ); p = 0;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ struct pointer_construct
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename A::template rebind< typename pointer_type< T,N-1 >::type >::other allocator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, size_type s )
+ {
+ type f = p, l = p+s;
+ allocator a;
+ try
+ { T t = T();
+ while( f != l ) { a.construct( f, t ); ++f; }
+ }catch( ... )
+ { type n = p;
+ while( n != f ) { a.destroy( n ); ++n; }
+ throw;
+ }
+ }
+ };
+
+ template< class T, std::size_t N, class A >
+ struct pointer_construct< T,N,false,A >
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type&, size_type )
+ {}
+ };
+
+//--
+
+ template< class T, std::size_t N, bool P, class A >
+ struct pointer_copy_assign
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename A::template rebind< typename pointer_type< T,N-1 >::type >::other allocator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, type const& q, size_type s )
+ {
+ type f = p, l = p+s, r = q;
+ allocator a;
+ try
+ { for (; f != l; ++f, ++r)
+ a.construct(f, *r);
+ }catch( ... )
+ { type n = p;
+ for (; n != r; ++n)
+ a.destroy(n);
+ throw;
+ }
+ }
+ };
+
+ template< class T, std::size_t N, class A >
+ struct pointer_copy_assign< T,N,true,A >
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, type const& q, size_type s )
+ {
+ memcpy( p, q, s * sizeof(T) );
+ }
+ };
+
+//-
+
+ template< class T, std::size_t N, bool P, class A >
+ struct pointer_fill
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type p, size_type s )
+ {
+ pointer_construct< T,N,true,A >()( p, s );
+ }
+ };
+
+ template< class T, std::size_t N, class A >
+ struct pointer_fill< T,N,true,A >
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type p, size_type s )
+ {
+ memset( p, 0, s * sizeof(T) );
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool D, class A >
+ struct pointer_destroy
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename A::template rebind< typename pointer_type< T,N-1 >::type >::other allocator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, size_type s )
+ {
+ allocator a;
+ for( std::size_t i = 0; i != s; ++i ) a.destroy( p+i );
+ }
+ };
+
+ template< class T, std::size_t N, class A >
+ struct pointer_destroy< T,N,true,A >
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename A::template rebind< typename pointer_type< T,N-1 >::type >::other allocator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type&, size_type )
+ {}
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ struct pointer_constructor
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::iterator iterator;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, iterator i, const_iterator c, size_type s )
+ {
+ if( s == 0 ) throw std::invalid_argument( "invalid pointer<> dimension" );
+ pointer_allocate< T,N,A >()( p, s ); *i = *c;
+ try { pointer_constructor< T,N-1,I,A >()( p[0], i+1, c+1, s * *( c+1 ) ); }
+ catch( ... ) { pointer_deallocate< T,N,A >()( p, s ); *i = 0; throw; }
+ for( std::size_t j = 1, k = *( c+1 ); j != s; ++j ) p[j] = p[j-1] + k;
+ }
+ };
+
+ template< class T, bool I, class A >
+ struct pointer_constructor< T,1,I,A >
+ {
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::iterator iterator;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+
+ void operator()( type& p, iterator i, const_iterator c, size_type s )
+ {
+ if( s == 0 ) throw std::invalid_argument( "invalid pointer<> dimension" );
+ pointer_allocate< T,1,A >()( p, s );
+ try { pointer_construct< T,1,I,A >()( p, s ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( p, s ); throw; }
+ *i = *c;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool D, class A >
+ struct pointer_destructor
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::iterator iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, iterator i, size_type s )
+ {
+ pointer_destructor< T,N-1,D,A >()( p[0], i+1, s * *( i+1 ) );
+ pointer_deallocate< T,N,A >()( p, s ); *i = 0;
+ }
+ };
+
+ template< class T, bool D, class A >
+ struct pointer_destructor< T,1,D,A >
+ {
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::iterator iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+
+ void operator()( type& p, iterator i, size_type s )
+ {
+ pointer_destroy< T,1,D,A >()( p, s );
+ pointer_deallocate< T,1,A >()( p, s ); *i = 0;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, class A >
+ struct pointer_copy
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::iterator iterator;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, iterator i, type const& q, const_iterator c, size_type s )
+ {
+ pointer_allocate< T,N,A >()( p, s ); *i = *c;
+ try { pointer_copy< T,N-1,A >()( p[0], i+1, q[0], c+1, s * *( c+1 ) ); }
+ catch( ... ) { pointer_deallocate< T,N,A >()( p, s ); *i = 0; throw; }
+ for( std::size_t j = 1, k = *( c+1 ); j != s; ++j ) p[j] = p[j-1] + k;
+ }
+ };
+
+ template< class T, class A >
+ struct pointer_copy< T,1,A >
+ {
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::iterator iterator;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+ typedef typename boost::is_pod< T >::type P;
+
+ void operator()( type& p, iterator i, type const& q, const_iterator c, size_type s )
+ {
+ pointer_allocate< T,1,A >()( p, s );
+ try { pointer_copy_assign< T,1,P::value,A >()( p, q, s ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( p, s ); throw; }
+ *i = *c;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool D, class A >
+ struct pointer_assign
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::iterator iterator;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, iterator i, size_type s, type const& q, const_iterator c, size_type n )
+ {
+ type t = 0; if( n != s ) pointer_allocate< T,N,A >()( t, n );
+ try { pointer_assign< T,N-1,D,A >()( p[0], i+1, s * *( i+1 ), q[0], c+1, n * *( c+1 ) ); }
+ catch( ... ) { if( t ) pointer_deallocate< T,N,A >()( t, n ); throw; }
+ if( t )
+ { for( std::size_t j = 0, k = 0; j != n; ++j, k += *( c+1 ) ) t[j] = &p[0][k];
+ type r = p; p = t; t = 0; pointer_deallocate< T,N,A >()( r, s );
+ }else
+ for( std::size_t j = 0, k = 0; j != n; ++j, k += *( c+1 ) ) p[j] = &p[0][k];
+ *i = *c;
+ }
+ };
+
+ template< class T, bool D, class A >
+ struct pointer_assign< T,1,D,A >
+ {
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::iterator iterator;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+ typedef typename boost::is_pod< T >::type P;
+
+ void operator()( type& p, iterator i, size_type s, type const& q, const_iterator c, size_type n )
+ {
+ type t = 0; pointer_allocate< T,1,A >()( t, n );
+ try { pointer_copy_assign< T,1,P::value,A >()( t, q, n ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( t, n ); throw; }
+ type r = p; p = t; t = 0; pointer_destructor< T,1,D,A >()( r, i, s );
+ *i = *c;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, bool D, class A, bool P >
+ struct pointer_resize
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::iterator iterator;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ void operator()( type& p, iterator i, size_type s, const_iterator c, size_type n )
+ {
+ if( n == 0 ) throw std::invalid_argument( "invalid pointer<> dimension" );
+ type t = 0; if( n != s ) pointer_allocate< T,N,A >()( t, n );
+ try { pointer_resize< T,N-1,I,D,A,P >()( p[0], i+1, s * *( i+1 ), c+1, n * *( c+1 ) ); }
+ catch( ... ) { if( t ) pointer_deallocate< T,N,A >()( t, n ); throw; }
+ if( t )
+ { for( std::size_t j = 0, k = 0; j != n; ++j, k += *( c+1 ) ) t[j] = &p[0][k];
+ type r = p; p = t; t = 0; pointer_deallocate< T,N,A >()( r, s );
+ }else
+ for( std::size_t j = 0, k = 0; j != n; ++j, k += *( c+1 ) ) p[j] = &p[0][k];
+ *i = *c;
+ }
+ };
+
+ template< class T, bool I, bool D, class A, bool P >
+ struct pointer_resize< T,1,I,D,A,P >
+ {
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::iterator iterator;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+
+ void operator()( type& p, iterator i, size_type s, const_iterator c, size_type n )
+ {
+ if( n == 0 ) throw std::invalid_argument( "invalid pointer<> dimension" );
+ type t = 0; pointer_allocate< T,1,A >()( t, n );
+ try { pointer_construct< T,1,I,A >()( t, n ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( t, n ); throw; }
+ type r = p; p = t; t = 0; pointer_destructor< T,1,D,A >()( r, i, s );
+ *i = *c;
+ }
+ };
+
+ template< class T, bool I, bool D, class A >
+ struct pointer_resize< T,1,I,D,A,true >
+ {
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::iterator iterator;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+ typedef typename boost::is_pod< T >::type P;
+
+ void operator()( type& p, iterator i, size_type s, const_iterator c, size_type n )
+ {
+ if( n == 0 ) throw std::invalid_argument( "invalid pointer<> bound" );
+ if( n != s )
+ { type t = 0; pointer_allocate< T,1,A >()( t, n );
+ if( n < s )
+ { try{ pointer_copy_assign< T,1,P::value,A >()( t, p, n ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( t, n ); throw; }
+ }else
+ { try { pointer_copy_assign< T,1,P::value,A >()( t, p, s ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( t, n ); throw; }
+ try{ pointer_fill< T,1,P::value,A >()( t+s, n - s ); }
+ catch( ... )
+ { pointer_destroy< T,1,D,A >()( t, s );
+ pointer_deallocate< T,1,A >()( t, n ); throw;
+ }
+ }
+ type r = p; p = t; t = 0; pointer_destructor< T,1,D,A >()( r, i, s );
+ }
+ *i = *c;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ struct pointer_element_const
+ {
+ typedef typename pointer< T,N,I,A >::const_reference const_reference;
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+
+ const_reference operator()( type const& p, const_iterator d, const_iterator i )
+ {
+ BOOST_ASSERT( *i < *d );
+ return pointer_element_const< T,N-1,I,A >()( p[*i], d+1, i+1 );
+ }
+ };
+
+ template< class T, bool I, class A >
+ struct pointer_element_const< T,1,I,A >
+ {
+ typedef typename pointer< T,1,I,A >::const_reference const_reference;
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+
+ const_reference operator()( type const& p, const_iterator d, const_iterator i )
+ {
+ BOOST_ASSERT( *i < *d );
+ return p[*i];
+ }
+ };
+
+ template< class T, std::size_t N, bool I, class A >
+ struct pointer_element
+ {
+ typedef typename pointer< T,N,I,A >::reference reference;
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+
+ reference operator()( type& p, const_iterator d, const_iterator i )
+ {
+ BOOST_ASSERT( *i < *d );
+ return pointer_element< T,N-1,I,A >()( p[*i], d+1, i+1 );
+ }
+ };
+
+ template< class T, bool I, class A >
+ struct pointer_element< T,1,I,A >
+ {
+ typedef typename pointer< T,1,I,A >::reference reference;
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+
+ reference operator()( type& p, const_iterator d, const_iterator i )
+ {
+ BOOST_ASSERT( *i < *d );
+ return p[*i];
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool D, class A >
+ struct pointer_reconstruct
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ bool operator()( type& p, const_iterator i, size_type s )
+ {
+ type t = 0;
+ try { pointer_allocate< T,N,A >()( t, s ); }
+ catch( ... ) { pointer_deallocate< T,N,A >()( t, s ); return false; }
+ if( pointer_reconstruct< T,N-1,D,A >()( p[0], i+1, s * *( i+1 ) ) )
+ { for( std::size_t j = 0, k = 0; j != s; ++j, k += *( i+1 ) ) t[j] = &p[0][k];
+ type r = p; p = t; t = 0; pointer_deallocate< T,N,A >()( r, s );
+ return true;
+ }else return false;
+ }
+ };
+
+ template< class T, bool D, class A >
+ struct pointer_reconstruct< T,1,D,A >
+ {
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+ typedef typename boost::is_pod< T >::type P;
+
+ bool operator()( type& p, const_iterator, size_type s )
+ {
+ type t = 0;
+ try
+ { pointer_allocate< T,1,A >()( t, s );
+ pointer_copy_assign< T,1,P::value,A >()( t, p, s );
+ }catch( ... ) { pointer_deallocate< T,1,A >()( t, s ); return false; }
+ type r = p; p = t; t = 0; pointer_destructor< T,1,D,A >()( r, &s, s );
+ return true;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, bool D, class A >
+ struct pointer_reset
+ {
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ bool operator()( type& p, const_iterator i, size_type s )
+ {
+ if( pointer_reset< T,N-1,I,D,A >()( p[0], i+1, s * *( i+1 ) ) )
+ return true;
+ else return false;
+ }
+ };
+
+ template< class T, bool I, bool D, class A >
+ struct pointer_reset< T,2,I,D,A >
+ {
+ typedef typename pointer_type< T,2 >::type type;
+ typedef typename bounds< 2 >::const_iterator const_iterator;
+ typedef typename bounds< 2 >::size_type size_type;
+
+ bool operator()( type& p, const_iterator i, size_type s )
+ {
+ if( pointer_reset< T,1,I,D,A >()( p[0], i+1, s * *( i+1 ) ) )
+ { for( std::size_t j = 0, k = 0; j != s; ++j, k += *( i+1 ) ) p[j] = &p[0][k];
+ return true;
+ }else return false;
+ }
+ };
+
+ template< class T, bool I, bool D, class A >
+ struct pointer_reset< T,1,I,D,A >
+ {
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+
+ bool operator()( type& p, const_iterator, size_type s )
+ {
+ type t = 0;
+ try
+ { pointer_allocate< T,1,A >()( t, s );
+ pointer_construct< T,1,I,A >()( t, s );
+ }catch( ... ) { pointer_deallocate< T,1,A >()( t, s ); return false; }
+ type r = p; p = t; t = 0; pointer_destructor< T,1,D,A >()( r, &s, s );
+ return true;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ struct pointer_begin_const
+ {
+ typedef typename pointer< T,N,I,A >::const_iterator const_iterator;
+ typedef typename pointer_type< T,N >::type type;
+
+ const_iterator operator()( type const p )
+ {
+ return pointer_begin_const< T,N-1,I,A >()( *p );
+ }
+ };
+
+ template< class T, bool I, class A >
+ struct pointer_begin_const< T,1,I,A >
+ {
+ typedef typename pointer< T,1,I,A >::const_iterator const_iterator;
+ typedef typename pointer_type< T,1 >::type type;
+
+ const_iterator operator()( type const p )
+ {
+ return p;
+ }
+ };
+
+ template< class T, std::size_t N, bool I, class A >
+ struct pointer_begin
+ {
+ typedef typename pointer< T,N,I,A >::iterator iterator;
+ typedef typename pointer_type< T,N >::type type;
+
+ iterator operator()( type p )
+ {
+ return pointer_begin< T,N-1,I,A >()( *p );
+ }
+ };
+
+ template< class T, bool I, class A >
+ struct pointer_begin< T,1,I,A >
+ {
+ typedef typename pointer< T,1,I,A >::iterator iterator;
+ typedef typename pointer_type< T,1 >::type type;
+
+ iterator operator()( type p )
+ {
+ return p;
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ struct pointer_end_const
+ {
+ typedef typename pointer< T,N,I,A >::const_iterator output_iterator;
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::const_iterator input_iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ output_iterator operator()( type const p, input_iterator i, size_type s )
+ {
+ return pointer_end_const< T,N-1,I,A >()( *p, i+1, s * *( i+1 ) );
+ }
+ };
+
+ template< class T, bool I, class A >
+ struct pointer_end_const< T,1,I,A >
+ {
+ typedef typename pointer< T,1,I,A >::const_iterator output_iterator;
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::const_iterator input_iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+
+ output_iterator operator()( type const p, input_iterator, size_type s )
+ {
+ return p+s;
+ }
+ };
+
+ template< class T, std::size_t N, bool I, class A >
+ struct pointer_end
+ {
+ typedef typename pointer< T,N,I,A >::iterator iterator;
+ typedef typename pointer_type< T,N >::type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ iterator operator()( type p, const_iterator i, size_type s )
+ {
+ return pointer_end< T,N-1,I,A >()( *p, i+1, s * *( i+1 ) );
+ }
+ };
+
+ template< class T, bool I, class A >
+ struct pointer_end< T,1,I,A >
+ {
+ typedef typename pointer< T,1,I,A >::iterator iterator;
+ typedef typename pointer_type< T,1 >::type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+ typedef typename bounds< 1 >::size_type size_type;
+
+ iterator operator()( type p, const_iterator, size_type s )
+ {
+ return p+s;
+ }
+ };
+
+//--
+
+ template< std::size_t N >
+ struct pointer_size
+ {
+ typedef typename bounds< N >::const_iterator const_iterator;
+ typedef typename bounds< N >::size_type size_type;
+
+ size_type operator()( const_iterator c )
+ {
+ return *c * pointer_size< N-1 >()( c+1 );
+ }
+ };
+
+ template<>
+ struct pointer_size< 1 >
+ {
+ typedef bounds< 1 >::const_iterator const_iterator;
+ typedef bounds< 1 >::size_type size_type;
+
+ size_type operator()( const_iterator c )
+ {
+ return *c;
+ }
+ };
+
+//--
+
+ template< std::size_t N >
+ struct pointer_bounds
+ {
+ typedef bounds< N > bounds_type;
+ };
+
+//--
+
+ /*
+ pointer class template
+
+ parameters
+
+ required
+
+ T - data type we wish to store
+ type: arbitrary type
+ N - number of dimensions
+ type: std::size_t
+
+ optional
+
+ I - default initialization parameter
+ type: bool, default = false
+ A - allocator
+ type: standard conforming allocator, default std::allocator<T>
+ */
+
+ template< class T, std::size_t N, bool I, class A >
+ class pointer
+ : public expression< pointer< T,N,I,A > >
+ {
+ public:
+
+ typedef pointer type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef expression< type > base_type;
+ typedef sub_type< type > subarray_type;
+ typedef typename pointer_type< T,N >::type member_type;
+ typedef typename pointer_type< T,N-1 >::type value_type;
+ typedef value_type const& const_reference_type;
+ typedef value_type& reference_type;
+ typedef value_type const* const_iterator_type;
+ typedef value_type* iterator_type;
+ typedef T element_type;
+ typedef T const& const_reference;
+ typedef T& reference;
+ typedef T const* const_iterator;
+ typedef T* iterator;
+ typedef typename A::template rebind< T >::other allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename allocator_type::difference_type difference_type;
+ typedef typename pointer_bounds< N >::bounds_type bounds_type;
+ typedef bounds_type const& bounds_const_reference;
+ typedef mpl::bool_< I > initialize;
+ typedef bounds_type limits_type;
+
+ enum { dimensionality = N };
+
+ pointer();
+ explicit pointer( bounds_const_reference );
+
+ pointer( type_const_reference );
+ template< bool I1, class A1 >
+ pointer( pointer< T,N,I1,A1 > const& );
+
+ type_reference operator=( type_const_reference );
+ template< bool I1, class A1 >
+ type_reference operator=( pointer< T,N,I1,A1 > const& );
+
+ ~pointer();
+
+ template< bool P > void resize( bounds_const_reference );
+
+ const_reference_type operator[]( size_type ) const;
+ reference_type operator[]( size_type );
+
+ const_reference_type operator*() const;
+ reference_type operator*();
+
+ const_iterator_type operator+( size_type ) const;
+ iterator_type operator+( size_type );
+
+ const_reference operator[]( bounds_const_reference ) const;
+ reference operator[]( bounds_const_reference );
+
+ const_reference at( bounds_const_reference ) const;
+ reference at( bounds_const_reference );
+
+ bool const empty() const;
+ size_type const size() const;
+ bounds_const_reference bounds() const;
+ template< std::size_t U > size_type const bound() const;
+
+ void swap( type_reference );
+ template< bool I1, class A1 > void swap( pointer< T,N,I1,A1 >& );
+
+ bool reconstruct();
+ bool reset();
+ void clear();
+
+ const_iterator begin() const;
+ iterator begin();
+ const_iterator end() const;
+ iterator end();
+
+ protected:
+
+ typedef typename has_trivial_destructor< T >::type M;
+ typedef typename array_initialize< T,I,A >::type C;
+
+ bounds_type limits;
+ member_type data;
+
+ template< class T1, std::size_t N1, bool I1, class A1 >
+ friend class pointer;
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ pointer< T,N,I,A >::pointer() : data( 0 )
+ {} // constructor
+
+ template< class T, std::size_t N, bool I, class A >
+ pointer< T,N,I,A >::pointer( bounds_const_reference b ) : data( 0 )
+ {
+ pointer_constructor< T,N,C::value,A >()( data, limits.begin(), b.begin(), b[0] );
+ } // constructor
+
+ template< class T, std::size_t N, bool I, class A >
+ pointer< T,N,I,A >::pointer( type_const_reference p ) : data( 0 )
+ {
+ if( p.data ) pointer_copy< T,N,A >()( data, limits.begin(), p.data, p.limits.begin(), p.limits[0] );
+ } // copy constructor
+
+ template< class T, std::size_t N, bool I, class A > template< bool I1, class A1 >
+ pointer< T,N,I,A >::pointer( pointer< T,N,I1,A1 > const& p ) : data( 0 )
+ {
+ if( p.data ) pointer_copy< T,N,A >()( data, limits.begin(), p.data, p.limits.begin(), p.limits[0] );
+ } // copy constructor
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::type_reference pointer< T,N,I,A >::operator=( type_const_reference p )
+ {
+ if( &p != this )
+ { if( p.data )
+ { if( data ) pointer_assign< T,N,M::value,A >()( data, limits.begin(), limits[0], p.data, p.limits.begin(), p.limits[0] );
+ else pointer_copy< T,N,A >()( data, limits.begin(), p.data, p.limits.begin(), p.limits[0] );
+ }else
+ { if( data ) pointer_destructor< T,N,M::value,A >()( data, limits.begin(), limits[0] );
+ }
+ }
+ return *this;
+ } // ( copy ) assignment operator
+
+ template< class T, std::size_t N, bool I, class A > template< bool I1, class A1 >
+ typename pointer< T,N,I,A >::type_reference pointer< T,N,I,A >::operator=( pointer< T,N,I1,A1 > const& p )
+ {
+ if( p.data )
+ { if( data ) pointer_assign< T,N,M::value,A >()( data, limits.begin(), limits[0], p.data, p.limits.begin(), p.limits[0] );
+ else pointer_copy< T,N,A >()( data, limits.begin(), p.data, p.limits.begin(), p.limits[0] );
+ }else
+ { if( data ) pointer_destructor< T,N,M::value,A >()( data, limits.begin(), limits[0] );
+ }
+ return *this;
+ } // ( copy ) assignment operator
+
+ template< class T, std::size_t N, bool I, class A >
+ pointer< T,N,I,A >::~pointer()
+ {
+ if( data ) pointer_destructor< T,N,M::value,A >()( data, limits.begin(), limits[0] );
+ } // destructor
+
+ template< class T, std::size_t N, bool I, class A > template< bool P >
+ void pointer< T,N,I,A >::resize( bounds_const_reference b )
+ {
+ if( data ) pointer_resize< T,N,C::value,M::value,A,P >()( data, limits.begin(), limits[0], b.begin(), b[0] );
+ else pointer_constructor< T,N,C::value,A >()( data, limits.begin(), b.begin(), b[0] );
+ } // resize
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::const_reference_type pointer< T,N,I,A >::operator[]( size_type s ) const
+ {
+ BOOST_ASSERT( data );
+ return data[s];
+ } // operator[] const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::reference_type pointer< T,N,I,A >::operator[]( size_type s )
+ {
+ BOOST_ASSERT( data );
+ return data[s];
+ } // operator[]
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::const_reference_type pointer< T,N,I,A >::operator*() const
+ {
+ BOOST_ASSERT( data );
+ return *data;
+ } // dereference const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::reference_type pointer< T,N,I,A >::operator*()
+ {
+ BOOST_ASSERT( data );
+ return *data;
+ } // dereference
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::const_iterator_type pointer< T,N,I,A >::operator+( size_type s ) const
+ {
+ BOOST_ASSERT( data );
+ return data+s;
+ } // operator+ const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::iterator_type pointer< T,N,I,A >::operator+( size_type s )
+ {
+ BOOST_ASSERT( data );
+ return data+s;
+ } // operator+
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::const_reference pointer< T,N,I,A >::operator[]( bounds_const_reference b ) const
+ {
+ BOOST_ASSERT( data );
+ return pointer_element_const< T,N,I,A >()( data, limits.begin(), b.begin() );
+ } // operator[] const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::reference pointer< T,N,I,A >::operator[]( bounds_const_reference b )
+ {
+ BOOST_ASSERT( data );
+ return pointer_element< T,N,I,A >()( data, limits.begin(), b.begin() );
+ } // operator[]
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::const_reference pointer< T,N,I,A >::at( bounds_const_reference b ) const
+ {
+ if( !( b < limits ) )
+ throw std::out_of_range( "pointer<> access out of range" );
+ return pointer_element_const< T,N,I,A >()( data, limits.begin(), b.begin() );
+ } // at const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::reference pointer< T,N,I,A >::at( bounds_const_reference b )
+ {
+ if( !( b < limits ) )
+ throw std::out_of_range( "pointer<> access out of range" );
+ return pointer_element< T,N,I,A >()( data, limits.begin(), b.begin() );
+ } // at
+
+ template< class T, std::size_t N, bool I, class A >
+ bool const pointer< T,N,I,A >::empty() const
+ {
+ return ( data == 0 );
+ } // empty
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::size_type const pointer< T,N,I,A >::size() const
+ {
+ return pointer_size< N >()( limits.begin() );
+ } // size
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::bounds_const_reference pointer< T,N,I,A >::bounds() const
+ {
+ return limits;
+ } // bounds
+
+ template< class T, std::size_t N, bool I, class A > template< std::size_t U >
+ typename pointer< T,N,I,A >::size_type const pointer< T,N,I,A >::bound() const
+ {
+ BOOST_STATIC_ASSERT( U < N );
+ return limits[U];
+ } // bound
+
+ template< class T, std::size_t N, bool I, class A >
+ void pointer< T,N,I,A >::swap( type_reference p )
+ {
+ if( &p != this ) { std::swap( data, p.data ); std::swap( limits, p.limits ); }
+ } // swap
+
+ template< class T, std::size_t N, bool I, class A > template< bool I1, class A1 >
+ void pointer< T,N,I,A >::swap( pointer< T,N,I1,A1 >& p )
+ {
+ std::swap( data, p.data ); std::swap( limits, p.limits );
+ } // swap
+
+ template< class T, std::size_t N, bool I, class A >
+ bool pointer< T,N,I,A >::reconstruct()
+ {
+ if( data ) return pointer_reconstruct< T,N,M::value,A >()( data, limits.begin(), limits[0] );
+ return true;
+ } // reconstruct
+
+ template< class T, std::size_t N, bool I, class A >
+ bool pointer< T,N,I,A >::reset()
+ {
+ if( data ) return pointer_reset< T,N,C::value,M::value,A >()( data, limits.begin(), limits[0] );
+ return true;
+ } // reset
+
+ template< class T, std::size_t N, bool I, class A >
+ void pointer< T,N,I,A >::clear()
+ {
+ if( data ) pointer_destructor< T,N,M::value,A >()( data, limits.begin(), limits[0] );
+ } // clear
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::const_iterator pointer< T,N,I,A >::begin() const
+ {
+ if( data ) return pointer_begin_const< T,N,I,A >()( data );
+ return 0;
+ } // begin const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::iterator pointer< T,N,I,A >::begin()
+ {
+ if( data ) return pointer_begin< T,N,I,A >()( data );
+ return 0;
+ } // begin
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::const_iterator pointer< T,N,I,A >::end() const
+ {
+ if( data ) return pointer_end_const< T,N,I,A >()( data, limits.begin(), limits[0] );
+ return 0;
+ } // end const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename pointer< T,N,I,A >::iterator pointer< T,N,I,A >::end()
+ {
+ if( data ) return pointer_end< T,N,I,A >()( data, limits.begin(), limits[0] );
+ return 0;
+ } // end
+
+//--
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ struct sub_type< pointer< T,N,I,A > >
+ {
+ typedef pointer< T,N-1,I,A > type;
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N, bool I, class A, class C, class CT >
+ struct pointer_out
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename pointer< T,N,I,A >::const_iterator_type type;
+ typedef typename bounds< N >::const_iterator const_iterator;
+
+ stream& operator()( stream& s, type const& p, const_iterator d )
+ {
+ s << '(';
+ for( std::size_t i = 0; i != *d; ++i )
+ { pointer_out< T,N-1,I,A,C,CT >()( s, p[i], d+1 );
+ if( i != *d - 1 ) s << ',';
+ }
+ s << ')';
+ return s;
+ }
+ };
+
+ template< class T, bool I, class A, class C, class CT >
+ struct pointer_out< T,1,I,A,C,CT >
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename pointer< T,1,I,A >::const_iterator_type type;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+
+ stream& operator()( stream& s, type const& p, const_iterator d )
+ {
+ s << '(';
+ for( std::size_t i = 0; i != *d - 1; ++i ) s << p[i] << ',';
+ s << p[*d-1] << ')';
+ return s;
+ }
+ };
+
+//--
+
+ template< std::size_t N, class C, class CT >
+ struct pointer_out_size
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename bounds< N >::const_iterator const_iterator;
+
+ void operator()( stream& s, const_iterator d )
+ {
+ s << '[' << *d << ']';
+ pointer_out_size< N-1,C,CT >()( s, d+1 );
+ }
+ };
+
+ template< class C, class CT >
+ struct pointer_out_size< 1,C,CT >
+ {
+ typedef std::basic_ostringstream< C,CT,std::allocator< C > > stream;
+ typedef typename bounds< 1 >::const_iterator const_iterator;
+
+ void operator()( stream& s, const_iterator d )
+ {
+ s << '[' << *d << ']';
+ }
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, class A, class C, class CT >
+ std::basic_ostream< C,CT >& operator<<( std::basic_ostream< C,CT >& o, pointer< T,N,I,A > const& p )
+ {
+ std::basic_ostringstream< C,CT,std::allocator< C > > s;
+ s.flags( o.flags() ); s.imbue( o.getloc() ); s.precision( o.precision() );
+ pointer_out_size< N,C,CT >()( s, p.bounds().begin() );
+ return o << pointer_out< T,N,I,A,C,CT >()( s, p+0, p.bounds().begin() ).str().c_str();
+ }
+
+//--
+//--
+
+ template< class T, bool I, class A >
+ class pointer< T,0,I,A >
+ {
+ public:
+
+ typedef pointer type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef T value_type;
+ typedef value_type const& const_reference_type;
+ typedef value_type& reference_type;
+ typedef value_type const* const_iterator_type;
+ typedef value_type* iterator_type;
+ typedef T element_type;
+ typedef T const& const_reference;
+ typedef T& reference;
+ typedef T const* const_iterator;
+ typedef T* iterator;
+ typedef typename A::template rebind< T >::other allocator_type;
+ typedef typename allocator_type::size_type size_type;
+ typedef typename allocator_type::difference_type difference_type;
+ typedef bounds< 0 > bounds_type;
+ typedef bounds_type const& bounds_const_reference;
+ typedef mpl::bool_< I > initialize;
+
+ enum { dimensionality = 0 };
+
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, class A, bool I1, class A1 >
+ bool operator==( pointer< T,N,I,A > const& x, pointer< T,N,I1,A1 > const& y )
+ {
+ return std::equal( x.begin(), x.end(), y.begin() );
+ }
+
+ template< class T, std::size_t N, bool I, class A, bool I1, class A1 >
+ bool operator<( pointer< T,N,I,A > const& x, pointer< T,N,I1,A1 > const& y )
+ {
+ return std::lexicographical_compare( x.begin(), x.end(), y.begin(), y.end() );
+ }
+
+ template< class T, std::size_t N, bool I, class A, bool I1, class A1 >
+ bool operator!=( pointer< T,N,I,A > const& x, pointer< T,N,I1,A1 > const& y )
+ {
+ return !( x == y );
+ }
+
+ template< class T, std::size_t N, bool I, class A, bool I1, class A1 >
+ bool operator>( pointer< T,N,I,A > const& x, pointer< T,N,I1,A1 > const& y )
+ {
+ return y < x;
+ }
+
+ template< class T, std::size_t N, bool I, class A, bool I1, class A1 >
+ bool operator<=( pointer< T,N,I,A > const& x, pointer< T,N,I1,A1 > const& y )
+ {
+ return !( y < x );
+ }
+
+ template< class T, std::size_t N, bool I, class A, bool I1, class A1 >
+ bool operator>=( pointer< T,N,I,A > const& x, pointer< T,N,I1,A1 > const& y )
+ {
+ return !( x < y );
+ }
+
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ void swap( pointer< T,N,I,A >& x, pointer< T,N,I,A >& y )
+ {
+ x.swap( y );
+ }
+
+ template< class T, std::size_t N, bool I, class A, bool I1, class A1 >
+ void swap( pointer< T,N,I,A >& x, pointer< T,N,I1,A1 >& y )
+ {
+ x.swap( y );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_GENERIC_POINTER_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/generic/view.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/generic/view.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,1249 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_GENERIC_VIEW_HPP )
+#define BOOST_MAPS_GENERIC_VIEW_HPP
+
+#include <boost/maps/generic/array.hpp>
+#include <boost/maps/generic/pointer.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class P, std::size_t N, std::size_t I, bool B, class L >
+ struct construct_view
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::iterator iterator1;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator2;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename mpl::deref< L >::type S;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+ typedef typename P::subarray_type::type R;
+ typedef typename mpl::next< L >::type M;
+
+ void operator()( type& v, iterator1 b, iterator2 r, size_type a )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= S::value || ( l - f ) % s != 0 || c > S::value )
+ throw std::invalid_argument( "invalid view<> range" );
+ pointer_allocate< T,N,A >()( v, a *= c ); *b = c;
+ try { construct_view< R,N-1,I+1,B,M >()( v[0], b+1, r, a ); }
+ catch( ... ) { pointer_deallocate< T,N,A >()( v, a ); *b = 0; throw; }
+ for( std::size_t j = 1, k = *( b+1 ); j != a; ++j ) v[j] = v[j-1] + k;
+ }
+ };
+
+ template< class P, std::size_t I, bool B, class L >
+ struct construct_view< P,1,I,B,L >
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::iterator iterator1;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator2;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename mpl::deref< L >::type S;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+
+ void operator()( type& v, iterator1 b, iterator2 r, size_type a )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= S::value || ( l - f ) % s != 0 || c > S::value )
+ throw std::invalid_argument( "invalid view<> range" );
+ pointer_allocate< T,1,A >()( v, a * c ); *b = c;
+ }
+ };
+
+ template< class P, std::size_t I, class L >
+ struct construct_view< P,1,I,false,L >
+ {
+ typedef typename view< P,false >::member_type type;
+ typedef typename view< P,false >::bounds_type::iterator iterator1;
+ typedef typename view< P,false >::ranges_type::const_iterator_type iterator2;
+ typedef typename view< P,false >::size_type size_type;
+ typedef typename mpl::deref< L >::type S;
+ typedef typename view< P,false >::element_type T;
+ typedef typename has_trivial_constructor< T >::type C;
+ typedef typename view< P,false >::allocator_type A;
+
+ void operator()( type& v, iterator1 b, iterator2 r, size_type a )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= S::value || ( l - f ) % s != 0 || c > S::value )
+ throw std::invalid_argument( "invalid view<> range" );
+ pointer_allocate< T,1,A >()( v, a *= c );
+ try { pointer_construct< T,1,!C::value,A >()( v, a ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( v, a ); throw; }
+ *b = c;
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, std::size_t I, bool B >
+ struct construct_view< P,N,I,B,bounds<N> >
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::iterator iterator1;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator2;
+ typedef typename P::bounds_type::const_iterator iterator3;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+ typedef typename P::subarray_type::type R;
+
+ void operator()( type& v, iterator1 b, iterator2 r, iterator3 i, size_type a )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= *i || ( l - f ) % s != 0 || c > *i )
+ throw std::invalid_argument( "invalid view<> range" );
+ pointer_allocate< T,N,A >()( v, a *= c ); *b = c;
+ try { construct_view< R,N-1,I+1,B,bounds<N-1> >()( v[0], b+1, r, i+1, a ); }
+ catch( ... ) { pointer_deallocate< T,N,A >()( v, a ); *b = 0; throw; }
+ for( std::size_t j = 1, k = *( b+1 ); j != a; ++j ) v[j] = v[j-1] + k;
+ }
+ };
+
+ template< class P, std::size_t I, bool B >
+ struct construct_view< P,1,I,B,bounds<1> >
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::iterator iterator1;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator2;
+ typedef typename P::bounds_type::const_iterator iterator3;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+
+ void operator()( type& v, iterator1 b, iterator2 r, iterator3 i, size_type a )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= *i || ( l - f ) % s != 0 || c > *i )
+ throw std::invalid_argument( "invalid view<> range" );
+ pointer_allocate< T,1,A >()( v, a * c ); *b = c;
+ }
+ };
+
+ template< class P, std::size_t I >
+ struct construct_view< P,1,I,false,bounds<1> >
+ {
+ typedef typename view< P,false >::member_type type;
+ typedef typename view< P,false >::bounds_type::iterator iterator1;
+ typedef typename view< P,false >::ranges_type::const_iterator_type iterator2;
+ typedef typename P::bounds_type::const_iterator iterator3;
+ typedef typename view< P,false >::size_type size_type;
+ typedef typename view< P,false >::element_type T;
+ typedef typename has_trivial_constructor< T >::type C;
+ typedef typename view< P,false >::allocator_type A;
+
+ void operator()( type& v, iterator1 b, iterator2 r, iterator3 i, size_type a )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= *i || ( l - f ) % s != 0 || c > *i )
+ throw std::invalid_argument( "invalid view<> range" );
+ pointer_allocate< T,1,A >()( v, a *= c );
+ try { pointer_construct< T,1,!C::value,A >()( v, a ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( v, a ); throw; }
+ *b = c;
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, bool B, class L >
+ struct view_constructor
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::iterator iterator1;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator2;
+
+ void operator()( type& v, iterator1 b, iterator2 r, P const& p )
+ {
+ construct_view< P,N,0,B,typename mpl::begin< L >::type >()( v, b, r, 1 );
+ }
+ };
+
+ template< class P, std::size_t N, bool B >
+ struct view_constructor< P,N,B,bounds<N> >
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::iterator iterator1;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator2;
+
+ void operator()( type& v, iterator1 b, iterator2 r, P const& p )
+ {
+ construct_view< P,N,0,B,bounds<N> >()( v, b, r, p.bounds().begin(), 1 );
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, std::size_t I, bool B, class L >
+ struct resize_view
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,B >::bounds_type::iterator iterator2;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename mpl::deref< L >::type S;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+ typedef typename P::subarray_type::type R;
+ typedef typename mpl::next< L >::type M;
+
+ void operator()( type& v, iterator1 r, iterator2 b, size_type a, size_type n )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= S::value || ( l - f ) % s != 0 || c > S::value )
+ throw std::invalid_argument( "invalid view<> range" );
+ type t = 0; if( ( a *= *b ) != ( n *= c ) ) pointer_allocate< T,N,A >()( t, n );
+ try { resize_view< R,N-1,I+1,B,M >()( v[0], r, b+1, a, n ); }
+ catch( ... ) { if( t ) pointer_deallocate< T,N,A >()( t, n ); throw; }
+ if( t )
+ { for( std::size_t j = 0, k = 0; j != n; ++j, k += *( b+1 ) ) t[j] = &v[0][k];
+ type r = v; v = t; t = 0; pointer_deallocate< T,N,A >()( r, a );
+ }else
+ for( std::size_t j = 0, k = 0; j != a; ++j, k += *( b+1 ) ) v[j] = &v[0][k];
+ *b = c;
+ }
+ };
+
+ template< class P, std::size_t I, bool B, class L >
+ struct resize_view< P,1,I,B,L >
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,B >::bounds_type::iterator iterator2;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename mpl::deref< L >::type S;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+
+ void operator()( type& v, iterator1 r, iterator2 b, size_type a, size_type n )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= S::value || ( l - f ) % s != 0 || c > S::value )
+ throw std::invalid_argument( "invalid view<> range" );
+ if( ( a *= *b ) != ( n *= c ) )
+ { type t = 0; pointer_allocate< T,1,A >()( t, n );
+ type r = v; v = t; t = 0; pointer_deallocate< T,1,A >()( r, a );
+ }
+ *b = c;
+ }
+ };
+
+ template< class P, std::size_t I, class L >
+ struct resize_view< P,1,I,false,L >
+ {
+ typedef typename view< P,false >::member_type type;
+ typedef typename view< P,false >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,false >::bounds_type::iterator iterator2;
+ typedef typename P::bounds_type::const_iterator iterator3;
+ typedef typename view< P,false >::size_type size_type;
+ typedef typename mpl::deref< L >::type S;
+ typedef typename view< P,false >::element_type T;
+ typedef typename has_trivial_constructor< T >::type C;
+ typedef typename has_trivial_destructor< T >::type D;
+ typedef typename view< P,false >::allocator_type A;
+
+ void operator()( type& v, iterator1 r, iterator2 b, size_type a, size_type n )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= S::value || ( l - f ) % s != 0 || c > S::value )
+ throw std::invalid_argument( "invalid view<> range" );
+ if( ( a *= *b ) != ( n *= c ) )
+ { type t = 0; pointer_allocate< T,1,A >()( t, n );
+ try { pointer_construct< T,1,!C::value,A >()( t, n ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( t, n ); throw; }
+ type r = v; v = t; t = 0; pointer_destructor< T,1,D::value,A >()( r, b, a );
+ }
+ *b = c;
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, std::size_t I, bool B >
+ struct resize_view< P,N,I,B,bounds<N> >
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,B >::bounds_type::iterator iterator2;
+ typedef typename P::bounds_type::const_iterator iterator3;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+ typedef typename P::subarray_type::type R;
+
+ void operator()( type& v, iterator1 r, iterator2 b, iterator3 i, size_type a, size_type n )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= *i || ( l - f ) % s != 0 || c > *i )
+ throw std::invalid_argument( "invalid view<> range" );
+ type t = 0; if( ( a *= *b ) != ( n *= c ) ) pointer_allocate< T,N,A >()( t, n );
+ try { resize_view< R,N-1,I+1,B,bounds<N-1> >()( v[0], r, b+1, i+1, a, n ); }
+ catch( ... ) { if( t ) pointer_deallocate< T,N,A >()( t, n ); throw; }
+ if( t )
+ { for( std::size_t j = 0, k = 0; j != n; ++j, k += *( b+1 ) ) t[j] = &v[0][k];
+ type r = v; v = t; t = 0; pointer_deallocate< T,N,A >()( r, a );
+ }else
+ for( std::size_t j = 0, k = 0; j != a; ++j, k += *( b+1 ) ) v[j] = &v[0][k];
+ *b = c;
+ }
+ };
+
+ template< class P, std::size_t I, bool B >
+ struct resize_view< P,1,I,B,bounds<1> >
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,B >::bounds_type::iterator iterator2;
+ typedef typename P::bounds_type::const_iterator iterator3;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+
+ void operator()( type& v, iterator1 r, iterator2 b, iterator3 i, size_type a, size_type n )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= *i || ( l - f ) % s != 0 || c > *i )
+ throw std::invalid_argument( "invalid view<> range" );
+ if( ( a *= *b ) != ( n *= c ) )
+ { type t = 0; pointer_allocate< T,1,A >()( t, n );
+ type r = v; v = t; t = 0; pointer_deallocate< T,1,A >()( r, a );
+ }
+ *b = c;
+ }
+ };
+
+ template< class P, std::size_t I >
+ struct resize_view< P,1,I,false,bounds<1> >
+ {
+ typedef typename view< P,false >::member_type type;
+ typedef typename view< P,false >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,false >::bounds_type::iterator iterator2;
+ typedef typename P::bounds_type::const_iterator iterator3;
+ typedef typename view< P,false >::size_type size_type;
+ typedef typename view< P,false >::element_type T;
+ typedef typename has_trivial_constructor< T >::type C;
+ typedef typename has_trivial_destructor< T >::type D;
+ typedef typename view< P,false >::allocator_type A;
+
+ void operator()( type& v, iterator1 r, iterator2 b, iterator3 i, size_type a, size_type n )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2], c = ( l - f ) / s;
+ if( s == 0 || f >= l || ( l - s ) >= *i || ( l - f ) % s != 0 || c > *i )
+ throw std::invalid_argument( "invalid view<> range" );
+ if( ( a *= *b ) != ( n *= c ) )
+ { type t = 0; pointer_allocate< T,1,A >()( t, n );
+ try { pointer_construct< T,1,!C::value,A >()( t, n ); }
+ catch( ... ) { pointer_deallocate< T,1,A >()( t, n ); throw; }
+ type r = v; v = t; t = 0; pointer_destructor< T,1,D::value,A >()( r, b, a );
+ }
+ *b = c;
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, bool B, class L >
+ struct view_resize
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,B >::bounds_type::iterator iterator2;
+
+ void operator()( type& v, iterator1 r, iterator2 b, P const& p )
+ {
+ resize_view< P,N,0,B,typename mpl::begin< L >::type >()( v, r, b, 1, 1 );
+ }
+ };
+
+ template< class P, std::size_t N, bool B >
+ struct view_resize< P,N,B,bounds<N> >
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,B >::bounds_type::iterator iterator2;
+
+ void operator()( type& v, iterator1 r, iterator2 b, P const& p )
+ {
+ resize_view< P,N,0,B,bounds<N> >()( v, r, b, p.bounds().begin(), 1, 1 );
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, std::size_t I, bool B >
+ struct view_reset
+ {
+ typedef typename view< P,B >::iterator_type iterator1;
+ typedef typename P::iterator_type iterator2;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator3;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename P::subarray_type::type R;
+
+ void operator()( iterator1 v, iterator2 p, iterator3 r )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ for( std::size_t i = 0, j = f; j != l; ++i, j += s )
+ view_reset< R,N-1,I+1,B >()( v[i], p[j], r );
+ }
+ };
+
+ template< class P, std::size_t I, bool B >
+ struct view_reset< P,1,I,B >
+ {
+ typedef typename view< P,B >::iterator_type iterator1;
+ typedef typename P::iterator_type iterator2;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator3;
+ typedef typename view< P,B >::size_type size_type;
+
+ void operator()( iterator1 v, iterator2 p, iterator3 r )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ for( std::size_t i = 0, j = f; j != l; ++i, j += s ) v[i] = &p[j];
+ }
+ };
+
+ template< class P, std::size_t I >
+ struct view_reset< P,1,I,false >
+ {
+ typedef typename view< P,false >::iterator_type iterator1;
+ typedef typename P::iterator_type iterator2;
+ typedef typename view< P,false >::ranges_type::const_iterator_type iterator3;
+ typedef typename view< P,false >::size_type size_type;
+
+ void operator()( iterator1 v, iterator2 p, iterator3 r )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ for( std::size_t i = 0, j = f; j != l; ++i, j += s ) v[i] = p[j];
+ }
+ };
+
+//--
+
+ template< class P, class P1, std::size_t N, std::size_t I, bool B, class L >
+ struct validate_view
+ {
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename mpl::front< L >::type S;
+ typedef typename mpl::pop_front< L >::type M;
+
+ void operator()( iterator r )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ if( s == 0 || f >= l || ( l - s ) >= S::value || ( l - f ) % s != 0 || ( l - f ) / s > S::value )
+ throw std::invalid_argument( "invalid view<> range" );
+ validate_view< P,P1,N-1,I+1,B,M >()( r );
+ }
+ };
+
+ template< class P, class P1, std::size_t I, bool B, class L >
+ struct validate_view< P,P1,1,I,B,L >
+ {
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename mpl::front< L >::type S;
+
+ void operator()( iterator r )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ if( s == 0 || f >= l || ( l - s ) >= S::value || ( l - f ) % s != 0 || ( l - f ) / s > S::value )
+ throw std::invalid_argument( "invalid view<> range" );
+ }
+ };
+
+//--
+
+ template< class P, class P1, std::size_t N, std::size_t I, bool B >
+ struct validate_view< P,P1,N,I,B,bounds<N> >
+ {
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename P1::bounds_type::const_iterator iterator2;
+
+ void operator()( iterator1 r, iterator2 i )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ if( s == 0 || f >= l || ( l - s ) >= *i || ( l - f ) % s != 0 || ( l - f ) / s > *i )
+ throw std::invalid_argument( "invalid view<> range" );
+ validate_view< P,P1,N-1,I+1,B,bounds<N-1> >()( r, i+1 );
+ }
+ };
+
+ template< class P, class P1, std::size_t I, bool B >
+ struct validate_view< P,P1,1,I,B,bounds<1> >
+ {
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename P1::bounds_type::const_iterator iterator2;
+
+ void operator()( iterator1 r, iterator2 i )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ if( s == 0 || f >= l || ( l - s ) >= *i || ( l - f ) % s != 0 || ( l - f ) / s > *i )
+ throw std::invalid_argument( "invalid view<> range" );
+ }
+ };
+
+//--
+
+ template< class P, class P1, std::size_t N, bool B, class L >
+ struct view_validate
+ {
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+
+ void operator()( iterator1 r, P1 const& )
+ {
+ validate_view< P,P1,N,0,B,L >()( r );
+ }
+ };
+
+ template< class P, class P1, std::size_t N, bool B >
+ struct view_validate< P,P1,N,B,bounds<N> >
+ {
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator1;
+
+ void operator()( iterator1 r, P1 const& p )
+ {
+ validate_view< P,P1,N,0,B,bounds<N> >()( r, p.bounds().begin() );
+ }
+ };
+
+//--
+
+ template< class P1, class P, std::size_t N, std::size_t I, bool B >
+ struct view_set
+ {
+ typedef typename P1::iterator_type iterator1;
+ typedef typename view< P,B >::iterator_type iterator2;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator3;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename P1::subarray_type::type R1;
+ typedef typename P::subarray_type::type R;
+
+ void operator()( iterator1 p, iterator2 v, iterator3 r )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ for( std::size_t i = 0, j = f; j != l; ++i, j += s )
+ view_set< R1,R,N-1,I+1,B >()( p[j], v[i], r );
+ }
+ };
+
+ template< class P1, class P, std::size_t I, bool B >
+ struct view_set< P1,P,1,I,B >
+ {
+ typedef typename P1::iterator_type iterator1;
+ typedef typename view< P,B >::iterator_type iterator2;
+ typedef typename view< P,B >::ranges_type::const_iterator_type iterator3;
+ typedef typename view< P,B >::size_type size_type;
+
+ void operator()( iterator1 p, iterator2 v, iterator3 r )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ for( std::size_t i = 0, j = f; j != l; ++i, j += s ) p[j] = *v[i];
+ }
+ };
+
+ template< class P1, class P, std::size_t I >
+ struct view_set< P1,P,1,I,false >
+ {
+ typedef typename P1::iterator_type iterator1;
+ typedef typename view< P,false >::iterator_type iterator2;
+ typedef typename view< P,false >::ranges_type::const_iterator_type iterator3;
+ typedef typename view< P,false >::size_type size_type;
+
+ void operator()( iterator1 p, iterator2 v, iterator3 r )
+ {
+ size_type f = r[I][0], l = r[I][1], s = r[I][2];
+ for( std::size_t i = 0, j = f; j != l; ++i, j += s ) p[j] = v[i];
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, bool B >
+ struct view_destructor
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::iterator iterator;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+ typedef typename P::subarray_type::type R;
+
+ void operator()( type& v, iterator i, size_type s )
+ {
+ view_destructor< R,N-1,B >()( v[0], i+1, s * *( i+1 ) );
+ pointer_deallocate< T,N,A >()( v, s ); *i = 0;
+ }
+ };
+
+ template< class P, bool B >
+ struct view_destructor< P,1,B >
+ {
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::iterator iterator;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename view< P,B >::element_type T;
+ typedef typename view< P,B >::allocator_type A;
+
+ void operator()( type& v, iterator i, size_type s )
+ {
+ pointer_deallocate< T,1,A >()( v, s ); *i = 0;
+ }
+ };
+
+ template< class P >
+ struct view_destructor< P,1,false >
+ {
+ typedef typename view< P,false >::member_type type;
+ typedef typename view< P,false >::bounds_type::iterator iterator;
+ typedef typename view< P,false >::size_type size_type;
+ typedef typename view< P,false >::element_type T;
+ typedef typename has_trivial_destructor< T >::type D;
+ typedef typename view< P,false >::allocator_type A;
+
+ void operator()( type& v, iterator i, size_type s )
+ {
+ pointer_destroy< T,1,D::value,A >()( v, s );
+ pointer_deallocate< T,1,A >()( v, s ); *i = 0;
+ }
+ };
+
+ //--
+
+ template< class P, std::size_t N, bool B >
+ struct view_element_const
+ {
+ typedef typename view< P,B >::const_reference const_reference;
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+ typedef typename P::subarray_type::type R;
+
+ const_reference operator()( type const& v, const_iterator d, const_iterator i )
+ {
+ BOOST_ASSERT( *i < *d );
+ return view_element_const< R,N-1,B >()( v[*i], d+1, i+1 );
+ }
+ };
+
+ template< class P, bool B >
+ struct view_element_const< P,1,B >
+ {
+ typedef typename view< P,B >::const_reference const_reference;
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+
+ const_reference operator()( type const& v, const_iterator d, const_iterator i )
+ {
+ BOOST_ASSERT( *i < *d );
+ return v[*i];
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, bool B >
+ struct view_element
+ {
+ typedef typename view< P,B >::reference reference;
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+ typedef typename P::subarray_type::type R;
+
+ reference operator()( type& v, const_iterator d, const_iterator i )
+ {
+ BOOST_ASSERT( *i < *d );
+ return view_element< R,N-1,B >()( v[*i], d+1, i+1 );
+ }
+ };
+
+ template< class P, bool B >
+ struct view_element< P,1,B >
+ {
+ typedef typename view< P,B >::reference reference;
+ typedef typename view< P,B >::member_type type;
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+
+ reference operator()( type& v, const_iterator d, const_iterator i )
+ {
+ BOOST_ASSERT( *i < *d );
+ return v[*i];
+ }
+ };
+
+//--
+
+ template< class P1, class P, std::size_t N, bool B, class L >
+ struct view_bounds_equality
+ {
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+ typedef typename mpl::front< L >::type F;
+ typedef typename mpl::pop_front< L >::type M;
+
+ bool operator()( const_iterator b )
+ {
+ if( *b != F::value ) return false;
+ return view_bounds_equality< P1,P,N-1,B,M >()( b+1 );
+ }
+ };
+
+ template< class P1, class P, bool B, class L >
+ struct view_bounds_equality< P1,P,1,B,L >
+ {
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+ typedef typename mpl::front< L >::type F;
+
+ bool operator()( const_iterator b )
+ {
+ if( *b != F::value ) return false;
+ return true;
+ }
+ };
+
+//--
+
+ template< class P1, class P, std::size_t N, bool B >
+ struct view_bounds_equality< P1,P,N,B,bounds<N> >
+ {
+ typedef typename view< P,B >::bounds_const_reference const_reference1;
+ typedef typename P1::bounds_const_reference const_reference2;
+
+ bool operator()( const_reference1 b, const_reference2 p )
+ {
+ if( b != p ) return false;
+ return true;
+ }
+ };
+
+//--
+
+ template< class P1, class P, std::size_t N, bool B, class L >
+ struct view_bounds_equal
+ {
+ typedef typename view< P,B >::bounds_const_reference const_reference;
+
+ bool operator()( const_reference b, P1 const& p )
+ {
+ return view_bounds_equality< P1,P,N,B,L >()( b.begin() );
+ }
+ };
+
+ template< class P1, class P, std::size_t N, bool B >
+ struct view_bounds_equal< P1,P,N,B,bounds<N> >
+ {
+ typedef typename view< P,B >::bounds_const_reference const_reference;
+
+ bool operator()( const_reference b, P1 const& p )
+ {
+ return view_bounds_equality< P1,P,N,B,bounds<N> >()( b, p.bounds() );
+ }
+ };
+
+//--
+
+ template< class P1, class P, std::size_t N, bool B >
+ struct view_to
+ {
+ typedef typename P1::iterator_type iterator1;
+ typedef typename view< P,B >::const_iterator_type iterator2;
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename P1::subarray_type::type R1;
+ typedef typename P::subarray_type::type R;
+
+ void operator()( iterator1 p, iterator2 v, const_iterator c )
+ {
+ size_type s = *c;
+ for( size_t i = 0; i != s; ++i )
+ view_to< R1,R,N-1,B >()( p[i], v[i], c+1 );
+ }
+ };
+
+ template< class P1, class P, bool B >
+ struct view_to< P1,P,1,B >
+ {
+ typedef typename P1::iterator_type iterator1;
+ typedef typename view< P,B >::const_iterator_type iterator2;
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+ typedef typename view< P,B >::size_type size_type;
+
+ void operator()( iterator1 p, iterator2 v, const_iterator c )
+ {
+ size_type s = *c;
+ for( std::size_t i = 0; i != s; ++i ) p[i] = *v[i];
+ }
+ };
+
+ template< class P1, class P >
+ struct view_to< P1,P,1,false >
+ {
+ typedef typename P1::iterator_type iterator1;
+ typedef typename view< P,false >::const_iterator_type iterator2;
+ typedef typename view< P,false >::bounds_type::const_iterator const_iterator;
+ typedef typename view< P,false >::size_type size_type;
+
+ void operator()( iterator1 p, iterator2 v, const_iterator c )
+ {
+ size_type s = *c;
+ for( std::size_t i = 0; i != s; ++i ) p[i] = v[i];
+ }
+ };
+
+//--
+
+ template< class P, class P1, std::size_t N, bool B >
+ struct view_from
+ {
+ typedef typename view< P,B >::iterator_type iterator1;
+ typedef typename P1::const_iterator_type iterator2;
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+ typedef typename view< P,B >::size_type size_type;
+ typedef typename P::subarray_type::type R;
+ typedef typename P1::subarray_type::type R1;
+
+ void operator()( iterator1 v, iterator2 p, const_iterator c )
+ {
+ size_type s = *c;
+ for( size_t i = 0; i != s; ++i )
+ view_from< R,R1,N-1,B >()( v[i], p[i], c+1 );
+ }
+ };
+
+ template< class P, class P1, bool B >
+ struct view_from< P,P1,1,B >
+ {
+ typedef typename view< P,B >::iterator_type iterator1;
+ typedef typename P1::const_iterator_type iterator2;
+ typedef typename view< P,B >::bounds_type::const_iterator const_iterator;
+ typedef typename view< P,B >::size_type size_type;
+
+ void operator()( iterator1 v, iterator2 p, const_iterator c )
+ {
+ size_type s = *c;
+ for( std::size_t i = 0; i != s; ++i ) *v[i] = p[i];
+ }
+ };
+
+ template< class P, class P1 >
+ struct view_from< P,P1,1,false >
+ {
+ typedef typename view< P,false >::iterator_type iterator1;
+ typedef typename P1::const_iterator_type iterator2;
+ typedef typename view< P,false >::bounds_type::const_iterator const_iterator;
+ typedef typename view< P,false >::size_type size_type;
+
+ void operator()( iterator1 v, iterator2 p, const_iterator c )
+ {
+ size_type s = *c;
+ for( std::size_t i = 0; i != s; ++i ) v[i] = p[i];
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, bool B >
+ struct view_begin_const
+ {
+ typedef typename view< P,B >::const_iterator const_iterator;
+ typedef typename view< P,B >::member_type type;
+ typedef typename P::subarray_type::type R;
+
+ const_iterator operator()( type const p )
+ {
+ return view_begin_const< R,N-1,B >()( *p );
+ }
+ };
+
+ template< class P, bool B >
+ struct view_begin_const< P,1,B >
+ {
+ typedef typename view< P,B >::const_iterator const_iterator;
+ typedef typename view< P,B >::member_type type;
+
+ const_iterator operator()( type const p )
+ {
+ return p;
+ }
+ };
+
+//--
+
+ template< class P, std::size_t N, bool B >
+ struct view_begin
+ {
+ typedef typename view< P,B >::iterator iterator;
+ typedef typename view< P,B >::member_type type;
+ typedef typename P::subarray_type::type R;
+
+ iterator operator()( type p )
+ {
+ return view_begin< R,N-1,B >()( *p );
+ }
+ };
+
+ template< class P, bool B >
+ struct view_begin< P,1,B >
+ {
+ typedef typename view< P,B >::iterator iterator;
+ typedef typename view< P,B >::member_type type;
+
+ iterator operator()( type p )
+ {
+ return p;
+ }
+ };
+
+//--
+//--
+
+ template< class P, bool B >
+ class view
+ : public expression< view< P,B > >
+ {
+ public:
+
+ typedef view type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef expression< type > base_type;
+ typedef typename view_traits< P,B >::member_type member_type;
+ typedef typename view_traits< P,B >::value_type value_type;
+ typedef typename view_traits< P,B >::const_reference_type const_reference_type;
+ typedef typename view_traits< P,B >::reference_type reference_type;
+ typedef typename view_traits< P,B >::const_iterator_type const_iterator_type;
+ typedef typename view_traits< P,B >::iterator_type iterator_type;
+ typedef typename view_traits< P,B >::element_type element_type;
+ typedef typename view_traits< P,B >::const_iterator const_iterator;
+ typedef typename view_traits< P,B >::iterator iterator;
+ typedef typename view_traits< P,B >::const_reference const_reference;
+ typedef typename view_traits< P,B >::reference reference;
+ typedef typename view_traits< P,B >::allocator_type allocator_type;
+ typedef typename view_traits< P,B >::size_type size_type;
+ typedef typename view_traits< P,B >::difference_type difference_type;
+ typedef typename view_traits< P,B >::bounds_type bounds_type;
+ typedef typename view_traits< P,B >::bounds_const_reference bounds_const_reference;
+ typedef typename view_traits< P,B >::limits_type limits_type;
+ typedef typename view_traits< P,B >::ranges ranges_type;
+ typedef typename view_traits< P,B >::ranges_const_reference ranges_const_reference;
+
+ enum { dimensionality = P::dimensionality };
+
+ view();
+
+ ~view();
+
+ void reset( P& );
+ template< class P1 > void set( P1& ) const;
+
+ const_reference_type operator[]( size_type ) const;
+ reference_type operator[]( size_type );
+
+ const_reference_type operator*() const;
+ reference_type operator*();
+
+ const_iterator_type operator+( size_type ) const;
+ iterator_type operator+( size_type );
+
+ const_reference operator[]( bounds_const_reference ) const;
+ reference operator[]( bounds_const_reference );
+
+ const_reference at( bounds_const_reference ) const;
+ reference at( bounds_const_reference );
+
+ bool const empty() const;
+ size_type const size() const;
+ bounds_const_reference bounds() const;
+ template< std::size_t U > size_type const bound() const;
+
+ template< class P1 > void to( P1& );
+ template< class P1 > void from( P1 const& );
+
+ void clear();
+
+ const_iterator begin() const;
+ iterator begin();
+ const_iterator end() const;
+ iterator end();
+
+ template< std::size_t R >
+ class range
+ {
+ public:
+
+ typedef range type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef std::size_t size_type;
+ typedef std::size_t element_type;
+ typedef typename ranges_type::value_type value_type;
+ typedef value_type const& const_reference_type;
+ typedef value_type& reference_type;
+ typedef value_type const* const_iterator_type;
+ typedef value_type* iterator_type;
+ typedef size_type const& const_reference;
+ typedef size_type& reference;
+ typedef size_type const* const_iterator;
+ typedef size_type* iterator;
+ typedef assigner< type,2 > assigner_type;
+
+ explicit range( view& );
+
+ assigner_type operator=( const_reference );
+
+ const_reference operator[]( size_type ) const;
+ reference operator[]( size_type );
+
+ protected:
+
+ view& v;
+ };
+
+ protected:
+
+ bounds_type limits;
+ ranges_type ranges;
+ member_type data;
+
+ private:
+
+ typedef typename mpl::size_t< dimensionality >::type N;
+ typedef limits_type L;
+
+ view( type_const_reference );
+ type_reference operator=( type_const_reference );
+
+ };
+
+//--
+//--
+
+ template< class P, bool B >
+ view< P,B >::view() : data( 0 )
+ {}
+
+ template< class P, bool B >
+ view< P,B >::~view()
+ {
+ if( data ) view_destructor< P,N::value,B >()( data, limits.begin(), limits[0] );
+ }
+
+ template< class P, bool B >
+ void view< P,B >::reset( P& p )
+ {
+ if( data ) view_resize< P,N::value,B,L >()( data, ranges+0, limits.begin(), p );
+ else view_constructor< P,N::value,B,L >()( data, limits.begin(), ranges+0, p );
+ view_reset< P,N::value,0,B >()( data, p+0, ranges+0 );
+ }
+
+ template< class P, bool B > template< class P1 >
+ void view< P,B >::set( P1& p ) const
+ {
+ if( data )
+ { view_validate< P,P1,N::value,B,typename P1::limits_type >()( ranges+0, p );
+ view_set< P1,P,N::value,0,B >()( p+0, data, ranges+0 );
+ }
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::const_reference_type view< P,B >::operator[]( size_type s ) const
+ {
+ BOOST_ASSERT( data );
+ return data[s];
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::reference_type view< P,B >::operator[]( size_type s )
+ {
+ BOOST_ASSERT( data );
+ return data[s];
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::const_reference_type view< P,B >::operator*() const
+ {
+ BOOST_ASSERT( data );
+ return *data;
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::reference_type view< P,B >::operator*()
+ {
+ BOOST_ASSERT( data );
+ return *data;
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::const_iterator_type view< P,B >::operator+( size_type s ) const
+ {
+ BOOST_ASSERT( data );
+ return data+s;
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::iterator_type view< P,B >::operator+( size_type s )
+ {
+ BOOST_ASSERT( data );
+ return data+s;
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::const_reference view< P,B >::operator[]( bounds_const_reference b ) const
+ {
+ BOOST_ASSERT( data );
+ return view_element_const< P,N::value,B >()( data, limits.begin(), b.begin() );
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::reference view< P,B >::operator[]( bounds_const_reference b )
+ {
+ BOOST_ASSERT( data );
+ return view_element< P,N::value,B >()( data, limits.begin(), b.begin() );
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::const_reference view< P,B >::at( bounds_const_reference b ) const
+ {
+ if( !( b < limits ) )
+ throw std::out_of_range( "view<> access out of range" );
+ return view_element_const< P,N::value,B >()( data, limits.begin(), b.begin() );
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::reference view< P,B >::at( bounds_const_reference b )
+ {
+ if( !( b < limits ) )
+ throw std::out_of_range( "view<> access out of range" );
+ return view_element< P,N::value,B >()( data, limits.begin(), b.begin() );
+ }
+
+ template< class P, bool B >
+ bool const view< P,B >::empty() const
+ {
+ return ( data == 0 );
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::size_type const view< P,B >::size() const
+ {
+ return pointer_size< N::value >()( limits.begin() );
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::bounds_const_reference view< P,B >::bounds() const
+ {
+ return limits;
+ }
+
+ template< class P, bool B > template< std::size_t U >
+ typename view< P,B >::size_type const view< P,B >::bound() const
+ {
+ BOOST_STATIC_ASSERT( U < N::value );
+ return limits[U];
+ }
+
+ template< class P, bool B > template< class P1 >
+ void view< P,B >::to( P1& p )
+ {
+ if( !view_bounds_equal< P1,P,N::value,B,typename P1::limits_type >()( limits, p ) )
+ throw std::invalid_argument( "view<> 'to' invalid argument" );
+ if( data ) view_to< P1,P,N::value,B >()( p+0, data, limits.begin() );
+ }
+
+ template< class P, bool B > template< class P1 >
+ void view< P,B >::from( P1 const& p )
+ {
+ if( !view_bounds_equal< P1,P,N::value,B,typename P1::limits_type >()( limits, p ) )
+ throw std::invalid_argument( "view<> 'from' invalid argument" );
+ if( data ) view_from< P,P1,N::value,B >()( data, p+0, limits.begin() );
+ }
+
+ template< class P, bool B >
+ void view< P,B >::clear()
+ {
+ if( data ) view_destructor< P,N::value,B >()( data, limits.begin(), limits[0] );
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::const_iterator view< P,B >::begin() const
+ {
+ if( data ) return view_begin_const< P,N::value,B >()( data );
+ return 0;
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::iterator view< P,B >::begin()
+ {
+ if( data ) return view_begin< P,N::value,B >()( data );
+ return 0;
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::const_iterator view< P,B >::end() const
+ {
+ if( data ) return begin()+size();
+ return 0;
+ }
+
+ template< class P, bool B >
+ typename view< P,B >::iterator view< P,B >::end()
+ {
+ if( data ) return begin()+size();
+ return 0;
+ }
+
+ template< class P, bool B >
+ view< P,B >::view( type_const_reference )
+ {}
+
+ template< class P, bool B >
+ typename view< P,B >::type_reference view< P,B >::operator=( type_const_reference )
+ {}
+
+//--
+
+ template< class P, bool B > template< std::size_t R >
+ view< P,B >::range< R >::range( view& v ) : v( v )
+ {
+ BOOST_STATIC_ASSERT( R < dimensionality );
+ }
+
+ template< class P, bool B > template< std::size_t R >
+ typename view< P,B >::template range< R >::assigner_type view< P,B >::range< R >::operator=( const_reference x )
+ {
+ return assigner_type( *this, v.ranges[R], x );
+ }
+
+ template< class P, bool B > template< std::size_t R >
+ typename view< P,B >::template range< R >::const_reference view< P,B >::range< R >::operator[]( size_type s ) const
+ {
+ BOOST_ASSERT( s < 3 );
+ return v.ranges[R][s];
+ }
+
+ template< class P, bool B > template< std::size_t R >
+ typename view< P,B >::template range< R >::reference view< P,B >::range< R >::operator[]( size_type s )
+ {
+ BOOST_ASSERT( s < 3 );
+ return v.ranges[R][s];
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_GENERIC_VIEW_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/generic/view_.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/generic/view_.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,663 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_GENERIC_VIEW_HPP_ )
+#define BOOST_MAPS_GENERIC_VIEW_HPP_
+
+#include <boost/maps/support/preprocessor_ranges.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class A, class R, std::size_t N, bool B >
+ struct view_reset_
+ {
+ typedef typename view_< A,R,B >::iterator_type view_iterator;
+ typedef typename A::iterator_type array_iterator;
+ typedef view_range< typename mpl::front< R >::type > range;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ void operator()( view_iterator v, array_iterator a )
+ {
+ for( std::size_t i = 0, j = range::first::value;
+ j != range::last::value; ++i, j += range::step::value )
+ view_reset_< P,Q,N-1,B >()( v[i], a[j] );
+ }
+ };
+
+ template< class A, class R, bool B >
+ struct view_reset_< A,R,1,B >
+ {
+ typedef typename view_< A,R,B >::iterator_type view_iterator;
+ typedef typename A::iterator_type array_iterator;
+ typedef view_range< typename mpl::front< R >::type > range;
+
+ void operator()( view_iterator v, array_iterator a )
+ {
+ for( std::size_t i = 0, j = range::first::value;
+ j != range::last::value; ++i, j += range::step::value ) v[i] = &a[j];
+ }
+ };
+
+ template< class A, class R >
+ struct view_reset_< A,R,1,false >
+ {
+ typedef typename view_< A,R,false >::iterator_type view_iterator;
+ typedef typename A::iterator_type array_iterator;
+ typedef view_range< typename mpl::front< R >::type > range;
+
+ void operator()( view_iterator v, array_iterator a )
+ {
+ for( std::size_t i = 0, j = range::first::value;
+ j != range::last::value; ++i, j += range::step::value ) v[i] = a[j];
+ }
+ };
+
+//--
+
+ template< class A1, class A, class R, std::size_t N, bool B >
+ struct view_set_
+ {
+ typedef typename A1::iterator_type array_iterator;
+ typedef typename view_< A,R,B >::const_iterator_type view_iterator;
+ typedef view_range< typename mpl::front< R >::type > range;
+ typedef typename A1::subarray_type::type P1;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ void operator()( array_iterator a, view_iterator v )
+ {
+ for( std::size_t i = 0, j = range::first::value;
+ j != range::last::value; ++i, j += range::step::value )
+ view_set_< P1,P,Q,N-1,B >()( a[j], v[i] );
+ }
+ };
+
+ template< class A1, class A, class R, bool B >
+ struct view_set_< A1,A,R,1,B >
+ {
+ typedef typename A1::iterator_type array_iterator;
+ typedef typename view_< A,R,B >::const_iterator_type view_iterator;
+ typedef view_range< typename mpl::front< R >::type > range;
+
+ void operator()( array_iterator a, view_iterator v )
+ {
+ for( std::size_t i = 0, j = range::first::value;
+ j != range::last::value; ++i, j += range::step::value ) a[j] = *v[i];
+ }
+ };
+
+ template< class A1, class A, class R >
+ struct view_set_< A1,A,R,1,false >
+ {
+ typedef typename A1::iterator_type array_iterator;
+ typedef typename view_< A,R,false >::const_iterator_type view_iterator;
+ typedef view_range< typename mpl::front< R >::type > range;
+
+ void operator()( array_iterator a, view_iterator v )
+ {
+ for( std::size_t i = 0, j = range::first::value;
+ j != range::last::value; ++i, j += range::step::value ) a[j] = v[i];
+ }
+ };
+
+//--
+
+ template< class A, class R, std::size_t N, bool B >
+ struct view_element_const_
+ {
+ typedef typename view_< A,R,B >::const_reference const_reference;
+ typedef typename view_< A,R,B >::const_iterator_type iterator_type;
+ typedef typename bounds< A::dimensionality >::const_iterator const_iterator;
+ typedef typename view_range< typename mpl::front< R >::type >::bound bound;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ const_reference operator()( iterator_type p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < bound::value );
+ return view_element_const_< P,Q,N-1,B >()( p[*i], i+1 );
+ }
+ };
+
+ template< class A, class R, bool B >
+ struct view_element_const_< A,R,1,B >
+ {
+ typedef typename view_< A,R,B >::const_reference const_reference;
+ typedef typename view_< A,R,B >::const_iterator_type iterator_type;
+ typedef typename bounds< A::dimensionality >::const_iterator const_iterator;
+ typedef typename view_range< typename mpl::front< R >::type >::bound bound;
+
+ const_reference operator()( iterator_type p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < bound::value );
+ return p[*i];
+ }
+ };
+
+//--
+
+ template< class A, class R, std::size_t N, bool B >
+ struct view_element_
+ {
+ typedef typename view_< A,R,B >::reference reference;
+ typedef typename view_< A,R,B >::iterator_type iterator_type;
+ typedef typename bounds< A::dimensionality >::const_iterator const_iterator;
+ typedef typename view_range< typename mpl::front< R >::type >::bound bound;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ reference operator()( iterator_type p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < bound::value );
+ return view_element_< P,Q,N-1,B >()( p[*i], i+1 );
+ }
+ };
+
+ template< class A, class R, bool B >
+ struct view_element_< A,R,1,B >
+ {
+ typedef typename view_< A,R,B >::reference reference;
+ typedef typename view_< A,R,B >::iterator_type iterator_type;
+ typedef typename bounds< A::dimensionality >::const_iterator const_iterator;
+ typedef typename view_range< typename mpl::front< R >::type >::bound bound;
+
+ reference operator()( iterator_type p, const_iterator i )
+ {
+ BOOST_ASSERT( *i < bound::value );
+ return p[*i];
+ }
+ };
+
+//--
+
+ template< class A, class R, std::size_t N, bool B >
+ struct view_element_at_const_
+ {
+ typedef typename view_< A,R,B >::const_reference const_reference;
+ typedef typename view_< A,R,B >::const_iterator_type iterator_type;
+ typedef typename bounds< A::dimensionality >::const_iterator const_iterator;
+ typedef typename view_range< typename mpl::front< R >::type >::bound bound;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ const_reference operator()( iterator_type p, const_iterator i )
+ {
+ if( !( *i < bound::value ) )
+ throw std::out_of_range( "view_<> access out of range" );
+ return view_element_at_const_< P,Q,N-1,B >()( p[*i], i+1 );
+ }
+ };
+
+ template< class A, class R, bool B >
+ struct view_element_at_const_< A,R,1,B >
+ {
+ typedef typename view_< A,R,B >::const_reference const_reference;
+ typedef typename view_< A,R,B >::const_iterator_type iterator_type;
+ typedef typename bounds< A::dimensionality >::const_iterator const_iterator;
+ typedef typename view_range< typename mpl::front< R >::type >::bound bound;
+
+ const_reference operator()( iterator_type p, const_iterator i )
+ {
+ if( !( *i < bound::value ) )
+ throw std::out_of_range( "view_<> access out of range" );
+ return p[*i];
+ }
+ };
+
+//--
+
+ template< class A, class R, std::size_t N, bool B >
+ struct view_element_at_
+ {
+ typedef typename view_< A,R,B >::reference reference;
+ typedef typename view_< A,R,B >::iterator_type iterator_type;
+ typedef typename bounds< A::dimensionality >::const_iterator const_iterator;
+ typedef typename view_range< typename mpl::front< R >::type >::bound bound;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ reference operator()( iterator_type p, const_iterator i )
+ {
+ if( !( *i < bound::value ) )
+ throw std::out_of_range( "view_<> access out of range" );
+ return view_element_at_< P,Q,N-1,B >()( p[*i], i+1 );
+ }
+ };
+
+ template< class A, class R, bool B >
+ struct view_element_at_< A,R,1,B >
+ {
+ typedef typename view_< A,R,B >::reference reference;
+ typedef typename view_< A,R,B >::iterator_type iterator_type;
+ typedef typename bounds< A::dimensionality >::const_iterator const_iterator;
+ typedef typename view_range< typename mpl::front< R >::type >::bound bound;
+
+ reference operator()( iterator_type p, const_iterator i )
+ {
+ if( !( *i < bound::value ) )
+ throw std::out_of_range( "view_<> access out of range" );
+ return p[*i];
+ }
+ };
+
+//--
+
+ template< class A, class R, std::size_t N, bool B, std::size_t S >
+ struct view_empty_
+ {
+ typedef typename view_< A,R,B >::const_iterator_type iterator_type;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+ typedef typename view_range< typename mpl::front< Q >::type >::bound D;
+
+ bool operator()( iterator_type v )
+ {
+ return view_empty_< P,Q,N-1,B,S*D::value >()( v[0] );
+ }
+ };
+
+ template< class A, class R, std::size_t S >
+ struct view_empty_< A,R,1,false,S >
+ {
+ typedef typename view_< A,R,false >::const_iterator_type iterator_type;
+
+ bool operator()( iterator_type )
+ {
+ return false;
+ }
+ };
+
+ template< class A, class R, bool B, std::size_t S >
+ struct view_empty_< A,R,1,B,S >
+ {
+ typedef typename view_< A,R,B >::const_iterator_type iterator_type;
+ typedef typename view_range< typename mpl::front< R >::type >::bound D;
+
+ bool operator()( iterator_type v )
+ {
+ for( std::size_t i = 0; i != S * D::value; ++i )
+ if( v[i] == 0 ) return true;
+ return false;
+ }
+ };
+
+//--
+
+ template< class A1, class A, class R, std::size_t N, bool B, std::size_t S >
+ struct view_to_
+ {
+ typedef typename A1::iterator_type array_iterator;
+ typedef typename view_< A,R,B >::const_iterator_type view_iterator;
+ typedef typename mpl::front< typename A1::bounds >::type F;
+ typedef typename A1::subarray_type::type P1;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ void operator()( array_iterator a, view_iterator v )
+ {
+ view_to_< P1,P,Q,N-1,B,S*F::value >()( a[0], v[0] );
+ }
+ };
+
+ template< class A1, class A, class R, bool B, std::size_t S >
+ struct view_to_< A1,A,R,1,B,S >
+ {
+ typedef typename A1::iterator_type array_iterator;
+ typedef typename view_< A,R,B >::const_iterator_type view_iterator;
+ typedef typename mpl::front< typename A1::bounds >::type F;
+
+ void operator()( array_iterator a, view_iterator v )
+ {
+ for( std::size_t i = 0; i != S * F::value; ++i ) a[i] = *v[i];
+ }
+ };
+
+ template< class A1, class A, class R, std::size_t S >
+ struct view_to_< A1,A,R,1,false,S >
+ {
+ typedef typename A1::iterator_type array_iterator;
+ typedef typename view_< A,mpl::vector1< R >,false >::const_iterator_type view_iterator;
+ typedef typename mpl::front< typename A1::bounds >::type F;
+
+ void operator()( array_iterator a, view_iterator v )
+ {
+ for( std::size_t i = 0; i != S * F::value; ++i ) a[i] = v[i];
+ }
+ };
+
+//--
+
+ template< class A, class A1, class R, std::size_t N, bool B, std::size_t S >
+ struct view_from_
+ {
+ typedef typename view_< A,R,B >::iterator_type view_iterator;
+ typedef typename A1::const_iterator_type array_iterator;
+ typedef typename mpl::front< typename A1::bounds >::type F;
+ typedef typename A::subarray_type::type P;
+ typedef typename A1::subarray_type::type P1;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ void operator()( view_iterator v, array_iterator a )
+ {
+ view_from_< P,P1,Q,N-1,B,S*F::value >()( v[0], a[0] );
+ }
+ };
+
+ template< class A, class A1, class R, bool B, std::size_t S >
+ struct view_from_< A,A1,R,1,B,S >
+ {
+ typedef typename view_< A,mpl::vector1< R >,B >::iterator_type view_iterator;
+ typedef typename A1::const_iterator_type array_iterator;
+ typedef typename mpl::front< typename A1::bounds >::type F;
+
+ void operator()( view_iterator v, array_iterator a )
+ {
+ for( std::size_t i = 0; i != S * F::value; ++i ) *v[i] = a[i];
+ }
+ };
+
+ template< class A, class A1, class R, std::size_t S >
+ struct view_from_< A,A1,R,1,false,S >
+ {
+ typedef typename view_< A,mpl::vector1< R >,false >::iterator_type view_iterator;
+ typedef typename A1::const_iterator_type array_iterator;
+ typedef typename mpl::front< typename A1::bounds >::type F;
+
+ void operator()( view_iterator v, array_iterator a )
+ {
+ for( std::size_t i = 0; i != S * F::value; ++i ) v[i] = a[i];
+ }
+ };
+
+//--
+
+ template< class A, class R, std::size_t N, bool B >
+ struct view_begin_const_
+ {
+ typedef typename view_< A,R,B >::const_iterator const_iterator;
+ typedef typename view_< A,R,B >::const_iterator_type iterator_type;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ const_iterator operator()( iterator_type p )
+ {
+ return view_begin_const_< P,Q,N-1,B >()( p[0] );
+ }
+ };
+
+ template< class A, class R, bool B >
+ struct view_begin_const_< A,R,1,B >
+ {
+ typedef typename view_< A,R,B >::const_iterator const_iterator;
+ typedef typename view_< A,R,B >::const_iterator_type iterator_type;
+
+ const_iterator operator()( iterator_type p )
+ {
+ return p;
+ }
+ };
+
+ template< class A, class R, std::size_t N, bool B >
+ struct view_begin_
+ {
+ typedef typename view_< A,R,B >::iterator iterator;
+ typedef typename view_< A,R,B >::iterator_type iterator_type;
+ typedef typename A::subarray_type::type P;
+ typedef typename mpl::pop_front< R >::type Q;
+
+ iterator operator()( iterator_type p )
+ {
+ return view_begin_< P,Q,N-1,B >()( p[0] );
+ }
+ };
+
+ template< class A, class R, bool B >
+ struct view_begin_< A,R,1,B >
+ {
+ typedef typename view_< A,R,B >::iterator iterator;
+ typedef typename view_< A,R,B >::iterator_type iterator_type;
+
+ iterator operator()( iterator_type p )
+ {
+ return p;
+ }
+ };
+
+//--
+//--
+
+ template< class A, class R, bool B >
+ class view_
+ : public expression< view_< A,R,B > >
+ {
+ public:
+
+ typedef view_ type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef expression< type > base_type;
+ typedef typename view_traits_< A,R,B >::value_type value_type;
+ typedef typename view_traits_< A,R,B >::const_reference_type const_reference_type;
+ typedef typename view_traits_< A,R,B >::reference_type reference_type;
+ typedef typename view_traits_< A,R,B >::const_iterator_type const_iterator_type;
+ typedef typename view_traits_< A,R,B >::iterator_type iterator_type;
+ typedef typename view_traits_< A,R,B >::element_type element_type;
+ typedef typename view_traits_< A,R,B >::const_iterator const_iterator;
+ typedef typename view_traits_< A,R,B >::iterator iterator;
+ typedef typename view_traits_< A,R,B >::const_reference const_reference;
+ typedef typename view_traits_< A,R,B >::reference reference;
+ typedef typename view_traits_< A,R,B >::allocator_type allocator_type;
+ typedef typename view_traits_< A,R,B >::size_type size_type;
+ typedef typename view_traits_< A,R,B >::difference_type difference_type;
+ typedef typename view_traits_< A,R,B >::bounds_type bounds_type;
+ typedef typename view_traits_< A,R,B >::bounds_const_reference bounds_const_reference;
+ typedef typename view_traits_< A,R,B >::bounds bounds;
+ typedef typename view_traits_< A,R,B >::ranges ranges;
+
+ enum { dimensionality = A::dimensionality, size = view_size< R >::type::value };
+
+ view_();
+ explicit view_( A& );
+
+ void reset( A& );
+ template< class A1 > void set( A1& ) const;
+
+ const_reference_type operator[]( size_type ) const;
+ reference_type operator[]( size_type );
+
+ const_reference_type operator*() const;
+ reference_type operator*();
+
+ const_iterator_type operator+( size_type ) const;
+ iterator_type operator+( size_type );
+
+ const_reference operator[]( bounds_const_reference ) const;
+ reference operator[]( bounds_const_reference );
+
+ const_reference at( bounds_const_reference ) const;
+ reference at( bounds_const_reference );
+
+ bool const empty() const;
+ template< std::size_t U > size_type const bound() const;
+
+ template< class A1 > void to( A1& );
+ template< class A1 > void from( A1 const& );
+
+ const_iterator begin() const;
+ iterator begin();
+ const_iterator end() const;
+ iterator end();
+
+ protected:
+
+ typedef typename mpl::size< R >::type N;
+ typedef typename view_traits_< A,R,B >::member_type member_type;
+
+ member_type data;
+
+ private:
+
+ view_( type_const_reference ) {}
+ type_reference operator=( type_const_reference ) {}
+
+ };
+
+//--
+//--
+
+ template< class A, class R, bool B >
+ view_< A,R,B >::view_()
+ {
+ BOOST_MPL_ASSERT(( view_valid< A,R > ));
+ }
+
+ template< class A, class R, bool B >
+ view_< A,R,B >::view_( A& a )
+ {
+ BOOST_MPL_ASSERT(( view_valid< A,R > ));
+ view_reset_< A,R,N::value,B >()( data+0, a+0 );
+ }
+
+ // Set this view_ representation to contain the values or pointers
+ // to the values, determined by parameter B, contained in array a.
+ template< class A, class R, bool B >
+ void view_< A,R,B >::reset( A& a )
+ {
+ view_reset_< A,R,N::value,B >()( data+0, a+0 );
+ }
+
+ // Sets the values of a to the corresponding values of the array
+ // that this view_ represents.
+ template< class A, class R, bool B > template< class A1 >
+ void view_< A,R,B >::set( A1& a ) const
+ {
+ BOOST_MPL_ASSERT(( mpl::equal< typename A::bounds, typename A1::bounds > ));
+ view_set_< A1,A,R,N::value,B >()( a+0, data+0 );
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::const_reference_type view_< A,R,B >::operator[]( size_type s ) const
+ {
+ return data[s];
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::reference_type view_< A,R,B >::operator[]( size_type s )
+ {
+ return data[s];
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::const_reference_type view_< A,R,B >::operator*() const
+ {
+ return *data;
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::reference_type view_< A,R,B >::operator*()
+ {
+ return *data;
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::const_iterator_type view_< A,R,B >::operator+( size_type s ) const
+ {
+ return data+s;
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::iterator_type view_< A,R,B >::operator+( size_type s )
+ {
+ return data+s;
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::const_reference view_< A,R,B >::operator[]( bounds_const_reference b ) const
+ {
+ return view_element_const_< A,R,N::value,B >()( data+0, b.begin() );
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::reference view_< A,R,B >::operator[]( bounds_const_reference b )
+ {
+ return view_element_< A,R,N::value,B >()( data+0, b.begin() );
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::const_reference view_< A,R,B >::at( bounds_const_reference b ) const
+ {
+ return view_element_at_const_< A,R,N::value,B >()( data+0, b.begin() );
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::reference view_< A,R,B >::at( bounds_const_reference b )
+ {
+ return view_element_at_< A,R,N::value,B >()( data+0, b.begin() );
+ }
+
+ template< class A, class R, bool B >
+ bool const view_< A,R,B >::empty() const
+ {
+ return view_empty_< A,R,N::value,B,1 >()( data+0 );
+ }
+
+ template< class A, class R, bool B > template< std::size_t U >
+ typename view_< A,R,B >::size_type const view_< A,R,B >::bound() const
+ {
+ BOOST_STATIC_ASSERT( U < dimensionality );
+ return mpl::at< bounds,mpl::size_t< U > >::type::value;
+ }
+
+ template< class A, class R, bool B > template< class A1 >
+ void view_< A,R,B >::to( A1& a )
+ {
+ BOOST_MPL_ASSERT(( mpl::equal< bounds, typename A1::bounds > ));
+ view_to_< A1,A,R,N::value,B,1 >()( a+0, data+0 );
+ }
+
+ template< class A, class R, bool B > template< class A1 >
+ void view_< A,R,B >::from( A1 const& a )
+ {
+ BOOST_MPL_ASSERT(( mpl::equal< bounds, typename A1::bounds > ));
+ view_from_< A,A1,R,N::value,B,1 >()( data+0, a+0 );
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::const_iterator view_< A,R,B >::begin() const
+ {
+ return view_begin_const_< A,R,N::value,B >()( data+0 );
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::iterator view_< A,R,B >::begin()
+ {
+ return view_begin_< A,R,N::value,B >()( data+0 );
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::const_iterator view_< A,R,B >::end() const
+ {
+ return begin()+size;
+ }
+
+ template< class A, class R, bool B >
+ typename view_< A,R,B >::iterator view_< A,R,B >::end()
+ {
+ return begin()+size;
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_GENERIC_VIEW_HPP_
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/math/matrix.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/matrix.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,449 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_MATRIX_HPP )
+#define BOOST_MAPS_MATH_MATRIX_HPP
+
+#include <boost/maps/support/math.hpp>
+#include <boost/maps/math/matrix_matrix.hpp>
+#include <boost/maps/math/matrix_scalar.hpp>
+#include <boost/maps/math/matrix_vector.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A, std::size_t K >
+ struct matrix_equality
+ {
+ typedef typename matrix< T,M,N,I,A >::const_iterator const_iterator;
+
+ bool operator()( const_iterator x, const_iterator y )
+ {
+ if( *x != *y ) return false;
+ else return matrix_equality< T,M,N,I,A,K-1 >()( x+1, y+1 );
+ }
+ };
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ struct matrix_equality< T,M,N,I,A,1 >
+ {
+ typedef typename matrix< T,M,N,I,A >::const_iterator const_iterator;
+
+ bool operator()( const_iterator x, const_iterator y )
+ {
+ if( *x != *y ) return false;
+ else return true;
+ }
+ };
+
+//--
+
+ /*
+ fixed size matrix class template
+
+ parameters
+
+ required
+
+ T - data type we wish to store
+ type: arbitrary type
+ M - number of rows
+ type: std::size_t
+ N - number of columns
+ type: std::size_t
+
+ optional
+
+ I - initialization parameter
+ type: bool
+ default: true, data elements zero/default initialized
+ A - allocator
+ type: standard conforming allocator, or null::allocator
+ default: null::allocator, statically allocated array
+ */
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ class matrix
+ : public matrix_expression< matrix< T,M,N,I,A >,M,N >
+ {
+ public:
+
+ typedef matrix type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef matrix_expression< type,M,N > base_type;
+ typedef typename matrix_type< T,M,N,I,A >::type representation_type;
+ typedef typename representation_type::value_type value_type;
+ typedef typename representation_type::const_reference_type const_reference_type;
+ typedef typename representation_type::reference_type reference_type;
+ typedef typename representation_type::const_iterator_type const_iterator_type;
+ typedef typename representation_type::iterator_type iterator_type;
+ typedef typename representation_type::element_type element_type;
+ typedef typename representation_type::const_reference const_reference;
+ typedef typename representation_type::reference reference;
+ typedef typename representation_type::allocator_type allocator_type;
+ typedef typename representation_type::size_type size_type;
+ typedef typename representation_type::difference_type difference_type;
+ typedef typename representation_type::const_iterator const_iterator;
+ typedef typename representation_type::iterator iterator;
+ typedef mpl::size_t< 2 > dimensionality;
+ typedef mpl::bool_< I > initialize;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N, size = M * N };
+ enum { linear = true };
+
+ protected:
+
+ typedef assigner< type,M*N-1 > assigner_type;
+
+ public:
+
+ matrix();
+
+ matrix( matrix const& );
+ template< class E > matrix( matrix_expression< E,M,N > const& );
+
+ matrix& operator=( matrix const& );
+ template< class E > matrix& operator=( matrix_expression< E,M,N > const& );
+ assigner_type operator=( const_reference );
+
+ ~matrix();
+
+ template< size_t B > size_type const bound() const;
+
+ void swap( matrix& );
+
+ const_reference_type operator[]( size_type ) const;
+ reference_type operator[]( size_type );
+
+ const_reference operator()( reference, size_type, size_type ) const;
+ reference operator()( reference, size_type, size_type );
+
+ const_reference operator()( size_type, size_type ) const;
+ reference operator()( size_type, size_type );
+
+ const_reference operator()( size_type ) const;
+ reference operator()( size_type );
+
+ const_iterator begin() const;
+ iterator begin();
+ const_iterator end() const;
+ iterator end();
+
+ matrix& operator*=( matrix< T,N,N,I,A > const& );
+ matrix& operator+=( matrix const& );
+ matrix& operator-=( matrix const& );
+ matrix& operator*=( T const& );
+ matrix& operator/=( T const& );
+
+ template< class E > matrix& operator*=( matrix_expression< E,N,N > const& );
+ template< class E > matrix& operator+=( matrix_expression< E,M,N > const& );
+ template< class E > matrix& operator-=( matrix_expression< E,M,N > const& );
+ template< class E > matrix& operator*=( scalar_expression< E > const& );
+ template< class E > matrix& operator/=( scalar_expression< E > const& );
+
+ void clear();
+
+ bool const operator==( matrix const& ) const;
+ bool const operator!=( matrix const& ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ representation_type data;
+
+ public:
+
+ template< class T1, std::size_t M1, std::size_t N1, bool I1, class A1, class C, class CT >
+ friend std::basic_ostream< C,CT >& operator<<( std::basic_ostream< C,CT >&, matrix< T1,M1,N1,I1,A1 > const& );
+ };
+
+//--
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ matrix< T,M,N,I,A >::matrix()
+ {} // constructor
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ matrix< T,M,N,I,A >::matrix( matrix const& m ) : data( m.data )
+ {}
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class E >
+ matrix< T,M,N,I,A >::matrix( matrix_expression< E,M,N > const& e )
+ {
+ matrix_assign< type,E,M,N,matrix_matrix_assign< type,E >,E::linear,true >()( *this, e );
+ }
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator=( matrix const& m )
+ {
+ if( &m != this ) data = m.data;
+ return *this;
+ }
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class E >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator=( matrix_expression< E,M,N > const& e )
+ {
+ matrix_assign< type,E,M,N,matrix_matrix_assign< type,E >,E::linear,false >()( *this, e );
+ return *this;
+ }
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::assigner_type matrix< T,M,N,I,A >::operator=( const_reference t )
+ {
+ return assigner_type( *this, begin(), t );
+ } // element assignment
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ matrix< T,M,N,I,A >::~matrix()
+ {} // destructor
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< size_t B >
+ typename matrix< T,M,N,I,A >::size_type const matrix< T,M,N,I,A >::bound() const
+ {
+ BOOST_STATIC_ASSERT( B < 2 );
+ return B == 0 ? M : N;
+ } // bound
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ void matrix< T,M,N,I,A >::swap( matrix& m )
+ {
+ if( &m != this ) data.swap( m.data );
+ } // swap
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::const_reference_type matrix< T,M,N,I,A >::operator[]( size_type s ) const
+ {
+ return data[s];
+ } // operator[] const
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::reference_type matrix< T,M,N,I,A >::operator[]( size_type s )
+ {
+ return data[s];
+ } // operator[]
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::const_reference matrix< T,M,N,I,A >::operator()( reference, size_type i, size_type j ) const
+ {
+ BOOST_ASSERT( i < M && j < N );
+ return *(*( data+i)+j );
+ } // operator() const
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::reference matrix< T,M,N,I,A >::operator()( reference, size_type i, size_type j )
+ {
+ BOOST_ASSERT( i < M && j < N );
+ return *(*( data+i)+j );
+ } // operator()
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::const_reference matrix< T,M,N,I,A >::operator()( size_type i, size_type j ) const
+ {
+ BOOST_ASSERT( i < M && j < N );
+ return *(*( data+i)+j );
+ } // operator() const
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::reference matrix< T,M,N,I,A >::operator()( size_type i, size_type j )
+ {
+ BOOST_ASSERT( i < M && j < N );
+ return *(*( data+i)+j );
+ } // operator()
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::const_reference matrix< T,M,N,I,A >::operator()( size_type s ) const
+ {
+ BOOST_ASSERT( s < size );
+ return *( data.begin()+s );
+ } // operator() const
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::reference matrix< T,M,N,I,A >::operator()( size_type s )
+ {
+ BOOST_ASSERT( s < size );
+ return *( data.begin()+s );
+ } // operator()
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::const_iterator matrix< T,M,N,I,A >::begin() const
+ {
+ return data.begin();
+ } // begin const
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::iterator matrix< T,M,N,I,A >::begin()
+ {
+ return data.begin();
+ } // begin
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::const_iterator matrix< T,M,N,I,A >::end() const
+ {
+ return data.end();
+ } // end const
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ typename matrix< T,M,N,I,A >::iterator matrix< T,M,N,I,A >::end()
+ {
+ return data.end();
+ } // end
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator*=( matrix< T,N,N,I,A > const& m )
+ {
+ *this = *this * m;
+ return *this;
+ } // operator*= matrix
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator+=( matrix const& m )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ data[i][j] += m[i][j];
+ return *this;
+ } // operator+= matrix
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator-=( matrix const& m )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ data[i][j] -= m[i][j];
+ return *this;
+ } // operator-= matrix
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator*=( T const& t )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ data[i][j] *= t;
+ return *this;
+ } // operator*= scalar
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator/=( T const& t )
+ {
+ T s = t;
+ BOOST_ASSERT( s != T(0) );
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ data[i][j] /= s;
+ return *this;
+ } // operator/= scalar
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class E >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator*=( matrix_expression< E,N,N > const& e )
+ {
+ *this = *this * e;
+ return *this;
+ } // operator*= matrix_expression
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class E >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator+=( matrix_expression< E,M,N > const& e )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ data[i][j] += e()( i,j );
+ return *this;
+ } // operator+= matrix_expression
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class E >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator-=( matrix_expression< E,M,N > const& e )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ data[i][j] -= e()( i,j );
+ return *this;
+ } // operator-= matrix_expression
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class E >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator*=( scalar_expression< E > const& e )
+ {
+ T s = e()( 0 );
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ data[i][j] *= s;
+ return *this;
+ } // operator*= scalar_expression
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class E >
+ matrix< T,M,N,I,A >& matrix< T,M,N,I,A >::operator/=( scalar_expression< E > const& e )
+ {
+ T s = e()( 0 );
+ BOOST_ASSERT( s != T(0) );
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ data[i][j] /= s;
+ return *this;
+ } // operator/= scalar_expression
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ void matrix< T,M,N,I,A >::clear()
+ {
+ T t = T(); std::fill( begin(), end(), t );
+ } // clear : set all elements to default
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ bool const matrix< T,M,N,I,A >::operator==( matrix< T,M,N,I,A > const& m ) const
+ {
+ return matrix_equality< T,M,N,I,A,size >()( data.begin(), m.data.begin() );
+ } // operator ==
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ bool const matrix< T,M,N,I,A >::operator!=( matrix< T,M,N,I,A > const& m ) const
+ {
+ return !( matrix_equality< T,M,N,I,A,size >()( data.begin(), m.data.begin() ) );
+ } // operator !=
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class U >
+ bool const matrix< T,M,N,I,A >::references( scalar< U > const& ) const
+ {
+ return false;
+ }
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix< T,M,N,I,A >::references( vector< U,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix< T,M,N,I,A >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( reinterpret_cast< matrix< T,M,N,I,A > const* >( &m ) == this );
+ }
+
+//--
+//--
+
+ template< class T1, std::size_t M1, std::size_t N1, bool I1, class A1, class C, class CT >
+ std::basic_ostream< C,CT >& operator<<( std::basic_ostream< C,CT >& o, matrix< T1,M1,N1,I1,A1 > const& m )
+ {
+ o << m.data;
+ return o;
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_MATRIX_HPP

Added: sandbox/maps/maps/boost/maps/math/matrix_matrix.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/matrix_matrix.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,2443 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_MATRIX_MATRIX_HPP )
+#define BOOST_MAPS_MATH_MATRIX_MATRIX_HPP
+
+#include <boost/maps/math/scalar_scalar.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E, std::size_t M, std::size_t N >
+ class matrix_expression
+ : expression< matrix_expression< E,M,N > >
+ {
+ public:
+
+ typedef matrix_expression type;
+ typedef E value_type;
+ typedef value_type const& const_reference;
+ typedef value_type& reference;
+
+ const_reference operator()() const
+ {
+ return *static_cast< value_type const* >( this );
+ }
+
+ reference operator()()
+ {
+ return *static_cast< value_type* >( this );
+ }
+
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ class matrix_binary_expression
+ : public matrix_expression< matrix_binary_expression< E1,E2,M,N,O,L >,M,N >
+ {
+ public:
+
+ typedef matrix_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E1::type_const_reference expression1_const_reference;
+ typedef typename E2::type_const_reference expression2_const_reference;
+ typedef E1 expression_type1;
+ typedef E2 expression_type2;
+ typedef O operator_type;
+ typedef typename operator_type::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = ( L & E1::linear & E2::linear ) };
+
+ matrix_binary_expression( E1 const&, E2 const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ reference operator()( reference, size_type, size_type ) const;
+ result_type const operator()( size_type, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ matrix_binary_expression< E1,E2,M,N,O,L >::matrix_binary_expression( E1 const& e1, E2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_binary_expression< E1,E2,M,N,O,L >::type_reference
+ matrix_binary_expression< E1,E2,M,N,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) { t1 = e.t1; t2 = e.t2; }
+ return *this;
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_binary_expression< E1,E2,M,N,O,L >::expression_type1 const&
+ matrix_binary_expression< E1,E2,M,N,O,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_binary_expression< E1,E2,M,N,O,L >::expression_type2 const&
+ matrix_binary_expression< E1,E2,M,N,O,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_binary_expression< E1,E2,M,N,O,L >::reference
+ matrix_binary_expression< E1,E2,M,N,O,L >::operator()( reference r, size_type i, size_type j ) const
+ {
+ return operator_type()( r,t1,t2,i,j );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_binary_expression< E1,E2,M,N,O,L >::result_type const
+ matrix_binary_expression< E1,E2,M,N,O,L >::operator()( size_type i, size_type j ) const
+ {
+ return operator_type()( t1,t2,i,j );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_binary_expression< E1,E2,M,N,O,L >::result_type const
+ matrix_binary_expression< E1,E2,M,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1( s ), t2( s ) );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L > template< class U >
+ bool const matrix_binary_expression< E1,E2,M,N,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< E1,E2,M,N,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< E1,E2,M,N,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T1, class T2 > struct matrix_matrix_product;
+
+ // matrix product
+ template< class E1, class E2, std::size_t M, std::size_t N, bool L >
+ class matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >
+ : public matrix_expression< matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >,M,N >
+ {
+ public:
+
+ typedef matrix_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef E1 expression_type1;
+ typedef E2 expression_type2;
+ typedef matrix_matrix_product< E1,E2 > operator_type;
+ typedef typename operator_type::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+ typedef matrix< element_type,M,N,false,allocator_type > matrix_type;
+ typedef matrix_type expression_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = false };
+
+ matrix_binary_expression( E1 const&, E2 const& );
+
+ expression_type const& expression() const;
+
+ const_reference operator()( size_type, size_type ) const;
+ const_reference operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ matrix_type t;
+
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t M, std::size_t N, bool L >
+ matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::matrix_binary_expression( E1 const& e1, E2 const& e2 )
+ {
+ result_type s;
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ { s = result_type();
+ for( std::size_t k = 0; k != E1::cols; ++k )
+ s += e1( i,k ) * e2( k,j );
+ t( i,j ) = s;
+ }
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, bool L >
+ typename matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::expression_type const&
+ matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, bool L >
+ typename matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::const_reference
+ matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::operator()( size_type i, size_type j ) const
+ {
+ return t( i,j );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, bool L >
+ typename matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::const_reference
+ matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::operator()( size_type s ) const
+ {
+ return t( s );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, bool L > template< class U >
+ bool const matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::references( scalar< U > const& ) const
+ {
+ return false;
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::references( vector< U,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,L >::references( matrix< U,P,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+//--
+//--
+
+ // The following specializations are for blocked matrix types.
+
+ // matrix< matrix< ... > > * E
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ class matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >
+ : public matrix_expression< matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >,M,N >
+ {
+ public:
+
+ typedef matrix_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 > expression_type1;
+ typedef E expression_type2;
+ typedef matrix_matrix_product< expression_type1,expression_type2 > operator_type;
+ typedef typename operator_type::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+ typedef matrix< element_type,M,N,true,A2 > matrix_type;
+ typedef matrix_type expression_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = false };
+
+ matrix_binary_expression( expression_type1 const&, expression_type2 const& );
+
+ expression_type const& expression() const;
+
+ const_reference operator()( size_type, size_type ) const;
+ const_reference operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ matrix_type t;
+
+ };
+
+//--
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::matrix_binary_expression( expression_type1 const& e1, expression_type2 const& e2 )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ for( std::size_t k = 0; k != R; ++k )
+ t( i,j ) += product( e1( i,k ), e2( k,j ) );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::expression_type const&
+ matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::const_reference
+ matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::operator()( size_type i, size_type j ) const
+ {
+ return t( i,j );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::const_reference
+ matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::operator()( size_type s ) const
+ {
+ return t( s );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U >
+ bool const matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::references( scalar< U > const& ) const
+ {
+ return false;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::references( vector< U,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_matrix_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::references( matrix< U,P,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+//--
+//--
+
+ // E * matrix< matrix< ... > >
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ class matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >
+ : public matrix_expression< matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >,M,N >
+ {
+ public:
+
+ typedef matrix_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef E expression_type1;
+ typedef matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > expression_type2;
+ typedef matrix_matrix_product< expression_type1,expression_type2 > operator_type;
+ typedef typename operator_type::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+ typedef matrix< element_type,M,N,true,A2 > matrix_type;
+ typedef matrix_type expression_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = false };
+
+ matrix_binary_expression( expression_type1 const&, expression_type2 const& );
+
+ expression_type const& expression() const;
+
+ const_reference operator()( size_type, size_type ) const;
+ const_reference operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ matrix_type t;
+
+ };
+
+//--
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::matrix_binary_expression( expression_type1 const& e1, expression_type2 const& e2 )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ for( std::size_t k = 0; k != R; ++k )
+ t( i,j ) += product( e1( i,k ), e2( k,j ) );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::expression_type const&
+ matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::const_reference
+ matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::operator()( size_type i, size_type j ) const
+ {
+ return t( i,j );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::const_reference
+ matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::operator()( size_type s ) const
+ {
+ return t( s );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U >
+ bool const matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::references( scalar< U > const& ) const
+ {
+ return false;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::references( vector< U,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_matrix_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::references( matrix< U,P,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+//--
+//--
+
+ // matrix< matrix< ... > > * matrix< matrix< ... > >
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ class matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >
+ : public matrix_expression< matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >,M,N >
+ {
+ public:
+
+ typedef matrix_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 > expression_type1;
+ typedef matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > expression_type2;
+ typedef matrix_matrix_product< expression_type1,expression_type2 > operator_type;
+ typedef typename operator_type::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+ typedef matrix< element_type,M,N,true,A2 > matrix_type;
+ typedef matrix_type expression_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = false };
+
+ matrix_binary_expression( expression_type1 const&, expression_type2 const& );
+
+ expression_type const& expression() const;
+
+ const_reference operator()( size_type, size_type ) const;
+ const_reference operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ matrix_type t;
+
+ };
+
+//--
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::matrix_binary_expression( expression_type1 const& e1, expression_type2 const& e2 )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ for( std::size_t k = 0; k != R; ++k )
+ t( i,j ) += product( e1( i,k ), e2( k,j ) );
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ typename matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::expression_type const&
+ matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ typename matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::const_reference
+ matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::operator()( size_type i, size_type j ) const
+ {
+ return t( i,j );
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ typename matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::const_reference
+ matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::operator()( size_type s ) const
+ {
+ return t( s );
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L > template< class U >
+ bool const matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::references( scalar< U > const& ) const
+ {
+ return false;
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::references( vector< U,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_matrix_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::references( matrix< U,P,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+//--
+//--
+
+ template< class T1, class T2 > struct matrix_expression_product;
+
+ // matrix product
+ // The following specializations are for blocked matrix types.
+
+ // matrix< matrix< ... > > * E
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ class matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >
+ : public matrix_expression< matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >,M,N >
+ {
+ public:
+
+ typedef matrix_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 > expression_type1;
+ typedef E expression_type2;
+ typedef typename expression_type1::type_const_reference expression1_const_reference;
+ typedef typename expression_type2::type_const_reference expression2_const_reference;
+ typedef matrix_expression_product< expression_type1,expression_type2 > operator_type;
+ typedef typename operator_type::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename result_type::size_type size_type;
+ typedef typename result_type::allocator_type allocator_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = false };
+
+ matrix_binary_expression( expression_type1 const&, expression_type2 const& );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ result_type const operator()( size_type, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::matrix_binary_expression( expression_type1 const& e1, expression_type2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::expression_type1 const&
+ matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::expression_type2 const&
+ matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::result_type const
+ matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::operator()( size_type i, size_type j ) const
+ {
+ return operator_type()( t1,t2,i,j );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::result_type const
+ matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1( s ), t2( s ) );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U >
+ bool const matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E,M,N,matrix_expression_product< matrix< matrix< T,M1,N1,I1,A1 >,M,R,I2,A2 >,E >,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ // E * matrix< matrix< ... > >
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ class matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >
+ : public matrix_expression< matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >,M,N >
+ {
+ public:
+
+ typedef matrix_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef E expression_type1;
+ typedef matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > expression_type2;
+ typedef typename expression_type1::type_const_reference expression1_const_reference;
+ typedef typename expression_type2::type_const_reference expression2_const_reference;
+ typedef matrix_expression_product< expression_type1,expression_type2 > operator_type;
+ typedef typename operator_type::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename result_type::size_type size_type;
+ typedef typename result_type::allocator_type allocator_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = false };
+
+ matrix_binary_expression( expression_type1 const&, expression_type2 const& );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ result_type const operator()( size_type, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::matrix_binary_expression( expression_type1 const& e1, expression_type2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::expression_type1 const&
+ matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::expression_type2 const&
+ matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::result_type const
+ matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::operator()( size_type i, size_type j ) const
+ {
+ return operator_type()( t1,t2,i,j );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L >
+ typename matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::result_type const
+ matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1( s ), t2( s ) );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U >
+ bool const matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E, class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, std::size_t N, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 >,M,N,matrix_expression_product< E,matrix< matrix< T,M1,N1,I1,A1 >,R,N,I2,A2 > >,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ // matrix< matrix< ... > > * matrix< matrix< ... > >
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ class matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >
+ : public matrix_expression< matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >,M,N >
+ {
+ public:
+
+ typedef matrix_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 > expression_type1;
+ typedef matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > expression_type2;
+ typedef typename expression_type1::type_const_reference expression1_const_reference;
+ typedef typename expression_type2::type_const_reference expression2_const_reference;
+ typedef matrix_expression_product< expression_type1,expression_type2 > operator_type;
+ typedef typename operator_type::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename result_type::size_type size_type;
+ typedef typename result_type::allocator_type allocator_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = false };
+
+ matrix_binary_expression( expression_type1 const&, expression_type2 const& );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ result_type const operator()( size_type, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::matrix_binary_expression( expression_type1 const& e1, expression_type2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ typename matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::expression_type1 const&
+ matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ typename matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::expression_type2 const&
+ matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ typename matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::result_type const
+ matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::operator()( size_type i, size_type j ) const
+ {
+ return operator_type()( t1,t2,i,j );
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L >
+ typename matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::result_type const
+ matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1( s ), t2( s ) );
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L > template< class U >
+ bool const matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_binary_expression< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 >,M,N,matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct matrix_product_traits
+ {
+ typedef typename expression_traits< T1 >::type_const_reference type_const_reference1;
+ typedef typename expression_traits< T2 >::type_const_reference type_const_reference2;
+ typedef typename expression_traits< T1 >::type_reference type_reference1;
+ typedef typename expression_traits< T2 >::type_reference type_reference2;
+ typedef typename expression_traits< T1 >::const_reference const_reference1;
+ typedef typename expression_traits< T2 >::const_reference const_reference2;
+ typedef typename expression_traits< T1 >::reference reference1;
+ typedef typename expression_traits< T2 >::reference reference2;
+ typedef typename expression_traits< T1 >::element_type element_type1;
+ typedef typename expression_traits< T2 >::element_type element_type2;
+ typedef typename expression_traits< T1 >::allocator_type allocator_type;
+ typedef typename expression_traits< T1 >::size_type size_type;
+ typedef typename matrix_product_type< element_type1,element_type2 >::type result_type;
+
+ };
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct matrix_matrix_product
+ : matrix_product_traits< T1,T2 >
+ {
+ typedef typename matrix_product_traits< T1,T2 >::result_type result_type;
+ typedef typename matrix_product_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename matrix_product_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename matrix_product_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ for( size_type k = 0; k != t1.cols; ++k )
+ r += t1( r,i,k ) * t2( r,k,j );
+ return r;
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ result_type r = result_type();
+ for( size_type k = 0; k != t1.cols; ++k )
+ r += t1( i,k ) * t2( k,j );
+ return r;
+ }
+ };
+
+//--
+
+ template< class T1, class T2 >
+ struct matrix_expression_product
+ : matrix_product_traits< T1,T2 >
+ {
+ typedef typename matrix_product_traits< T1,T2 >::result_type result_type;
+ typedef typename matrix_product_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename matrix_product_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename matrix_product_traits< T1,T2 >::size_type size_type;
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ result_type r = result_type();
+ for( size_type k = 0; k != t1.cols; ++k )
+ r += t1( i,k ) * t2( k,j );
+ return r;
+ }
+ };
+
+ // matrix< matrix< ... > > * T
+ template< class T, class T1, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I2, class A2 >
+ struct matrix_expression_product< matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 >,T >
+ : matrix_product_traits< matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 >,T >
+ {
+ typedef matrix_product_traits< matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 >,T > traits;
+ typedef typename traits::result_type result_type;
+ typedef typename traits::type_const_reference1 type_const_reference1;
+ typedef typename traits::type_const_reference2 type_const_reference2;
+ typedef typename traits::size_type size_type;
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ result_type r = result_type();
+ for( size_type k = 0; k != t1.cols; ++k )
+ r += product( t1( i,k ), t2( k,j ) );
+ return r;
+ }
+ };
+
+ // T * matrix< matrix< ... > >
+ template< class T, class T1, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I2, class A2 >
+ struct matrix_expression_product< T,matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 > >
+ : matrix_product_traits< T,matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 > >
+ {
+ typedef matrix_product_traits< T,matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 > > traits;
+ typedef typename traits::result_type result_type;
+ typedef typename traits::type_const_reference1 type_const_reference1;
+ typedef typename traits::type_const_reference2 type_const_reference2;
+ typedef typename traits::size_type size_type;
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ result_type r = result_type();
+ for( size_type k = 0; k != t1.cols; ++k )
+ r += product( t1( i,k ), t2( k,j ) );
+ return r;
+ }
+ };
+
+ // matrix< matrix< ... > > * matrix< matrix< ... > >
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t R, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4 >
+ struct matrix_expression_product< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >
+ : matrix_product_traits< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > >
+ {
+ typedef matrix_product_traits< matrix< matrix< T1,M1,P1,I1,A1 >,M,R,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,R,N,I4,A4 > > traits;
+ typedef typename traits::result_type result_type;
+ typedef typename traits::type_const_reference1 type_const_reference1;
+ typedef typename traits::type_const_reference2 type_const_reference2;
+ typedef typename traits::size_type size_type;
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ result_type r = result_type();
+ for( size_type k = 0; k != t1.cols; ++k )
+ r += product( t1( i,k ), t2( k,j ) );
+ return r;
+ }
+ };
+
+//--
+
+ template< class T1, class T2 >
+ struct matrix_matrix_addition
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::result_type result_type;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return r = t1( r,i,j ) + t2( r,i,j );
+ }
+
+ result_type& operator()( result_type& r, const_reference1 t1, const_reference2 t2 )
+ {
+ return r = t1 + t2;
+ }
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 + t2;
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return t1( i,j ) + t2( i,j );
+ }
+ };
+
+ template< class T1, class T2 >
+ struct matrix_matrix_subtraction
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::result_type result_type;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return r = t1( r,i,j ) - t2( r,i,j );
+ }
+
+ result_type& operator()( result_type& r, const_reference1 t1, const_reference2 t2 )
+ {
+ return r = t1 - t2;
+ }
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 - t2;
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return t1( i,j ) - t2( i,j );
+ }
+ };
+
+//--
+//--
+
+ template< class E1, class E2, std::size_t M, std::size_t P, std::size_t N >
+ matrix_binary_expression< E1,E2,M,N,matrix_matrix_product< E1,E2 >,false >
+ operator*( matrix_expression< E1,M,P > const& e1, matrix_expression< E2,P,N > const& e2 )
+ {
+ return matrix_binary_expression< E1,E2,M,N,
+ matrix_matrix_product< E1,E2 >,false >( e1(), e2() );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t P, std::size_t N >
+ matrix_binary_expression< E1,E2,M,N,matrix_expression_product< E1,E2 >,false >
+ product( matrix_expression< E1,M,P > const& e1, matrix_expression< E2,P,N > const& e2 )
+ {
+ return matrix_binary_expression< E1,E2,M,N,
+ matrix_expression_product< E1,E2 >,false >( e1(), e2() );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N >
+ matrix_binary_expression< E1,E2,M,N,matrix_matrix_addition< E1,E2 >,true >
+ operator+( matrix_expression< E1,M,N > const& e1, matrix_expression< E2,M,N > const& e2 )
+ {
+ return matrix_binary_expression< E1,E2,M,N,
+ matrix_matrix_addition< E1,E2 >,true >( e1(), e2() );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N >
+ matrix_binary_expression< E1,E2,M,N,matrix_matrix_subtraction< E1,E2 >,true >
+ operator-( matrix_expression< E1,M,N > const& e1, matrix_expression< E2,M,N > const& e2 )
+ {
+ return matrix_binary_expression< E1,E2,M,N,
+ matrix_matrix_subtraction< E1,E2 >,true >( e1(), e2() );
+ }
+
+//--
+
+ template< class T1, class T2 >
+ struct matrix_matrix_assign
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::reference1 reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::type_reference1 type_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::size_type size_type;
+
+ void operator()( reference1 t1, const_reference2 t2 )
+ {
+ t1 = t2;
+ }
+
+ void operator()( type_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ t1( i,j ) = t2( i,j );
+ }
+ };
+
+//--
+
+ template< class T, class E, std::size_t M, std::size_t N, class O, bool L, bool C >
+ struct matrix_assign
+ {
+ typedef T& reference;
+ typedef matrix_expression< E,M,N > const& expression_const_reference;
+ typedef O operator_type;
+
+ void operator()( reference m, expression_const_reference e )
+ {
+ if( e().references( m ) )
+ { T t;
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ operator_type()( t( i,j ), e()( i,j ) );
+ t.swap( m );
+ }else
+ { for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ operator_type()( m( i,j ), e()( i,j ) );
+ }
+ }
+ };
+
+//--
+
+ template< class T, class E, std::size_t M, std::size_t N, class O, bool C >
+ struct matrix_assign< T,E,M,N,O,true,C >
+ {
+ typedef T& reference;
+ typedef matrix_expression< E,M,N > const& expression_const_reference;
+ typedef O operator_type;
+
+ void operator()( reference m, expression_const_reference e )
+ {
+ for( std::size_t i = 0; i != m.size; ++i )
+ operator_type()( m( i ), e()( i ) );
+ }
+ };
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, class E, class O, bool C >
+ struct matrix_assign< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,E,M,N,O,true,C >
+ {
+ typedef matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >& reference;
+ typedef matrix_expression< E,M,N > const& expression_const_reference;
+
+ void operator()( reference m, expression_const_reference e )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ e()( m( i,j ),i,j );
+ }
+ };
+
+//--
+
+ template< class T, class E, std::size_t M, std::size_t N, class O >
+ struct matrix_assign< T,E,M,N,O,false,true >
+ {
+ typedef T& reference;
+ typedef matrix_expression< E,M,N > const& expression_const_reference;
+ typedef O operator_type;
+
+ void operator()( reference m, expression_const_reference e )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ operator_type()( m( i,j ), e()( i,j ) );
+ }
+ };
+
+//--
+//--
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ class matrix_unary_expression
+ : public matrix_expression< matrix_unary_expression< E,M,N,O,L >,M,N >
+ {
+ public:
+
+ typedef matrix_unary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E::type_const_reference expression_const_reference;
+ typedef E expression_type;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = ( L & E::linear ) };
+
+ matrix_unary_expression( E const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type const& expression() const;
+
+ result_type const operator()( reference, size_type, size_type ) const;
+ result_type const operator()( size_type, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression_const_reference t;
+
+ };
+
+//--
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ matrix_unary_expression< E,M,N,O,L >::matrix_unary_expression( E const& e )
+ : t( e )
+ {}
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_unary_expression< E,M,N,O,L >::type_reference
+ matrix_unary_expression< E,M,N,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) t = e.t;
+ return *this;
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_unary_expression< E,M,N,O,L >::expression_type const&
+ matrix_unary_expression< E,M,N,O,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_unary_expression< E,M,N,O,L >::result_type const
+ matrix_unary_expression< E,M,N,O,L >::operator()( reference r, size_type i, size_type j ) const
+ {
+ return operator_type()( r,t,i,j );
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_unary_expression< E,M,N,O,L >::result_type const
+ matrix_unary_expression< E,M,N,O,L >::operator()( size_type i, size_type j ) const
+ {
+ return operator_type()( t,i,j );
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_unary_expression< E,M,N,O,L >::result_type const
+ matrix_unary_expression< E,M,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t( s ) );
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L > template< class U >
+ bool const matrix_unary_expression< E,M,N,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t().references( s ) );
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_unary_expression< E,M,N,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t().references( v ) );
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_unary_expression< E,M,N,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T > struct matrix_transpose;
+
+ // matrix transpose matrix< matrix< ... > >
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, bool L >
+ class matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >
+ : public matrix_expression< matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >,N,M >
+ {
+ public:
+
+ typedef matrix_unary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > expression_type1;
+ typedef expression_type1 const& expression_const_reference;
+ typedef matrix_transpose< expression_type1 > operator_type;
+ typedef typename operator_type::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+ typedef typename matrix_transpose_type< expression_type1 >::type matrix_type;
+ typedef matrix_type expression_type;
+
+ using matrix_expression< type,N,M >::operator();
+
+ enum { rows = N, cols = M };
+ enum { linear = false };
+
+ matrix_unary_expression( expression_const_reference );
+
+ type_reference operator=( type_const_reference );
+
+ expression_type const& expression() const;
+
+ const_reference operator()( size_type, size_type ) const;
+ const_reference operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ matrix_type t;
+
+ };
+
+//--
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, bool L >
+ matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::matrix_unary_expression( expression_const_reference e )
+ {
+ operator_type()( t,e );
+ }
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, bool L >
+ typename matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::type_reference
+ matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) t = e.t;
+ return *this;
+ }
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, bool L >
+ typename matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::expression_type const&
+ matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, bool L >
+ typename matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::const_reference
+ matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::operator()( size_type i, size_type j ) const
+ {
+ return t( i,j );
+ }
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, bool L >
+ typename matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::const_reference
+ matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::operator()( size_type s ) const
+ {
+ return t( s );
+ }
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, bool L > template< class U >
+ bool const matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::references( scalar< U > const& ) const
+ {
+ return false;
+ }
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::references( vector< U,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_unary_expression< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A >,N,M,matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >,L >::references( matrix< U,P,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+//--
+//--
+
+ template< class T >
+ struct matrix_transpose_traits
+ {
+ typedef typename matrix_transpose_type< T >::type T1;
+ typedef typename expression_traits< T1 >::type_const_reference type_const_reference1;
+ typedef typename expression_traits< T >::type_const_reference type_const_reference2;
+ typedef typename expression_traits< T1 >::type_reference type_reference1;
+ typedef typename expression_traits< T >::type_reference type_reference2;
+ typedef typename expression_traits< T1 >::const_reference const_reference1;
+ typedef typename expression_traits< T >::const_reference const_reference2;
+ typedef typename expression_traits< T1 >::reference reference1;
+ typedef typename expression_traits< T >::reference reference2;
+ typedef typename expression_traits< T1 >::element_type element_type1;
+ typedef typename expression_traits< T >::element_type element_type2;
+ typedef typename expression_traits< T1 >::allocator_type allocator_type;
+ typedef typename expression_traits< T1 >::size_type size_type;
+ typedef element_type1 result_type;
+
+ };
+
+//--
+//--
+
+ namespace detail {
+
+ template< class T, bool E >
+ struct matrix_transpose
+ : matrix_transpose_traits< T >
+ {
+ typedef typename matrix_transpose_traits< T >::result_type result_type;
+ typedef typename matrix_transpose_traits< T >::const_reference2 const_reference2;
+
+ result_type operator()( const_reference2 t )
+ {
+ return transpose( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_transpose< T,false >
+ : matrix_transpose_traits< T >
+ {
+ typedef typename matrix_transpose_traits< T >::const_reference2 const_reference2;
+
+ const_reference2 operator()( const_reference2 t )
+ {
+ return t;
+ }
+ };
+
+ } // namespace detail
+
+ template< class T >
+ struct matrix_transpose
+ : matrix_transpose_traits< T >
+ {
+ typedef typename matrix_transpose_traits< T >::result_type result_type;
+ typedef typename matrix_transpose_traits< T >::type_const_reference2 type_const_reference2;
+ typedef typename matrix_transpose_traits< T >::type_reference1 type_reference1;
+ typedef typename matrix_transpose_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference2 t, size_type i, size_type j )
+ {
+ return detail::matrix_transpose< T,is_matrix< result_type >::type::value >()( t( j,i ) );
+ }
+
+ void operator()( type_reference1 t1, type_const_reference2 t2 )
+ {
+ for( std::size_t i = 0; i != t2.rows; ++i )
+ for( std::size_t j = 0; j != t2.cols; ++j )
+ t1( j,i ) = t2( i,j );
+ }
+ };
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A >
+ struct matrix_transpose< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >
+ : matrix_transpose_traits< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >
+ {
+ typedef matrix_transpose_traits< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > > traits;
+ typedef typename traits::type_reference1 type_reference1;
+ typedef typename traits::type_const_reference2 type_const_reference2;
+
+ void operator()( type_reference1 t1, type_const_reference2 t2 )
+ {
+ for( std::size_t i = 0; i != M; ++i )
+ for( std::size_t j = 0; j != N; ++j )
+ matrix_transpose< matrix< T,M1,N1,I1,A1 > >()( t1( j,i ), t2( i,j ) );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_negate
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return -t( i,j );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return -t;
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_sin
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::sin( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::sin( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_cos
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::cos( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::cos( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_tan
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::tan( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::tan( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_cosec
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return T(1) / std::sin( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::sin( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_sec
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return T(1) / std::cos( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::cos( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_cot
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return T(1) / std::tan( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::tan( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_sinh
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::sinh( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::sinh( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_cosh
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::cosh( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::cosh( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_tanh
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::tanh( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::tanh( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_cosech
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return T(1) / std::sinh( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::sinh( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_sech
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return T(1) / std::cosh( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::cosh( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_coth
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return T(1) / std::tanh( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::tanh( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_asin
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::asin( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::asin( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_asin< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return math::asin( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return math::asin( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_acos
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::acos( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::cos( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_acos< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return math::acos( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return math::acos( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_atan
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::atan( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::atan( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_atan< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return math::atan( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return math::atan( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_asinh
+ : expression_unary_traits< T >
+ {};
+
+ template< class T >
+ struct matrix_scalar_acosh
+ : expression_unary_traits< T >
+ {};
+
+ template< class T >
+ struct matrix_scalar_atanh
+ : expression_unary_traits< T >
+ {};
+
+ template< class T >
+ struct matrix_scalar_asinh< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return math::asinh( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return math::asinh( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_acosh< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return math::acosh( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return math::acosh( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_atanh< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return math::atanh( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return math::atanh( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_exp
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::exp( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::exp( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_log
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::log( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::log( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_log10
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::log10( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::log10( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_sqrt
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::sqrt( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::sqrt( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_abs
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::abs( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::abs( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_fabs
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return std::fabs( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return std::fabs( t );
+ }
+ };
+
+ template< class T >
+ struct matrix_scalar_fabs< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+ typedef typename expression_unary_traits< std::complex< T > >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i, size_type j )
+ {
+ return math::fabs( t( i,j ) );
+ }
+
+ result_type operator()( const_reference t )
+ {
+ return math::fabs( t );
+ }
+ };
+
+//--
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,N,M,matrix_transpose< E >,false >
+ transpose( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,N,M,matrix_transpose< E >,false >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_negate< E >,true >
+ operator-( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_negate< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_sin< E >,true >
+ sin( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_sin< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_cos< E >,true >
+ cos( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_cos< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_tan< E >,true >
+ tan( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_tan< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_cosec< E >,true >
+ cosec( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_cosec< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_sec< E >,true >
+ sec( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_sec< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_cot< E >,true >
+ cot( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_cot< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_sinh< E >,true >
+ sinh( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_sinh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_cosh< E >,true >
+ cosh( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_cosh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_tanh< E >,true >
+ tanh( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_tanh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_cosech< E >,true >
+ cosech( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_cosech< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_sech< E >,true >
+ sech( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_sech< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_coth< E >,true >
+ coth( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_coth< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_asin< E >,true >
+ asin( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_asin< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_acos< E >,true >
+ acos( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_acos< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_atan< E >,true >
+ atan( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_atan< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_asinh< E >,true >
+ asinh( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_asinh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_acosh< E >,true >
+ acosh( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_acosh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_atanh< E >,true >
+ atanh( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_atanh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_exp< E >,true >
+ exp( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_exp< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_log< E >,true >
+ log( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_log< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_log10< E >,true >
+ log10( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_log10< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_sqrt< E >,true >
+ sqrt( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_sqrt< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_abs< E >,true >
+ abs( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_abs< E >,true >( e() );
+ }
+
+ template< class E, std::size_t M, std::size_t N >
+ matrix_unary_expression< E,M,N,matrix_scalar_fabs< E >,true >
+ fabs( matrix_expression< E,M,N > const& e )
+ {
+ return matrix_unary_expression< E,M,N,matrix_scalar_fabs< E >,true >( e() );
+ }
+
+//--
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ class matrix_matrix_expression
+ : public matrix_expression< matrix_matrix_expression< E,M,N,O,L >,M,N >
+ {
+ public:
+
+ typedef matrix_matrix_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef E expression_type;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = ( L & E::linear ) };
+
+ matrix_matrix_expression();
+
+ result_type const operator()( size_type, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ };
+
+//--
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ matrix_matrix_expression< E,M,N,O,L >::matrix_matrix_expression()
+ {}
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_matrix_expression< E,M,N,O,L >::result_type const
+ matrix_matrix_expression< E,M,N,O,L >::operator()( size_type i, size_type j ) const
+ {
+ return operator_type()( i,j );
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_matrix_expression< E,M,N,O,L >::result_type const
+ matrix_matrix_expression< E,M,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( s );
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L > template< class U >
+ bool const matrix_matrix_expression< E,M,N,O,L >::references( scalar< U > const& ) const
+ {
+ return false;
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_matrix_expression< E,M,N,O,L >::references( vector< U,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class E, std::size_t M, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_matrix_expression< E,M,N,O,L >::references( matrix< U,P,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+//--
+
+ template< class T >
+ struct matrix_matrix_zero
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( size_type, size_type )
+ {
+ return result_type(0);
+ }
+
+ result_type operator()( size_type )
+ {
+ return result_type(0);
+ }
+ };
+
+ template< class T >
+ struct matrix_matrix_identity
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( size_type i, size_type j )
+ {
+ return i == j ? result_type(1) : result_type(0);
+ }
+
+ result_type operator()( size_type s )
+ {
+ return ((s % (T::cols + 1)) == 0) ? result_type(1) : result_type(0);
+ }
+ };
+
+//--
+
+ template< class T, std::size_t M, std::size_t N >
+ matrix_matrix_expression< matrix< T,M,N >,M,N,matrix_matrix_zero< matrix< T,M,N > >,true >
+ matrix_zero()
+ {
+ return matrix_matrix_expression< matrix< T,M,N >,M,N,
+ matrix_matrix_zero< matrix< T,M,N > >,true >();
+ }
+
+ template< class T, std::size_t N >
+ matrix_matrix_expression< matrix< T,N,N >,N,N,matrix_matrix_identity< matrix< T,N,N > >,true >
+ matrix_identity()
+ {
+ return matrix_matrix_expression< matrix< T,N,N >,N,N,
+ matrix_matrix_identity< matrix< T,N,N > >,true >();
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_MATRIX_MATRIX_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/math/matrix_scalar.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/matrix_scalar.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,244 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_MATRIX_SCALAR_HPP )
+#define BOOST_MAPS_MATH_MATRIX_SCALAR_HPP
+
+#include <boost/maps/math/matrix_matrix.hpp>
+#include <boost/maps/math/scalar_scalar.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ class matrix_scalar_binary_expression
+ : public matrix_expression< matrix_scalar_binary_expression< E1,E2,M,N,O,L >,M,N >
+ {
+ public:
+
+ typedef matrix_scalar_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E1::type_const_reference expression1_const_reference;
+ typedef typename E2::type_const_reference expression2_const_reference;
+ typedef E1 expression_type1;
+ typedef E2 expression_type2;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using matrix_expression< type,M,N >::operator();
+
+ enum { rows = M, cols = N };
+ enum { linear = ( L & E1::linear & E2::linear ) };
+
+ matrix_scalar_binary_expression( E1 const&, E2 const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ reference operator()( reference, size_type, size_type ) const;
+ result_type const operator()( size_type, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+ //--
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ matrix_scalar_binary_expression< E1,E2,M,N,O,L >::matrix_scalar_binary_expression( E1 const& e1, E2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_scalar_binary_expression< E1,E2,M,N,O,L >::type_reference
+ matrix_scalar_binary_expression< E1,E2,M,N,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) { t1 = e.t1; t2 = e.t2; }
+ return *this;
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_scalar_binary_expression< E1,E2,M,N,O,L >::expression_type1 const&
+ matrix_scalar_binary_expression< E1,E2,M,N,O,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_scalar_binary_expression< E1,E2,M,N,O,L >::expression_type2 const&
+ matrix_scalar_binary_expression< E1,E2,M,N,O,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_scalar_binary_expression< E1,E2,M,N,O,L >::reference
+ matrix_scalar_binary_expression< E1,E2,M,N,O,L >::operator()( reference r, size_type i, size_type j ) const
+ {
+ return operator_type()( r,t1,t2,i,j );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_scalar_binary_expression< E1,E2,M,N,O,L >::result_type const
+ matrix_scalar_binary_expression< E1,E2,M,N,O,L >::operator()( size_type i, size_type j ) const
+ {
+ return operator_type()( t1,t2,i,j );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L >
+ typename matrix_scalar_binary_expression< E1,E2,M,N,O,L >::result_type const
+ matrix_scalar_binary_expression< E1,E2,M,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1,t2,s );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L > template< class U >
+ bool const matrix_scalar_binary_expression< E1,E2,M,N,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_scalar_binary_expression< E1,E2,M,N,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_scalar_binary_expression< E1,E2,M,N,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct matrix_scalar_traits
+ {
+ typedef typename expression_traits< T1 >::type_const_reference type_const_reference1;
+ typedef typename expression_traits< T2 >::type_const_reference type_const_reference2;
+ typedef typename expression_traits< T1 >::type_reference type_reference1;
+ typedef typename expression_traits< T2 >::type_reference type_reference2;
+ typedef typename expression_traits< T1 >::const_reference const_reference1;
+ typedef typename expression_traits< T2 >::const_reference const_reference2;
+ typedef typename expression_traits< T1 >::reference reference1;
+ typedef typename expression_traits< T2 >::reference reference2;
+ typedef typename expression_traits< T1 >::element_type element_type1;
+ typedef typename expression_traits< T2 >::element_type element_type2;
+ typedef typename expression_traits< T1 >::allocator_type allocator_type;
+ typedef typename expression_traits< T1 >::size_type size_type;
+ typedef typename matrix_scalar_type< element_type1,element_type2 >::type result_type;
+
+ };
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct matrix_scalar_product
+ : matrix_scalar_traits< T1,T2 >
+ {
+ typedef typename matrix_scalar_traits< T1,T2 >::result_type result_type;
+ typedef typename matrix_scalar_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename matrix_scalar_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename matrix_scalar_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return r = t1( r,i,j ) * t2();
+ }
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return r = t1( r,s ) * t2();
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return t1( i,j ) * t2();
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return t1( s ) * t2();
+ }
+ };
+
+ template< class T1, class T2 >
+ struct scalar_matrix_product
+ : matrix_scalar_traits< T1,T2 >
+ {
+ typedef typename matrix_scalar_traits< T1,T2 >::result_type result_type;
+ typedef typename matrix_scalar_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename matrix_scalar_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename matrix_scalar_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return r = t1() * t2( r,i,j );
+ }
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return r = t1() * t2( r,s );
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return t1() * t2( i,j );
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return t1() * t2( s );
+ }
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t M, std::size_t N >
+ matrix_scalar_binary_expression< E1,E2,M,N,matrix_scalar_product< E1,E2 >,true >
+ operator*( matrix_expression< E1,M,N > const& e1, scalar_expression< E2 > const& e2 )
+ {
+ return matrix_scalar_binary_expression< E1,E2,M,N,
+ matrix_scalar_product< E1,E2 >,true >( e1(), e2() );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N >
+ matrix_scalar_binary_expression< E1,E2,M,N,scalar_matrix_product< E1,E2 >,true >
+ operator*( scalar_expression< E1 > const& e1, matrix_expression< E2,M,N > const& e2 )
+ {
+ return matrix_scalar_binary_expression< E1,E2,M,N,
+ scalar_matrix_product< E1,E2 >,true >( e1(), e2() );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_MATRIX_SCALAR_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/math/matrix_vector.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/matrix_vector.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,211 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_MATRIX_VECTOR_HPP )
+#define BOOST_MAPS_MATH_MATRIX_VECTOR_HPP
+
+#include <boost/maps/math/matrix_matrix.hpp>
+#include <boost/maps/math/vector_vector.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ class matrix_vector_binary_expression
+ : public matrix_expression< matrix_vector_binary_expression< E1,E2,N,O,L >,N,N >
+ {
+ public:
+
+ typedef matrix_vector_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E1::type_const_reference expression1_const_reference;
+ typedef typename E2::type_const_reference expression2_const_reference;
+ typedef E1 expression_type1;
+ typedef E2 expression_type2;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using matrix_expression< type,N,N >::operator();
+
+ enum { rows = N, cols = N };
+ enum { linear = ( L & E1::linear & E2::linear ) };
+
+ matrix_vector_binary_expression( E1 const&, E2 const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ reference operator()( reference, size_type, size_type ) const;
+ result_type const operator()( size_type, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ matrix_vector_binary_expression< E1,E2,N,O,L >::matrix_vector_binary_expression( E1 const& e1, E2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename matrix_vector_binary_expression< E1,E2,N,O,L >::type_reference
+ matrix_vector_binary_expression< E1,E2,N,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) { t1 = e.t1; t2 = e.t2; }
+ return *this;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename matrix_vector_binary_expression< E1,E2,N,O,L >::expression_type1 const&
+ matrix_vector_binary_expression< E1,E2,N,O,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename matrix_vector_binary_expression< E1,E2,N,O,L >::expression_type2 const&
+ matrix_vector_binary_expression< E1,E2,N,O,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename matrix_vector_binary_expression< E1,E2,N,O,L >::reference
+ matrix_vector_binary_expression< E1,E2,N,O,L >::operator()( reference r, size_type i, size_type j ) const
+ {
+ return operator_type()( r,t1,t2,i,j );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename matrix_vector_binary_expression< E1,E2,N,O,L >::result_type const
+ matrix_vector_binary_expression< E1,E2,N,O,L >::operator()( size_type i, size_type j ) const
+ {
+ return operator_type()( t1,t2,i,j );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename matrix_vector_binary_expression< E1,E2,N,O,L >::result_type const
+ matrix_vector_binary_expression< E1,E2,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1( s ), t2( s ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U >
+ bool const matrix_vector_binary_expression< E1,E2,N,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const matrix_vector_binary_expression< E1,E2,N,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const matrix_vector_binary_expression< E1,E2,N,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct outer_product_traits
+ {
+ typedef typename expression_traits< T1 >::type_const_reference type_const_reference1;
+ typedef typename expression_traits< T2 >::type_const_reference type_const_reference2;
+ typedef typename expression_traits< T1 >::type_reference type_reference1;
+ typedef typename expression_traits< T2 >::type_reference type_reference2;
+ typedef typename expression_traits< T1 >::const_reference const_reference1;
+ typedef typename expression_traits< T2 >::const_reference const_reference2;
+ typedef typename expression_traits< T1 >::reference reference1;
+ typedef typename expression_traits< T2 >::reference reference2;
+ typedef typename expression_traits< T1 >::element_type element_type1;
+ typedef typename expression_traits< T2 >::element_type element_type2;
+ typedef typename expression_traits< T1 >::allocator_type allocator_type;
+ typedef typename expression_traits< T1 >::size_type size_type;
+ typedef typename matrix_vector_type< element_type1,element_type2 >::type result_type;
+
+ };
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct vector_vector_outer_product
+ : outer_product_traits< T1,T2 >
+ {
+ typedef typename outer_product_traits< T1,T2 >::result_type result_type;
+ typedef typename outer_product_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename outer_product_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename outer_product_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename outer_product_traits< T1,T2 >::const_reference2 const_reference2;
+ typedef typename outer_product_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return r = t1( r,i ) * t2( r,j );
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type i, size_type j )
+ {
+ return t1( i ) * t2( j );
+ }
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 * t2;
+ }
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t N >
+ matrix_vector_binary_expression< E1,E2,N,vector_vector_outer_product< E1,E2 >,false >
+ outer_product( vector_expression< E1,N > const& e1, vector_expression< E2,N > const& e2 )
+ {
+ return matrix_vector_binary_expression< E1,E2,N,
+ vector_vector_outer_product< E1,E2 >,false >( e1(), e2() );
+ }
+
+ template< class E1, class E2, std::size_t N >
+ matrix_vector_binary_expression< E1,E2,N,vector_vector_outer_product< E1,E2 >,false >
+ operator*( vector_expression< E1,N > const& e1, vector_expression< E2,N > const& e2 )
+ {
+ return matrix_vector_binary_expression< E1,E2,N,
+ vector_vector_outer_product< E1,E2 >,false >( e1(), e2() );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_MATRIX_VECTOR_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/math/scalar.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/scalar.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,321 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_SCALAR_HPP )
+#define BOOST_MAPS_MATH_SCALAR_HPP
+
+#include <boost/maps/support/math.hpp>
+#include <boost/maps/math/scalar_scalar.hpp>
+#include <boost/maps/math/scalar_vector.hpp>
+
+namespace boost { namespace maps {
+
+ /*
+ scalar class template
+
+ parameters
+
+ required
+
+ T - data type we wish to store
+ type: arbitrary type
+ */
+
+ template< class T >
+ class scalar
+ : public scalar_expression< scalar< T > >
+ {
+ public:
+
+ typedef scalar type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef scalar_expression< type > base_type;
+ typedef T representation_type;
+ typedef T value_type;
+ typedef T const& const_reference_type;
+ typedef T& reference_type;
+ typedef T element_type;
+ typedef T const& const_reference;
+ typedef T& reference;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef T const* const_iterator;
+ typedef T* iterator;
+ typedef null::allocator allocator_type;
+ typedef mpl::size_t< 0 > dimensionality;
+
+ using scalar_expression< type >::operator();
+
+ enum { size = 1 };
+ enum { linear = true };
+
+ scalar();
+
+ scalar( scalar const& );
+ scalar( T const& );
+ template< class E > scalar( scalar_expression< E > const& );
+
+ scalar& operator=( scalar const& );
+ scalar& operator=( T const& );
+ template< class E > scalar& operator=( scalar_expression< E > const& );
+
+ ~scalar() {}
+
+ template< size_t B >size_type const bound() const;
+
+ void swap( scalar& );
+
+ const_reference operator[]( size_type ) const;
+ reference operator[]( size_type );
+
+ const_reference operator()( size_type ) const;
+ reference operator()( size_type );
+
+ operator T() const;
+
+ scalar& operator*=( T const& );
+ scalar& operator/=( T const& );
+ scalar& operator+=( T const& );
+ scalar& operator-=( T const& );
+
+ scalar& operator*=( scalar const& );
+ scalar& operator/=( scalar const& );
+ scalar& operator+=( scalar const& );
+ scalar& operator-=( scalar const& );
+
+ template< class E > scalar& operator*=( scalar_expression< E > const& );
+ template< class E > scalar& operator/=( scalar_expression< E > const& );
+ template< class E > scalar& operator+=( scalar_expression< E > const& );
+ template< class E > scalar& operator-=( scalar_expression< E > const& );
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ representation_type data;
+
+ public:
+
+ template< class T1, class C, class CT >
+ friend std::basic_ostream< C,CT >& operator<<( std::basic_ostream< C,CT >& o, scalar< T1 > const& );
+
+ };
+
+//--
+
+ template< class T >
+ scalar< T >::scalar() : data( T() )
+ {}
+
+ template< class T >
+ scalar< T >::scalar( scalar const& t ) : data( t.data )
+ {}
+
+ template< class T >
+ scalar< T >::scalar( T const& t ) : data( t )
+ {}
+
+ template< class T > template< class E >
+ scalar< T >::scalar( scalar_expression< E > const& e )
+ {
+ scalar_assign< type,E,scalar_scalar_assign< type,E >,E::linear >()( *this, e );
+ }
+
+ template< class T >
+ scalar< T >& scalar< T >::operator=( T const& t )
+ {
+ data = t;
+ return *this;
+ }
+
+ template< class T >
+ scalar< T >& scalar< T >::operator=( scalar const& t )
+ {
+ if( &t != this ) data = t.data;
+ return *this;
+ }
+
+ template< class T > template< class E >
+ scalar< T >& scalar< T >::operator=( scalar_expression< E > const& e )
+ {
+ scalar_assign< type,E,scalar_scalar_assign< type,E >,E::linear >()( *this, e );
+ return *this;
+ }
+
+ template< class T > template< size_t B >
+ typename scalar< T >::size_type const scalar< T >::bound() const
+ {
+ BOOST_STATIC_ASSERT( B == 0 );
+ return 1;
+ } // bound
+
+ template< class T >
+ void scalar< T >::swap( scalar& o )
+ {
+ if( &o != this ) { T t = o.data; o.data = data; data = t; }
+ } // swap
+
+ template< class T >
+ typename scalar< T >::const_reference scalar< T >::operator[]( size_type s ) const
+ {
+ BOOST_ASSERT( s == 0 );
+ return data;
+ } // operator() const
+
+ template< class T >
+ typename scalar< T >::reference scalar< T >::operator[]( size_type s )
+ {
+ BOOST_ASSERT( s == 0 );
+ return data;
+ } // operator()
+
+ template< class T >
+ typename scalar< T >::const_reference scalar< T >::operator()( size_type s ) const
+ {
+ BOOST_ASSERT( s == 0 );
+ return data;
+ } // operator() const
+
+ template< class T >
+ typename scalar< T >::reference scalar< T >::operator()( size_type s )
+ {
+ BOOST_ASSERT( s == 0 );
+ return data;
+ } // operator()
+
+ template< class T >
+ scalar< T >::operator T() const
+ {
+ return data;
+ }
+
+ template< class T >
+ scalar< T >& scalar< T >::operator*=( T const& t )
+ {
+ data *= t;
+ return *this;
+ } // operator*=
+
+ template< class T >
+ scalar< T >& scalar< T >::operator/=( T const& t )
+ {
+ data /= t;
+ return *this;
+ } // operator/=
+
+ template< class T >
+ scalar< T >& scalar< T >::operator+=( T const& t )
+ {
+ data += t;
+ return *this;
+ } // operator+=
+
+ template< class T >
+ scalar< T >& scalar< T >::operator-=( T const& t )
+ {
+ data -= t;
+ return *this;
+ } // operator-=
+
+ template< class T >
+ scalar< T >& scalar< T >::operator*=( scalar const& s )
+ {
+ data *= s.data;
+ return *this;
+ } // operator*=
+
+ template< class T >
+ scalar< T >& scalar< T >::operator/=( scalar const& s )
+ {
+ data /= s.data;
+ return *this;
+ } // operator/=
+
+ template< class T >
+ scalar< T >& scalar< T >::operator+=( scalar const& s )
+ {
+ data += s.data;
+ return *this;
+ } // operator+=
+
+ template< class T >
+ scalar< T >& scalar< T >::operator-=( scalar const& s )
+ {
+ data -= s.data;
+ return *this;
+ } // operator-=
+
+ template< class T > template< class E >
+ scalar< T >& scalar< T >::operator*=( scalar_expression< E > const& e )
+ {
+ data *= e()( 0 );
+ return *this;
+ } // operator*=
+
+ template< class T > template< class E >
+ scalar< T >& scalar< T >::operator/=( scalar_expression< E > const& e )
+ {
+ data /= e()( 0 );
+ return *this;
+ } // operator/=
+
+ template< class T > template< class E >
+ scalar< T >& scalar< T >::operator+=( scalar_expression< E > const& e )
+ {
+ data += e()( 0 );
+ return *this;
+ } // operator+=
+
+ template< class T > template< class E >
+ scalar< T >& scalar< T >::operator-=( scalar_expression< E > const& e )
+ {
+ data -= e()( 0 );
+ return *this;
+ } // operator-=
+
+ template< class T > template< class U >
+ bool const scalar< T >::references( scalar< U > const& s ) const
+ {
+ return ( reinterpret_cast< scalar< T > const* >( &s ) == this );
+ }
+
+ template< class T > template< class U, std::size_t Q, bool J, class B >
+ bool const scalar< T >::references( vector< U,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class T > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const scalar< T >::references( matrix< U,P,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+//--
+//--
+
+ template< class T1, class C, class CT >
+ std::basic_ostream< C,CT >& operator<<( std::basic_ostream< C,CT >& o, scalar< T1 > const& s )
+ {
+ o << s.data;
+ return o;
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_SCALAR_HPP

Added: sandbox/maps/maps/boost/maps/math/scalar_matrix.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/scalar_matrix.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,146 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_SCALAR_MATRIX_HPP )
+#define BOOST_MAPS_MATH_SCALAR_MATRIX_HPP
+
+#include <boost/maps/math/scalar_scalar.hpp>
+#include <boost/maps/math/matrix_matrix.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E, class O, bool L >
+ class scalar_matrix_unary_expression
+ : public scalar_expression< scalar_matrix_unary_expression< E,O,L > >
+ {
+ public:
+
+ typedef scalar_matrix_unary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E::type_const_reference expression_const_reference;
+ typedef E expression_type;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using scalar_expression< type >::operator();
+
+ enum { size = 1 };
+ enum { linear = ( L & E::linear ) };
+
+ scalar_matrix_unary_expression( E const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type const& expression() const;
+
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression_const_reference t;
+
+ };
+
+//--
+
+ template< class E, class O, bool L >
+ scalar_matrix_unary_expression< E,O,L >::scalar_matrix_unary_expression( E const& e )
+ : t( e )
+ {}
+
+ template< class E, class O, bool L >
+ typename scalar_matrix_unary_expression< E,O,L >::type_reference
+ scalar_matrix_unary_expression< E,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) t = e.t;
+ return *this;
+ }
+
+ template< class E, class O, bool L >
+ typename scalar_matrix_unary_expression< E,O,L >::expression_type const&
+ scalar_matrix_unary_expression< E,O,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class E, class O, bool L >
+ typename scalar_matrix_unary_expression< E,O,L >::result_type const
+ scalar_matrix_unary_expression< E,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t );
+ }
+
+ template< class E, class O, bool L > template< class U >
+ bool const scalar_matrix_unary_expression< E,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t().references( s ) );
+ }
+
+ template< class E, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const scalar_matrix_unary_expression< E,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t().references( v ) );
+ }
+
+ template< class E, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const scalar_matrix_unary_expression< E,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t().references( m ) );
+ }
+
+//--
+
+ template< class T >
+ struct matrix_norm_1
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t )
+ {
+ result_type r = result_type();
+ for( size_type j = 0; j != t.cols; ++j )
+ { result_type s = result_type();
+ for( size_type i = 0; i != t.rows; ++i )
+ s += std::abs( t( i,j ) );
+ if( s > r ) r = s;
+ }
+ return r;
+ }
+ };
+
+//--
+
+ template< class E, std::size_t M, std::size_t N >
+ scalar_matrix_unary_expression< E,matrix_norm_1< E >,true >
+ norm_1( matrix_expression< E,M,N > const& e )
+ {
+ return scalar_matrix_unary_expression< E,matrix_norm_1< E >,true >( e() );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_SCALAR_MATRIX_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/math/scalar_scalar.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/scalar_scalar.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,952 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_SCALAR_SCALAR_HPP )
+#define BOOST_MAPS_MATH_SCALAR_SCALAR_HPP
+
+#include <boost/maps/support/expression.hpp>
+
+#include <boost/math/complex.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E >
+ class scalar_expression
+ : expression< scalar_expression< E > >
+ {
+ public:
+
+ typedef scalar_expression type;
+ typedef E value_type;
+ typedef value_type const& const_reference;
+ typedef value_type& reference;
+
+ const_reference operator()() const
+ {
+ return *static_cast< value_type const* >( this );
+ }
+
+ reference operator()()
+ {
+ return *static_cast< value_type* >( this );
+ }
+
+ };
+
+//--
+
+ template< class E1, class E2, class O, bool L >
+ class scalar_binary_expression
+ : public scalar_expression< scalar_binary_expression< E1,E2,O,L > >
+ {
+ public:
+
+ typedef scalar_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E1::type_const_reference expression1_const_reference;
+ typedef typename E2::type_const_reference expression2_const_reference;
+ typedef E1 expression_type1;
+ typedef E2 expression_type2;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using scalar_expression< type >::operator();
+
+ enum { size = E1::size };
+ enum { linear = ( L & E1::linear & E2::linear ) };
+
+ scalar_binary_expression( E1 const&, E2 const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class E1, class E2, class O, bool L >
+ scalar_binary_expression< E1,E2,O,L >::scalar_binary_expression( E1 const& e1, E2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E1, class E2, class O, bool L >
+ typename scalar_binary_expression< E1,E2,O,L >::type_reference
+ scalar_binary_expression< E1,E2,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) { t1 = e.t1; t2 = e.t2; }
+ return *this;
+ }
+
+ template< class E1, class E2, class O, bool L >
+ typename scalar_binary_expression< E1,E2,O,L >::expression_type1 const&
+ scalar_binary_expression< E1,E2,O,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E1, class E2, class O, bool L >
+ typename scalar_binary_expression< E1,E2,O,L >::expression_type2 const&
+ scalar_binary_expression< E1,E2,O,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E1, class E2, class O, bool L >
+ typename scalar_binary_expression< E1,E2,O,L >::result_type const
+ scalar_binary_expression< E1,E2,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1( s ), t2( s ) );
+ }
+
+ template< class E1, class E2, class O, bool L > template< class U >
+ bool const scalar_binary_expression< E1,E2,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E1, class E2, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const scalar_binary_expression< E1,E2,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E1, class E2, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const scalar_binary_expression< E1,E2,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct scalar_scalar_product
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::result_type result_type;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 * t2;
+ }
+ };
+
+ template< class T1, class T2 >
+ struct scalar_scalar_division
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::result_type result_type;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 / t2;
+ }
+ };
+
+ template< class T1, class T2 >
+ struct scalar_scalar_addition
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::result_type result_type;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 + t2;
+ }
+ };
+
+ template< class T1, class T2 >
+ struct scalar_scalar_subtraction
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::result_type result_type;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 - t2;
+ }
+ };
+
+//--
+
+ template< class E1, class E2 >
+ scalar_binary_expression< E1,E2,scalar_scalar_product< E1,E2 >,true >
+ operator*( scalar_expression< E1 > const& e1, scalar_expression< E2 > const& e2 )
+ {
+ return scalar_binary_expression< E1,E2,
+ scalar_scalar_product< E1,E2 >,true >( e1(), e2() );
+ }
+
+ template< class E1, class E2 >
+ scalar_binary_expression< E1,E2,scalar_scalar_division< E1,E2 >,true >
+ operator/( scalar_expression< E1 > const& e1, scalar_expression< E2 > const& e2 )
+ {
+ return scalar_binary_expression< E1,E2,
+ scalar_scalar_division< E1,E2 >,true >( e1(), e2() );
+ }
+
+ template< class E1, class E2 >
+ scalar_binary_expression< E1,E2,scalar_scalar_addition< E1,E2 >,true >
+ operator+( scalar_expression< E1 > const& e1, scalar_expression< E2 > const& e2 )
+ {
+ return scalar_binary_expression< E1,E2,
+ scalar_scalar_addition< E1,E2 >,true >( e1(), e2() );
+ }
+
+ template< class E1, class E2 >
+ scalar_binary_expression< E1,E2,scalar_scalar_subtraction< E1,E2 >,true >
+ operator-( scalar_expression< E1 > const& e1, scalar_expression< E2 > const& e2 )
+ {
+ return scalar_binary_expression< E1,E2,
+ scalar_scalar_subtraction< E1,E2 >,true >( e1(), e2() );
+ }
+
+//--
+
+ template< class T1, class T2 >
+ struct scalar_scalar_assign
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::reference1 reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+
+ void operator()( reference1 t1, const_reference2 t2 )
+ {
+ t1 = t2;
+ }
+ };
+
+//--
+
+ template< class T, class E, class O, bool L >
+ struct scalar_assign
+ {
+ typedef T& reference;
+ typedef scalar_expression< E > const& expression_const_reference;
+ typedef O operator_type;
+
+ void operator()( reference s, expression_const_reference e )
+ {
+ operator_type()( s( 0 ), e()( 0 ) );
+ }
+ };
+
+//--
+//--
+
+ template< class E, class O, bool L >
+ class scalar_unary_expression
+ : public scalar_expression< scalar_unary_expression< E,O,L > >
+ {
+ public:
+
+ typedef scalar_unary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E::type_const_reference expression_const_reference;
+ typedef E expression_type;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using scalar_expression< type >::operator();
+
+ enum { size = E::size };
+ enum { linear = ( L & E::linear ) };
+
+ scalar_unary_expression( E const& );
+
+ expression_type const& expression() const;
+
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression_const_reference t;
+
+ };
+
+//--
+
+ template< class E, class O, bool L >
+ scalar_unary_expression< E,O,L >::scalar_unary_expression( E const& e )
+ : t( e )
+ {}
+
+ template< class E, class O, bool L >
+ typename scalar_unary_expression< E,O,L >::expression_type const&
+ scalar_unary_expression< E,O,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class E, class O, bool L >
+ typename scalar_unary_expression< E,O,L >::result_type const
+ scalar_unary_expression< E,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t( s ) );
+ }
+
+ template< class E, class O, bool L > template< class U >
+ bool const scalar_unary_expression< E,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t().references( s ) );
+ }
+
+ template< class E, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const scalar_unary_expression< E,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t().references( v ) );
+ }
+
+ template< class E, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const scalar_unary_expression< E,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T >
+ struct scalar_negate
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return -t;
+ }
+ };
+
+ template< class T >
+ struct scalar_sin
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::sin( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_cos
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::cos( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_tan
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::tan( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_cosec
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::sin( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_sec
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::cos( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_cot
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::tan( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_sinh
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::sinh( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_cosh
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::cosh( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_tanh
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::tanh( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_cosech
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::sinh( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_sech
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::cosh( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_coth
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return T(1) / std::tanh( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_asin
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::asin( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_asin< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return math::asin( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_acos
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::acos( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_acos< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return math::acos( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_atan
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::atan( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_atan< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return math::atan( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_asinh
+ : expression_unary_traits< T >
+ {};
+
+ template< class T >
+ struct scalar_acosh
+ : expression_unary_traits< T >
+ {};
+
+ template< class T >
+ struct scalar_atanh
+ : expression_unary_traits< T >
+ {};
+
+ template< class T >
+ struct scalar_asinh< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return math::asinh( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_acosh< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return math::acosh( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_atanh< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return math::atanh( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_exp
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::exp( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_log
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::log( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_log10
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::log10( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_sqrt
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::sqrt( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_sqr
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return t * t;
+ }
+ };
+
+ template< class T >
+ struct scalar_abs
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::abs( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_fabs
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return std::fabs( t );
+ }
+ };
+
+ template< class T >
+ struct scalar_fabs< std::complex< T > >
+ : expression_unary_traits< std::complex< T > >
+ {
+ typedef typename expression_unary_traits< std::complex< T > >::result_type result_type;
+ typedef typename expression_unary_traits< std::complex< T > >::const_reference const_reference;
+
+ result_type operator()( const_reference t )
+ {
+ return math::fabs( t );
+ }
+ };
+
+//--
+//--
+
+ template< class E >
+ scalar_unary_expression< E,scalar_negate< E >,true >
+ operator-( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_negate< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_sin< E >,true >
+ sin( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_sin< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_cos< E >,true >
+ cos( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_cos< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_tan< E >,true >
+ tan( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_tan< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_cosec< E >,true >
+ cosec( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_cosec< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_sec< E >,true >
+ sec( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_sec< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_cot< E >,true >
+ cot( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_cot< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_sinh< E >,true >
+ sinh( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_sinh< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_cosh< E >,true >
+ cosh( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_cosh< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_tanh< E >,true >
+ tanh( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_tanh< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_cosech< E >,true >
+ cosech( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_cosech< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_sech< E >,true >
+ sech( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_sech< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_coth< E >,true >
+ coth( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_coth< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_asin< E >,true >
+ asin( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_asin< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_acos< E >,true >
+ acos( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_acos< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_atan< E >,true >
+ atan( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_atan< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_asinh< E >,true >
+ asinh( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_asinh< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_acosh< E >,true >
+ acosh( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_acosh< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_atanh< E >,true >
+ atanh( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_atanh< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_exp< E >,true >
+ exp( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_exp< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_log< E >,true >
+ log( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_log< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_log10< E >,true >
+ log10( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_log10< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_sqrt< E >,true >
+ sqrt( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_sqrt< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_sqr< E >,true >
+ sqr( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_sqr< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_abs< E >,true >
+ abs( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_abs< E >,true >( e() );
+ }
+
+ template< class E >
+ scalar_unary_expression< E,scalar_fabs< E >,true >
+ fabs( scalar_expression< E > const& e )
+ {
+ return scalar_unary_expression< E,scalar_fabs< E >,true >( e() );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_SCALAR_SCALAR_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/math/scalar_vector.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/scalar_vector.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,307 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_SCALAR_VECTOR_HPP )
+#define BOOST_MAPS_MATH_SCALAR_VECTOR_HPP
+
+#include <boost/maps/math/scalar_scalar.hpp>
+#include <boost/maps/math/vector_vector.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E1, class E2, class O, bool L >
+ class scalar_vector_binary_expression
+ : public scalar_expression< scalar_vector_binary_expression< E1,E2,O,L > >
+ {
+ public:
+
+ typedef scalar_vector_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E1::type_const_reference expression1_const_reference;
+ typedef typename E2::type_const_reference expression2_const_reference;
+ typedef E1 expression_type1;
+ typedef E2 expression_type2;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using scalar_expression< type >::operator();
+
+ enum { size = 1 };
+ enum { linear = ( L & E1::linear & E2::linear ) };
+
+ scalar_vector_binary_expression( E1 const&, E2 const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class E1, class E2, class O, bool L >
+ scalar_vector_binary_expression< E1,E2,O,L >::scalar_vector_binary_expression( E1 const& e1, E2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E1, class E2, class O, bool L >
+ typename scalar_vector_binary_expression< E1,E2,O,L >::type_reference
+ scalar_vector_binary_expression< E1,E2,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) { t1 = e.t1; t2 = e.t2; }
+ return *this;
+ }
+
+ template< class E1, class E2, class O, bool L >
+ typename scalar_vector_binary_expression< E1,E2,O,L >::expression_type1 const&
+ scalar_vector_binary_expression< E1,E2,O,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E1, class E2, class O, bool L >
+ typename scalar_vector_binary_expression< E1,E2,O,L >::expression_type2 const&
+ scalar_vector_binary_expression< E1,E2,O,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E1, class E2, class O, bool L >
+ typename scalar_vector_binary_expression< E1,E2,O,L >::result_type const
+ scalar_vector_binary_expression< E1,E2,O,L >::operator()( size_type ) const
+ {
+ return operator_type()( t1, t2 );
+ }
+
+ template< class E1, class E2, class O, bool L > template< class U >
+ bool const scalar_vector_binary_expression< E1,E2,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E1, class E2, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const scalar_vector_binary_expression< E1,E2,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E1, class E2, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const scalar_vector_binary_expression< E1,E2,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct scalar_vector_inner_product
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::result_type result_type;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::size_type size_type;
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2 )
+ {
+ result_type r = result_type();
+ for( size_type k = 0; k != t1.size; ++k )
+ r += t1( k ) * t2( k );
+ return r;
+ }
+ };
+
+//--
+
+ /*
+ vector inner product
+ < x,y > = sum( i = 1 to N ) x( i ).y( i )
+ or < x,y > = ||x||.||y||.cos( t ), t = angle between x and y
+ x, y orthogonal if < x,y > = 0
+ < x,x > = 0 iff x = 0
+ */
+
+ template< class E1, class E2, std::size_t N >
+ scalar_vector_binary_expression< E1,E2,scalar_vector_inner_product< E1,E2 >,true >
+ inner_product( vector_expression< E1,N > const& e1, vector_expression< E2,N > const& e2 )
+ {
+ return scalar_vector_binary_expression< E1,E2,
+ scalar_vector_inner_product< E1,E2 >,true >( e1(), e2() );
+ }
+
+//--
+//--
+
+ template< class E, class O, bool L >
+ class scalar_vector_unary_expression
+ : public scalar_expression< scalar_vector_unary_expression< E,O,L > >
+ {
+ public:
+
+ typedef scalar_vector_unary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E::type_const_reference expression_const_reference;
+ typedef E expression_type;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using scalar_expression< type >::operator();
+
+ enum { size = 1 };
+ enum { linear = ( L & E::linear ) };
+
+ scalar_vector_unary_expression( E const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type const& expression() const;
+
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression_const_reference t;
+
+ };
+
+//--
+
+ template< class E, class O, bool L >
+ scalar_vector_unary_expression< E,O,L >::scalar_vector_unary_expression( E const& e )
+ : t( e )
+ {}
+
+ template< class E, class O, bool L >
+ typename scalar_vector_unary_expression< E,O,L >::type_reference
+ scalar_vector_unary_expression< E,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) t = e.t;
+ return *this;
+ }
+
+ template< class E, class O, bool L >
+ typename scalar_vector_unary_expression< E,O,L >::expression_type const&
+ scalar_vector_unary_expression< E,O,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class E, class O, bool L >
+ typename scalar_vector_unary_expression< E,O,L >::result_type const
+ scalar_vector_unary_expression< E,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t );
+ }
+
+ template< class E, class O, bool L > template< class U >
+ bool const scalar_vector_unary_expression< E,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t().references( s ) );
+ }
+
+ template< class E, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const scalar_vector_unary_expression< E,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t().references( v ) );
+ }
+
+ template< class E, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const scalar_vector_unary_expression< E,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T >
+ struct scalar_vector_euclidean_norm
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t )
+ {
+ result_type r = result_type();
+ for( size_type k = 0; k != t.size; ++k )
+ r += t( k ) * t( k );
+ return r;
+ }
+ };
+
+ template< class T >
+ struct scalar_vector_magnitude
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+
+ result_type operator()( type_const_reference t )
+ {
+ return std::sqrt( scalar_vector_euclidean_norm< T >()( t ) );
+ }
+ };
+
+//--
+
+ template< class E, std::size_t N >
+ scalar_vector_unary_expression< E,scalar_vector_euclidean_norm< E >,false >
+ euclidean_norm( vector_expression< E,N > const& e )
+ {
+ return scalar_vector_unary_expression< E,scalar_vector_euclidean_norm< E >,false >( e() );
+ }
+
+ template< class E, std::size_t N >
+ scalar_vector_unary_expression< E,scalar_vector_magnitude< E >,false >
+ magnitude( vector_expression< E,N > const& e )
+ {
+ return scalar_vector_unary_expression< E,scalar_vector_magnitude< E >,false >( e() );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_SCALAR_VECTOR_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/math/vector.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/vector.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,405 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_VECTOR_HPP )
+#define BOOST_MAPS_MATH_VECTOR_HPP
+
+#include <boost/maps/support/math.hpp>
+#include <boost/maps/math/vector_vector.hpp>
+#include <boost/maps/math/vector_matrix.hpp>
+#include <boost/maps/math/vector_scalar.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class T, std::size_t N, bool I, class A, std::size_t K >
+ struct vector_equality
+ {
+ typedef typename vector< T,N,I,A >::const_iterator const_iterator;
+
+ bool operator()( const_iterator x, const_iterator y )
+ {
+ if( *x != *y ) return false;
+ else return vector_equality< T,N,I,A,K-1 >()( x+1, y+1 );
+ }
+ };
+
+ template< class T, std::size_t N, bool I, class A >
+ struct vector_equality< T,N,I,A,1 >
+ {
+ typedef typename vector< T,N,I,A >::const_iterator const_iterator;
+
+ bool operator()( const_iterator x, const_iterator y )
+ {
+ if( *x != *y ) return false;
+ else return true;
+ }
+ };
+
+//--
+
+ /*
+ fixed size vector class template
+
+ parameters
+
+ required
+
+ T - data type we wish to store
+ type: arbitrary type
+ N - number of components
+ type: std::size_t
+
+ optional
+
+ I - initialization parameter
+ type: bool
+ default: true, data elements zero/default initialized
+ A - allocator
+ type: standard conforming allocator, or null::allocator
+ default: null::allocator, statically allocated array
+ */
+
+ template< class T, std::size_t N, bool I, class A >
+ class vector
+ : public vector_expression< vector< T,N,I,A >, N >
+ {
+ public:
+
+ typedef vector type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef vector_expression< type,N > base_type;
+ typedef typename vector_type< T,N,I,A >::type representation_type;
+ typedef typename representation_type::value_type value_type;
+ typedef typename representation_type::const_reference_type const_reference_type;
+ typedef typename representation_type::reference_type reference_type;
+ typedef typename representation_type::element_type element_type;
+ typedef typename representation_type::const_reference const_reference;
+ typedef typename representation_type::reference reference;
+ typedef typename representation_type::size_type size_type;
+ typedef typename representation_type::difference_type difference_type;
+ typedef typename representation_type::const_iterator const_iterator;
+ typedef typename representation_type::iterator iterator;
+ typedef A allocator_type;
+ typedef mpl::size_t< 1 > dimensionality;
+ typedef mpl::bool_< I > initialize;
+
+ using vector_expression< type,N >::operator();
+
+ enum { size = N };
+ enum { linear = true };
+
+ protected:
+
+ typedef assigner< type,N-1 > assigner_type;
+
+ public:
+
+ vector();
+
+ vector( vector const& );
+ template< class E > vector( vector_expression< E,N > const& );
+
+ vector& operator=( vector const& );
+ template< class E > vector& operator=( vector_expression< E,N > const& );
+ assigner_type operator=( const_reference );
+
+ ~vector() {}
+
+ template< size_t B > size_type const bound() const;
+
+ void swap( vector& );
+
+ const_reference_type operator[]( size_type ) const;
+ reference_type operator[]( size_type );
+
+ const_reference operator()( reference, size_type ) const;
+ reference operator()( reference, size_type );
+
+ const_reference operator()( size_type ) const;
+ reference operator()( size_type );
+
+ const_iterator begin() const;
+ iterator begin();
+ const_iterator end() const;
+ iterator end();
+
+ vector& operator+=( vector const& );
+ vector& operator-=( vector const& );
+ vector& operator*=( T const& );
+ vector& operator/=( T const& );
+
+ template< class E > vector& operator+=( vector_expression< E,N > const& );
+ template< class E > vector& operator-=( vector_expression< E,N > const& );
+ template< class E > vector& operator*=( scalar_expression< E > const& );
+ template< class E > vector& operator/=( scalar_expression< E > const& );
+
+ bool const operator==( vector const& ) const;
+ bool const operator!=( vector const& ) const;
+
+ void normalize();
+ void clear();
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ representation_type data;
+
+ public:
+
+ template< class T1, std::size_t N1, bool I1, class A1, class C, class CT >
+ friend std::basic_ostream< C, CT >& operator<<( std::basic_ostream< C, CT >&, vector< T1,N1,I1,A1 > const& );
+
+ };
+
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ inline vector< T,N,I,A >::vector()
+ {} // constructor
+
+ template< class T, std::size_t N, bool I, class A >
+ vector< T,N,I,A >::vector( vector const& v ) : data( v.data )
+ {}
+
+ template< class T, std::size_t N, bool I, class A > template< class E >
+ vector< T,N,I,A >::vector( vector_expression< E,N > const& e )
+ {
+ vector_assign< type,E,N,vector_vector_assign< type,E >,E::linear,true >()( *this, e );
+ }
+
+ template< class T, std::size_t N, bool I, class A >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator=( vector const& v )
+ {
+ if( &v != this ) data = v.data;
+ return *this;
+ }
+
+ template< class T, std::size_t N, bool I, class A > template< class E >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator=( vector_expression< E,N > const& e )
+ {
+ vector_assign< type,E,N,vector_vector_assign< type,E >,E::linear,false >()( *this, e );
+ return *this;
+ }
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::assigner_type vector< T,N,I,A >::operator=( const_reference t )
+ {
+ return assigner_type( *this, begin(), t );
+ } // initializing assignment
+
+ template< class T, std::size_t N, bool I, class A > template< size_t B >
+ typename vector< T,N,I,A >::size_type const vector< T,N,I,A >::bound() const
+ {
+ BOOST_STATIC_ASSERT( B == 0 );
+ return N;
+ } // bound
+
+ template< class T, std::size_t N, bool I, class A >
+ void vector< T,N,I,A >::swap( vector& o )
+ {
+ if( &o != this ) data.swap( o.data );
+ } // swap
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::const_reference_type vector< T,N,I,A >::operator[]( size_type s ) const
+ {
+ BOOST_ASSERT( s < size );
+ return data[s];
+ } // operator[] const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::reference_type vector< T,N,I,A >::operator[]( size_type s )
+ {
+ BOOST_ASSERT( s < size );
+ return data[s];
+ } // operator[]
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::const_reference vector< T,N,I,A >::operator()( reference, size_type s ) const
+ {
+ BOOST_ASSERT( s < size );
+ return *( data+s );
+ } // operator() const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::reference vector< T,N,I,A >::operator()( reference, size_type s )
+ {
+ BOOST_ASSERT( s < size );
+ return *( data+s );
+ } // operator()
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::const_reference vector< T,N,I,A >::operator()( size_type s ) const
+ {
+ BOOST_ASSERT( s < size );
+ return *( data+s );
+ } // operator() const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::reference vector< T,N,I,A >::operator()( size_type s )
+ {
+ BOOST_ASSERT( s < size );
+ return *( data+s );
+ } // operator()
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::const_iterator vector< T,N,I,A >::begin() const
+ {
+ return data.begin();
+ } // begin const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::iterator vector< T,N,I,A >::begin()
+ {
+ return data.begin();
+ } // begin
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::const_iterator vector< T,N,I,A >::end() const
+ {
+ return data.end();
+ } // end const
+
+ template< class T, std::size_t N, bool I, class A >
+ typename vector< T,N,I,A >::iterator vector< T,N,I,A >::end()
+ {
+ return data.end();
+ } // end
+
+ template< class T, std::size_t N, bool I, class A >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator+=( vector const& v )
+ {
+ for( std::size_t i = 0; i != N; ++i ) data[i] += v[i];
+ return *this;
+ } // operator += vector
+
+ template< class T, std::size_t N, bool I, class A >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator-=( vector const& v )
+ {
+ for( std::size_t i = 0; i != N; ++i ) data[i] -= v[i];
+ return *this;
+ } // operator -= vector
+
+ template< class T, std::size_t N, bool I, class A >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator*=( T const& t )
+ {
+ for( std::size_t i = 0; i != N; ++i ) data[i] *= t;
+ return *this;
+ } // operator *= scalar
+
+ template< class T, std::size_t N, bool I, class A >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator/=( T const& t )
+ {
+ T x = t;
+ BOOST_ASSERT( x != T(0) );
+ for( std::size_t i = 0; i != N; ++i ) data[i] /= x;
+ return *this;
+ } // operator /= scalar
+
+ template< class T, std::size_t N, bool I, class A > template< class E >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator+=( vector_expression< E,N > const& e )
+ {
+ for( std::size_t i = 0; i != N; ++i ) data[i] += e()( i );
+ return *this;
+ } // operator += vector_expression
+
+ template< class T, std::size_t N, bool I, class A > template< class E >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator-=( vector_expression< E,N > const& e )
+ {
+ for( std::size_t i = 0; i != N; ++i ) data[i] -= e()( i );
+ return *this;
+ } // operator -= vector_expression
+
+ template< class T, std::size_t N, bool I, class A > template< class E >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator*=( scalar_expression< E > const& e )
+ {
+ for( std::size_t i = 0; i != N; ++i ) data[i] *= e()( 0 );
+ return *this;
+ } // operator *= scalar_expression
+
+ template< class T, std::size_t N, bool I, class A > template< class E >
+ vector< T,N,I,A >& vector< T,N,I,A >::operator/=( scalar_expression< E > const& e )
+ {
+ T x = e()( 0 );
+ BOOST_ASSERT( x != T(0) );
+ for( std::size_t i = 0; i != N; ++i ) data[i] /= x;
+ return *this;
+ } // operator /= scalar_expression
+
+ template< class T, std::size_t N, bool I, class A >
+ inline bool const vector< T,N,I,A >::operator==( vector< T,N,I,A > const& o ) const
+ {
+ return vector_equality< T,N,I,A,N >()( begin(), o.begin() );
+ } // operator ==
+
+ template< class T, std::size_t N, bool I, class A >
+ inline bool const vector< T,N,I,A >::operator!=( vector< T,N,I,A > const& o ) const
+ {
+ return !( vector_equality< T,N,I,A,N >()( begin(), o.begin() ) );
+ } // operator !=
+
+ template< class T, std::size_t N, bool I, class A > template< class U >
+ bool const vector< T,N,I,A >::references( scalar< U > const& s ) const
+ {
+ return false;
+ }
+
+ template< class T, std::size_t N, bool I, class A > template< class U, std::size_t Q, bool J, class B >
+ bool const vector< T,N,I,A >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( reinterpret_cast< vector< T,N,I,A > const* >( &v ) == this );
+ }
+
+ template< class T, std::size_t N, bool I, class A > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const vector< T,N,I,A >::references( matrix< U,P,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class T, std::size_t N, bool I, class A >
+ void vector< T,N,I,A >::normalize()
+ {
+ T m = vector_magnitude( *this ), x;
+ if( m != T(0) )
+ { x = T(1) / m;
+ for( std::size_t i = 0; i != N; ++i ) data[i] *= x;
+ }
+ } // normalize
+
+ template< class T, std::size_t N, bool I, class A >
+ void vector< T,N,I,A >::clear()
+ {
+ T t = T();
+ std::fill( begin(), end(), t );
+ } // clear : set all elements to default
+
+//--
+
+ template< class T1, std::size_t N1, bool I1, class A1, class C, class CT >
+ std::basic_ostream< C,CT >& operator<<( std::basic_ostream< C,CT >& o, vector< T1,N1,I1,A1 > const& v )
+ {
+ o << v.data;
+ return o;
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_VECTOR_HPP

Added: sandbox/maps/maps/boost/maps/math/vector_matrix.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/vector_matrix.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,338 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_VECTOR_MATRIX_HPP )
+#define BOOST_MAPS_MATH_VECTOR_MATRIX_HPP
+
+#include <boost/maps/math/vector_vector.hpp>
+#include <boost/maps/math/matrix_matrix.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ class vector_matrix_binary_expression
+ : public vector_expression< vector_matrix_binary_expression< E1,E2,N,O,L >,N >
+ {
+ public:
+
+ typedef vector_matrix_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E1::type_const_reference expression1_const_reference;
+ typedef typename E2::type_const_reference expression2_const_reference;
+ typedef E1 expression_type1;
+ typedef E2 expression_type2;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using vector_expression< type,N >::operator();
+
+ enum { size = N };
+ enum { linear = ( L & E1::linear & E2::linear ) };
+
+ vector_matrix_binary_expression( E1 const&, E2 const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ vector_matrix_binary_expression< E1,E2,N,O,L >::vector_matrix_binary_expression( E1 const& e1, E2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_matrix_binary_expression< E1,E2,N,O,L >::type_reference
+ vector_matrix_binary_expression< E1,E2,N,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) { t1 = e.t1; t2 = e.t2; }
+ return *this;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_matrix_binary_expression< E1,E2,N,O,L >::expression_type1 const&
+ vector_matrix_binary_expression< E1,E2,N,O,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_matrix_binary_expression< E1,E2,N,O,L >::expression_type2 const&
+ vector_matrix_binary_expression< E1,E2,N,O,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_matrix_binary_expression< E1,E2,N,O,L >::result_type const
+ vector_matrix_binary_expression< E1,E2,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1,t2,s );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U >
+ bool const vector_matrix_binary_expression< E1,E2,N,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const vector_matrix_binary_expression< E1,E2,N,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const vector_matrix_binary_expression< E1,E2,N,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct matrix_vector_traits
+ {
+ typedef typename expression_traits< T1 >::type_const_reference type_const_reference1;
+ typedef typename expression_traits< T2 >::type_const_reference type_const_reference2;
+ typedef typename expression_traits< T1 >::type_reference type_reference1;
+ typedef typename expression_traits< T2 >::type_reference type_reference2;
+ typedef typename expression_traits< T1 >::const_reference const_reference1;
+ typedef typename expression_traits< T2 >::const_reference const_reference2;
+ typedef typename expression_traits< T1 >::reference reference1;
+ typedef typename expression_traits< T2 >::reference reference2;
+ typedef typename expression_traits< T1 >::element_type element_type1;
+ typedef typename expression_traits< T2 >::element_type element_type2;
+ typedef typename expression_traits< T1 >::allocator_type allocator_type;
+ typedef typename expression_traits< T1 >::size_type size_type;
+ typedef typename vector_matrix_type< element_type1,element_type2 >::type result_type;
+
+ };
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct matrix_vector_product
+ : matrix_vector_traits< T1,T2 >
+ {
+ typedef typename matrix_vector_traits< T1,T2 >::result_type result_type;
+ typedef typename matrix_vector_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename matrix_vector_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename matrix_vector_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename matrix_vector_traits< T1,T2 >::const_reference2 const_reference2;
+ typedef typename matrix_vector_traits< T1,T2 >::size_type size_type;
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ result_type r = result_type();
+ for( size_type k = 0; k != t1.cols; ++k )
+ r += t1( s,k ) * t2( k );
+ return r;
+ }
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 * t2;
+ }
+ };
+
+ template< class T1, class T2 >
+ struct vector_matrix_product
+ : matrix_vector_traits< T1,T2 >
+ {
+ typedef typename matrix_vector_traits< T1,T2 >::result_type result_type;
+ typedef typename matrix_vector_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename matrix_vector_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename matrix_vector_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename matrix_vector_traits< T1,T2 >::const_reference2 const_reference2;
+ typedef typename matrix_vector_traits< T1,T2 >::size_type size_type;
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ result_type r = result_type();
+ for( size_type k = 0; k != t2.rows; ++k )
+ r += t1( k ) * t2( k,s );
+ return r;
+ }
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 * t2;
+ }
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t M, std::size_t N >
+ vector_matrix_binary_expression< E1,E2,M,matrix_vector_product< E1,E2 >,false >
+ operator*( matrix_expression< E1,M,N > const& e1, vector_expression< E2,N > const& e2 )
+ {
+ return vector_matrix_binary_expression< E1,E2,M,
+ matrix_vector_product< E1,E2 >,false >( e1(), e2() );
+ }
+
+ template< class E1, class E2, std::size_t M, std::size_t N >
+ vector_matrix_binary_expression< E1,E2,N,vector_matrix_product< E1,E2 >,false >
+ operator*( vector_expression< E1,M > const& e1, matrix_expression< E2,M,N > const& e2 )
+ {
+ return vector_matrix_binary_expression< E1,E2,N,
+ vector_matrix_product< E1,E2 >,false >( e1(), e2() );
+ }
+
+//--
+//--
+
+ template< class E, std::size_t N, class O, bool L >
+ class vector_matrix_unary_expression
+ : public vector_expression< vector_matrix_unary_expression< E,N,O,L >,N >
+ {
+ public:
+
+ typedef vector_matrix_unary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E::type_const_reference expression_const_reference;
+ typedef E expression_type;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using vector_expression< type,N >::operator();
+
+ enum { size = N };
+ enum { linear = ( L & E::linear ) };
+
+ vector_matrix_unary_expression( E const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type const& expression() const;
+
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression_const_reference t;
+
+ };
+
+//--
+
+ template< class E, std::size_t N, class O, bool L >
+ vector_matrix_unary_expression< E,N,O,L >::vector_matrix_unary_expression( E const& e )
+ : t( e )
+ {}
+
+ template< class E, std::size_t N, class O, bool L >
+ typename vector_matrix_unary_expression< E,N,O,L >::type_reference
+ vector_matrix_unary_expression< E,N,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) { t = e.t; }
+ return *this;
+ }
+
+ template< class E, std::size_t N, class O, bool L >
+ typename vector_matrix_unary_expression< E,N,O,L >::expression_type const&
+ vector_matrix_unary_expression< E,N,O,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class E, std::size_t N, class O, bool L >
+ typename vector_matrix_unary_expression< E,N,O,L >::result_type const
+ vector_matrix_unary_expression< E,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t,s );
+ }
+
+ template< class E, std::size_t N, class O, bool L > template< class U >
+ bool const vector_matrix_unary_expression< E,N,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t().references( s ) );
+ }
+
+ template< class E, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const vector_matrix_unary_expression< E,N,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t().references( v ) );
+ }
+
+ template< class E, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const vector_matrix_unary_expression< E,N,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T >
+ struct matrix_trace
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( type_const_reference t, size_type i )
+ {
+ return t( i,i );
+ }
+ };
+
+//--
+
+ template< class E, std::size_t N >
+ vector_matrix_unary_expression< E,N,matrix_trace< E >,true >
+ trace( matrix_expression< E,N,N > const& e )
+ {
+ return vector_matrix_unary_expression< E,N,matrix_trace< E >,true >( e() );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_VECTOR_MATRIX_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/math/vector_scalar.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/vector_scalar.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,236 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_VECTOR_SCALAR_HPP )
+#define BOOST_MAPS_MATH_VECTOR_SCALAR_HPP
+
+#include <boost/maps/math/vector_vector.hpp>
+#include <boost/maps/math/scalar_scalar.hpp>
+#include <boost/maps/math/scalar_vector.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ class vector_scalar_binary_expression
+ : public vector_expression< vector_scalar_binary_expression< E1,E2,N,O,L >,N >
+ {
+ public:
+
+ typedef vector_scalar_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E1::type_const_reference expression1_const_reference;
+ typedef typename E2::type_const_reference expression2_const_reference;
+ typedef E1 expression_type1;
+ typedef E2 expression_type2;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using vector_expression< type,N >::operator();
+
+ enum { size = N };
+ enum { linear = ( L & E1::linear & E2::linear ) };
+
+ vector_scalar_binary_expression( E1 const&, E2 const& );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ reference operator()( reference, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ vector_scalar_binary_expression< E1,E2,N,O,L >::vector_scalar_binary_expression( E1 const& e1, E2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_scalar_binary_expression< E1,E2,N,O,L >::expression_type1 const&
+ vector_scalar_binary_expression< E1,E2,N,O,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_scalar_binary_expression< E1,E2,N,O,L >::expression_type2 const&
+ vector_scalar_binary_expression< E1,E2,N,O,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_scalar_binary_expression< E1,E2,N,O,L >::reference
+ vector_scalar_binary_expression< E1,E2,N,O,L >::operator()( reference r, size_type s ) const
+ {
+ return operator_type()( r,t1,t2,s );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_scalar_binary_expression< E1,E2,N,O,L >::result_type const
+ vector_scalar_binary_expression< E1,E2,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1,t2,s );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U >
+ bool const vector_scalar_binary_expression< E1,E2,N,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const vector_scalar_binary_expression< E1,E2,N,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const vector_scalar_binary_expression< E1,E2,N,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct vector_scalar_traits
+ {
+ typedef typename expression_traits< T1 >::type_const_reference type_const_reference1;
+ typedef typename expression_traits< T2 >::type_const_reference type_const_reference2;
+ typedef typename expression_traits< T1 >::type_reference type_reference1;
+ typedef typename expression_traits< T2 >::type_reference type_reference2;
+ typedef typename expression_traits< T1 >::const_reference const_reference1;
+ typedef typename expression_traits< T2 >::const_reference const_reference2;
+ typedef typename expression_traits< T1 >::reference reference1;
+ typedef typename expression_traits< T2 >::reference reference2;
+ typedef typename expression_traits< T1 >::element_type element_type1;
+ typedef typename expression_traits< T2 >::element_type element_type2;
+ typedef typename expression_traits< T1 >::allocator_type allocator_type;
+ typedef typename expression_traits< T1 >::size_type size_type;
+ typedef typename vector_scalar_type< element_type1,element_type2 >::type result_type;
+
+ };
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct vector_scalar_product
+ : vector_scalar_traits< T1,T2 >
+ {
+ typedef typename vector_scalar_traits< T1,T2 >::result_type result_type;
+ typedef typename vector_scalar_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename vector_scalar_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename vector_scalar_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return r = t1( s ) * t2();
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return t1( s ) * t2();
+ }
+ };
+
+ template< class T1, class T2 >
+ struct scalar_vector_product
+ : vector_scalar_traits< T1,T2 >
+ {
+ typedef typename vector_scalar_traits< T1,T2 >::result_type result_type;
+ typedef typename vector_scalar_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename vector_scalar_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename vector_scalar_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return r = t1() * t2( s );
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return t1() * t2( s );
+ }
+ };
+
+ template< class T1, class T2 >
+ struct vector_scalar_division
+ : vector_scalar_traits< T1,T2 >
+ {
+ typedef typename vector_scalar_traits< T1,T2 >::result_type result_type;
+ typedef typename vector_scalar_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename vector_scalar_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename vector_scalar_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return r = t1( s ) / t2();
+ }
+
+ result_type operator()( type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return t1( s ) / t2();
+ }
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t N >
+ vector_scalar_binary_expression< E1,E2,N,vector_scalar_product< E1,E2 >,true >
+ operator*( vector_expression< E1,N > const& e1, scalar_expression< E2 > const& e2 )
+ {
+ return vector_scalar_binary_expression< E1,E2,N,
+ vector_scalar_product< E1,E2 >,true >( e1(), e2() );
+ }
+
+ template< class E1, class E2, std::size_t N >
+ vector_scalar_binary_expression< E1,E2,N,scalar_vector_product< E1,E2 >,true >
+ operator*( scalar_expression< E1 > const& e1, vector_expression< E2,N > const& e2 )
+ {
+ return vector_scalar_binary_expression< E1,E2,N,
+ scalar_vector_product< E1,E2 >,true >( e1(), e2() );
+ }
+
+ template< class E1, class E2, std::size_t N >
+ vector_scalar_binary_expression< E1,E2,N,vector_scalar_division< E1,E2 >,true >
+ operator/( vector_expression< E1,N > const& e1, scalar_expression< E2 > const& e2 )
+ {
+ return vector_scalar_binary_expression< E1,E2,N,
+ vector_scalar_division< E1,E2 >,true >( e1(), e2() );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_VECTOR_SCALAR_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/math/vector_vector.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/math/vector_vector.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,665 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_MATH_VECTOR_VECTOR_HPP )
+#define BOOST_MAPS_MATH_VECTOR_VECTOR_HPP
+
+#include <boost/maps/math/scalar_scalar.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E, std::size_t N >
+ class vector_expression
+ : expression< vector_expression< E,N > >
+ {
+ public:
+
+ typedef vector_expression type;
+ typedef E value_type;
+ typedef value_type const& const_reference;
+ typedef value_type& reference;
+
+ const_reference operator()() const
+ {
+ return *static_cast< value_type const* >( this );
+ }
+
+ reference operator()()
+ {
+ return *static_cast< value_type* >( this );
+ }
+
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ class vector_binary_expression
+ : public vector_expression< vector_binary_expression< E1,E2,N,O,L >,N >
+ {
+ public:
+
+ typedef vector_binary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E1::type_const_reference expression1_const_reference;
+ typedef typename E2::type_const_reference expression2_const_reference;
+ typedef E1 expression_type1;
+ typedef E2 expression_type2;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using vector_expression< type,N >::operator();
+
+ enum { size = N };
+ enum { linear = ( L & E1::linear & E2::linear ) };
+
+ vector_binary_expression( E1 const&, E2 const& );
+ type_reference operator=( type_const_reference );
+
+ expression_type1 const& expression1() const;
+ expression_type2 const& expression2() const;
+
+ reference operator()( reference, size_type ) const;
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression1_const_reference t1;
+ expression2_const_reference t2;
+
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ vector_binary_expression< E1,E2,N,O,L >::vector_binary_expression( E1 const& e1, E2 const& e2 )
+ : t1( e1 ), t2( e2 )
+ {}
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_binary_expression< E1,E2,N,O,L >::type_reference
+ vector_binary_expression< E1,E2,N,O,L >::operator=( type_const_reference e )
+ {
+ if( &e != this ) { t1 = e.t1; t2 = e.t2; }
+ return *this;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_binary_expression< E1,E2,N,O,L >::expression_type1 const&
+ vector_binary_expression< E1,E2,N,O,L >::expression1() const
+ {
+ return t1;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_binary_expression< E1,E2,N,O,L >::expression_type2 const&
+ vector_binary_expression< E1,E2,N,O,L >::expression2() const
+ {
+ return t2;
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_binary_expression< E1,E2,N,O,L >::reference
+ vector_binary_expression< E1,E2,N,O,L >::operator()( reference r, size_type s ) const
+ {
+ return operator_type()( r,t1,t2,s );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L >
+ typename vector_binary_expression< E1,E2,N,O,L >::result_type const
+ vector_binary_expression< E1,E2,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t1( s ), t2( s ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U >
+ bool const vector_binary_expression< E1,E2,N,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t1().references( s ) || t2().references( s ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const vector_binary_expression< E1,E2,N,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t1().references( v ) || t2().references( v ) );
+ }
+
+ template< class E1, class E2, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const vector_binary_expression< E1,E2,N,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t1().references( m ) || t2().references( m ) );
+ }
+
+//--
+//--
+
+ template< class T1, class T2 >
+ struct vector_vector_addition
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::result_type result_type;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return r = t1( s ) + t2( s );
+ }
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 + t2;
+ }
+ };
+
+ template< class T1, class T2 >
+ struct vector_vector_subtraction
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::result_type result_type;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference1 type_const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::type_const_reference2 type_const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference1 const_reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+ typedef typename expression_binary_traits< T1,T2 >::size_type size_type;
+
+ result_type& operator()( result_type& r, type_const_reference1 t1, type_const_reference2 t2, size_type s )
+ {
+ return r = t1( s ) - t2( s );
+ }
+
+ result_type operator()( const_reference1 t1, const_reference2 t2 )
+ {
+ return t1 - t2;
+ }
+ };
+
+//--
+
+ template< class E1, class E2, std::size_t N >
+ vector_binary_expression< E1,E2,N,vector_vector_addition< E1,E2 >,true >
+ operator+( vector_expression< E1,N > const& e1, vector_expression< E2,N > const& e2 )
+ {
+ return vector_binary_expression< E1,E2,N,
+ vector_vector_addition< E1,E2 >,true >( e1(), e2() );
+ }
+
+ template< class E1, class E2, std::size_t N >
+ vector_binary_expression< E1,E2,N,vector_vector_subtraction< E1,E2 >,true >
+ operator-( vector_expression< E1,N > const& e1, vector_expression< E2,N > const& e2 )
+ {
+ return vector_binary_expression< E1,E2,N,
+ vector_vector_subtraction< E1,E2 >,true >( e1(), e2() );
+ }
+
+//--
+
+ template< class T1, class T2 >
+ struct vector_vector_assign
+ : expression_binary_traits< T1,T2 >
+ {
+ typedef typename expression_binary_traits< T1,T2 >::reference1 reference1;
+ typedef typename expression_binary_traits< T1,T2 >::const_reference2 const_reference2;
+
+ void operator()( reference1 t1, const_reference2 t2 )
+ {
+ t1 = t2;
+ }
+ };
+
+//--
+
+ template< class T, class E, std::size_t N, class O, bool L, bool C >
+ struct vector_assign
+ {
+ typedef T type;
+ typedef type& reference;
+ typedef vector_expression< E,N > const& expression_const_reference;
+ typedef O operator_type;
+
+ void operator()( reference v, expression_const_reference e )
+ {
+ if( e().references( v ) )
+ { type t;
+ for( std::size_t i = 0; i != N; ++i )
+ operator_type()( t( i ), e()( i ) );
+ t.swap( v );
+ }else
+ { for( std::size_t i = 0; i != N; ++i )
+ operator_type()( v( i ), e()( i ) );
+ }
+ }
+ };
+
+//--
+
+ template< class T, class E, std::size_t N, class O, bool C >
+ struct vector_assign< T,E,N,O,true,C >
+ {
+ typedef T& reference;
+ typedef vector_expression< E,N > const& expression_const_reference;
+ typedef O operator_type;
+
+ void operator()( reference v, expression_const_reference e )
+ {
+ for( std::size_t i = 0; i != N; ++i )
+ operator_type()( v( i ), e()( i ) );
+ }
+ };
+
+ template< class T, std::size_t N1, bool I1, class A1, std::size_t N, bool I, class A, class E, class O, bool C >
+ struct vector_assign< vector< vector< T,N1,I1,A1 >,N,I,A >,E,N,O,true,C >
+ {
+ typedef vector< vector< T,N1,I1,A1 >,N,I,A >& reference;
+ typedef vector_expression< E,N > const& expression_const_reference;
+
+ void operator()( reference v, expression_const_reference e )
+ {
+ for( std::size_t i = 0; i != N; ++i )
+ e()( v( i ),i );
+ }
+ };
+
+//--
+
+ template< class T, class E, std::size_t N, class O >
+ struct vector_assign< T,E,N,O,false,true >
+ {
+ typedef T& reference;
+ typedef vector_expression< E,N > const& expression_const_reference;
+ typedef O operator_type;
+
+ void operator()( reference v, expression_const_reference e )
+ {
+ for( std::size_t i = 0; i != N; ++i )
+ operator_type()( v( i ), e()( i ) );
+ }
+ };
+
+//--
+//--
+
+ template< class E, std::size_t N, class O, bool L >
+ class vector_unary_expression
+ : public vector_expression< vector_unary_expression< E,N,O,L >,N >
+ {
+ public:
+
+ typedef vector_unary_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef typename E::type_const_reference expression_const_reference;
+ typedef E expression_type;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using vector_expression< type,N >::operator();
+
+ enum { size = N };
+ enum { linear = ( L & E::linear ) };
+
+ vector_unary_expression( E const& );
+
+ expression_type const& expression() const;
+
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ private:
+
+ expression_const_reference t;
+
+ };
+
+//--
+
+ template< class E, std::size_t N, class O, bool L >
+ vector_unary_expression< E,N,O,L >::vector_unary_expression( E const& e )
+ : t( e )
+ {}
+
+ template< class E, std::size_t N, class O, bool L >
+ typename vector_unary_expression< E,N,O,L >::expression_type const&
+ vector_unary_expression< E,N,O,L >::expression() const
+ {
+ return t;
+ }
+
+ template< class E, std::size_t N, class O, bool L >
+ typename vector_unary_expression< E,N,O,L >::result_type const
+ vector_unary_expression< E,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( t( s ) );
+ }
+
+ template< class E, std::size_t N, class O, bool L > template< class U >
+ bool const vector_unary_expression< E,N,O,L >::references( scalar< U > const& s ) const
+ {
+ return ( t().references( s ) );
+ }
+
+ template< class E, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const vector_unary_expression< E,N,O,L >::references( vector< U,Q,J,B > const& v ) const
+ {
+ return ( t().references( v ) );
+ }
+
+ template< class E, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const vector_unary_expression< E,N,O,L >::references( matrix< U,P,Q,J,B > const& m ) const
+ {
+ return ( t().references( m ) );
+ }
+
+//--
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_negate< E >,true >
+ operator-( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_negate< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_sin< E >,true >
+ sin( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_sin< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_cos< E >,true >
+ cos( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_cos< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_tan< E >,true >
+ tan( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_tan< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_cosec< E >,true >
+ cosec( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_cosec< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_sec< E >,true >
+ sec( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_sec< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_cot< E >,true >
+ cot( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_cot< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_sinh< E >,true >
+ sinh( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_sinh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_cosh< E >,true >
+ cosh( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_cosh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_tanh< E >,true >
+ tanh( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_tanh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_cosech< E >,true >
+ cosech( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_cosech< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_sech< E >,true >
+ sech( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_sech< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_coth< E >,true >
+ coth( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_coth< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_asin< E >,true >
+ asin( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_asin< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_acos< E >,true >
+ acos( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_acos< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_atan< E >,true >
+ atan( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_atan< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_asinh< E >,true >
+ asinh( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_asinh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_acosh< E >,true >
+ acosh( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_acosh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_atanh< E >,true >
+ atanh( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_atanh< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_exp< E >,true >
+ exp( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_exp< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_log< E >,true >
+ log( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_log< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_log10< E >,true >
+ log10( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_log10< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_sqrt< E >,true >
+ sqrt( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_sqrt< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_abs< E >,true >
+ abs( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_abs< E >,true >( e() );
+ }
+
+ template< class E, std::size_t N >
+ vector_unary_expression< E,N,scalar_fabs< E >,true >
+ fabs( vector_expression< E,N > const& e )
+ {
+ return vector_unary_expression< E,N,scalar_fabs< E >,true >( e() );
+ }
+
+//--
+//--
+
+ template< class E, std::size_t N, class O, bool L >
+ class vector_vector_expression
+ : public vector_expression< vector_vector_expression< E,N,O,L >,N >
+ {
+ public:
+
+ typedef vector_vector_expression type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef O operator_type;
+ typedef typename O::result_type result_type;
+ typedef result_type element_type;
+ typedef element_type const& const_reference;
+ typedef element_type& reference;
+ typedef typename operator_type::size_type size_type;
+ typedef typename operator_type::allocator_type allocator_type;
+
+ using vector_expression< type,N >::operator();
+
+ enum { size = N };
+ enum { linear = ( L & E::linear ) };
+
+ vector_vector_expression();
+
+ result_type const operator()( size_type ) const;
+
+ template< class U >
+ bool const references( scalar< U > const& ) const;
+ template< class U, std::size_t Q, bool J, class B >
+ bool const references( vector< U,Q,J,B > const& ) const;
+ template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const references( matrix< U,P,Q,J,B > const& ) const;
+
+ };
+
+//--
+
+ template< class E, std::size_t N, class O, bool L >
+ vector_vector_expression< E,N,O,L >::vector_vector_expression()
+ {}
+
+ template< class E, std::size_t N, class O, bool L >
+ typename vector_vector_expression< E,N,O,L >::result_type const
+ vector_vector_expression< E,N,O,L >::operator()( size_type s ) const
+ {
+ return operator_type()( s );
+ }
+
+ template< class E, std::size_t N, class O, bool L > template< class U >
+ bool const vector_vector_expression< E,N,O,L >::references( scalar< U > const& ) const
+ {
+ return false;
+ }
+
+ template< class E, std::size_t N, class O, bool L > template< class U, std::size_t Q, bool J, class B >
+ bool const vector_vector_expression< E,N,O,L >::references( vector< U,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+ template< class E, std::size_t N, class O, bool L > template< class U, std::size_t P, std::size_t Q, bool J, class B >
+ bool const vector_vector_expression< E,N,O,L >::references( matrix< U,P,Q,J,B > const& ) const
+ {
+ return false;
+ }
+
+//--
+
+ template< class T, std::size_t I >
+ struct vector_standard_basis
+ : expression_unary_traits< T >
+ {
+ typedef typename expression_unary_traits< T >::result_type result_type;
+ typedef typename expression_unary_traits< T >::size_type size_type;
+
+ result_type operator()( size_type s )
+ {
+ return s == I ? result_type(1) : result_type(0);
+ }
+ };
+
+//--
+
+ // N = number of elements in (virtual) vector
+ // I ( < N ) is the zero-based index of basis identity component
+ template< class T, std::size_t N, std::size_t I >
+ vector_vector_expression< vector< T,N >,N,vector_standard_basis< vector< T,N >,I >,true >
+ standard_basis()
+ {
+ BOOST_STATIC_ASSERT( I < N );
+ return vector_vector_expression< vector< T,N >,N,
+ vector_standard_basis< vector< T,N >,I >,true >();
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_MATH_VECTOR_VECTOR_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/support/assigner.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/support/assigner.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,138 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_SUPPORT_ASSIGNER_HPP )
+#define BOOST_MAPS_SUPPORT_ASSIGNER_HPP
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class T, std::size_t N >
+ class assigner
+ {
+ public:
+
+ typedef assigner type;
+ typedef typename T::iterator iterator;
+ typedef typename T::const_reference const_reference;
+
+ assigner( T&, iterator, const_reference );
+
+ assigner< T,N-1 > operator,( const_reference );
+
+ private:
+
+ friend class assigner< T,N+1 >;
+ assigner( T&, iterator );
+ type& operator=( type const& );
+
+ iterator iter;
+ T& t;
+
+ };
+
+ template< class T >
+ class assigner< T,1 >
+ {
+ public:
+
+ typedef assigner type;
+ typedef typename T::iterator iterator;
+ typedef typename T::const_reference const_reference;
+
+ assigner( T&, iterator, const_reference );
+
+ T& operator,( const_reference );
+
+ private:
+
+ friend class assigner< T,2 >;
+ assigner( T&, iterator );
+ type& operator=( type const& );
+
+ iterator iter;
+ T& t;
+
+ };
+
+
+ template< class T >
+ class assigner< T,0 >
+ {
+ public:
+
+ typedef assigner type;
+ typedef typename T::iterator iterator;
+ typedef typename T::const_reference const_reference;
+
+ assigner( T&, iterator, const_reference );
+
+ T& operator,( const_reference );
+
+ private:
+
+ friend class assigner< T,1 >;
+ assigner( T&, iterator );
+
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N >
+ assigner< T,N >::assigner( T& t, iterator i, const_reference x )
+ : t( t ), iter( i )
+ {
+ *iter++ = x;
+ }
+
+ template< class T, std::size_t N >
+ assigner< T,N-1 > assigner< T,N >::operator,( const_reference x )
+ {
+ *iter = x; return assigner< T,N-1 >( t, ++iter );
+ }
+
+ template< class T, std::size_t N >
+ assigner< T,N >::assigner( T& t, iterator i )
+ : t( t ), iter( i )
+ {}
+
+//--
+
+ template< class T >
+ assigner< T,1 >::assigner( T& t, iterator i, const_reference x )
+ : t( t ), iter( i )
+ {
+ *iter++ = x;
+ }
+
+ template< class T >
+ T& assigner< T,1 >::operator,( const_reference x )
+ {
+ *iter = x; return t;
+ }
+
+ template< class T >
+ assigner< T,1 >::assigner( T& t, iterator i )
+ : t( t ), iter( i )
+ {}
+
+//--
+
+ template< class T >
+ assigner< T,0 >::assigner( T&, iterator i, const_reference x )
+ {
+ *i = x;
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_SUPPORT_ASSIGNER_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/support/bounds.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/support/bounds.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,354 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_SUPPORT_BOUNDS_HPP )
+#define BOOST_MAPS_SUPPORT_BOUNDS_HPP
+
+#include <boost/maps/support/assigner.hpp>
+
+#ifdef BOOST_MSVC
+# pragma warning( push )
+# pragma warning( disable : 4351 ) // new behavior: elements of array 'array' will be default initialized
+#endif
+
+namespace boost { namespace maps {
+
+//--
+
+ template< std::size_t N > class bounds;
+ template< std::size_t N > struct bounds_assign;
+
+//--
+
+ template< std::size_t N >
+ struct bounds_assigner
+ {
+ typedef assigner< bounds< N >,N-1 > type;
+ };
+
+ template<>
+ struct bounds_assigner< 1 >
+ {
+ typedef bounds< 1 > type;
+ };
+
+//--
+
+ template< std::size_t N >
+ class bounds
+ {
+ public:
+
+ typedef bounds type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef std::size_t size_type;
+ typedef std::size_t element_type;
+ typedef element_type value_type;
+ typedef value_type const& const_reference;
+ typedef value_type& reference;
+ typedef value_type const* const_iterator;
+ typedef value_type* iterator;
+ typedef typename bounds_assigner< N >::type assigner;
+
+ enum { size = N };
+
+ bounds();
+ explicit bounds( const_reference );
+
+ assigner operator=( const_reference );
+
+ const_reference operator[]( size_type ) const;
+ reference operator[]( size_type );
+
+ void fill( const_reference );
+
+ const_iterator begin() const;
+ iterator begin();
+ const_iterator end() const;
+ iterator end();
+
+ protected:
+
+ typedef typename detail::array_type_< std::size_t,1,N >::type data_type;
+
+ data_type data;
+
+ };
+
+//--
+//--
+
+ template< std::size_t N >
+ bounds< N >::bounds() : data()
+ {}
+
+ template< std::size_t N >
+ bounds< N >::bounds( const_reference s )
+ {
+ std::fill_n( data, N, s );
+ }
+
+ template< std::size_t N >
+ typename bounds< N >::assigner bounds< N >::operator=( const_reference x )
+ {
+ return bounds_assign< N >()( *this, data, x );
+ }
+
+ template< std::size_t N >
+ typename bounds< N >::const_reference bounds< N >::operator[]( size_type s ) const
+ {
+ BOOST_ASSERT( s < N );
+ return data[s];
+ }
+
+ template< std::size_t N >
+ typename bounds< N >::reference bounds< N >::operator[]( size_type s )
+ {
+ BOOST_ASSERT( s < N );
+ return data[s];
+ }
+
+ template< std::size_t N >
+ void bounds< N >::fill( const_reference s )
+ {
+ std::fill_n( data, N, s );
+ }
+
+ template< std::size_t N >
+ typename bounds< N >::const_iterator bounds< N >::begin() const
+ {
+ return data;
+ }
+
+ template< std::size_t N >
+ typename bounds< N >::iterator bounds< N >::begin()
+ {
+ return data;
+ }
+
+ template< std::size_t N >
+ typename bounds< N >::const_iterator bounds< N >::end() const
+ {
+ return data+N;
+ }
+
+ template< std::size_t N >
+ typename bounds< N >::iterator bounds< N >::end()
+ {
+ return data+N;
+ }
+
+//--
+
+ template<>
+ class bounds< 0 >
+ {
+ public:
+
+ typedef bounds< 0 > type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef std::size_t size_type;
+ typedef void element_type;
+ typedef element_type value_type;
+ typedef value_type const_reference;
+ typedef value_type reference;
+ typedef value_type const* const_iterator;
+ typedef value_type* iterator;
+
+ enum { size = 0 };
+
+ };
+
+//--
+//--
+
+ template< std::size_t N >
+ struct bounds_assign
+ {
+ typedef typename bounds< N >::assigner assigner;
+ typedef typename bounds< N >::type_reference type_reference;
+ typedef typename bounds< N >::iterator iterator;
+ typedef typename bounds< N >::const_reference const_reference;
+
+ assigner operator()( type_reference b, iterator i, const_reference x )
+ {
+ return assigner( b, i, x );
+ }
+ };
+
+ template<>
+ struct bounds_assign< 1 >
+ {
+ typedef bounds< 1 >::type_reference type_reference;
+ typedef bounds< 1 >::iterator iterator;
+ typedef bounds< 1 >::const_reference const_reference;
+
+ type_reference operator()( type_reference b, iterator i, const_reference x )
+ {
+ *i = x; return b;
+ }
+ };
+
+//--
+//--
+
+ template< std::size_t N >
+ class dimensions
+ : public bounds< N >
+ {
+ public:
+
+ typedef dimensions type;
+ typedef bounds< N > base_type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef std::size_t size_type;
+ typedef std::size_t element_type;
+ typedef element_type value_type;
+ typedef value_type const& const_reference;
+ typedef value_type& reference;
+ typedef value_type const* const_iterator;
+ typedef value_type* iterator;
+ typedef typename bounds_assigner< N >::type assigner;
+
+ dimensions();
+
+ assigner operator=( const_reference );
+
+ };
+
+//--
+//--
+
+ template< std::size_t N >
+ dimensions< N >::dimensions()
+ {}
+
+ template< std::size_t N >
+ typename dimensions< N >::assigner dimensions< N >::operator=( const_reference x )
+ {
+ return base_type::operator=( x );
+ }
+
+//--
+
+ template<>
+ class dimensions< 0 >
+ : public bounds< 0 >
+ {};
+
+//--
+//--
+
+ template< std::size_t N >
+ class indexes
+ : public bounds< N >
+ {
+ public:
+
+ typedef indexes type;
+ typedef bounds< N > base_type;
+ typedef type const& type_const_reference;
+ typedef type& type_reference;
+ typedef type const* type_const_pointer;
+ typedef type* type_pointer;
+ typedef std::size_t size_type;
+ typedef std::size_t element_type;
+ typedef element_type value_type;
+ typedef value_type const& const_reference;
+ typedef value_type& reference;
+ typedef value_type const* const_iterator;
+ typedef value_type* iterator;
+ typedef typename bounds_assigner< N >::type assigner;
+
+ indexes();
+
+ assigner operator=( const_reference );
+
+ };
+
+//--
+//--
+
+ template< std::size_t N >
+ indexes< N >::indexes()
+ {}
+
+ template< std::size_t N >
+ typename indexes< N >::assigner indexes< N >::operator=( const_reference x )
+ {
+ return base_type::operator=( x );
+ }
+
+//--
+
+ template<>
+ class indexes< 0 >
+ : public bounds< 0 >
+ {};
+
+//--
+//--
+
+ template< std::size_t N >
+ bool operator==( bounds< N > const& x, bounds< N > const& y )
+ {
+ for( std::size_t i = 0; i != N; ++i )
+ if( !( x[i] == y[i] ) ) return false;
+ return true;
+ }
+
+ template< std::size_t N >
+ bool operator<( bounds< N > const& x, bounds< N > const& y )
+ {
+ for( std::size_t i = 0; i != N; ++i )
+ if( !( x[i] < y[i] ) ) return false;
+ return true;
+ }
+
+ template< std::size_t N >
+ bool operator!=( bounds< N > const& x, bounds< N > const& y )
+ {
+ return !( x == y );
+ }
+
+ template< std::size_t N >
+ bool operator>( bounds< N > const& x, bounds< N > const& y )
+ {
+ return y < x;
+ }
+
+ template< std::size_t N >
+ bool operator<=( bounds< N > const& x, bounds< N > const& y )
+ {
+ return !( y < x );
+ }
+
+ template< std::size_t N >
+ bool operator>=( bounds< N > const& x, bounds< N > const& y )
+ {
+ return !( x < y );
+ }
+
+//--
+
+}} // namespace boost, namespace maps
+
+#ifdef BOOST_MSVC
+# pragma warning( pop )
+#endif
+
+#endif // BOOST_MAPS_SUPPORT_BOUNDS_HPP

Added: sandbox/maps/maps/boost/maps/support/expression.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/support/expression.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,122 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_SUPPORT_EXPRESSION_HPP )
+#define BOOST_MAPS_SUPPORT_EXPRESSION_HPP
+
+#include <boost/type_traits/common_type.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class E >
+ class expression_type
+ {
+ public:
+
+ typedef expression_type type;
+ typedef E value_type;
+ typedef value_type const& const_reference;
+ typedef value_type& reference;
+
+ const_reference operator()() const
+ {
+ return *static_cast< const value_type* >( this );
+ }
+
+ reference operator()()
+ {
+ return *static_cast< value_type* >( this );
+ }
+
+ protected:
+
+ expression_type() {}
+ ~expression_type() {}
+
+ };
+
+//--
+//--
+
+ template< class E >
+ class expression
+ : expression_type< expression< E > >
+ {
+ public:
+
+ typedef expression type;
+ typedef E value_type;
+ typedef value_type const& const_reference;
+ typedef value_type& reference;
+
+ const_reference operator()() const
+ {
+ return *static_cast< const value_type* >( this );
+ }
+
+ reference operator()()
+ {
+ return *static_cast< value_type* >( this );
+ }
+
+ };
+
+//--
+//--
+
+ template< class T >
+ struct expression_traits
+ {
+ typedef T type;
+ typedef typename type::type_const_reference type_const_reference;
+ typedef typename type::type_reference type_reference;
+ typedef typename type::const_reference const_reference;
+ typedef typename type::reference reference;
+ typedef typename type::element_type element_type;
+ typedef typename type::allocator_type allocator_type;
+ typedef typename type::size_type size_type;
+ };
+
+ template< class T1, class T2 >
+ struct expression_binary_traits
+ {
+ typedef typename expression_traits< T1 >::type_const_reference type_const_reference1;
+ typedef typename expression_traits< T2 >::type_const_reference type_const_reference2;
+ typedef typename expression_traits< T1 >::type_reference type_reference1;
+ typedef typename expression_traits< T2 >::type_reference type_reference2;
+ typedef typename expression_traits< T1 >::const_reference const_reference1;
+ typedef typename expression_traits< T2 >::const_reference const_reference2;
+ typedef typename expression_traits< T1 >::reference reference1;
+ typedef typename expression_traits< T2 >::reference reference2;
+ typedef typename expression_traits< T1 >::element_type element_type1;
+ typedef typename expression_traits< T2 >::element_type element_type2;
+ typedef typename common_type< element_type1,element_type2 >::type result_type;
+ typedef typename expression_traits< T1 >::allocator_type allocator_type;
+ typedef typename expression_traits< T1 >::size_type size_type;
+ };
+
+ template< class T >
+ struct expression_unary_traits
+ {
+ typedef typename expression_traits< T >::type_const_reference type_const_reference;
+ typedef typename expression_traits< T >::type_reference type_reference;
+ typedef typename expression_traits< T >::const_reference const_reference;
+ typedef typename expression_traits< T >::reference reference;
+ typedef typename expression_traits< T >::element_type element_type;
+ typedef typename expression_traits< T >::element_type result_type;
+ typedef typename expression_traits< T >::allocator_type allocator_type;
+ typedef typename expression_traits< T >::size_type size_type;
+ };
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_SUPPORT_EXPRESSION_HPP

Added: sandbox/maps/maps/boost/maps/support/generic.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/support/generic.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,621 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_SUPPORT_GENERIC_HPP )
+#define BOOST_MAPS_SUPPORT_GENERIC_HPP
+
+#include <boost/maps/support/preprocessor_bounds.hpp>
+
+#include <boost/type_traits/add_pointer.hpp>
+#include <boost/type_traits/has_trivial_constructor.hpp>
+#include <boost/type_traits/has_trivial_destructor.hpp>
+#include <boost/type_traits/is_pod.hpp>
+
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/back.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/pop_front.hpp>
+#include <boost/mpl/pop_back.hpp>
+#include <boost/mpl/begin.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/next.hpp>
+#include <boost/mpl/size_t.hpp>
+#include <boost/mpl/integral_c.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/less_equal.hpp>
+#include <boost/mpl/less.hpp>
+#include <boost/mpl/equal.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/not_equal_to.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/modulus.hpp>
+#include <boost/mpl/divides.hpp>
+#include <boost/mpl/minus.hpp>
+#include <boost/mpl/assert.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ namespace null {
+
+ struct allocator
+ {
+ template< class T >
+ struct rebind { typedef allocator other; };
+
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ };
+
+ } // namespace null
+
+//--
+
+ template< class T, std::size_t N >
+ struct pointer_type
+ {
+ typedef typename pointer_type<
+ typename add_pointer< T >::type,N-1
+ >::type type;
+ };
+
+ template< class T >
+ struct pointer_type< T,0 >
+ {
+ typedef T type;
+ };
+
+//--
+//--
+
+ namespace detail {
+
+ template< class T, std::size_t N, class I >
+ struct array_type
+ {
+ typedef typename array_type<
+ T,N-1,typename mpl::next< I >::type
+ >::type type[ mpl::deref< I >::type::value ];
+ };
+
+ template< class T, class I >
+ struct array_type< T,0,I >
+ {
+ typedef T type;
+ };
+
+//--
+
+ template< class T, std::size_t N, class I >
+ struct array_transverse_type
+ {
+ typedef typename array_transverse_type<
+ T[ mpl::deref< I >::type::value ],N-1,typename mpl::next< I >::type
+ >::type type;
+ };
+
+ template< class T, class I >
+ struct array_transverse_type< T,0,I >
+ {
+ typedef T type;
+ };
+
+//--
+
+ template< std::size_t N, class I >
+ struct array_size
+ {
+ typedef mpl::size_t<
+ mpl::deref< I >::type::value *
+ array_size< N-1,typename mpl::next< I >::type >::type::value
+ > type;
+ };
+
+ template< class I >
+ struct array_size< 1,I >
+ {
+ typedef mpl::size_t<
+ mpl::deref< I >::type::value
+ > type;
+ };
+
+ } // namespace detail
+
+//--
+//--
+
+ template< class T, std::size_t N, class B, class A >
+ struct array_type
+ {
+ typedef typename pointer_type< T,N >::type type;
+ };
+
+ template< class T, std::size_t N, class B >
+ struct array_type< T,N,B,null::allocator >
+ {
+ typedef typename detail::array_type< T,N,B >::type type;
+ };
+
+//--
+
+ template< class T, class B, class A >
+ struct array_member_type
+ {
+ typedef typename array_type<
+ T,mpl::size< B >::type::value,typename mpl::begin< B >::type,A
+ >::type type;
+ };
+
+//--
+
+ template< class T, class B, class A >
+ struct array_value_type
+ {
+ typedef typename array_type<
+ T,mpl::size< B >::type::value-1,typename mpl::next< typename mpl::begin< B >::type >::type,A
+ >::type type;
+ };
+
+//--
+
+ template< class B >
+ struct array_size
+ {
+ typedef typename detail::array_size<
+ mpl::size< B >::type::value,typename mpl::begin< B >::type
+ >::type type;
+ };
+
+//--
+
+ template< class T, bool I, class A >
+ struct array_initialize
+ {
+ typedef typename mpl::or_<
+ mpl::not_< has_trivial_constructor< T > >,mpl::bool_< I >
+ >::type type;
+ };
+
+ template< class T, bool I >
+ struct array_initialize< T,I,null::allocator >
+ {
+ typedef typename mpl::if_<
+ has_trivial_constructor< T >,mpl::bool_< I >,mpl::bool_< false >
+ >::type type;
+ };
+
+//--
+//--
+
+ namespace detail {
+
+ template< class T, std::size_t N, std::size_t D >
+ struct array_type_
+ {
+ typedef typename array_type_<
+ T[D],N-1,D
+ >::type type;
+ };
+
+ template< class T, std::size_t D >
+ struct array_type_< T,0,D >
+ {
+ typedef T type;
+ };
+
+//--
+
+ template< std::size_t N, std::size_t D >
+ struct array_size_
+ {
+ typedef mpl::size_t<
+ D * array_size_< N-1,D >::type::value
+ > type;
+ };
+
+ template< std::size_t D >
+ struct array_size_< 1, D >
+ {
+ typedef mpl::size_t< D > type;
+ };
+
+//--
+
+ template< class B, std::size_t N, std::size_t D >
+ struct array_bounds_
+ {
+ typedef typename array_bounds_<
+ typename mpl::push_back< B,mpl::integral_c< std::size_t,D > >::type,N-1,D
+ >::type type;
+ };
+
+ template< class B, std::size_t D >
+ struct array_bounds_< B,0,D >
+ {
+ typedef B type;
+ };
+
+ } // namespace detail
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, class A >
+ struct array_type_
+ {
+ typedef typename pointer_type< T,N >::type type;
+ };
+
+ template< class T, std::size_t N, std::size_t D >
+ struct array_type_< T,N,D,null::allocator >
+ {
+ typedef typename detail::array_type_< T,N,D >::type type;
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, class A >
+ struct array_member_type_
+ {
+ typedef typename array_type_< T,N,D,A >::type type;
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, class A >
+ struct array_value_type_
+ {
+ typedef typename array_type_< T,N-1,D,A >::type type;
+ };
+
+//--
+
+ template< std::size_t N, std::size_t D >
+ struct array_size_
+ {
+ typedef typename detail::array_size_< N,D >::type type;
+ };
+
+//--
+
+ template< std::size_t N, std::size_t D >
+ struct array_bounds_
+ {
+ typedef typename detail::array_bounds_<
+ mpl::vector0<>,N,D
+ >::type type;
+ };
+
+//--
+//--
+
+ template< class T, std::size_t N, bool I = false, class A = std::allocator< T > > class pointer;
+ template< class T, class B, bool I = true, class A = null::allocator > class array;
+ template< class T, std::size_t N, std::size_t D, bool I = true, class A = null::allocator > class array_;
+
+//--
+
+ template< class A >
+ struct sub_type
+ {};
+
+//--
+//--
+
+// views
+
+ template< std::size_t F, std::size_t L, std::size_t S = 1 >
+ struct range
+ : bounds3< F,L,S >
+ {};
+
+ template< std::size_t F, std::size_t L >
+ struct range< F,L,0 >
+ : bounds0
+ {};
+
+ template< std::size_t F, std::size_t S >
+ struct range< F,F,S >
+ : bounds0
+ {};
+
+//--
+//--
+
+// view_
+
+ template< class R >
+ class view_range
+ {
+ typedef typename mpl::deref< R >::type D;
+ typedef typename mpl::begin< D >::type R1;
+ typedef typename mpl::next< R1 >::type R2;
+ typedef typename mpl::next< R2 >::type R3;
+
+ public:
+
+ typedef mpl::integral_c< std::size_t,mpl::deref< R1 >::type::value > first;
+ typedef mpl::integral_c< std::size_t,mpl::deref< R2 >::type::value > last;
+ typedef mpl::integral_c< std::size_t,mpl::deref< R3 >::type::value > step;
+
+ typedef typename mpl::minus< last,first >::type range;
+ typedef typename mpl::minus< last,step >::type last_index;
+
+ typedef typename mpl::eval_if<
+ mpl::equal_to< mpl::modulus< range,step >,mpl::size_t< 0 > >,
+ mpl::integral_c< std::size_t,mpl::divides< range,step >::value >,
+ mpl::integral_c< std::size_t,0 >
+ >::type bound;
+
+ };
+
+//--
+
+ template< class B, class I, class E, bool S >
+ struct view_validate_
+ {
+ typedef typename mpl::and_<
+ typename mpl::less_equal<
+ typename view_range< I >::bound,
+ typename mpl::front< B >::type
+ >::type,
+ typename mpl::less<
+ typename view_range< I >::last_index,
+ typename mpl::front< B >::type
+ >::type,
+ typename mpl::less<
+ typename view_range< I >::first,
+ typename view_range< I >::last
+ >::type,
+ typename view_validate_<
+ typename mpl::pop_front< B >::type,
+ typename mpl::next< I >::type,
+ E,
+ S
+ >::type
+ >::type type;
+ };
+
+ template< class B, class E, bool S >
+ struct view_validate_< B,E,E,S >
+ {
+ typedef mpl::bool_< true > type;
+ };
+
+ template< class B, class I, class E >
+ struct view_validate_< B,I,E,false >
+ {
+ typedef mpl::bool_< false > type;
+ };
+
+ template< class A, class R >
+ struct view_valid
+ {
+ typedef typename view_validate_<
+ typename A::limits_type,
+ typename mpl::begin< R >::type,
+ typename mpl::end< R >::type,
+ mpl::equal< mpl::size< typename A::limits_type >,mpl::size< R > >::type::value
+ >::type type;
+ };
+
+//--
+
+ namespace detail {
+
+ template< class B, class I, class E >
+ struct view_bounds
+ {
+ typedef typename view_bounds<
+ typename mpl::push_back<
+ B,
+ typename view_range< typename mpl::deref< I >::type >::bound
+ >::type,
+ typename mpl::next< I >::type,
+ E
+ >::type type;
+ };
+
+ template< class B, class E >
+ struct view_bounds< B,E,E >
+ {
+ typedef B type;
+ };
+
+ } // namespace detail
+
+ template< class B, class R >
+ struct view_bounds
+ {
+ typedef typename detail::view_bounds<
+ B,typename mpl::begin< R >::type,typename mpl::end< R >::type
+ >::type type;
+ };
+
+//--
+
+ template< std::size_t N, class R >
+ struct view_ranges
+ {
+ typedef R type;
+ };
+
+ template< class R >
+ struct view_ranges< 1,R >
+ {
+ typedef mpl::vector1< typename mpl::front< R >::type > type;
+ };
+
+//--
+
+ namespace detail {
+
+ template< class R, class B, class E >
+ struct view_size
+ {
+ typedef typename mpl::size_t<
+ view_range< typename mpl::front< R >::type >::bound::value *
+ view_size< typename mpl::pop_front< R >::type,typename mpl::next< B >::type,E >::type::value
+ >::type type;
+ };
+
+ template< class R, class E >
+ struct view_size< R,E,E >
+ {
+ typedef mpl::size_t< 1 > type;
+ };
+
+ } // namespace detail
+
+ template< class R >
+ struct view_size
+ {
+ typedef typename detail::view_size<
+ R,typename mpl::begin< R >::type,typename mpl::end< R >::type
+ >::type type;
+ };
+
+//--
+
+ template< class A, class R, bool P > struct view_traits_base_ {};
+ template< class A, class R, bool P > struct view_traits_ {};
+
+//--
+
+ template< class T, class B, bool I, class A, class R, bool P >
+ struct view_traits_base_< array< T,B,I,A >,R,P >
+ {
+ typedef typename view_bounds< mpl::vector0<>,R >::type bounds;
+ typedef array< T*,bounds,false,A > array_type;
+ };
+
+ template< class T, class B, bool I, class A, class R >
+ struct view_traits_base_< array< T,B,I,A >,R,false >
+ {
+ typedef typename view_bounds< mpl::vector0<>,R >::type bounds;
+ typedef array< T,bounds,false,A > array_type;
+ };
+
+//--
+
+ template< class T, class B, bool I, class A, class R, bool P >
+ struct view_traits_< array< T,B,I,A >,R,P >
+ : view_traits_base_< array< T,B,I,A >,R,P >
+ {
+ typedef view_traits_base_< array< T,B,I,A >,R,P > base_type;
+ typedef typename base_type::array_type::member_type member_type;
+ typedef typename base_type::array_type::value_type value_type;
+ typedef typename base_type::array_type::const_reference_type const_reference_type;
+ typedef typename base_type::array_type::reference_type reference_type;
+ typedef typename base_type::array_type::const_iterator_type const_iterator_type;
+ typedef typename base_type::array_type::iterator_type iterator_type;
+ typedef typename base_type::array_type::element_type element_type;
+ typedef typename base_type::array_type::const_iterator const_iterator;
+ typedef typename base_type::array_type::iterator iterator;
+ typedef typename base_type::array_type::const_reference const_reference;
+ typedef typename base_type::array_type::reference reference;
+ typedef typename base_type::array_type::allocator_type allocator_type;
+ typedef typename base_type::array_type::size_type size_type;
+ typedef typename base_type::array_type::difference_type difference_type;
+ typedef typename base_type::array_type::bounds_type bounds_type;
+ typedef typename base_type::array_type::bounds_const_reference bounds_const_reference;
+ typedef typename base_type::bounds bounds;
+ typedef typename view_ranges< base_type::array_type::dimensionality,R >::type ranges;
+
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A, class R, bool P >
+ struct view_traits_< array_< T,N,D,I,A >,R,P >
+ : view_traits_< array< T,typename array_bounds_< N,D >::type,I,A >,R,P >
+ {};
+
+//--
+
+ template< class A, class R, bool B = true > class view_;
+
+//--
+//--
+
+// view
+
+ template< class T, class A >
+ struct view_allocator_type
+ {
+ typedef typename A::template rebind< T >::other type;
+ };
+
+ template< class T >
+ struct view_allocator_type< T,null::allocator >
+ {
+ typedef std::allocator< T > type;
+ };
+
+//--
+
+ template< class P, bool B >
+ struct view_traits_base
+ {
+ typedef typename P::element_type* T;
+ typedef typename view_allocator_type< T,typename P::allocator_type >::type A;
+ typedef pointer< T,P::dimensionality,P::initialize::value,A > pointer_type;
+ };
+
+ template< class P >
+ struct view_traits_base< P,false >
+ {
+ typedef typename P::element_type T;
+ typedef typename view_allocator_type< T,typename P::allocator_type >::type A;
+ typedef pointer< T,P::dimensionality,P::initialize::value,A > pointer_type;
+ };
+
+//--
+
+ template< class P, bool B >
+ struct view_traits
+ : view_traits_base< P,B >
+ {
+ typedef view_traits_base< P,B > base_type;
+ typedef typename base_type::pointer_type::member_type member_type;
+ typedef typename base_type::pointer_type::value_type value_type;
+ typedef typename base_type::pointer_type::const_reference_type const_reference_type;
+ typedef typename base_type::pointer_type::reference_type reference_type;
+ typedef typename base_type::pointer_type::const_iterator_type const_iterator_type;
+ typedef typename base_type::pointer_type::iterator_type iterator_type;
+ typedef typename base_type::pointer_type::element_type element_type;
+ typedef typename base_type::pointer_type::const_iterator const_iterator;
+ typedef typename base_type::pointer_type::iterator iterator;
+ typedef typename base_type::pointer_type::const_reference const_reference;
+ typedef typename base_type::pointer_type::reference reference;
+ typedef typename base_type::pointer_type::allocator_type allocator_type;
+ typedef typename base_type::pointer_type::size_type size_type;
+ typedef typename base_type::pointer_type::difference_type difference_type;
+ typedef typename base_type::pointer_type::bounds_type bounds_type;
+ typedef typename base_type::pointer_type::bounds_const_reference bounds_const_reference;
+ typedef typename P::limits_type limits_type;
+ typedef array< std::size_t, bounds2< P::dimensionality,3 > > ranges;
+ typedef ranges const& ranges_const_reference;
+
+ };
+
+//--
+
+ template< class P, bool B = true > class view;
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_SUPPORT_GENERIC_HPP

Added: sandbox/maps/maps/boost/maps/support/includes.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/support/includes.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,28 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_SUPPORT_INCLUDES_HPP )
+#define BOOST_MAPS_SUPPORT_INCLUDES_HPP
+
+#include <boost/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <boost/maps/support/expression.hpp>
+#include <boost/maps/support/generic.hpp>
+#include <boost/maps/support/bounds.hpp>
+
+#include <utility>
+#include <sstream>
+#include <memory>
+#include <stdexcept>
+#include <algorithm>
+
+#include <string.h>
+
+#endif // BOOST_MAPS_SUPPORT_INCLUDES_HPP
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/support/math.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/support/math.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,246 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+#if !defined( BOOST_MAPS_SUPPORT_MATH_HPP )
+#define BOOST_MAPS_SUPPORT_MATH_HPP
+
+#include <boost/maps/generic/array.hpp>
+#include <boost/maps/generic/array_.hpp>
+
+namespace boost { namespace maps {
+
+//--
+
+ template< class T, std::size_t N, bool I, class A >
+ struct vector_type
+ {
+ typedef array_< T,1,N,I,A > type;
+ };
+
+//--
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ struct matrix_type
+ {
+ typedef array< T,bounds2< M,N >,I,A > type;
+ };
+
+//--
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A >
+ struct tensor_type
+ {
+ typedef array_< T,N,D,I,A > type;
+ };
+
+//--
+
+ template< class T > class scalar;
+ template< class T, std::size_t N, bool I = true, class A = null::allocator > class vector;
+ template< class T, std::size_t M, std::size_t N, bool I = true, class A = null::allocator > class matrix;
+ template< class T, std::size_t N, std::size_t D, bool I = true, class A = null::allocator > class tensor;
+
+//--
+
+ template< class T1, class T2 >
+ struct matrix_vector_type
+ {
+ typedef typename common_type< T1,T2 >::type type;
+ };
+
+ template< class T1, std::size_t N, bool I1, class A1, class T2, bool I2, class A2 >
+ struct matrix_vector_type< vector< T1,N,I1,A1 >,vector< T2,N,I2,A2 > >
+ {
+ typedef matrix< typename common_type< T1,T2 >::type,N,N,I1,A1 > type;
+ };
+
+ template< class T1, std::size_t N, bool I1, class A1, class T2, std::size_t M, bool I2, class A2 >
+ struct matrix_vector_type< vector< T1,N,I1,A1 >,matrix< T2,N,M,I2,A2 > >
+ {
+ typedef matrix< typename common_type< T1,T2 >::type,N,M,I2,A2 > type;
+ };
+
+ template< class T1, std::size_t M, std::size_t N, bool I1, class A1, class T2, bool I2, class A2 >
+ struct matrix_vector_type< matrix< T1,M,N,I1,A1 >,vector< T2,N,I2,A2 > >
+ {
+ typedef matrix< typename common_type< T1,T2 >::type,M,N,I1,A1 > type;
+ };
+
+ template< class T1, std::size_t N1, bool I1, class A1, std::size_t N, bool I2, class A2, class T2, bool I3, class A3, bool I4, class A4 >
+ struct matrix_vector_type< vector< vector< T1,N1,I1,A1 >,N,I2,A2 >,vector< vector< T2,N1,I3,A3 >,N,I4,A4 > >
+ {
+ typedef matrix< typename matrix_vector_type< vector< T1,N1,I1,A1 >,vector< T2,N1,I3,A3 > >::type,N1,N1,I1,A1 > type;
+ };
+
+ template< class T1, std::size_t N1, bool I1, class A1, std::size_t N, bool I2, class A2, class T2, std::size_t M1, bool I3, class A3, std::size_t M, bool I4, class A4 >
+ struct matrix_vector_type< vector< vector< T1,N1,I1,A1 >,N,I2,A2 >,matrix< matrix< T2,N1,M1,I3,A3 >,N,M,I4,A4 > >
+ {
+ typedef matrix< typename matrix_vector_type< vector< T1,N1,I1,A1 >,matrix< T2,N1,M1,I3,A3 > >::type,N1,M1,I3,A3 > type;
+ };
+
+ template< class T1, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I2, class A2, class T2, bool I3, class A3, bool I4, class A4 >
+ struct matrix_vector_type< matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 >,vector< vector< T2,N1,I3,A3 >,N,I4,A4 > >
+ {
+ typedef matrix< typename matrix_vector_type< matrix< T1,M1,N1,I1,A1 >,vector< T2,N1,I3,A3 > >::type,M1,N1,I1,A1 > type;
+ };
+
+//--
+
+ template< class T1, class T2 >
+ struct vector_matrix_type
+ {
+ typedef typename common_type< T1,T2 >::type type;
+ };
+
+ template< class T1, std::size_t N1, bool I1, class A1, class T2, std::size_t N2, bool I2, class A2 >
+ struct vector_matrix_type< vector< T1,N1,I1,A1 >,matrix< T2,N1,N2,I2,A2 > >
+ {
+ typedef vector< T1,N2,I1,A1 > type;
+ };
+
+ template< class T1, std::size_t N1, bool I1, class A1, class T2, std::size_t N2, bool I2, class A2 >
+ struct vector_matrix_type< matrix< T2,N1,N2,I2,A2 >,vector< T1,N2,I1,A1 > >
+ {
+ typedef vector< T1,N1,I1,A1 > type;
+ };
+
+ template< class T1, std::size_t N1, bool I1, class A1, std::size_t N, bool I2, class A2, class T2, std::size_t N2, bool I3, class A3, std::size_t M, bool I4, class A4 >
+ struct vector_matrix_type< vector< vector< T1,N1,I1,A1 >,N,I2,A2 >,matrix< matrix< T2,N1,N2,I3,A3 >,N,M,I4,A4 > >
+ {
+ typedef vector< typename vector_matrix_type< vector< T1,N1,I1,A1 >,matrix< T2,N1,N2,I3,A3 > >::type,M,I2,A2 > type;
+ };
+
+ template< class T1, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I2, class A2, class T2, bool I3, class A3, bool I4, class A4 >
+ struct vector_matrix_type< matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 >,vector< vector< T2,N1,I3,A3 >,N,I4,A4 > >
+ {
+ typedef vector< typename vector_matrix_type< matrix< T1,M1,N1,I1,A1 >,vector< T2,N1,I3,A3 > >::type,M,I4,A4 > type;
+ };
+
+//--
+
+ template< class T1, class T2 >
+ struct matrix_scalar_type
+ {
+ typedef typename common_type< T1,T2 >::type type;
+ };
+
+ template< class T1, class T2, std::size_t M, std::size_t N, bool I, class A >
+ struct matrix_scalar_type< T1,matrix< T2,M,N,I,A > >
+ {
+ typedef matrix< typename common_type< T1,T2 >::type,M,N,I,A > type;
+ };
+
+ template< class T1, std::size_t M, std::size_t N, bool I, class A, class T2 >
+ struct matrix_scalar_type< matrix< T1,M,N,I,A >,T2 >
+ {
+ typedef matrix< typename common_type< T1,T2 >::type,M,N,I,A > type;
+ };
+
+ template< class T1, class T2, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I2, class A2 >
+ struct matrix_scalar_type< T1,matrix< matrix< T2,M1,N1,I1,A1 >,M,N,I2,A2 > >
+ {
+ typedef matrix< matrix< T2,M1,N1,I1,A1 >,M,N,I2,A2 > type;
+ };
+
+ template< class T1, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I2, class A2, class T2 >
+ struct matrix_scalar_type< matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 >,T2 >
+ {
+ typedef matrix< matrix< T1,M1,N1,I1,A1 >,M,N,I2,A2 > type;
+ };
+
+//--
+
+ template< class T1, class T2 >
+ struct vector_scalar_type
+ {
+ typedef typename common_type< T1,T2 >::type type;
+ };
+
+ template< class T1, class T2, std::size_t N, bool I, class A >
+ struct vector_scalar_type< T1,vector< T2,N,I,A > >
+ {
+ typedef vector< typename common_type< T1,T2 >::type,N,I,A > type;
+ };
+
+ template< class T1, std::size_t N, bool I, class A, class T2 >
+ struct vector_scalar_type< vector< T1,N,I,A >,T2 >
+ {
+ typedef vector< typename common_type< T1,T2 >::type,N,I,A > type;
+ };
+
+ template< class T1, class T2, std::size_t N1, bool I1, class A1, std::size_t N, bool I2, class A2 >
+ struct vector_scalar_type< T1,vector< vector< T2,N1,I1,A1 >,N,I2,A2 > >
+ {
+ typedef vector< vector< T2,N1,I1,A1 >,N,I2,A2 > type;
+ };
+
+ template< class T1, std::size_t N1, bool I1, class A1, std::size_t N, bool I2, class A2, class T2 >
+ struct vector_scalar_type< vector< vector< T1,N1,I1,A1 >,N,I2,A2 >,T2 >
+ {
+ typedef vector< vector< T1,N1,I1,A1 >,N,I2,A2 > type;
+ };
+
+//--
+
+ template< class T1, class T2 >
+ struct matrix_product_type
+ {
+ typedef typename common_type< T1,T2 >::type type;
+ };
+
+ template< class T1, std::size_t M, std::size_t P, bool I1, class A1, class T2, std::size_t N, bool I2, class A2 >
+ struct matrix_product_type< matrix< T1,M,P,I1,A1 >,matrix< T2,P,N,I2,A2 > >
+ {
+ typedef matrix< typename common_type< T1,T2 >::type,M,N,true,A1 > type;
+ };
+
+ template< class T1, std::size_t M1, std::size_t P1, bool I1, class A1, std::size_t M, std::size_t P, bool I2, class A2, class T2, std::size_t N1, bool I3, class A3, std::size_t N, bool I4, class A4 >
+ struct matrix_product_type< matrix< matrix< T1,M1,P1,I1,A1 >,M,P,I2,A2 >,matrix< matrix< T2,P1,N1,I3,A3 >,P,N,I4,A4 > >
+ {
+ typedef matrix< typename matrix_product_type< matrix< T1,M1,P1,I1,A1 >,matrix< T2,P1,N1,I3,A3 > >::type,M,N,true,A2 > type;
+ };
+
+//--
+
+ template< class T >
+ struct matrix_transpose_type
+ {
+ typedef T type;
+ };
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ struct matrix_transpose_type< matrix< T,M,N,I,A > >
+ {
+ typedef matrix< T,N,M,I,A > type;
+ };
+
+ template< class T, std::size_t M1, std::size_t N1, bool I1, class A1, std::size_t M, std::size_t N, bool I, class A >
+ struct matrix_transpose_type< matrix< matrix< T,M1,N1,I1,A1 >,M,N,I,A > >
+ {
+ typedef matrix< typename matrix_transpose_type< matrix< T,M1,N1,I1,A1 > >::type,N,M,I,A > type;
+ };
+
+//--
+
+ template< class T >
+ struct is_matrix
+ {
+ typedef mpl::bool_< false > type;
+ };
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A >
+ struct is_matrix< matrix< T,M,N,I,A > >
+ {
+ typedef mpl::bool_< true > type;
+ };
+
+//--
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_MAPS_SUPPORT_MATH_HPP

Added: sandbox/maps/maps/boost/maps/support/preprocessor_bounds.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/support/preprocessor_bounds.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,50 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+
+#ifndef BOOST_PP_IS_ITERATING
+
+# if !defined( BOOST_MAPS_SUPPORT_PREPROCESSOR_BOUNDS_HPP )
+# define BOOST_MAPS_SUPPORT_PREPROCESSOR_BOUNDS_HPP
+
+# include <boost/mpl/vector_c.hpp>
+# include <boost/preprocessor/cat.hpp>
+# include <boost/preprocessor/repetition.hpp>
+# include <boost/preprocessor/iteration/iterate.hpp>
+
+namespace boost { namespace maps {
+
+ // bounds0 definition
+ struct bounds0
+ : mpl::vector0_c< std::size_t >
+ {};
+
+}} // namespace boost, namespace maps
+
+// generate remaining definitions
+# define BOOST_PP_ITERATION_LIMITS (1, BOOST_MPL_LIMIT_VECTOR_SIZE)
+# define BOOST_PP_FILENAME_1 <boost/maps/support/preprocessor_bounds.hpp>
+# include BOOST_PP_ITERATE()
+
+# endif // BOOST_MAPS_SUPPORT_PREPROCESSOR_BOUNDS_HPP
+
+#else // BOOST_PP_IS_ITERATING
+
+namespace boost { namespace maps {
+
+ // boundsN definition
+ template< BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), std::size_t S) >
+ struct BOOST_PP_CAT(bounds,BOOST_PP_ITERATION())
+ : public mpl::BOOST_PP_CAT(BOOST_PP_CAT(vector,BOOST_PP_ITERATION()),_c)<
+ std::size_t, BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), S)
+ >
+ {};
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_PP_IS_ITERATING
\ No newline at end of file

Added: sandbox/maps/maps/boost/maps/support/preprocessor_ranges.hpp
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/boost/maps/support/preprocessor_ranges.hpp 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,50 @@
+//--
+// Copyright (c) 2010-2011 Brian Smith
+//
+// 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)
+//
+// See http://www.boost.org/libs/maps for documentation.
+//--
+
+#ifndef BOOST_PP_IS_ITERATING
+
+# if !defined( BOOST_MAPS_SUPPORT_PREPROCESSOR_RANGES_HPP )
+# define BOOST_MAPS_SUPPORT_PREPROCESSOR_RANGES_HPP
+
+# include <boost/mpl/vector.hpp>
+# include <boost/preprocessor/cat.hpp>
+# include <boost/preprocessor/repetition.hpp>
+# include <boost/preprocessor/iteration/iterate.hpp>
+
+namespace boost { namespace maps {
+
+ // ranges0 definition
+ struct ranges0
+ : mpl::vector0<>
+ {};
+
+}} // namespace boost, namespace maps
+
+// generate remaining definitions
+# define BOOST_PP_ITERATION_LIMITS (1, BOOST_MPL_LIMIT_VECTOR_SIZE)
+# define BOOST_PP_FILENAME_1 <boost/maps/support/preprocessor_ranges.hpp>
+# include BOOST_PP_ITERATE()
+
+# endif // BOOST_MAPS_SUPPORT_PREPROCESSOR_RANGES_HPP
+
+#else // BOOST_PP_IS_ITERATING
+
+namespace boost { namespace maps {
+
+ // rangesN definition
+ template< BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class R) >
+ struct BOOST_PP_CAT(ranges,BOOST_PP_ITERATION())
+ : mpl::BOOST_PP_CAT(vector,BOOST_PP_ITERATION())<
+ BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), R)
+ >
+ {};
+
+}} // namespace boost, namespace maps
+
+#endif // BOOST_PP_IS_ITERATING

Added: sandbox/maps/maps/libs/maps/doc/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/Jamfile.v2 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,32 @@
+
+# Copyright John Maddock 2005. Use, modification, and distribution are
+# subject to the Boost Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+using quickbook ;
+
+xml maps : maps.qbk ;
+boostbook standalone
+ :
+ maps
+ :
+ # Path for links to Boost:
+ <xsl:param>boost.root=../../../..
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=1
+ # Don't put the first section on the same page as the TOC:
+ <xsl:param>chunk.first.sections=0
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=1
+ ;
+
+
+

Added: sandbox/maps/maps/libs/maps/doc/html/index.html
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/html/index.html 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,77 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Boost.Maps</title>
+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="index.html" title="Boost.Maps">
+<link rel="next" href="maps/concepts.html" title="Concepts">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="maps/concepts.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
+<div class="book">
+<div class="titlepage">
+<div>
+<div><h1 class="title">
+<a name="maps"></a>Boost.Maps</h1></div>
+<div><div class="authorgroup"><div class="author"><h3 class="author">
+<span class="firstname">Brian</span> <span class="surname">Smith</span>
+</h3></div></div></div>
+<div><p class="copyright">Copyright &#169; 2010 -2011 Brian Smith</p></div>
+<div><div class="legalnotice">
+<a name="id752289"></a><p>
+ 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)
+ </p>
+</div></div>
+</div>
+<hr>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="maps.introduction"></a><a class="link" href="index.html#maps.introduction" title="Introduction">Introduction</a>
+</h2></div></div></div>
+<p>
+ The Boost maps library provides sequence containers for statically and dynamically
+ allocated multi-dimensional arrays. The implementations allow standard data
+ element types, data element initialization, subject to conditions imposed by
+ the data element type, and the choice of allocator used for memory allocation,
+ element construction, etc., where appropriate. The library also includes scalar
+ and fixed-size vector and matrix class templates with a DSEL implementation
+ of operators via expression templates.
+ </p>
+<p>
+ The <a class="link" href="maps/concepts.html" title="Concepts">Concepts</a> section provides an overview
+ of the library as well as a discussion of the supplementary structures that
+ interoperate with the main classes in the library.
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <a class="link" href="maps/concepts.html" title="Concepts">Concepts</a>
+ </li>
+<li class="listitem">
+ <a class="link" href="maps/tutorial.html" title="Tutorial">Tutorial</a>
+ </li>
+<li class="listitem">
+ <a class="link" href="maps/reference.html" title="Reference">Reference</a>
+ </li>
+</ul></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: June 11, 2011 at 13:25:38 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"><a accesskey="n" href="maps/concepts.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
+</body>
+</html>

Added: sandbox/maps/maps/libs/maps/doc/html/maps/array.html
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/html/maps/array.html 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>array</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Boost.Maps">
+<link rel="up" href="../index.html" title="Boost.Maps">
+<link rel="prev" href="reference.html" title="Reference">
+<link rel="next" href="array_.html" title="array_">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="reference.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="array_.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="maps.array"></a><a class="link" href="array.html" title="array">array</a>
+</h2></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2010 -2011 Brian Smith<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="reference.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="array_.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/maps/maps/libs/maps/doc/html/maps/array_.html
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/html/maps/array_.html 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>array_</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Boost.Maps">
+<link rel="up" href="../index.html" title="Boost.Maps">
+<link rel="prev" href="array.html" title="array">
+<link rel="next" href="pointer.html" title="pointer">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="array.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="pointer.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="maps.array_"></a><a class="link" href="array_.html" title="array_">array_</a>
+</h2></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2010 -2011 Brian Smith<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="array.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="pointer.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/maps/maps/libs/maps/doc/html/maps/concepts.html
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/html/maps/concepts.html 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,526 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Concepts</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Boost.Maps">
+<link rel="up" href="../index.html" title="Boost.Maps">
+<link rel="prev" href="../index.html" title="Boost.Maps">
+<link rel="next" href="tutorial.html" title="Tutorial">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="maps.concepts"></a><a class="link" href="concepts.html" title="Concepts">Concepts</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Introduction</span></dt>
+<dt><span class="section">Fixed-Size Arrays</span></dt>
+<dt><span class="section">Resizeable Arrays</span></dt>
+<dt><span class="section">Array Views</span></dt>
+<dt><span class="section"><a href="concepts.html#maps.concepts.scalars_vectors_matrices">Scalars, Vectors
+ and Matrices</a></span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="maps.concepts.introduction"></a><a class="link" href="concepts.html#maps.concepts.introduction" title="Introduction">Introduction</a>
+</h3></div></div></div>
+<p>
+ The array of array specification for statically allocated intrinsic multi-dimensional
+ arrays is conceptually well defined in C++. The fixed-size array class templates
+ discussed here include versions whose data member is an intrinsic multi-dimensional
+ array. The arrays' shape is determined from a compile time supplied set of
+ bounds. An alternative approach to constructing multi-dimensional arrays
+ results from using pointers. The structural components in this case are allocated
+ dynamically at runtime allowing for both fixed-size and resizeable varieties.
+ The approach taken here is to allocate all the elements at each dimension
+ in a continuous block of memory from a given set of bounds. For fixed-size
+ arrays this again means the bounds are set at compile time. A resizeable
+ array must be passed a set of bounds in order to construct it in addition
+ to the purpose of resizing.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="maps.concepts.fixed_size_arrays"></a><a class="link" href="concepts.html#maps.concepts.fixed_size_arrays" title="Fixed-Size Arrays">Fixed-Size Arrays</a>
+</h3></div></div></div>
+<p>
+ The array types <code class="computeroutput"><span class="identifier">array</span></code> and
+ <code class="computeroutput"><span class="identifier">array_</span></code> define objects that
+ satisfy the notion of a multi-dimensional array. The data member type generated
+ for the array depends on the template arguments to the class. The header
+ <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">array</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ defines the class template,
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">B</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">I</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">array</span><span class="special">;</span>
+</pre>
+<p>
+ Here,
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">T</span></code> is the data type the
+ array holds.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">B</span></code> is a <code class="computeroutput"><span class="identifier">boundsN</span></code> sequence of <code class="computeroutput"><span class="identifier">N</span></code>
+ non-zero positive integers.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">I</span></code> is the zero/default
+ initialization parameter.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">A</span></code> is an allocator type.
+ </li>
+</ul></div>
+<p>
+ The sequence argument, <code class="computeroutput"><span class="identifier">B</span></code>,
+ determines the dimensionality, <code class="computeroutput"><span class="identifier">N</span></code>,
+ of the array, as well as the size of each dimension. The library defines
+ a <code class="computeroutput"><span class="identifier">null</span><span class="special">::</span><span class="identifier">allocator</span></code> type which is the default allocator
+ type for the class. If a <code class="computeroutput"><span class="identifier">null</span><span class="special">::</span><span class="identifier">allocator</span></code>
+ is used for the template argument <code class="computeroutput"><span class="identifier">A</span></code>
+ then the resulting data member is a statically allocated array of <code class="computeroutput"><span class="identifier">N</span></code> dimensions with the size of each dimension
+ given by successive values in the argument sequence <code class="computeroutput"><span class="identifier">B</span></code>,
+ and with data elements of type <code class="computeroutput"><span class="identifier">T</span></code>,
+ where the usual restrictions on type <code class="computeroutput"><span class="identifier">T</span></code>
+ apply. Otherwise the array data member is the type <code class="computeroutput"><span class="identifier">T</span></code>
+ or its non-reference equivalent, which from here on its assumed to be, with
+ <code class="computeroutput"><span class="identifier">N</span></code> pointer symbols appended
+ and is constructed at runtime in accordance with template argument's <code class="computeroutput"><span class="identifier">B</span></code>, <code class="computeroutput"><span class="identifier">I</span></code>
+ and <code class="computeroutput"><span class="identifier">A</span></code>. In either case if
+ the argument <code class="computeroutput"><span class="identifier">T</span></code> has a non-trivial
+ constructor the data elements will be constructed during the construction
+ of the array, standard case for intrinsic arrays, otherwise data element
+ construction will depend on the argument <code class="computeroutput"><span class="identifier">I</span></code>,
+ whose default value is <code class="computeroutput"><span class="keyword">true</span></code>.
+ Therefore, arguments are always required for both <code class="computeroutput"><span class="identifier">T</span></code>
+ and <code class="computeroutput"><span class="identifier">B</span></code>, while <code class="computeroutput"><span class="identifier">I</span></code> and <code class="computeroutput"><span class="identifier">A</span></code>
+ are optional.
+ </p>
+<p>
+ As an illustration the following declaration produces an <code class="computeroutput"><span class="identifier">array</span></code>
+ object with data member type <code class="computeroutput"><span class="keyword">int</span><span class="special">[</span><span class="number">3</span><span class="special">][</span><span class="number">4</span><span class="special">][</span><span class="number">5</span><span class="special">][</span><span class="number">4</span><span class="special">][</span><span class="number">3</span><span class="special">]</span></code> and zero
+ initialized data elements.
+ </p>
+<pre class="programlisting"><span class="identifier">array</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">bounds5</span><span class="special">&lt;</span> <span class="number">3</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">5</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">3</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">a</span><span class="special">;</span>
+</pre>
+<p>
+ If we now consider the declaration,
+ </p>
+<pre class="programlisting"><span class="identifier">array</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">bounds5</span><span class="special">&lt;</span> <span class="number">3</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">5</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">3</span> <span class="special">&gt;,</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span> <span class="keyword">int</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">a</span><span class="special">;</span>
+</pre>
+<p>
+ The <code class="computeroutput"><span class="identifier">array</span></code> object's data member
+ in this case is an <code class="computeroutput"><span class="keyword">int</span><span class="special">*****</span></code>
+ whose runtime construction requires five memory allocations with the data
+ elements left uninitialized. A point of note concerns the allocator type
+ used in the previous declaration. Strictly, it should have been <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">****</span>
+ <span class="special">&gt;</span></code>, however the nested <code class="computeroutput"><span class="identifier">rebind</span></code> struct in the original declaration's
+ allocator is used to bind the template parameter to the correct type. Since
+ a non-static N-dimensional array requires N allocations for N different types,
+ N different allocators are necessary to fully construct the resulting array.
+ </p>
+<p>
+ The header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">array_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ defines the class template,
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">D</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">I</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">array_</span><span class="special">;</span>
+</pre>
+<p>
+ Here,
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">T</span></code> is the data type the
+ array holds.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">N</span></code> is the dimensionality
+ of the array.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">D</span></code> is the size of each
+ of the <code class="computeroutput"><span class="identifier">N</span></code> dimensions of
+ the array.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">I</span></code> is the zero/default
+ initialization parameter.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">A</span></code> is an allocator type.
+ </li>
+</ul></div>
+<p>
+ The template parameters <code class="computeroutput"><span class="identifier">T</span></code>,
+ <code class="computeroutput"><span class="identifier">I</span></code> and <code class="computeroutput"><span class="identifier">A</span></code>
+ have the same meaning, requirements and default behaviour as the <code class="computeroutput"><span class="identifier">array</span></code> class template discussed previously.
+ An <code class="computeroutput"><span class="identifier">array_</span></code> object has dimensionality
+ <code class="computeroutput"><span class="identifier">N</span></code> with each dimension taking
+ the fixed value <code class="computeroutput"><span class="identifier">D</span></code>, both of
+ which are required parameters. Thus, in the following declaration the data
+ member type is <code class="computeroutput"><span class="keyword">int</span><span class="special">[</span><span class="number">5</span><span class="special">][</span><span class="number">5</span><span class="special">][</span><span class="number">5</span><span class="special">][</span><span class="number">5</span><span class="special">][</span><span class="number">5</span><span class="special">]</span></code> with zero initialized data elements.
+ </p>
+<pre class="programlisting"><span class="identifier">array_</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">5</span><span class="special">,</span><span class="number">5</span> <span class="special">&gt;</span> <span class="identifier">a</span><span class="special">;</span>
+</pre>
+<p>
+ The dynamically allocated version with uninitialized data elements results
+ from,
+ </p>
+<pre class="programlisting"><span class="identifier">array_</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">5</span><span class="special">,</span><span class="number">5</span><span class="special">,</span> <span class="keyword">false</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span> <span class="keyword">int</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">a</span><span class="special">;</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="maps.concepts.resizeable_arrays"></a><a class="link" href="concepts.html#maps.concepts.resizeable_arrays" title="Resizeable Arrays">Resizeable Arrays</a>
+</h3></div></div></div>
+<p>
+ The arrays discussed in this section satisfy the notion of a dynamically
+ allocated multi-dimensional array. The header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">pointer</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ defines the class template,
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">I</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">pointer</span><span class="special">;</span>
+</pre>
+<p>
+ Here,
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">T</span></code> is the data type the
+ array holds.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">N</span></code> is the dimensionality
+ of the array.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">I</span></code> is the zero/default
+ initialization parameter.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">A</span></code> is an allocator type.
+ </li>
+</ul></div>
+<p>
+ Parameters <code class="computeroutput"><span class="identifier">T</span></code> and <code class="computeroutput"><span class="identifier">N</span></code> are both required, while <code class="computeroutput"><span class="identifier">I</span></code> and <code class="computeroutput"><span class="identifier">A</span></code>
+ are optional, with respective default's <code class="computeroutput"><span class="keyword">false</span></code>
+ and <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span>
+ <span class="identifier">T</span> <span class="special">&gt;</span></code>.
+ In order to construct a <code class="computeroutput"><span class="identifier">pointer</span></code>
+ type with specific dimensions the auxiliary type <code class="computeroutput"><span class="identifier">bounds</span></code>,
+ defined in the header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">bounds</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>,
+ is required. A <code class="computeroutput"><span class="identifier">bounds</span></code> type
+ is a template array type with a single <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code>
+ parameter that determines the number of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code>
+ type elements the array should hold. Notwithstanding Scott Meyers item<sup>[<a name="id753190" href="#ftn.id753190" class="footnote">1</a>]</sup> and similar to Blitz++<sup>[<a name="id753199" href="#ftn.id753199" class="footnote">2</a>]</sup> arrays the comma operator has been overloaded for convenience.
+ The following declaration and assignment results in the <code class="computeroutput"><span class="identifier">bounds</span></code>
+ array <code class="computeroutput"><span class="identifier">b</span></code> having values 3,
+ 4, 5, 4 and 3 respectively.
+ </p>
+<pre class="programlisting"><span class="identifier">bounds</span><span class="special">&lt;</span><span class="number">5</span><span class="special">&gt;</span> <span class="identifier">b</span><span class="special">;</span>
+<span class="identifier">b</span> <span class="special">=</span> <span class="number">3</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">5</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">3</span><span class="special">;</span>
+</pre>
+<p>
+ Creating a <code class="computeroutput"><span class="identifier">pointer</span></code> object
+ with uninitialized data elements then follows as,
+ </p>
+<pre class="programlisting"><span class="identifier">pointer</span><span class="special">&lt;</span> <span class="keyword">double</span><span class="special">,</span> <span class="number">5</span> <span class="special">&gt;</span> <span class="identifier">a</span><span class="special">(</span> <span class="identifier">b</span> <span class="special">);</span>
+</pre>
+<p>
+ To continue, we can further write,
+ </p>
+<pre class="programlisting"><span class="identifier">b</span> <span class="special">=</span> <span class="number">5</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">3</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">5</span><span class="special">;</span>
+<span class="identifier">a</span><span class="special">.</span><span class="identifier">resize</span><span class="special">&lt;</span> <span class="keyword">false</span> <span class="special">&gt;(</span> <span class="identifier">b</span> <span class="special">);</span>
+</pre>
+<p>
+ This results in the array being resized to the updated values in <code class="computeroutput"><span class="identifier">b</span></code> without preserving the values already
+ present in <code class="computeroutput"><span class="identifier">a</span></code>. For a <code class="computeroutput"><span class="identifier">pointer</span></code> type with dimensionality <code class="computeroutput"><span class="identifier">N</span></code>, <code class="computeroutput"><span class="identifier">N</span></code>
+ memory allocations are again required. However, for an already constructed
+ array such as <code class="computeroutput"><span class="identifier">a</span></code> above it
+ is only necessary to make a request for memory during resizing if the total
+ number of elements required for each dimension is different from that already
+ present. At least this is the case for all but the final request where a
+ memory allocation is required if the template argument to <code class="computeroutput"><span class="identifier">resize</span></code>
+ is <code class="computeroutput"><span class="keyword">false</span></code> or if the template
+ argument to <code class="computeroutput"><span class="identifier">resize</span></code> is <code class="computeroutput"><span class="keyword">true</span></code> and the total number of elements differs
+ from the requested new total, thus maintaining the exception guarantee specified
+ for the class. For example, in the resize operation above the third request
+ for memory is to accommodate 5 x 4 x 3 = 60 elements, while 3 x 4 x 5 = 60
+ elements of the required type are already present, hence, no request for
+ memory is needed. Pedantically, the types <code class="computeroutput"><span class="identifier">dimensions</span></code>
+ and <code class="computeroutput"><span class="identifier">indexes</span></code> may be used in
+ place of a <code class="computeroutput"><span class="identifier">bounds</span></code> type for
+ construction and element access of a resizeable array.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="maps.concepts.array_views"></a><a class="link" href="concepts.html#maps.concepts.array_views" title="Array Views">Array Views</a>
+</h3></div></div></div>
+<p>
+ Accessing the elements of an array can be considered from a number of perspectives
+ that inevitably depends on the particular application and patterns in the
+ data represented by the elements. The indexing operator for example is used
+ to access individual elements of an array. However access to specific non-/continuous
+ sequences of elements in the form of slices or subarrays may be required.
+ For an N-dimensional array a slice can be represented in 1 to N-1 dimensions
+ whereas subarrays of N-dimensional arrays are themselves N-dimensional arrays.
+ A <code class="computeroutput"><span class="identifier">view</span></code> is a resizeable N-dimensional
+ array of the same dimesionality as the array used to define it. The data
+ elements can be either pointers to or copies of some sequence of data elements
+ from an array whose type parameterizes the <code class="computeroutput"><span class="identifier">view</span></code>.
+ </p>
+<p>
+ The header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">view</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ defines the class template,
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">B</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">view</span><span class="special">;</span>
+</pre>
+<p>
+ Here,
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">A</span></code> is the array type the
+ <code class="computeroutput"><span class="identifier">view</span></code> will be constructed
+ from.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">B</span></code> signifies our intention
+ to store pointers on an argument of type <code class="computeroutput"><span class="identifier">A</span></code>
+ or otherwise.
+ </li>
+</ul></div>
+<p>
+ <code class="computeroutput"><span class="identifier">A</span></code> is a required parameter
+ while <code class="computeroutput"><span class="identifier">B</span></code> is optional with
+ default value <code class="computeroutput"><span class="keyword">true</span></code>, i.e. stores
+ pointers to some sequence of data elements from an array of type <code class="computeroutput"><span class="identifier">A</span></code>. The <code class="computeroutput"><span class="identifier">view</span></code>
+ type contains the nested class template <code class="computeroutput"><span class="identifier">range</span></code>,
+ used to set three values, first, last and step, over one dimension of an
+ array of type <code class="computeroutput"><span class="identifier">A</span></code>. The relationship
+ between first, last and step can be considered analogous to the following
+ <code class="computeroutput"><span class="keyword">for</span></code> statement.
+ </p>
+<pre class="programlisting"><span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">first</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">last</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">+=</span> <span class="identifier">step</span> <span class="special">)</span> <span class="special">{</span> <span class="special">...</span> <span class="special">}</span>
+</pre>
+<p>
+ The single template parameter of a <code class="computeroutput"><span class="identifier">range</span></code>
+ is the type <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code> that determines which dimension
+ the <code class="computeroutput"><span class="identifier">range</span></code> is associated with.
+ For an N-dimensional array, N <code class="computeroutput"><span class="identifier">range</span></code>'s
+ should be set which together form the sequence of data elements from an argument
+ of type <code class="computeroutput"><span class="identifier">A</span></code> that the <code class="computeroutput"><span class="identifier">view</span></code> will store. The <code class="computeroutput"><span class="identifier">range</span></code>
+ constructor expects an argument of type <code class="computeroutput"><span class="identifier">view</span></code>.
+ Implicitly a <code class="computeroutput"><span class="identifier">view</span></code> must be
+ declared before setting the <code class="computeroutput"><span class="identifier">range</span></code>'s
+ and subsequently an argument of type <code class="computeroutput"><span class="identifier">A</span></code>
+ is passed to the <code class="computeroutput"><span class="identifier">view</span></code>'s
+ <code class="computeroutput"><span class="identifier">reset</span></code> method in order to
+ construct it. To clarify, consider the following,
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">array_</span><span class="special">&lt;</span> <span class="keyword">double</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span><span class="number">7</span><span class="special">,</span> <span class="keyword">true</span> <span class="special">&gt;</span> <span class="identifier">A</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">view</span><span class="special">&lt;</span> <span class="identifier">A</span> <span class="special">&gt;</span> <span class="identifier">V</span><span class="special">;</span>
+
+<span class="identifier">A</span> <span class="identifier">a</span><span class="special">;</span>
+<span class="identifier">V</span> <span class="identifier">v</span><span class="special">;</span>
+
+<span class="identifier">V</span><span class="special">::</span><span class="identifier">range</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span> <span class="identifier">r0</span><span class="special">(</span> <span class="identifier">v</span> <span class="special">);</span> <span class="identifier">r0</span> <span class="special">=</span> <span class="number">1</span><span class="special">,</span><span class="number">7</span><span class="special">,</span><span class="number">2</span><span class="special">;</span>
+<span class="identifier">V</span><span class="special">::</span><span class="identifier">range</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;</span> <span class="identifier">r1</span><span class="special">(</span> <span class="identifier">v</span> <span class="special">);</span> <span class="identifier">r1</span> <span class="special">=</span> <span class="number">1</span><span class="special">,</span><span class="number">7</span><span class="special">,</span><span class="number">2</span><span class="special">;</span>
+<span class="identifier">V</span><span class="special">::</span><span class="identifier">range</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;</span> <span class="identifier">r2</span><span class="special">(</span> <span class="identifier">v</span> <span class="special">);</span> <span class="identifier">r2</span> <span class="special">=</span> <span class="number">1</span><span class="special">,</span><span class="number">7</span><span class="special">,</span><span class="number">2</span><span class="special">;</span>
+
+<span class="identifier">v</span><span class="special">.</span><span class="identifier">reset</span><span class="special">(</span> <span class="identifier">a</span> <span class="special">);</span>
+</pre>
+<p>
+ The call to <code class="computeroutput"><span class="identifier">reset</span></code> in this
+ example constructs a three-dimensional <code class="computeroutput"><span class="identifier">view</span></code>
+ with shape 3 x 3 x 3 whose data elements store the addresses of every second
+ data element in the third dimension of every second array in the second dimension
+ of every second array of array in the first dimension of the 7 x 7 x 7 <code class="computeroutput"><span class="identifier">array_</span> <span class="identifier">a</span></code>.
+ </p>
+<p>
+ The header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">view_</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ defines the class template,
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">A</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">B</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">view_</span><span class="special">;</span>
+</pre>
+<p>
+ Here,
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">A</span></code> is the array type the
+ <code class="computeroutput"><span class="identifier">view_</span></code> will be constructed
+ from.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">R</span></code> is a sequence of ranges.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">B</span></code> signifies our intention
+ to store pointers on an argument of type <code class="computeroutput"><span class="identifier">A</span></code>
+ or otherwise.
+ </li>
+</ul></div>
+<p>
+ A <code class="computeroutput"><span class="identifier">view_</span></code> is used to construct
+ a view of a fixed-size array. The data member of a <code class="computeroutput"><span class="identifier">view_</span></code>
+ will be statically or dynamically allocated dependant on the type of the
+ data member of the array type <code class="computeroutput"><span class="identifier">A</span></code>.
+ <code class="computeroutput"><span class="identifier">A</span></code> and <code class="computeroutput"><span class="identifier">R</span></code>
+ are both required parameters with <code class="computeroutput"><span class="identifier">B</span></code>
+ optional defaulting to <code class="computeroutput"><span class="keyword">true</span></code>.
+ A <code class="computeroutput"><span class="identifier">view_</span></code> type is more restricted
+ than a <code class="computeroutput"><span class="identifier">view</span></code> in the sense
+ that the parameter <code class="computeroutput"><span class="identifier">R</span></code> defines
+ at compile time the ranges over an array of type <code class="computeroutput"><span class="identifier">A</span></code>
+ associated with the <code class="computeroutput"><span class="identifier">view_</span></code>.
+ Template types <code class="computeroutput"><span class="identifier">rangesN</span></code>,
+ <code class="computeroutput"><span class="identifier">N</span></code> the dimensionality of an
+ array of type <code class="computeroutput"><span class="identifier">A</span></code>, and <code class="computeroutput"><span class="identifier">range</span></code> are defined specifically for the
+ template argument <code class="computeroutput"><span class="identifier">R</span></code>. Since
+ the range's are predetermined the <code class="computeroutput"><span class="identifier">view_</span></code>
+ type defines a constructor accepting an argument of type <code class="computeroutput"><span class="identifier">A</span></code>.
+ Thus, we can write,
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">array_</span><span class="special">&lt;</span> <span class="keyword">double</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span><span class="number">7</span><span class="special">,</span> <span class="keyword">true</span> <span class="special">&gt;</span> <span class="identifier">A</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">ranges3</span><span class="special">&lt;</span> <span class="identifier">range</span><span class="special">&lt;</span> <span class="number">1</span><span class="special">,</span><span class="number">7</span><span class="special">,</span><span class="number">2</span> <span class="special">&gt;,</span> <span class="identifier">range</span><span class="special">&lt;</span> <span class="number">1</span><span class="special">,</span><span class="number">7</span><span class="special">,</span><span class="number">2</span> <span class="special">&gt;,</span> <span class="identifier">range</span><span class="special">&lt;</span> <span class="number">1</span><span class="special">,</span><span class="number">7</span><span class="special">,</span><span class="number">2</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">R</span><span class="special">;</span>
+<span class="keyword">typedef</span> <span class="identifier">view_</span><span class="special">&lt;</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">R</span> <span class="special">&gt;</span> <span class="identifier">V</span><span class="special">;</span>
+
+<span class="identifier">A</span> <span class="identifier">a</span><span class="special">;</span>
+<span class="identifier">V</span> <span class="identifier">v</span><span class="special">(</span> <span class="identifier">a</span> <span class="special">);</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="maps.concepts.scalars_vectors_matrices"></a><a class="link" href="concepts.html#maps.concepts.scalars_vectors_matrices" title="Scalars, Vectors and Matrices">Scalars, Vectors
+ and Matrices</a>
+</h3></div></div></div>
+<p>
+ In certain problem domains we can specify a set of integral dimensions which
+ fully characterize the problem space. Fixed-size matrices for example are
+ common in many algebraic problems. Knowing the initial dimensions in advance
+ allows us to exploit this knowledge in all future computations. For example,
+ given a matrix, M1, with M rows and P columns and a matrix, M2, with P rows
+ and N columns, the product M1 x M2 is a matrix, M3 say, with M rows and N
+ columns. Computational requirements such as the operand and result type dimensions
+ in this example can be encoded in the template parameters of the types involved
+ and also in the operators that act on them. The Boost maps library provides
+ implementations for <code class="computeroutput"><span class="identifier">scalar</span></code>
+ and fixed-size <code class="computeroutput"><span class="identifier">vector</span></code> and
+ <code class="computeroutput"><span class="identifier">matrix</span></code> operators that conform
+ to such requirements, enabling compile time determination of consistent operations
+ on the operands involved. The expression template paradigm has been invoked
+ to enhance performance for mathematically intensive applications. Note that
+ <code class="computeroutput"><span class="identifier">scalar</span></code> operands are a convenient
+ way to specify operations involving scalar types and are not intended to
+ be used as the data elements of the <code class="computeroutput"><span class="identifier">vector</span></code>
+ or <code class="computeroutput"><span class="identifier">matrix</span></code> types. The headers
+ <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">scalar</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>,
+ <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">vector</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ and <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">matrix</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
+ define the following respective types.
+ </p>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">scalar</span><span class="special">;</span>
+</pre>
+<p>
+ Here,
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+ <code class="computeroutput"><span class="identifier">T</span></code> is the data type of
+ the stored member.
+ </li></ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">I</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">vector</span><span class="special">;</span>
+</pre>
+<p>
+ Here,
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">T</span></code> is the element type.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">N</span></code> is the number of components.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">I</span></code> is the zero/default
+ initialization parameter.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">A</span></code> is an allocator type.
+ </li>
+</ul></div>
+<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">M</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">,</span> <span class="keyword">bool</span> <span class="identifier">I</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A</span> <span class="special">&gt;</span> <span class="keyword">class</span> <span class="identifier">matrix</span><span class="special">;</span>
+</pre>
+<p>
+ Here,
+ </p>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">T</span></code> is the element type.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">M</span></code> is the number of rows.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">N</span></code> is the number of columns.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">I</span></code> is the zero/default
+ initialization parameter.
+ </li>
+<li class="listitem">
+ <code class="computeroutput"><span class="identifier">A</span></code> is an allocator type.
+ </li>
+</ul></div>
+<p>
+ For all three class templates <code class="computeroutput"><span class="identifier">T</span></code>
+ is a required parameter. The parameters <code class="computeroutput"><span class="identifier">N</span></code>
+ for a <code class="computeroutput"><span class="identifier">vector</span></code> and, <code class="computeroutput"><span class="identifier">M</span></code> and <code class="computeroutput"><span class="identifier">N</span></code>
+ for a <code class="computeroutput"><span class="identifier">matrix</span></code> are also required.
+ The remaining parameters <code class="computeroutput"><span class="identifier">I</span></code>
+ and <code class="computeroutput"><span class="identifier">A</span></code> for the <code class="computeroutput"><span class="identifier">vector</span></code> and <code class="computeroutput"><span class="identifier">matrix</span></code>
+ class templates are optional with respective default's <code class="computeroutput"><span class="keyword">true</span></code>
+ and <code class="computeroutput"><span class="identifier">null</span><span class="special">::</span><span class="identifier">allocator</span></code> for both classes.
+ </p>
+</div>
+<div class="footnotes">
+<br><hr width="100" align="left">
+<div class="footnote"><p><sup>[<a id="ftn.id753190" href="#id753190" class="para">1</a>] </sup>
+ Scott Meyers, More Effective C++, Addison Wesley Longman, Inc., 1996, item
+ 7.
+ </p></div>
+<div class="footnote"><p><sup>[<a id="ftn.id753199" href="#id753199" class="para">2</a>] </sup>
+ Todd Veldhuizen, Blitz++, http://www.oonumerics.org/blitz/.
+ </p></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2010 -2011 Brian Smith<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="tutorial.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/maps/maps/libs/maps/doc/html/maps/pointer.html
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/html/maps/pointer.html 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>pointer</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Boost.Maps">
+<link rel="up" href="../index.html" title="Boost.Maps">
+<link rel="prev" href="array_.html" title="array_">
+<link rel="next" href="view.html" title="view">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="array_.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="view.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="maps.pointer"></a><a class="link" href="pointer.html" title="pointer">pointer</a>
+</h2></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2010 -2011 Brian Smith<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="array_.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="view.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/maps/maps/libs/maps/doc/html/maps/reference.html
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/html/maps/reference.html 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,60 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Reference</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Boost.Maps">
+<link rel="up" href="../index.html" title="Boost.Maps">
+<link rel="prev" href="tutorial.html" title="Tutorial">
+<link rel="next" href="array.html" title="array">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="array.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="maps.reference"></a><a class="link" href="reference.html" title="Reference">Reference</a>
+</h2></div></div></div>
+<div class="itemizedlist"><ul class="itemizedlist" type="disc">
+<li class="listitem">
+ <a class="link" href="array.html" title="array">array</a>
+ </li>
+<li class="listitem">
+ <a class="link" href="array_.html" title="array_">array_</a>
+ </li>
+<li class="listitem">
+ <a class="link" href="pointer.html" title="pointer">pointer</a>
+ </li>
+<li class="listitem">
+ <a class="link" href="view.html" title="view">view</a>
+ </li>
+<li class="listitem">
+ <a class="link" href="view_.html" title="view_">view_</a>
+ </li>
+</ul></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2010 -2011 Brian Smith<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="tutorial.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="array.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/maps/maps/libs/maps/doc/html/maps/tutorial.html
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/html/maps/tutorial.html 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,292 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Tutorial</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Boost.Maps">
+<link rel="up" href="../index.html" title="Boost.Maps">
+<link rel="prev" href="concepts.html" title="Concepts">
+<link rel="next" href="reference.html" title="Reference">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="concepts.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="maps.tutorial"></a><a class="link" href="tutorial.html" title="Tutorial">Tutorial</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">Arrays</span></dt>
+<dt><span class="section"><a href="tutorial.html#maps.tutorial.scalar_vector_matrix_tutorial">Scalars,
+ Vectors and Matrices</a></span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="maps.tutorial.array_tutorial"></a><a class="link" href="tutorial.html#maps.tutorial.array_tutorial" title="Arrays">Arrays</a>
+</h3></div></div></div>
+<p>
+ The intention in this section is to simply reveal the functionality of the
+ multi-dimensional array classes. The dominant feature is element access so
+ we'll consider the various methods available. The following example declares
+ a statically allocated, uninitialized <code class="computeroutput"><span class="identifier">array</span></code>,
+ <code class="computeroutput"><span class="identifier">a</span></code>, then loops over each dimension
+ setting the value of each data element to the sum of its indexes.
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">array</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">bounds5</span><span class="special">&lt;</span> <span class="number">5</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">3</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">5</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">array_t</span><span class="special">;</span>
+
+<span class="identifier">array_t</span> <span class="identifier">a</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">k</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">k</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">3</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">l</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">m</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">m</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">4</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">m</span> <span class="special">)</span>
+ <span class="identifier">a</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">][</span><span class="identifier">k</span><span class="special">][</span><span class="identifier">l</span><span class="special">][</span><span class="identifier">m</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span> <span class="special">+</span> <span class="identifier">k</span> <span class="special">+</span> <span class="identifier">l</span> <span class="special">+</span> <span class="identifier">m</span><span class="special">;</span>
+</pre>
+<p>
+ Alternatively, in place of <code class="computeroutput"><span class="identifier">a</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">][</span><span class="identifier">k</span><span class="special">][</span><span class="identifier">l</span><span class="special">][</span><span class="identifier">m</span><span class="special">]</span></code> we can
+ use indirection as follows, <code class="computeroutput"><span class="special">*(*(*(*(*(</span><span class="identifier">a</span><span class="special">+</span><span class="identifier">i</span><span class="special">)+</span><span class="identifier">j</span><span class="special">)+</span><span class="identifier">k</span><span class="special">)+</span><span class="identifier">l</span><span class="special">)+</span><span class="identifier">m</span><span class="special">)</span></code>.
+ No check with either of these methods is made to ensure the indexes are within
+ the bounds of the array. The <code class="computeroutput"><span class="identifier">bound</span></code>
+ method however returns the bound at each dimension and includes a compile
+ time assertion on its argument. Note that this method employs the same zero-based
+ indexing semantics the language provides for indexing array or pointer types.
+ If a debug assertion on the indexes is required we can write the following,
+ </p>
+<pre class="programlisting"><span class="identifier">bounds</span><span class="special">&lt;</span><span class="number">5</span><span class="special">&gt;</span> <span class="identifier">b</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">k</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">k</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">3</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">l</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">m</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">m</span> <span class="special">!=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">4</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">m</span> <span class="special">)</span>
+ <span class="identifier">a</span><span class="special">[</span><span class="identifier">b</span> <span class="special">=</span> <span class="identifier">i</span><span class="special">,</span><span class="identifier">j</span><span class="special">,</span><span class="identifier">k</span><span class="special">,</span><span class="identifier">l</span><span class="special">,</span><span class="identifier">m</span><span class="special">]</span> <span class="special">+=</span> <span class="number">1</span><span class="special">;</span>
+</pre>
+<p>
+ If the indexes should always be checked then replacing <code class="computeroutput"><span class="identifier">a</span><span class="special">[</span><span class="identifier">b</span> <span class="special">=</span>
+ <span class="identifier">i</span><span class="special">,</span><span class="identifier">j</span><span class="special">,</span><span class="identifier">k</span><span class="special">,</span><span class="identifier">l</span><span class="special">,</span><span class="identifier">m</span><span class="special">]</span></code> with
+ <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">at</span><span class="special">((</span><span class="identifier">b</span>
+ <span class="special">=</span> <span class="identifier">i</span><span class="special">,</span><span class="identifier">j</span><span class="special">,</span><span class="identifier">k</span><span class="special">,</span><span class="identifier">l</span><span class="special">,</span><span class="identifier">m</span><span class="special">))</span></code>
+ will throw a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">out_of_range</span></code> exception on an invalid index.
+ </p>
+<p>
+ When a function or operator is to be applied on all data elements in the
+ array we can do something along the following lines,
+ </p>
+<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">::</span><span class="identifier">_1</span> <span class="special">-=</span> <span class="number">1</span> <span class="special">);</span>
+</pre>
+<p>
+ The <code class="computeroutput"><span class="identifier">view</span></code> class template can
+ used to access non-continuous sequences of data elements as follows,
+ </p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">view</span><span class="special">&lt;</span> <span class="identifier">array_t</span> <span class="special">&gt;</span> <span class="identifier">view_t</span><span class="special">;</span>
+
+<span class="identifier">view_t</span> <span class="identifier">v</span><span class="special">;</span>
+
+<span class="identifier">view_t</span><span class="special">::</span><span class="identifier">range</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;</span> <span class="identifier">r0</span><span class="special">(</span> <span class="identifier">v</span> <span class="special">);</span> <span class="identifier">r0</span> <span class="special">=</span> <span class="number">1</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">1</span><span class="special">;</span>
+<span class="identifier">view_t</span><span class="special">::</span><span class="identifier">range</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;</span> <span class="identifier">r1</span><span class="special">(</span> <span class="identifier">v</span> <span class="special">);</span> <span class="identifier">r1</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span><span class="number">2</span><span class="special">,</span><span class="number">1</span><span class="special">;</span>
+<span class="identifier">view_t</span><span class="special">::</span><span class="identifier">range</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;</span> <span class="identifier">r2</span><span class="special">(</span> <span class="identifier">v</span> <span class="special">);</span> <span class="identifier">r2</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span><span class="number">3</span><span class="special">,</span><span class="number">1</span><span class="special">;</span>
+<span class="identifier">view_t</span><span class="special">::</span><span class="identifier">range</span><span class="special">&lt;</span><span class="number">3</span><span class="special">&gt;</span> <span class="identifier">r3</span><span class="special">(</span> <span class="identifier">v</span> <span class="special">);</span> <span class="identifier">r3</span> <span class="special">=</span> <span class="number">2</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">1</span><span class="special">;</span>
+<span class="identifier">view_t</span><span class="special">::</span><span class="identifier">range</span><span class="special">&lt;</span><span class="number">4</span><span class="special">&gt;</span> <span class="identifier">r4</span><span class="special">(</span> <span class="identifier">v</span> <span class="special">);</span> <span class="identifier">r4</span> <span class="special">=</span> <span class="number">1</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">1</span><span class="special">;</span>
+
+<span class="identifier">v</span><span class="special">.</span><span class="identifier">reset</span><span class="special">(</span> <span class="identifier">a</span> <span class="special">);</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">1</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">k</span> <span class="special">!=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">2</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">k</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">!=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">3</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">l</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">m</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">m</span> <span class="special">!=</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">bound</span><span class="special">&lt;</span><span class="number">4</span><span class="special">&gt;();</span> <span class="special">++</span><span class="identifier">m</span> <span class="special">)</span>
+ <span class="special">*</span><span class="identifier">v</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">][</span><span class="identifier">k</span><span class="special">][</span><span class="identifier">l</span><span class="special">][</span><span class="identifier">m</span><span class="special">]</span> <span class="special">*=</span> <span class="number">1</span><span class="special">;</span>
+
+<span class="identifier">r1</span> <span class="special">=</span> <span class="number">2</span><span class="special">,</span><span class="number">4</span><span class="special">,</span><span class="number">1</span><span class="special">;</span> <span class="identifier">r3</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span><span class="number">2</span><span class="special">,</span><span class="number">1</span><span class="special">;</span>
+<span class="identifier">v</span><span class="special">.</span><span class="identifier">reset</span><span class="special">(</span> <span class="identifier">a</span> <span class="special">);</span>
+
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">for_each</span><span class="special">(</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="special">*</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">::</span><span class="identifier">_1</span> <span class="special">*=</span> <span class="number">1</span> <span class="special">);</span>
+</pre>
+<p>
+ Given that <code class="computeroutput"><span class="identifier">v</span></code> represents a
+ 3 x 2 x 3 x 2 x 3 array and that its values are the addresses of elements
+ in the array <code class="computeroutput"><span class="identifier">a</span></code>, we can set
+ the values of any array whose dimensions are the same as those of <code class="computeroutput"><span class="identifier">v</span></code> to the corresponding values in <code class="computeroutput"><span class="identifier">a</span></code>.
+ </p>
+<pre class="programlisting"><span class="identifier">b</span> <span class="special">=</span> <span class="number">3</span><span class="special">,</span><span class="number">2</span><span class="special">,</span><span class="number">3</span><span class="special">,</span><span class="number">2</span><span class="special">,</span><span class="number">3</span><span class="special">;</span>
+<span class="identifier">pointer</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">5</span> <span class="special">&gt;</span> <span class="identifier">p</span><span class="special">(</span> <span class="identifier">b</span> <span class="special">);</span>
+<span class="identifier">v</span><span class="special">.</span><span class="identifier">to</span><span class="special">(</span> <span class="identifier">p</span> <span class="special">);</span>
+</pre>
+<p>
+ Similarly, again provided we store the addresses of a sequence of values
+ from the representative array, we can set those values to the values in an
+ array with the same dimensions as the <code class="computeroutput"><span class="identifier">view</span></code>,
+ so that given an array <code class="computeroutput"><span class="identifier">q</span></code>
+ with shape 3 x 2 x 3 x 2 x 3 we can write, <code class="computeroutput"><span class="identifier">v</span><span class="special">.</span><span class="identifier">from</span><span class="special">(</span>
+ <span class="identifier">q</span> <span class="special">)</span></code>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="maps.tutorial.scalar_vector_matrix_tutorial"></a><a class="link" href="tutorial.html#maps.tutorial.scalar_vector_matrix_tutorial" title="Scalars, Vectors and Matrices">Scalars,
+ Vectors and Matrices</a>
+</h3></div></div></div>
+<p>
+ At present, only dense vectors and matrices with associated operations are
+ available. The following gives some examples.
+ </p>
+<pre class="programlisting"><span class="identifier">matrix</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span><span class="number">2</span> <span class="special">&gt;</span> <span class="identifier">m1</span><span class="special">,</span> <span class="identifier">m2</span><span class="special">;</span>
+<span class="identifier">vector</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">2</span> <span class="special">&gt;</span> <span class="identifier">r</span><span class="special">,</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">;</span>
+<span class="identifier">scalar</span><span class="special">&lt;</span> <span class="keyword">int</span> <span class="special">&gt;</span> <span class="identifier">s</span><span class="special">;</span>
+
+<span class="identifier">s</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">v</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="number">3</span><span class="special">;</span>
+ <span class="identifier">v1</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="number">1</span><span class="special">;</span>
+ <span class="identifier">v2</span><span class="special">[</span><span class="identifier">i</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="number">2</span><span class="special">;</span>
+
+ <span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">m1</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span> <span class="special">+</span> <span class="number">1</span><span class="special">;</span>
+ <span class="identifier">m2</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span> <span class="special">+</span> <span class="number">2</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+
+<span class="identifier">r</span> <span class="special">=</span> <span class="identifier">outer_product</span><span class="special">(</span> <span class="identifier">m1</span> <span class="special">*</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span> <span class="special">*</span> <span class="identifier">m2</span> <span class="special">)</span> <span class="special">*</span> <span class="special">(</span> <span class="identifier">s</span> <span class="special">*</span> <span class="identifier">v</span> <span class="special">);</span>
+</pre>
+<p>
+ No distinction is made between row and column vectors hence pre and post
+ multiplication of a matrix by the same vector is possible provided the matrix
+ is square or otherwise whenever the number of vector components equals the
+ number of matrix rows for pre-multiplication or the number of matrix columns
+ for post-multiplication. For n matrices, n &gt; 2, it is more efficient to
+ produce temporary intermediate results when they are multiplied in succession
+ using the <code class="computeroutput"><span class="special">*</span></code> operator. Determining
+ when such a chain of multiplications are being applied has proven to be inefficient
+ thus a temporary matrix is produced for the case n = 2 also. In order to
+ avoid this the <code class="computeroutput"><span class="identifier">product</span></code> operator
+ can be applied as shown below.
+ </p>
+<pre class="programlisting"><span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="identifier">M</span> <span class="special">=</span> <span class="number">1000</span><span class="special">;</span>
+
+<span class="identifier">matrix</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="identifier">M</span><span class="special">,</span><span class="identifier">M</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span> <span class="keyword">int</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">m1</span><span class="special">,</span> <span class="identifier">m2</span><span class="special">,</span> <span class="identifier">m3</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">M</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="identifier">M</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="identifier">m1</span><span class="special">(</span> <span class="identifier">i</span><span class="special">,</span><span class="identifier">j</span> <span class="special">)</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+ <span class="identifier">m2</span><span class="special">(</span> <span class="identifier">i</span><span class="special">,</span><span class="identifier">j</span> <span class="special">)</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
+ <span class="identifier">m3</span><span class="special">(</span> <span class="identifier">i</span><span class="special">,</span><span class="identifier">j</span> <span class="special">)</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span>
+<span class="special">}</span>
+
+<span class="identifier">m</span> <span class="special">=</span> <span class="identifier">product</span><span class="special">(</span> <span class="identifier">m1</span><span class="special">,</span> <span class="identifier">m2</span> <span class="special">)</span> <span class="special">+</span> <span class="identifier">m3</span><span class="special">;</span>
+</pre>
+<p>
+ For some system dependant value of M the number of cache misses will dramatically
+ reduce the performance of the above calculation. In such cases we can reorganize
+ the computation as below, although setting up the matrices is not always
+ so easily accomplished.
+ </p>
+<pre class="programlisting"><span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="identifier">N</span> <span class="special">=</span> <span class="number">10</span><span class="special">;</span>
+
+<span class="identifier">matrix</span><span class="special">&lt;</span> <span class="identifier">matrix</span><span class="special">&lt;</span> <span class="identifier">matrix</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span>
+ <span class="identifier">N</span><span class="special">,</span><span class="identifier">N</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span> <span class="keyword">int</span> <span class="special">&gt;</span> <span class="special">&gt;,</span>
+ <span class="identifier">N</span><span class="special">,</span><span class="identifier">N</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span> <span class="keyword">int</span> <span class="special">&gt;</span> <span class="special">&gt;,</span>
+ <span class="identifier">N</span><span class="special">,</span><span class="identifier">N</span><span class="special">,</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special">&lt;</span> <span class="keyword">int</span> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">m1</span><span class="special">,</span> <span class="identifier">m2</span><span class="special">,</span> <span class="identifier">m3</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">N</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="identifier">N</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">k</span> <span class="special">!=</span> <span class="identifier">N</span><span class="special">;</span> <span class="special">++</span><span class="identifier">k</span> <span class="special">)</span>
+ <span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">!=</span> <span class="identifier">N</span><span class="special">;</span> <span class="special">++</span><span class="identifier">l</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">m</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">m</span> <span class="special">!=</span> <span class="identifier">N</span><span class="special">;</span> <span class="special">++</span><span class="identifier">m</span> <span class="special">)</span>
+ <span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">n</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">n</span> <span class="special">!=</span> <span class="identifier">N</span><span class="special">;</span> <span class="special">++</span><span class="identifier">n</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">m1</span><span class="special">(</span> <span class="identifier">i</span><span class="special">,</span><span class="identifier">j</span> <span class="special">)(</span> <span class="identifier">k</span><span class="special">,</span><span class="identifier">l</span> <span class="special">)(</span> <span class="identifier">m</span><span class="special">,</span><span class="identifier">n</span> <span class="special">)</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+ <span class="identifier">m2</span><span class="special">(</span> <span class="identifier">i</span><span class="special">,</span><span class="identifier">j</span> <span class="special">)(</span> <span class="identifier">k</span><span class="special">,</span><span class="identifier">l</span> <span class="special">)(</span> <span class="identifier">m</span><span class="special">,</span><span class="identifier">n</span> <span class="special">)</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span>
+ <span class="identifier">m3</span><span class="special">(</span> <span class="identifier">i</span><span class="special">,</span><span class="identifier">j</span> <span class="special">)(</span> <span class="identifier">k</span><span class="special">,</span><span class="identifier">l</span> <span class="special">)(</span> <span class="identifier">m</span><span class="special">,</span><span class="identifier">n</span> <span class="special">)</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+
+<span class="identifier">m</span> <span class="special">=</span> <span class="identifier">product</span><span class="special">(</span> <span class="identifier">m1</span><span class="special">,</span> <span class="identifier">m2</span> <span class="special">)</span> <span class="special">+</span> <span class="identifier">m3</span><span class="special">;</span>
+</pre>
+<p>
+ Likewise, we can set up blocked computations with non-square matrices.
+ </p>
+<pre class="programlisting"><span class="identifier">matrix</span><span class="special">&lt;</span> <span class="identifier">matrix</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span><span class="number">2</span> <span class="special">&gt;,</span> <span class="number">2</span><span class="special">,</span><span class="number">3</span> <span class="special">&gt;</span> <span class="identifier">m1</span><span class="special">;</span>
+<span class="identifier">matrix</span><span class="special">&lt;</span> <span class="identifier">matrix</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span><span class="number">4</span> <span class="special">&gt;,</span> <span class="number">2</span><span class="special">,</span><span class="number">3</span> <span class="special">&gt;</span> <span class="identifier">m2</span><span class="special">;</span>
+<span class="identifier">matrix</span><span class="special">&lt;</span> <span class="identifier">matrix</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span><span class="number">4</span> <span class="special">&gt;,</span> <span class="number">3</span><span class="special">,</span><span class="number">3</span> <span class="special">&gt;</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">m3</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="number">3</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">k</span> <span class="special">!=</span> <span class="number">3</span><span class="special">;</span> <span class="special">++</span><span class="identifier">k</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">l</span> <span class="special">)</span>
+ <span class="identifier">m1</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">][</span><span class="identifier">k</span><span class="special">][</span><span class="identifier">l</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span> <span class="special">+</span> <span class="identifier">k</span> <span class="special">+</span> <span class="identifier">l</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="number">3</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">k</span> <span class="special">!=</span> <span class="number">3</span><span class="special">;</span> <span class="special">++</span><span class="identifier">k</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">!=</span> <span class="number">4</span><span class="special">;</span> <span class="special">++</span><span class="identifier">l</span> <span class="special">)</span>
+ <span class="identifier">m2</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">][</span><span class="identifier">k</span><span class="special">][</span><span class="identifier">l</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span> <span class="special">+</span> <span class="identifier">k</span> <span class="special">+</span> <span class="identifier">l</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="number">3</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="number">3</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">k</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">k</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">!=</span> <span class="number">4</span><span class="special">;</span> <span class="special">++</span><span class="identifier">l</span> <span class="special">)</span>
+ <span class="identifier">m3</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">][</span><span class="identifier">k</span><span class="special">][</span><span class="identifier">l</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span> <span class="special">+</span> <span class="identifier">k</span> <span class="special">+</span> <span class="identifier">l</span><span class="special">;</span>
+
+<span class="identifier">m</span> <span class="special">=</span> <span class="identifier">transpose</span><span class="special">(</span> <span class="identifier">m1</span> <span class="special">)</span> <span class="special">*</span> <span class="identifier">m2</span> <span class="special">+</span> <span class="identifier">m3</span><span class="special">;</span>
+</pre>
+<p>
+ Or similarly with a combination of vectors and matrices.
+ </p>
+<pre class="programlisting"><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">vector</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">3</span> <span class="special">&gt;,</span> <span class="number">2</span> <span class="special">&gt;</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span><span class="special">;</span>
+<span class="identifier">matrix</span><span class="special">&lt;</span> <span class="identifier">matrix</span><span class="special">&lt;</span> <span class="keyword">int</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span><span class="number">4</span> <span class="special">&gt;,</span> <span class="number">2</span><span class="special">,</span><span class="number">3</span> <span class="special">&gt;</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">m1</span><span class="special">,</span> <span class="identifier">m2</span><span class="special">;</span>
+
+<span class="identifier">v1</span><span class="special">[</span><span class="number">0</span><span class="special">][</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">v1</span><span class="special">[</span><span class="number">0</span><span class="special">][</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> <span class="identifier">v1</span><span class="special">[</span><span class="number">0</span><span class="special">][</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span>
+<span class="identifier">v1</span><span class="special">[</span><span class="number">1</span><span class="special">][</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">4</span><span class="special">;</span> <span class="identifier">v1</span><span class="special">[</span><span class="number">1</span><span class="special">][</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">5</span><span class="special">;</span> <span class="identifier">v1</span><span class="special">[</span><span class="number">1</span><span class="special">][</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="number">6</span><span class="special">;</span>
+
+<span class="identifier">v2</span><span class="special">[</span><span class="number">0</span><span class="special">][</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">6</span><span class="special">;</span> <span class="identifier">v2</span><span class="special">[</span><span class="number">0</span><span class="special">][</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">5</span><span class="special">;</span> <span class="identifier">v2</span><span class="special">[</span><span class="number">0</span><span class="special">][</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="number">4</span><span class="special">;</span>
+<span class="identifier">v2</span><span class="special">[</span><span class="number">1</span><span class="special">][</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span> <span class="identifier">v2</span><span class="special">[</span><span class="number">1</span><span class="special">][</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> <span class="identifier">v2</span><span class="special">[</span><span class="number">1</span><span class="special">][</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="number">3</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">k</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">k</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">!=</span> <span class="number">4</span><span class="special">;</span> <span class="special">++</span><span class="identifier">l</span> <span class="special">)</span>
+ <span class="identifier">m1</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">][</span><span class="identifier">k</span><span class="special">][</span><span class="identifier">l</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span> <span class="special">+</span> <span class="identifier">k</span> <span class="special">+</span> <span class="identifier">l</span><span class="special">;</span>
+
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">j</span> <span class="special">!=</span> <span class="number">3</span><span class="special">;</span> <span class="special">++</span><span class="identifier">j</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">k</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">k</span> <span class="special">!=</span> <span class="number">2</span><span class="special">;</span> <span class="special">++</span><span class="identifier">k</span> <span class="special">)</span>
+<span class="keyword">for</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">!=</span> <span class="number">4</span><span class="special">;</span> <span class="special">++</span><span class="identifier">l</span> <span class="special">)</span>
+ <span class="identifier">m2</span><span class="special">[</span><span class="identifier">i</span><span class="special">][</span><span class="identifier">j</span><span class="special">][</span><span class="identifier">k</span><span class="special">][</span><span class="identifier">l</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">i</span> <span class="special">+</span> <span class="identifier">j</span> <span class="special">+</span> <span class="identifier">k</span> <span class="special">+</span> <span class="identifier">l</span><span class="special">;</span>
+
+<span class="identifier">m</span> <span class="special">=</span> <span class="identifier">transpose</span><span class="special">(</span> <span class="identifier">outer_product</span><span class="special">(</span> <span class="identifier">v1</span><span class="special">,</span> <span class="identifier">v2</span> <span class="special">)</span> <span class="special">)</span> <span class="special">*</span> <span class="identifier">m1</span> <span class="special">+</span> <span class="identifier">m2</span><span class="special">;</span>
+</pre>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2010 -2011 Brian Smith<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="concepts.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/maps/maps/libs/maps/doc/html/maps/view.html
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/html/maps/view.html 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,41 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>view</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Boost.Maps">
+<link rel="up" href="../index.html" title="Boost.Maps">
+<link rel="prev" href="pointer.html" title="pointer">
+<link rel="next" href="view_.html" title="view_">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="pointer.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="view_.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="maps.view"></a><a class="link" href="view.html" title="view">view</a>
+</h2></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2010 -2011 Brian Smith<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="pointer.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="view_.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/maps/maps/libs/maps/doc/html/maps/view_.html
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/html/maps/view_.html 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,40 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>view_</title>
+<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="Boost.Maps">
+<link rel="up" href="../index.html" title="Boost.Maps">
+<link rel="prev" href="view.html" title="view">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr>
+<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
+<td align="center">Home</td>
+<td align="center">Libraries</td>
+<td align="center">People</td>
+<td align="center">FAQ</td>
+<td align="center">More</td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="view.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
+</div>
+<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="maps.view_"></a><a class="link" href="view_.html" title="view_">view_</a>
+</h2></div></div></div></div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2010 -2011 Brian Smith<p>
+ 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)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="view.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>

Added: sandbox/maps/maps/libs/maps/doc/maps.qbk
==============================================================================
--- (empty file)
+++ sandbox/maps/maps/libs/maps/doc/maps.qbk 2011-08-23 16:08:40 EDT (Tue, 23 Aug 2011)
@@ -0,0 +1,558 @@
+[book Boost.Maps
+ [quickbook 1.5]
+ [authors [Smith, Brian]]
+ [copyright 2010-2011 Brian Smith]
+ [id maps]
+ [license
+ 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 http://www.boost.org/LICENSE_1_0.txt])
+ ]
+]
+
+[section:introduction Introduction]
+
+The Boost maps library provides sequence containers for statically and dynamically
+allocated multi-dimensional arrays. The implementations allow standard data element types,
+data element initialization, subject to conditions imposed by the data element type, and the
+choice of allocator used for memory allocation, element construction, etc., where appropriate.
+The library also includes scalar and fixed-size vector and matrix class templates with a DSEL
+implementation of operators via expression templates.
+
+The [link maps.concepts Concepts] section provides an overview of the library as well as a
+discussion of the supplementary structures that interoperate with the main classes in the
+library.
+
+*[link maps.concepts Concepts]
+*[link maps.tutorial Tutorial]
+*[link maps.reference Reference]
+
+[endsect]
+
+[section:concepts Concepts]
+
+[section:introduction Introduction]
+
+The array of array specification for statically allocated intrinsic multi-dimensional arrays is
+conceptually well defined in C++. The fixed-size array class templates discussed here include
+versions whose data member is an intrinsic multi-dimensional array. The arrays' shape is
+determined from a compile time supplied set of bounds. An alternative approach to constructing
+multi-dimensional arrays results from using pointers. The structural components in this case
+are allocated dynamically at runtime allowing for both fixed-size and resizeable varieties. The
+approach taken here is to allocate all the elements at each dimension in a continuous block of
+memory from a given set of bounds. For fixed-size arrays this again means the bounds are set at
+compile time. A resizeable array must be passed a set of bounds in order to construct it in
+addition to the purpose of resizing.
+
+[endsect] [/ Introduction]
+
+[section:fixed_size_arrays Fixed-Size Arrays]
+
+The array types `array` and `array_` define objects that satisfy the notion of a
+multi-dimensional array. The data member type generated for the array depends on the
+template arguments to the class. The header `<array.hpp>` defines the class template,
+
+ template< class T, class B, bool I, class A > class array;
+
+Here,
+
+* `T` is the data type the array holds.
+* `B` is a `boundsN` sequence of `N` non-zero positive integers.
+* `I` is the zero/default initialization parameter.
+* `A` is an allocator type.
+
+The sequence argument, `B`, determines the dimensionality, `N`, of the array,
+as well as the size of each dimension. The library defines a `null::allocator` type which
+is the default allocator type for the class. If a `null::allocator` is used for the
+template argument `A` then the resulting data member is a statically allocated array of
+`N` dimensions with the size of each dimension given by successive values in the argument
+sequence `B`, and with data elements of type `T`, where the usual restrictions on type `T`
+apply. Otherwise the array data member is the type `T` or its non-reference
+equivalent, which from here on its assumed to be, with `N` pointer symbols appended and is
+constructed at runtime in accordance with template argument's `B`, `I` and `A`. In either
+case if the argument `T` has a non-trivial constructor the data elements will be
+constructed during the construction of the array, standard case for intrinsic
+arrays, otherwise data element construction will depend on the argument `I`, whose default
+value is `true`. Therefore, arguments are always required for both `T` and `B`, while
+`I` and `A` are optional.
+
+As an illustration the following declaration produces an `array` object with data member
+type `int[3][4][5][4][3]` and zero initialized data elements.
+
+ array< int, bounds5< 3,4,5,4,3 > > a;
+
+If we now consider the declaration,
+
+ array< int, bounds5< 3,4,5,4,3 >, false, std::allocator< int > > a;
+
+The `array` object's data member in this case is an `int*****` whose runtime construction
+requires five memory allocations with the data elements left uninitialized. A point of note
+concerns the allocator type used in the previous declaration. Strictly, it should have been
+`std::allocator< int**** >`, however the nested `rebind` struct in the original
+declaration's allocator is used to bind the template parameter to the correct type. Since
+a non-static N-dimensional array requires N allocations for N different types, N different
+allocators are necessary to fully construct the resulting array.
+
+The header `<array_.hpp>` defines the class template,
+
+ template< class T, std::size_t N, std::size_t D, bool I, class A > class array_;
+
+Here,
+
+* `T` is the data type the array holds.
+* `N` is the dimensionality of the array.
+* `D` is the size of each of the `N` dimensions of the array.
+* `I` is the zero/default initialization parameter.
+* `A` is an allocator type.
+
+The template parameters `T`, `I` and `A` have the same meaning, requirements and default
+behaviour as the `array` class template discussed previously. An `array_` object has
+dimensionality `N` with each dimension taking the fixed value `D`, both of which are
+required parameters. Thus, in the following declaration the data member type is
+`int[5][5][5][5][5]` with zero initialized data elements.
+
+ array_< int, 5,5 > a;
+
+The dynamically allocated version with uninitialized data elements results from,
+
+ array_< int, 5,5, false, std::allocator< int > > a;
+
+[endsect] [/ Fixed-Size Arrays]
+
+[section:resizeable_arrays Resizeable Arrays]
+
+The arrays discussed in this section satisfy the notion of a dynamically allocated
+multi-dimensional array. The header `<pointer.hpp>` defines the class template,
+
+ template< class T, std::size_t N, bool I, class A > class pointer;
+
+Here,
+
+* `T` is the data type the array holds.
+* `N` is the dimensionality of the array.
+* `I` is the zero/default initialization parameter.
+* `A` is an allocator type.
+
+Parameters `T` and `N` are both required, while `I` and `A` are optional, with respective
+default's `false` and `std::allocator< T >`. In order to construct a `pointer` type with
+specific dimensions the auxiliary type `bounds`, defined in the header `<bounds.hpp>`, is
+required. A `bounds` type is a template array type with a single `std::size_t` parameter
+that determines the number of `std::size_t` type elements the array should hold.
+Notwithstanding Scott Meyers item[footnote Scott Meyers, More Effective C++, Addison Wesley
+Longman, Inc., 1996, item 7.] and similar to Blitz++[footnote Todd Veldhuizen, Blitz++,
+[@http://www.oonumerics.org/blitz/].] arrays the comma operator has been overloaded for
+convenience. The following declaration and assignment results in the `bounds` array `b`
+having values 3, 4, 5, 4 and 3 respectively.
+
+ bounds<5> b;
+ b = 3,4,5,4,3;
+
+Creating a `pointer` object with uninitialized data elements then follows as,
+
+ pointer< double, 5 > a( b );
+
+To continue, we can further write,
+
+ b = 5,4,3,4,5;
+ a.resize< false >( b );
+
+This results in the array being resized to the updated values in `b` without preserving the
+values already present in `a`. For a `pointer` type with dimensionality `N`, `N` memory
+allocations are again required. However, for an already constructed array such as `a` above
+it is only necessary to make a request for memory during resizing if the total number of
+elements required for each dimension is different from that already present. At least this
+is the case for all but the final request where a memory allocation is required if the
+template argument to `resize` is `false` or if the template argument to `resize` is `true`
+and the total number of elements differs from the requested new total, thus maintaining the
+exception guarantee specified for the class. For example, in the resize operation above the
+third request for memory is to accommodate 5 x 4 x 3 = 60 elements, while 3 x 4 x 5 = 60
+elements of the required type are already present, hence, no request for memory is needed.
+Pedantically, the types `dimensions` and `indexes` may be used in place of a `bounds` type
+for construction and element access of a resizeable array.
+
+[endsect] [/ Resizeable Arrays]
+
+[section:array_views Array Views]
+
+Accessing the elements of an array can be considered from a number of perspectives that
+inevitably depends on the particular application and patterns in the data represented
+by the elements. The indexing operator for example is used to access individual elements of
+an array. However access to specific non-/continuous sequences of elements in the form of
+slices or subarrays may be required. For an N-dimensional array a slice can be represented
+in 1 to N-1 dimensions whereas subarrays of N-dimensional arrays are themselves N-dimensional
+arrays. A `view` is a resizeable N-dimensional array of the same dimensionality as the array used
+to define it. The data elements can be either pointers to or copies of some sequence of data
+elements from an array whose type parameterizes the `view`.
+
+The header `<view.hpp>` defines the class template,
+
+ template< class A, bool B > class view;
+
+Here,
+
+* `A` is the array type the `view` will be constructed from.
+* `B` signifies our intention to store pointers on an argument of type `A` or otherwise.
+
+`A` is a required parameter while `B` is optional with default value `true`, i.e. stores
+pointers to some sequence of data elements from an array of type `A`. The `view` type
+contains the nested class template `range`, used to set three values, first, last and
+step, over one dimension of an array of type `A`. The relationship between first, last and
+step can be considered analogous to the following `for` statement.
+
+ for( std::size_t i = first; i != last; i += step ) { ... }
+
+The single template parameter of a `range` is the type `std::size_t` that determines which
+dimension the `range` is associated with. For an N-dimensional array, N `range`'s should be
+set which together form the sequence of data elements from an argument of type `A` that the
+`view` will store. The `range` constructor expects an argument of type `view`. Implicitly a
+`view` must be declared before setting the `range`'s and subsequently an argument of type
+`A` is passed to the `view`'s `reset` method in order to construct it. To clarify, consider
+the following,
+
+ typedef array_< double, 3,7, true > A;
+ typedef view< A > V;
+
+ A a;
+ V v;
+
+ V::range<0> r0( v ); r0 = 1,7,2;
+ V::range<1> r1( v ); r1 = 1,7,2;
+ V::range<2> r2( v ); r2 = 1,7,2;
+
+ v.reset( a );
+
+The call to `reset` in this example constructs a three-dimensional `view` with shape
+3 x 3 x 3 whose data elements store the addresses of every second data element in the third
+dimension of every second array in the second dimension of every second array of array in
+the first dimension of the 7 x 7 x 7 `array_ a`.
+
+The header `<view_.hpp>` defines the class template,
+
+ template< class A, class R, bool B > class view_;
+
+Here,
+
+* `A` is the array type the `view_` will be constructed from.
+* `R` is a sequence of ranges.
+* `B` signifies our intention to store pointers on an argument of type `A` or otherwise.
+
+A `view_` is used to construct a view of a fixed-size array. The data member of a `view_`
+will be statically or dynamically allocated dependant on the type of the data member of
+the array type `A`. `A` and `R` are both required parameters with `B` optional defaulting
+to `true`. A `view_` type is more restricted than a `view` in the sense that the parameter
+`R` defines at compile time the ranges over an array of type `A` associated with the
+`view_`. Template types `rangesN`, `N` the dimensionality of an array of type `A`, and
+`range` are defined specifically for the template argument `R`. Since the range's are
+predetermined the `view_` type defines a constructor accepting an argument of type `A`.
+Thus, we can write,
+
+ typedef array_< double, 3,7, true > A;
+ typedef ranges3< range< 1,7,2 >, range< 1,7,2 >, range< 1,7,2 > > R;
+ typedef view_< A, R > V;
+
+ A a;
+ V v( a );
+
+
+[endsect] [/ Array Views]
+
+[section:scalars_vectors_matrices Scalars, Vectors and Matrices]
+
+In certain problem domains we can specify a set of integral dimensions which fully
+characterize the problem space. Fixed-size matrices for example are common in many
+algebraic problems. Knowing the initial dimensions in advance allows us to exploit this
+knowledge in all future computations. For example, given a matrix, M1, with M rows and P
+columns and a matrix, M2, with P rows and N columns, the product M1 x M2 is a matrix, M3 say,
+with M rows and N columns. Computational requirements such as the operand and result type
+dimensions in this example can be encoded in the template parameters of the types involved
+and also in the operators that act on them. The Boost maps library provides implementations
+for `scalar` and fixed-size `vector` and `matrix` operators that conform to such
+requirements, enabling compile time determination of consistent operations on the operands
+involved. The expression template paradigm has been invoked to enhance performance for
+mathematically intensive applications. Note that `scalar` operands are a convenient way to
+specify operations involving scalar types and are not intended to be used as the data
+elements of the `vector` or `matrix` types. The headers `<scalar.hpp>`, `<vector.hpp>` and
+`<matrix.hpp>` define the following respective types.
+
+ template< class T > class scalar;
+
+Here,
+
+* `T` is the data type of the stored member.
+
+ template< class T, std::size_t N, bool I, class A > class vector;
+
+Here,
+
+* `T` is the element type.
+* `N` is the number of components.
+* `I` is the zero/default initialization parameter.
+* `A` is an allocator type.
+
+ template< class T, std::size_t M, std::size_t N, bool I, class A > class matrix;
+
+Here,
+
+* `T` is the element type.
+* `M` is the number of rows.
+* `N` is the number of columns.
+* `I` is the zero/default initialization parameter.
+* `A` is an allocator type.
+
+For all three class templates `T` is a required parameter. The parameters `N` for a `vector`
+and, `M` and `N` for a `matrix` are also required. The remaining parameters `I` and `A` for
+the `vector` and `matrix` class templates are optional with respective default's `true` and
+`null::allocator` for both classes.
+
+[endsect] [/ Scalars, Vectors and Matrices]
+
+[endsect] [/ Concepts]
+
+[section:tutorial Tutorial]
+
+[section:array_tutorial Arrays]
+
+The intention in this section is to simply reveal the functionality of the multi-dimensional
+array classes. The dominant feature is element access so we'll consider the various methods
+available. The following example declares a statically allocated, uninitialized `array`, `a`,
+then loops over each dimension setting the value of each data element to the sum of its indexes.
+
+ typedef array< int, bounds5< 5,4,3,4,5 > > array_t;
+
+ array_t a;
+
+ for( std::size_t i = 0; i != a.bound<0>(); ++i )
+ for( std::size_t j = 0; j != a.bound<1>(); ++j )
+ for( std::size_t k = 0; k != a.bound<2>(); ++k )
+ for( std::size_t l = 0; l != a.bound<3>(); ++l )
+ for( std::size_t m = 0; m != a.bound<4>(); ++m )
+ a[i][j][k][l][m] = i + j + k + l + m;
+
+Alternatively, in place of `a[i][j][k][l][m]` we can use indirection as follows,
+`*(*(*(*(*(a+i)+j)+k)+l)+m)`. No check with either of these methods is made to ensure the
+indexes are within the bounds of the array. The `bound` method however returns the bound at each
+dimension and includes a compile time assertion on its argument. Note that this method employs
+the same zero-based indexing semantics the language provides for indexing array or pointer types.
+If a debug assertion on the indexes is required we can write the following,
+
+ bounds<5> b;
+
+ for( std::size_t i = 0; i != a.bound<0>(); ++i )
+ for( std::size_t j = 0; j != a.bound<1>(); ++j )
+ for( std::size_t k = 0; k != a.bound<2>(); ++k )
+ for( std::size_t l = 0; l != a.bound<3>(); ++l )
+ for( std::size_t m = 0; m != a.bound<4>(); ++m )
+ a[b = i,j,k,l,m] += 1;
+
+If the indexes should always be checked then replacing `a[b = i,j,k,l,m]` with
+`a.at((b = i,j,k,l,m))` will throw a `std::out_of_range` exception on an invalid index.
+
+When a function or operator is to be applied on all data elements in the array we can do
+something along the following lines,
+
+ std::for_each( a.begin(), a.end(), boost::lambda::_1 -= 1 );
+
+The `view` class template can used to access non-continuous sequences of data elements as
+follows,
+
+ typedef view< array_t > view_t;
+
+ view_t v;
+
+ view_t::range<0> r0( v ); r0 = 1,4,1;
+ view_t::range<1> r1( v ); r1 = 0,2,1;
+ view_t::range<2> r2( v ); r2 = 0,3,1;
+ view_t::range<3> r3( v ); r3 = 2,4,1;
+ view_t::range<4> r4( v ); r4 = 1,4,1;
+
+ v.reset( a );
+
+ for( std::size_t i = 0; i != v.bound<0>(); ++i )
+ for( std::size_t j = 0; j != v.bound<1>(); ++j )
+ for( std::size_t k = 0; k != v.bound<2>(); ++k )
+ for( std::size_t l = 0; l != v.bound<3>(); ++l )
+ for( std::size_t m = 0; m != v.bound<4>(); ++m )
+ *v[i][j][k][l][m] *= 1;
+
+ r1 = 2,4,1; r3 = 0,2,1;
+ v.reset( a );
+
+ std::for_each( v.begin(), v.end(), *boost::lambda::_1 *= 1 );
+
+Given that `v` represents a 3 x 2 x 3 x 2 x 3 array and that its values are the addresses of
+elements in the array `a`, we can set the values of any array whose dimensions are the same as
+those of `v` to the corresponding values in `a`.
+
+ b = 3,2,3,2,3;
+ pointer< int, 5 > p( b );
+ v.to( p );
+
+Similarly, again provided we store the addresses of a sequence of values from the representative
+array, we can set those values to the values in an array with the same dimensions as the `view`,
+so that given an array `q` with shape 3 x 2 x 3 x 2 x 3 we can write, `v.from( q )`.
+
+[endsect] [/ Arrays]
+
+[section:scalar_vector_matrix_tutorial Scalars, Vectors and Matrices]
+
+At present, only dense vectors and matrices with associated operations are available. The
+following gives some examples.
+
+ matrix< int, 2,2 > m1, m2;
+ vector< int, 2 > r, v, v1, v2;
+ scalar< int > s;
+
+ s = 3;
+
+ for( int i = 0; i != 2; ++i )
+ {
+ v[i] = i + 3;
+ v1[i] = i + 1;
+ v2[i] = i + 2;
+
+ for( int j = 0; j != 2; ++j )
+ {
+ m1[i][j] = i + j + 1;
+ m2[i][j] = i + j + 2;
+ }
+ }
+
+ r = outer_product( m1 * v1, v2 * m2 ) * ( s * v );
+
+No distinction is made between row and column vectors hence pre and post multiplication of a
+matrix by the same vector is possible provided the matrix is square or otherwise whenever the
+number of vector components equals the number of matrix rows for pre-multiplication or the
+number of matrix columns for post-multiplication. For n matrices, n > 2, it is more efficient
+to produce temporary intermediate results when they are multiplied in succession using the `*`
+operator. Determining when such a chain of multiplications are being applied has proven to be
+inefficient thus a temporary matrix is produced for the case n = 2 also. In order to avoid this
+the `product` operator can be applied as shown below.
+
+ const unsigned M = 1000;
+
+ matrix< int, M,M, true, std::allocator< int > > m, m1, m2, m3;
+
+ for( int i = 0; i != M; ++i )
+ for( int j = 0; j != M; ++j )
+ {
+ m1( i,j ) = 1;
+ m2( i,j ) = 2;
+ m3( i,j ) = 3;
+ }
+
+ m = product( m1, m2 ) + m3;
+
+For some system dependant value of M the number of cache misses will dramatically reduce the
+performance of the above calculation. In such cases we can reorganize the computation as below,
+although setting up the matrices is not always so easily accomplished.
+
+ const unsigned N = 10;
+
+ matrix< matrix< matrix< int,
+ N,N, true, std::allocator< int > >,
+ N,N, true, std::allocator< int > >,
+ N,N, true, std::allocator< int > > m, m1, m2, m3;
+
+ for( int i = 0; i != N; ++i )
+ for( int j = 0; j != N; ++j )
+ {
+ for( int k = 0; k != N; ++k )
+ for( int l = 0; l != N; ++l )
+ {
+ for( int m = 0; m != N; ++m )
+ for( int n = 0; n != N; ++n )
+ {
+ m1( i,j )( k,l )( m,n ) = 1;
+ m2( i,j )( k,l )( m,n ) = 2;
+ m3( i,j )( k,l )( m,n ) = 3;
+ }
+ }
+ }
+
+ m = product( m1, m2 ) + m3;
+
+Likewise, we can set up blocked computations with non-square matrices.
+
+ matrix< matrix< int, 3,2 >, 2,3 > m1;
+ matrix< matrix< int, 3,4 >, 2,3 > m2;
+ matrix< matrix< int, 2,4 >, 3,3 > m, m3;
+
+ for( std::size_t i = 0; i != 2; ++i )
+ for( std::size_t j = 0; j != 3; ++j )
+ for( std::size_t k = 0; k != 3; ++k )
+ for( std::size_t l = 0; l != 2; ++l )
+ m1[i][j][k][l] = i + j + k + l;
+
+ for( std::size_t i = 0; i != 2; ++i )
+ for( std::size_t j = 0; j != 3; ++j )
+ for( std::size_t k = 0; k != 3; ++k )
+ for( std::size_t l = 0; l != 4; ++l )
+ m2[i][j][k][l] = i + j + k + l;
+
+ for( std::size_t i = 0; i != 3; ++i )
+ for( std::size_t j = 0; j != 3; ++j )
+ for( std::size_t k = 0; k != 2; ++k )
+ for( std::size_t l = 0; l != 4; ++l )
+ m3[i][j][k][l] = i + j + k + l;
+
+ m = transpose( m1 ) * m2 + m3;
+
+Or similarly with a combination of vectors and matrices.
+
+ vector< vector< int, 3 >, 2 > v1, v2;
+ matrix< matrix< int, 3,4 >, 2,3 > m, m1, m2;
+
+ v1[0][0] = 1; v1[0][1] = 2; v1[0][2] = 3;
+ v1[1][0] = 4; v1[1][1] = 5; v1[1][2] = 6;
+
+ v2[0][0] = 6; v2[0][1] = 5; v2[0][2] = 4;
+ v2[1][0] = 3; v2[1][1] = 2; v2[1][2] = 1;
+
+ for( std::size_t i = 0; i != 2; ++i )
+ for( std::size_t j = 0; j != 3; ++j )
+ for( std::size_t k = 0; k != 2; ++k )
+ for( std::size_t l = 0; l != 4; ++l )
+ m1[i][j][k][l] = i + j + k + l;
+
+ for( std::size_t i = 0; i != 2; ++i )
+ for( std::size_t j = 0; j != 3; ++j )
+ for( std::size_t k = 0; k != 2; ++k )
+ for( std::size_t l = 0; l != 4; ++l )
+ m2[i][j][k][l] = i + j + k + l;
+
+ m = transpose( outer_product( v1, v2 ) ) * m1 + m2;
+
+[endsect] [/ Scalars, Vectors and Matrices]
+
+[endsect] [/ Tutorial]
+
+[section:reference Reference]
+
+*[link maps.array array]
+*[link maps.array_ array_]
+*[link maps.pointer pointer]
+*[link maps.view view]
+*[link maps.view_ view_]
+
+[endsect] [/ Reference]
+
+
+[section:array array]
+
+[endsect] [/ array]
+
+[section:array_ array_]
+
+[endsect] [/ array_]
+
+[section:pointer pointer]
+
+[endsect] [/ pointer]
+
+[section:view view]
+
+[endsect] [/ view]
+
+[section:view_ view_]
+
+[endsect] [/ view_]


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk