mirror of
http://172.16.200.102/MOISE/Timed-Altarica-To-Fiacre-Translator.git
synced 2025-11-26 06:17:57 +01:00
Initial commit.
This commit is contained in:
121
sdk/boost/numeric/bindings/ublas/banded.hpp
Normal file
121
sdk/boost/numeric/bindings/ublas/banded.hpp
Normal file
@@ -0,0 +1,121 @@
|
||||
//
|
||||
// Copyright (c) 2002 Kresimir Fresl
|
||||
// Copyright (c) 2010 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_BANDED_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_BANDED_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/detail/if_row_major.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/basic_ublas_adaptor.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/convert_to.hpp>
|
||||
#include <boost/numeric/bindings/ublas/matrix_expression.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/numeric/ublas/banded.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename F, typename A, typename Id, typename Enable >
|
||||
struct adaptor< ublas::banded_matrix< T, F, A >, Id, Enable > {
|
||||
|
||||
// The ublas banded row_major format corresponds to the LAPACK band format.
|
||||
// LAPACK is column_major; so we flip the data order reported by uBLAS.
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef typename if_row_major<
|
||||
typename convert_to< tag::data_order, F >::type,
|
||||
tag::column_major,
|
||||
tag::row_major
|
||||
>::type data_order;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::matrix >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::matrix_type, tag::band >,
|
||||
mpl::pair< tag::data_structure, tag::band_array >,
|
||||
mpl::pair< tag::data_order, data_order >,
|
||||
mpl::pair< tag::bandwidth_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::bandwidth_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::stride_type<1>,
|
||||
typename if_row_major< data_order, std::ptrdiff_t, tag::contiguous >::type >,
|
||||
mpl::pair< tag::stride_type<2>,
|
||||
typename if_row_major< data_order, tag::contiguous, std::ptrdiff_t >::type >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::end_value( id.data() );
|
||||
}
|
||||
|
||||
// A.k.a. left half-bandwidth
|
||||
static std::ptrdiff_t bandwidth1( const Id& id ) {
|
||||
return id.lower();
|
||||
}
|
||||
|
||||
// A.k.a. right half-bandwidth
|
||||
static std::ptrdiff_t bandwidth2( const Id& id ) {
|
||||
return id.upper();
|
||||
}
|
||||
|
||||
// These strides are over the band array structure; not over
|
||||
// the band matrix representation of this structure
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return id.lower() + id.upper() + 1;
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride2( const Id& id ) {
|
||||
return id.lower() + id.upper() + 1;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::banded_adaptor< T >, Id, Enable >:
|
||||
basic_ublas_adaptor<
|
||||
T,
|
||||
Id,
|
||||
mpl::pair< tag::matrix_type, tag::band >,
|
||||
mpl::pair< tag::bandwidth_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::bandwidth_type<2>, std::ptrdiff_t >
|
||||
> {
|
||||
|
||||
// A.k.a. left half-bandwidth
|
||||
static std::ptrdiff_t bandwidth1( const Id& id ) {
|
||||
return id.lower();
|
||||
}
|
||||
|
||||
// A.k.a. right half-bandwidth
|
||||
static std::ptrdiff_t bandwidth2( const Id& id ) {
|
||||
return id.upper();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // detail
|
||||
} // bindings
|
||||
} // numeric
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_DETAIL_BASIC_UBLAS_ADAPTOR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_DETAIL_BASIC_UBLAS_ADAPTOR_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename Id, typename P1 = mpl::void_,
|
||||
typename P2 = mpl::void_, typename P3 = mpl::void_ >
|
||||
struct basic_ublas_adaptor {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_insert< adapted_type, P1, P2, P3 >::type property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
|
||||
return bindings::end_value( id.data() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride1( id.data() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride2( const Id& id ) {
|
||||
return bindings::stride2( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // detail
|
||||
} // bindings
|
||||
} // numeric
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
76
sdk/boost/numeric/bindings/ublas/detail/convert_to.hpp
Normal file
76
sdk/boost/numeric/bindings/ublas/detail/convert_to.hpp
Normal file
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_DETAIL_CONVERT_TO_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_DETAIL_CONVERT_TO_HPP
|
||||
|
||||
#include <boost/numeric/bindings/detail/convert_to.hpp>
|
||||
#include <boost/numeric/bindings/tag.hpp>
|
||||
#include <boost/numeric/ublas/fwd.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::data_order, ublas::row_major > {
|
||||
typedef tag::row_major type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::data_order, ublas::column_major > {
|
||||
typedef tag::column_major type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::matrix_type, ublas::lower > {
|
||||
typedef tag::triangular type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::matrix_type, ublas::upper > {
|
||||
typedef tag::triangular type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::matrix_type, ublas::unit_lower > {
|
||||
typedef tag::unit_triangular type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::matrix_type, ublas::unit_upper > {
|
||||
typedef tag::unit_triangular type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::data_side, ublas::lower > {
|
||||
typedef tag::lower type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::data_side, ublas::upper > {
|
||||
typedef tag::upper type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::data_side, ublas::unit_lower > {
|
||||
typedef tag::lower type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct convert_to< tag::data_side, ublas::unit_upper > {
|
||||
typedef tag::upper type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
86
sdk/boost/numeric/bindings/ublas/hermitian.hpp
Normal file
86
sdk/boost/numeric/bindings/ublas/hermitian.hpp
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_HERMITIAN_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_HERMITIAN_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/basic_ublas_adaptor.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/convert_to.hpp>
|
||||
#include <boost/numeric/bindings/ublas/matrix.hpp>
|
||||
#include <boost/numeric/bindings/ublas/triangular.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/numeric/ublas/hermitian.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename F1, typename F2, typename A, typename Id, typename Enable >
|
||||
struct adaptor< ublas::hermitian_matrix< T, F1, F2, A >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::matrix >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::matrix_type, tag::hermitian >,
|
||||
mpl::pair< tag::data_structure, tag::triangular_array >,
|
||||
mpl::pair< tag::data_side, typename convert_to< tag::data_side, F1 >::type >,
|
||||
mpl::pair< tag::data_order, typename convert_to< tag::data_order, F2 >::type >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::end_value( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, typename F, typename Id, typename Enable >
|
||||
struct adaptor< ublas::hermitian_adaptor< T, F >, Id, Enable >:
|
||||
basic_ublas_adaptor<
|
||||
T,
|
||||
Id,
|
||||
mpl::pair< tag::matrix_type, tag::hermitian >,
|
||||
mpl::pair< tag::data_side, typename convert_to< tag::data_side, F >::type >
|
||||
> {
|
||||
|
||||
typedef typename convert_to< tag::data_side, F >::type data_side;
|
||||
|
||||
static std::ptrdiff_t bandwidth1( const Id& id ) {
|
||||
return bindings::bandwidth( id.data(), data_side() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t bandwidth2( const Id& id ) {
|
||||
return bindings::bandwidth( id.data(), data_side() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
148
sdk/boost/numeric/bindings/ublas/matrix.hpp
Normal file
148
sdk/boost/numeric/bindings/ublas/matrix.hpp
Normal file
@@ -0,0 +1,148 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/detail/if_row_major.hpp>
|
||||
#include <boost/numeric/bindings/detail/offset.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/convert_to.hpp>
|
||||
#include <boost/numeric/bindings/ublas/storage.hpp>
|
||||
#include <boost/numeric/bindings/ublas/matrix_expression.hpp>
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename F, typename A, typename Id, typename Enable >
|
||||
struct adaptor< ::boost::numeric::ublas::matrix< T, F, A >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef typename convert_to< tag::data_order, F >::type data_order;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::matrix >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::matrix_type, tag::general >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
mpl::pair< tag::data_order, data_order >,
|
||||
mpl::pair< tag::stride_type<1>,
|
||||
typename if_row_major< data_order, std::ptrdiff_t, tag::contiguous >::type >,
|
||||
mpl::pair< tag::stride_type<2>,
|
||||
typename if_row_major< data_order, tag::contiguous, std::ptrdiff_t >::type >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::end_value( id.data() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride2( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, std::size_t M, std::size_t N, typename F, typename Id, typename Enable >
|
||||
struct adaptor< ::boost::numeric::ublas::bounded_matrix< T, M, N, F >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef typename convert_to< tag::data_order, F >::type data_order;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::matrix >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
mpl::pair< tag::data_order, data_order >,
|
||||
mpl::pair< tag::stride_type<1>,
|
||||
typename if_row_major< data_order, mpl::int_<N>, tag::contiguous >::type >,
|
||||
mpl::pair< tag::stride_type<2>,
|
||||
typename if_row_major< data_order, tag::contiguous, mpl::int_<M> >::type >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::end_value( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, std::size_t M, std::size_t N, typename Id, typename Enable >
|
||||
struct adaptor< ::boost::numeric::ublas::c_matrix< T, M, N >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::matrix >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::matrix_type, tag::general >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
mpl::pair< tag::data_order, tag::row_major >,
|
||||
mpl::pair< tag::stride_type<1>, mpl::int_<N> >,
|
||||
mpl::pair< tag::stride_type<2>, tag::contiguous >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return id.data();
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return id.data() + offset( id, id.size1(), id.size2() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
126
sdk/boost/numeric/bindings/ublas/matrix_expression.hpp
Normal file
126
sdk/boost/numeric/bindings/ublas/matrix_expression.hpp
Normal file
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_EXPRESSION_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_EXPRESSION_HPP
|
||||
|
||||
#include <boost/numeric/bindings/bandwidth.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/detail/property_map.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/ublas/matrix_expression.hpp>
|
||||
|
||||
#include <boost/mpl/replace.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< boost::numeric::ublas::matrix_reference< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_map_of< adapted_type >::type property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.expression() );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
|
||||
return bindings::end_value( id.expression() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride1( id.expression() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride2( const Id& id ) {
|
||||
return bindings::stride2( id.expression() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t bandwidth1( const Id& id ) {
|
||||
return bindings::bandwidth1( id.expression() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t bandwidth2( const Id& id ) {
|
||||
return bindings::bandwidth2( id.expression() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, typename U, typename Id, typename Enable >
|
||||
struct adaptor< boost::numeric::ublas::matrix_unary2< T, U >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_map_of< adapted_type >::type map;
|
||||
|
||||
typedef mpl::map<
|
||||
mpl::pair<tag::value_type, typename mpl::at<map, tag::value_type>::type>,
|
||||
mpl::pair<tag::entity, typename mpl::at<map, tag::entity>::type>,
|
||||
mpl::pair<tag::size_type<1>, typename mpl::at<map, tag::size_type<1> >::type>,
|
||||
mpl::pair<tag::size_type<2>, typename mpl::at<map, tag::size_type<2> >::type>,
|
||||
mpl::pair<tag::data_structure, typename mpl::at<map, tag::data_structure>::type>,
|
||||
|
||||
mpl::pair<tag::data_order,
|
||||
typename mpl::if_<
|
||||
is_same<
|
||||
typename mpl::at<map, tag::data_order>::type,
|
||||
tag::row_major>,
|
||||
tag::column_major,
|
||||
tag::row_major
|
||||
>::type>,
|
||||
|
||||
mpl::pair<tag::stride_type<1>, typename mpl::at<map, tag::stride_type<2> >:: type>,
|
||||
mpl::pair<tag::stride_type<2>, typename mpl::at<map, tag::stride_type<1> >:: type>
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type
|
||||
begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.expression() );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type
|
||||
end_value( Id& id ) {
|
||||
return bindings::end_value( id.expression() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride2( id.expression() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride2( const Id& id ) {
|
||||
return bindings::stride1( id.expression() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
244
sdk/boost/numeric/bindings/ublas/matrix_proxy.hpp
Normal file
244
sdk/boost/numeric/bindings/ublas/matrix_proxy.hpp
Normal file
@@ -0,0 +1,244 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_PROXY_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_PROXY_HPP
|
||||
|
||||
#include <boost/numeric/bindings/bandwidth.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/detail/offset.hpp>
|
||||
#include <boost/numeric/bindings/detail/property_map.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
#include <boost/numeric/ublas/matrix_proxy.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::matrix_range< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_map_of< adapted_type >::type property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.start1(), id.start2() );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.start1() + id.size1(), id.start2() + id.size2() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride1( id.data() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride2( const Id& id ) {
|
||||
return bindings::stride2( id.data() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t bandwidth1( const Id& id ) {
|
||||
return bindings::bandwidth1( id.data() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t bandwidth2( const Id& id ) {
|
||||
return bindings::bandwidth2( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::matrix_slice< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_map_of< adapted_type >::type property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.start1(), id.start2() );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.start1() + id.size1(), id.start2() + id.size2() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return id.stride1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride2( const Id& id ) {
|
||||
return id.stride2();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t bandwidth1( const Id& id ) {
|
||||
return bindings::bandwidth1( id.data() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t bandwidth2( const Id& id ) {
|
||||
return bindings::bandwidth2( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::matrix_column< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, typename bindings::value_type< T>::type >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
// TODO in case of column major, this could be contiguous
|
||||
mpl::pair< tag::stride_type<1>, std::ptrdiff_t >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), 0, id.index() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), bindings::size(id), id.index() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride1( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::matrix_row< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, typename bindings::value_type< T>::type >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
// TODO in case of row major, this could be contiguous
|
||||
mpl::pair< tag::stride_type<1>, std::ptrdiff_t >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.index(), 0 );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.index(), bindings::size(id) );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride2( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::matrix_vector_range< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_insert< adapted_type,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::stride_type<1>, std::ptrdiff_t >
|
||||
>::type property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.start1(), id.start2() );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.start1() + id.size1(), id.start2() + id.size2() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride1( id.data() ) + bindings::stride2( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::matrix_vector_slice< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_insert< adapted_type,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::stride_type<1>, std::ptrdiff_t >
|
||||
>::type property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.start1(), id.start2() );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id.data(), id.start1() + id.size1(), id.start2() + id.size2() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return id.stride1() * bindings::stride1( id.data() ) +
|
||||
id.stride2() * bindings::stride2( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
135
sdk/boost/numeric/bindings/ublas/matrix_sparse.hpp
Normal file
135
sdk/boost/numeric/bindings/ublas/matrix_sparse.hpp
Normal file
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_SPARSE_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_MATRIX_SPARSE_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/detail/copy_const.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/convert_to.hpp>
|
||||
#include <boost/numeric/bindings/ublas/matrix_expression.hpp>
|
||||
#include <boost/numeric/bindings/ublas/storage.hpp>
|
||||
#include <boost/numeric/ublas/matrix_sparse.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename F, std::size_t IB, typename IA, typename TA, typename Id, typename Enable >
|
||||
struct adaptor< ublas::compressed_matrix< T, F, IB, IA, TA >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef typename copy_const< Id, typename bindings::value_type<IA>::type >::type index_type;
|
||||
typedef typename convert_to< tag::data_order, F >::type data_order;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::index_type, index_type >,
|
||||
mpl::pair< tag::entity, tag::matrix >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::matrix_type, tag::general >,
|
||||
mpl::pair< tag::data_structure, tag::compressed_sparse >,
|
||||
mpl::pair< tag::data_order, data_order >,
|
||||
mpl::pair< tag::index_base, mpl::int_<IB> >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.value_data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::begin_value( id.value_data() ) + id.nnz();
|
||||
}
|
||||
|
||||
static index_type* begin_compressed_index_major( Id& id ) {
|
||||
return bindings::begin_value( id.index1_data() );
|
||||
}
|
||||
|
||||
static index_type* end_compressed_index_major( Id& id ) {
|
||||
return bindings::end_value( id.index1_data() );
|
||||
}
|
||||
|
||||
static index_type* begin_index_minor( Id& id ) {
|
||||
return bindings::begin_value( id.index2_data() );
|
||||
}
|
||||
|
||||
static index_type* end_index_minor( Id& id ) {
|
||||
return bindings::begin_value( id.index2_data() ) + id.nnz();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, typename F, std::size_t IB, typename IA, typename TA, typename Id, typename Enable >
|
||||
struct adaptor< ublas::coordinate_matrix< T, F, IB, IA, TA >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef typename copy_const< Id, typename bindings::value_type<IA>::type >::type index_type;
|
||||
typedef typename convert_to< tag::data_order, F >::type data_order;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::index_type, index_type >,
|
||||
mpl::pair< tag::entity, tag::matrix >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::matrix_type, tag::general >,
|
||||
mpl::pair< tag::data_structure, tag::coordinate_sparse >,
|
||||
mpl::pair< tag::data_order, data_order >,
|
||||
mpl::pair< tag::index_base, mpl::int_<IB> >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& id ) {
|
||||
return id.size2();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.value_data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::begin_value( id.value_data() ) + id.nnz();
|
||||
}
|
||||
|
||||
static index_type* begin_index_major( Id& id ) {
|
||||
return bindings::begin_value( id.index1_data() );
|
||||
}
|
||||
|
||||
static index_type* end_index_major( Id& id ) {
|
||||
return bindings::begin_value( id.index1_data() ) + id.nnz();
|
||||
}
|
||||
|
||||
static index_type* begin_index_minor( Id& id ) {
|
||||
return bindings::begin_value( id.index2_data() );
|
||||
}
|
||||
|
||||
static index_type* end_index_minor( Id& id ) {
|
||||
return bindings::begin_value( id.index2_data() ) + id.nnz();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
51
sdk/boost/numeric/bindings/ublas/scalar_vector.hpp
Normal file
51
sdk/boost/numeric/bindings/ublas/scalar_vector.hpp
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_SCALAR_VECTOR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_SCALAR_VECTOR_HPP
|
||||
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename Alloc, typename Id, typename Enable >
|
||||
struct adaptor< ublas::scalar_vector< T, Alloc >, Id, Enable > {
|
||||
|
||||
typedef typename add_const< T >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
mpl::pair< tag::stride_type<1>, mpl::int_<0> >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& t ) {
|
||||
return t.size();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& t ) {
|
||||
return t.find_element( 0 );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& t ) {
|
||||
return t.find_element( 0 ) + 1;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
53
sdk/boost/numeric/bindings/ublas/storage.hpp
Normal file
53
sdk/boost/numeric/bindings/ublas/storage.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
// Copyright (c) 2011 Andrey Asadchev
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_STORAGE_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_STORAGE_HPP
|
||||
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/ublas/storage.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename Id >
|
||||
struct adaptor< T, Id, typename boost::enable_if< boost::is_base_of< ublas::storage_array<T>, T> >::type > {
|
||||
|
||||
typedef typename copy_const< Id, typename T::value_type >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
mpl::pair< tag::stride_type<1>, tag::contiguous >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return id.begin();
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return id.end();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
86
sdk/boost/numeric/bindings/ublas/symmetric.hpp
Normal file
86
sdk/boost/numeric/bindings/ublas/symmetric.hpp
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_SYMMETRIC_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_SYMMETRIC_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/convert_to.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/basic_ublas_adaptor.hpp>
|
||||
#include <boost/numeric/bindings/ublas/matrix.hpp>
|
||||
#include <boost/numeric/bindings/ublas/triangular.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/numeric/ublas/symmetric.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename F1, typename F2, typename A, typename Id, typename Enable >
|
||||
struct adaptor< ublas::symmetric_matrix< T, F1, F2, A >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::matrix >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::matrix_type, tag::symmetric >,
|
||||
mpl::pair< tag::data_structure, tag::triangular_array >,
|
||||
mpl::pair< tag::data_side, typename convert_to< tag::data_side, F1 >::type >,
|
||||
mpl::pair< tag::data_order, typename convert_to< tag::data_order, F2 >::type >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& t ) {
|
||||
return t.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& t ) {
|
||||
return t.size2();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& t ) {
|
||||
return bindings::begin_value( t.data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& t ) {
|
||||
return bindings::end_value( t.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, typename F, typename Id, typename Enable >
|
||||
struct adaptor< ublas::symmetric_adaptor< T, F >, Id, Enable >:
|
||||
basic_ublas_adaptor<
|
||||
T,
|
||||
Id,
|
||||
mpl::pair< tag::matrix_type, tag::symmetric >,
|
||||
mpl::pair< tag::data_side, typename convert_to< tag::data_side, F >::type >
|
||||
> {
|
||||
|
||||
typedef typename convert_to< tag::data_side, F >::type data_side;
|
||||
|
||||
static std::ptrdiff_t bandwidth1( const Id& id ) {
|
||||
return bindings::bandwidth( id.data(), data_side() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t bandwidth2( const Id& id ) {
|
||||
return bindings::bandwidth( id.data(), data_side() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
73
sdk/boost/numeric/bindings/ublas/triangular.hpp
Normal file
73
sdk/boost/numeric/bindings/ublas/triangular.hpp
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_TRIANGULAR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_TRIANGULAR_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/basic_ublas_adaptor.hpp>
|
||||
#include <boost/numeric/bindings/ublas/detail/convert_to.hpp>
|
||||
#include <boost/numeric/bindings/value_type.hpp>
|
||||
#include <boost/numeric/bindings/ublas/matrix_expression.hpp>
|
||||
#include <boost/numeric/ublas/triangular.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename F1, typename F2, typename A, typename Id, typename Enable >
|
||||
struct adaptor< ublas::triangular_matrix< T, F1, F2, A >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::matrix >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::size_type<2>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::matrix_type, typename convert_to< tag::matrix_type, F1 >::type >,
|
||||
mpl::pair< tag::data_structure, tag::triangular_array >,
|
||||
mpl::pair< tag::data_side, typename convert_to< tag::data_side, F1 >::type >,
|
||||
mpl::pair< tag::data_order, typename convert_to< tag::data_order, F2 >::type >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& t ) {
|
||||
return t.size1();
|
||||
}
|
||||
|
||||
static std::ptrdiff_t size2( const Id& t ) {
|
||||
return t.size2();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& t ) {
|
||||
return bindings::begin_value( t.data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& t ) {
|
||||
return bindings::end_value( t.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, typename F, typename Id, typename Enable >
|
||||
struct adaptor< ublas::triangular_adaptor< T, F >, Id, Enable >:
|
||||
basic_ublas_adaptor<
|
||||
T,
|
||||
Id,
|
||||
mpl::pair< tag::matrix_type, typename convert_to< tag::matrix_type, F >::type >,
|
||||
mpl::pair< tag::data_side, typename convert_to< tag::data_side, F >::type >
|
||||
> {};
|
||||
|
||||
} // detail
|
||||
} // bindings
|
||||
} // numeric
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
107
sdk/boost/numeric/bindings/ublas/vector.hpp
Normal file
107
sdk/boost/numeric/bindings/ublas/vector.hpp
Normal file
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_HPP
|
||||
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/ublas/storage.hpp>
|
||||
#include <boost/numeric/bindings/ublas/vector_expression.hpp>
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename Alloc, typename Id, typename Enable >
|
||||
struct adaptor< ublas::vector< T, Alloc >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
mpl::pair< tag::stride_type<1>, tag::contiguous >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::end_value( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, std::size_t N, typename Id, typename Enable >
|
||||
struct adaptor< ublas::bounded_vector< T, N >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
mpl::pair< tag::stride_type<1>, tag::contiguous >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() );
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return bindings::end_value( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, std::size_t N, typename Id, typename Enable >
|
||||
struct adaptor< ublas::c_vector< T, N >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::data_structure, tag::linear_array >,
|
||||
mpl::pair< tag::stride_type<1>, tag::contiguous >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static value_type* begin_value( Id& id ) {
|
||||
return id.data();
|
||||
}
|
||||
|
||||
static value_type* end_value( Id& id ) {
|
||||
return id.data() + id.size();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
54
sdk/boost/numeric/bindings/ublas/vector_expression.hpp
Normal file
54
sdk/boost/numeric/bindings/ublas/vector_expression.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_EXPRESSION_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_EXPRESSION_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/detail/property_map.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
#include <boost/numeric/ublas/vector_expression.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::vector_reference< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_map_of< adapted_type >::type property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.expression() );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
|
||||
return bindings::end_value( id.expression() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride1( id.expression() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
81
sdk/boost/numeric/bindings/ublas/vector_proxy.hpp
Normal file
81
sdk/boost/numeric/bindings/ublas/vector_proxy.hpp
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_PROXY_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_PROXY_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/detail/offset.hpp>
|
||||
#include <boost/numeric/bindings/detail/property_map.hpp>
|
||||
#include <boost/numeric/bindings/end.hpp>
|
||||
#include <boost/numeric/bindings/size.hpp>
|
||||
#include <boost/numeric/bindings/stride.hpp>
|
||||
#include <boost/numeric/ublas/vector_proxy.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::vector_range< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_map_of< adapted_type >::type property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) + id.start() * stride1( id );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) + id.size() * stride1( id );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride1( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template< typename T, typename Id, typename Enable >
|
||||
struct adaptor< ublas::vector_slice< T >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type adapted_type;
|
||||
typedef typename property_map_of< adapted_type >::type property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& id ) {
|
||||
return id.size();
|
||||
}
|
||||
|
||||
static typename result_of::begin_value< adapted_type >::type begin_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id, id.start() );
|
||||
}
|
||||
|
||||
static typename result_of::end_value< adapted_type >::type end_value( Id& id ) {
|
||||
return bindings::begin_value( id.data() ) +
|
||||
offset( id, id.start() + id.size() );
|
||||
}
|
||||
|
||||
static std::ptrdiff_t stride1( const Id& id ) {
|
||||
return bindings::stride1( id.data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
53
sdk/boost/numeric/bindings/ublas/vector_sparse.hpp
Normal file
53
sdk/boost/numeric/bindings/ublas/vector_sparse.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Copyright (c) 2009 Rutger ter Borg
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#ifndef BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_SPARSE_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_UBLAS_VECTOR_SPARSE_HPP
|
||||
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/detail/adaptor.hpp>
|
||||
#include <boost/numeric/bindings/ublas/vector_expression.hpp>
|
||||
#include <boost/numeric/ublas/vector_sparse.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace bindings {
|
||||
namespace detail {
|
||||
|
||||
template< typename T, std::size_t IB, typename IA, typename TA, typename Id, typename Enable >
|
||||
struct adaptor< ublas::compressed_vector< T, IB, IA, TA >, Id, Enable > {
|
||||
|
||||
typedef typename copy_const< Id, T >::type value_type;
|
||||
typedef mpl::map<
|
||||
mpl::pair< tag::value_type, value_type >,
|
||||
mpl::pair< tag::entity, tag::vector >,
|
||||
mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
|
||||
mpl::pair< tag::data_structure, tag::compressed_sparse >
|
||||
> property_map;
|
||||
|
||||
static std::ptrdiff_t size1( const Id& t ) {
|
||||
return t.size();
|
||||
}
|
||||
|
||||
// static void index_data( Id& t ) {
|
||||
// // t.index_data();
|
||||
// }
|
||||
//
|
||||
|
||||
static value_type* begin_value( Id& t ) {
|
||||
return bindings::begin_value( t.value_data() );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user