|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60726 - in sandbox/numeric_bindings: boost/numeric/bindings boost/numeric/bindings/mumps boost/numeric/bindings/ublas boost/numeric/bindings/umfpack libs/numeric/bindings/mumps/test libs/numeric/bindings/umfpack/test
From: thomas.klimpel_at_[hidden]
Date: 2010-03-19 20:36:47
Author: klimpel
Date: 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
New Revision: 60726
URL: http://svn.boost.org/trac/boost/changeset/60726
Log:
updated support for sparse matrix structures to use new traits system
Text files modified:
sandbox/numeric_bindings/boost/numeric/bindings/begin.hpp | 31 ++
sandbox/numeric_bindings/boost/numeric/bindings/end.hpp | 31 ++
sandbox/numeric_bindings/boost/numeric/bindings/mumps/mumps_driver_4_6_4.hpp | 54 +-
sandbox/numeric_bindings/boost/numeric/bindings/mumps/mumps_driver_4_8_0.hpp | 54 +-
sandbox/numeric_bindings/boost/numeric/bindings/tag.hpp | 8
sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_sparse.hpp | 72 ++++
sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_sparse.hpp | 2
sandbox/numeric_bindings/boost/numeric/bindings/umfpack/umfpack.hpp | 565 +++++++++++++++++++++------------------
sandbox/numeric_bindings/boost/numeric/bindings/umfpack/umfpack_overloads.hpp | 55 +-
sandbox/numeric_bindings/libs/numeric/bindings/mumps/test/mumps_ublas.cpp | 4
sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umf4.cc | 18
sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_di_demo.cc | 24 +
sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_simple.cc | 4
sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_zi_demo.cc | 23 +
14 files changed, 559 insertions(+), 386 deletions(-)
Modified: sandbox/numeric_bindings/boost/numeric/bindings/begin.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/begin.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/begin.hpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -33,7 +33,6 @@
static result_type invoke( T& t ) {
return adaptor_access<T>::begin_value( t );
}
-
};
template< typename T, int Dimension >
@@ -49,7 +48,33 @@
static result_type invoke( T& t ) {
return result_type( begin_value( t ), stride(t, tag_type() ) );
}
+};
+template< typename T >
+struct begin_impl< T, tag::index_major > {
+ typedef typename detail::property_at< T, tag::index_type >::type* result_type;
+
+ static result_type invoke( T& t ) {
+ return adaptor_access<T>::begin_index_major( t );
+ }
+};
+
+template< typename T >
+struct begin_impl< T, tag::compressed_index_major > {
+ typedef typename detail::property_at< T, tag::index_type >::type* result_type;
+
+ static result_type invoke( T& t ) {
+ return adaptor_access<T>::begin_compressed_index_major( t );
+ }
+};
+
+template< typename T >
+struct begin_impl< T, tag::index_minor > {
+ typedef typename detail::property_at< T, tag::index_type >::type* result_type;
+
+ static result_type invoke( T& t ) {
+ return adaptor_access<T>::begin_index_minor( t );
+ }
};
} // namespace detail
@@ -109,6 +134,10 @@
GENERATE_FUNCTIONS( begin, _row, tag::addressing_index<1> )
GENERATE_FUNCTIONS( begin, _column, tag::addressing_index<2> )
+GENERATE_FUNCTIONS( begin, _index_major, tag::index_major )
+GENERATE_FUNCTIONS( begin, _compressed_index_major, tag::compressed_index_major )
+GENERATE_FUNCTIONS( begin, _index_minor, tag::index_minor )
+
} // namespace bindings
} // namespace numeric
} // namespace boost
Modified: sandbox/numeric_bindings/boost/numeric/bindings/end.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/end.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/end.hpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -27,7 +27,6 @@
static result_type invoke( T& t ) {
return adaptor_access<T>::end_value( t );
}
-
};
template< typename T, int N >
@@ -43,7 +42,33 @@
static result_type invoke( T& t ) {
return result_type( end_value( t ), stride(t, tag_type() ) );
}
+};
+template< typename T >
+struct end_impl< T, tag::index_major > {
+ typedef typename detail::property_at< T, tag::index_type >::type* result_type;
+
+ static result_type invoke( T& t ) {
+ return adaptor_access<T>::end_index_major( t );
+ }
+};
+
+template< typename T >
+struct end_impl< T, tag::compressed_index_major > {
+ typedef typename detail::property_at< T, tag::index_type >::type* result_type;
+
+ static result_type invoke( T& t ) {
+ return adaptor_access<T>::end_compressed_index_major( t );
+ }
+};
+
+template< typename T >
+struct end_impl< T, tag::index_minor > {
+ typedef typename detail::property_at< T, tag::index_type >::type* result_type;
+
+ static result_type invoke( T& t ) {
+ return adaptor_access<T>::end_index_minor( t );
+ }
};
} // namespace detail
@@ -57,6 +82,7 @@
};
} // namespace result_of
+
//
// Free Functions
//
@@ -102,6 +128,9 @@
GENERATE_FUNCTIONS( end, _row, tag::addressing_index<1> )
GENERATE_FUNCTIONS( end, _column, tag::addressing_index<2> )
+GENERATE_FUNCTIONS( end, _index_major, tag::index_major )
+GENERATE_FUNCTIONS( end, _compressed_index_major, tag::compressed_index_major )
+GENERATE_FUNCTIONS( end, _index_minor, tag::index_minor )
} // namespace bindings
} // namespace numeric
Modified: sandbox/numeric_bindings/boost/numeric/bindings/mumps/mumps_driver_4_6_4.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/mumps/mumps_driver_4_6_4.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/mumps/mumps_driver_4_6_4.hpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -13,9 +13,9 @@
#include <boost/numeric/bindings/mumps/4.6.4/cmumps_c.hpp>
#include <boost/numeric/bindings/mumps/4.6.4/dmumps_c.hpp>
#include <boost/numeric/bindings/mumps/4.6.4/zmumps_c.hpp>
-#include <boost/numeric/bindings/traits/sparse_traits.hpp>
-#include <boost/numeric/bindings/traits/matrix_traits.hpp>
-#include <boost/numeric/bindings/traits/type_traits.hpp>
+#include <boost/numeric/bindings/value_type.hpp>
+#include <boost/numeric/bindings/begin.hpp>
+#include <boost/numeric/bindings/size.hpp>
#include <boost/static_assert.hpp>
#include <complex>
#include <cassert>
@@ -139,12 +139,12 @@
} ;
template <>
- struct mumps_sym< boost::numeric::bindings::traits::symmetric_t > {
+ struct mumps_sym< boost::numeric::bindings::tag::symmetric > {
static int const value = 2 ;
} ;
template <>
- struct mumps_sym< boost::numeric::bindings::traits::general_t > {
+ struct mumps_sym< boost::numeric::bindings::tag::general > {
static int const value = 0 ;
} ;
@@ -152,15 +152,15 @@
// Get index pointers
//
template <typename M>
- void indices( boost::numeric::bindings::traits::row_major_t, int*& rows, int*& cols, M const& m ) {
- rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ;
- cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ;
+ void indices( boost::numeric::bindings::tag::row_major, int*& rows, int*& cols, M const& m ) {
+ rows = const_cast<int*>( boost::numeric::bindings::begin_index_major( m ) ) ;
+ cols = const_cast<int*>( boost::numeric::bindings::begin_index_minor( m ) ) ;
}
template <typename M>
- void indices( boost::numeric::bindings::traits::column_major_t, int*& rows, int*& cols, M const& m ) {
- cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ;
- rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ;
+ void indices( boost::numeric::bindings::tag::column_major, int*& rows, int*& cols, M const& m ) {
+ cols = const_cast<int*>( boost::numeric::bindings::begin_index_major( m ) ) ;
+ rows = const_cast<int*>( boost::numeric::bindings::begin_index_minor( m ) ) ;
}
// Pointer Cast
@@ -177,10 +177,10 @@
//
template <typename M>
struct mumps
- : detail::mumps_type< typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::value_type >::type
+ : detail::mumps_type< typename boost::numeric::bindings::value_type<M>::type >::type
{
- typedef typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::value_type value_type ;
- typedef typename detail::mumps_type< typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::value_type >::type c_struct_type ;
+ typedef typename boost::numeric::bindings::value_type<M>::type value_type ;
+ typedef typename detail::mumps_type< typename boost::numeric::bindings::value_type<M>::type >::type c_struct_type ;
//
// Initialize MUMPS solver
@@ -192,7 +192,7 @@
this->job = -1 ;
this->par = par ;
this->comm_fortran = comm_fortran ;
- this->sym = detail::mumps_sym< typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::matrix_structure >::value ;
+ this->sym = detail::mumps_sym< typename boost::numeric::bindings::detail::property_at<M, tag::matrix_type >::type >::value ;
detail::mumps_call<value_type>() ( *this ) ;
}
@@ -209,15 +209,15 @@
//
template <typename M>
void matrix_integer_data( mumps<M>& data, M& m ) {
- BOOST_STATIC_ASSERT( (1 == boost::numeric::bindings::traits::sparse_matrix_traits<M>::index_base) ) ;
- data.n = boost::numeric::bindings::traits::spmatrix_num_rows( m ) ;
- assert( boost::numeric::bindings::traits::spmatrix_num_columns( m ) == data.n ) ;
+ BOOST_STATIC_ASSERT( (1 == boost::numeric::bindings::detail::adaptor_access<M>::index_base) ) ;
+ data.n = boost::numeric::bindings::size_row( m ) ;
+ assert( boost::numeric::bindings::size_column( m ) == data.n ) ;
- data.nz = boost::numeric::bindings::traits::spmatrix_num_nonzeros( m ) ;
- detail::indices( typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::ordering_type(), data.irn, data.jcn, m ) ;
+ data.nz = boost::numeric::bindings::detail::adaptor_access<M>::num_nonzeros( m ) ;
+ detail::indices( typename boost::numeric::bindings::detail::property_at< M, tag::data_order >::type(), data.irn, data.jcn, m ) ;
- data.nz_loc = boost::numeric::bindings::traits::spmatrix_num_nonzeros( m ) ;
- detail::indices( typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::ordering_type(), data.irn_loc, data.jcn_loc, m ) ;
+ data.nz_loc = boost::numeric::bindings::detail::adaptor_access<M>::num_nonzeros( m ) ;
+ detail::indices( typename boost::numeric::bindings::detail::property_at< M, tag::data_order >::type(), data.irn_loc, data.jcn_loc, m ) ;
} // matrix_integer_data()
@@ -226,8 +226,8 @@
//
template <typename M>
void matrix_value_data( mumps<M>& data, M& m ) {
- data.a = detail::cast_2_mumps( boost::numeric::bindings::traits::spmatrix_value_storage( m ) ) ;
- data.a_loc = detail::cast_2_mumps( boost::numeric::bindings::traits::spmatrix_value_storage( m ) ) ;
+ data.a = detail::cast_2_mumps( boost::numeric::bindings::begin_value( m ) ) ;
+ data.a_loc = detail::cast_2_mumps( boost::numeric::bindings::begin_value( m ) ) ;
} // matrix_value_data()
@@ -237,9 +237,9 @@
//
template <typename M, typename X>
void rhs_sol_value_data( mumps<M>& data, X& x ) {
- data.rhs = detail::cast_2_mumps( boost::numeric::bindings::traits::matrix_storage( x ) ) ;
- data.nrhs = boost::numeric::bindings::traits::matrix_num_columns( x ) ;
- data.lrhs = boost::numeric::bindings::traits::leading_dimension( x ) ;
+ data.rhs = detail::cast_2_mumps( boost::numeric::bindings::begin_value( x ) ) ;
+ data.nrhs = boost::numeric::bindings::size_column( x ) ;
+ data.lrhs = boost::numeric::bindings::stride_major( x ) ;
} // matrix_rhs_sol_value_data()
Modified: sandbox/numeric_bindings/boost/numeric/bindings/mumps/mumps_driver_4_8_0.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/mumps/mumps_driver_4_8_0.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/mumps/mumps_driver_4_8_0.hpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -13,9 +13,9 @@
#include <cmumps_c.h>
#include <dmumps_c.h>
#include <zmumps_c.h>
-#include <boost/numeric/bindings/traits/sparse_traits.hpp>
-#include <boost/numeric/bindings/traits/matrix_traits.hpp>
-#include <boost/numeric/bindings/traits/type_traits.hpp>
+#include <boost/numeric/bindings/value_type.hpp>
+#include <boost/numeric/bindings/begin.hpp>
+#include <boost/numeric/bindings/size.hpp>
#include <boost/static_assert.hpp>
#include <complex>
#include <cassert>
@@ -139,12 +139,12 @@
} ;
template <>
- struct mumps_sym< boost::numeric::bindings::traits::symmetric_t > {
+ struct mumps_sym< boost::numeric::bindings::tag::symmetric > {
static int const value = 2 ;
} ;
template <>
- struct mumps_sym< boost::numeric::bindings::traits::general_t > {
+ struct mumps_sym< boost::numeric::bindings::tag::general > {
static int const value = 0 ;
} ;
@@ -152,15 +152,15 @@
// Get index pointers
//
template <typename M>
- void indices( boost::numeric::bindings::traits::row_major_t, int*& rows, int*& cols, M const& m ) {
- rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ;
- cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ;
+ void indices( boost::numeric::bindings::tag::row_major, int*& rows, int*& cols, M const& m ) {
+ rows = const_cast<int*>( boost::numeric::bindings::begin_index_major( m ) ) ;
+ cols = const_cast<int*>( boost::numeric::bindings::begin_index_minor( m ) ) ;
}
template <typename M>
- void indices( boost::numeric::bindings::traits::column_major_t, int*& rows, int*& cols, M const& m ) {
- cols = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index1_storage( m ) ) ;
- rows = const_cast<int*>( boost::numeric::bindings::traits::spmatrix_index2_storage( m ) ) ;
+ void indices( boost::numeric::bindings::tag::column_major, int*& rows, int*& cols, M const& m ) {
+ cols = const_cast<int*>( boost::numeric::bindings::begin_index_major( m ) ) ;
+ rows = const_cast<int*>( boost::numeric::bindings::begin_index_minor( m ) ) ;
}
// Pointer Cast
@@ -177,11 +177,11 @@
//
template <typename M>
class mumps
- : public detail::mumps_type< typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::value_type >::type
+ : public detail::mumps_type< typename boost::numeric::bindings::value_type<M>::type >::type
{
public:
- typedef typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::value_type value_type ;
- typedef typename detail::mumps_type< typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::value_type >::type c_struct_type ;
+ typedef typename boost::numeric::bindings::value_type<M>::type value_type ;
+ typedef typename detail::mumps_type< typename boost::numeric::bindings::value_type<M>::type >::type c_struct_type ;
//
// Initialize MUMPS solver
@@ -193,7 +193,7 @@
this->job = -1 ;
this->par = par ;
this->comm_fortran = comm_fortran ;
- this->sym = detail::mumps_sym< typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::matrix_structure >::value ;
+ this->sym = detail::mumps_sym< typename boost::numeric::bindings::detail::property_at<M, tag::matrix_type >::type >::value ;
detail::mumps_call<value_type>() ( *this ) ;
}
@@ -216,15 +216,15 @@
//
template <typename M>
void matrix_integer_data( mumps<M>& data, M& m ) {
- BOOST_STATIC_ASSERT( (1 == boost::numeric::bindings::traits::sparse_matrix_traits<M>::index_base) ) ;
- data.n = boost::numeric::bindings::traits::spmatrix_num_rows( m ) ;
- assert( boost::numeric::bindings::traits::spmatrix_num_columns( m ) == data.n ) ;
+ BOOST_STATIC_ASSERT( (1 == boost::numeric::bindings::detail::adaptor_access<M>::index_base) ) ;
+ data.n = boost::numeric::bindings::size_row( m ) ;
+ assert( boost::numeric::bindings::size_column( m ) == data.n ) ;
- data.nz = boost::numeric::bindings::traits::spmatrix_num_nonzeros( m ) ;
- detail::indices( typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::ordering_type(), data.irn, data.jcn, m ) ;
+ data.nz = boost::numeric::bindings::detail::adaptor_access<M>::num_nonzeros( m ) ;
+ detail::indices( typename boost::numeric::bindings::detail::property_at< M, tag::data_order >::type(), data.irn, data.jcn, m ) ;
- data.nz_loc = boost::numeric::bindings::traits::spmatrix_num_nonzeros( m ) ;
- detail::indices( typename boost::numeric::bindings::traits::sparse_matrix_traits<M>::ordering_type(), data.irn_loc, data.jcn_loc, m ) ;
+ data.nz_loc = boost::numeric::bindings::detail::adaptor_access<M>::num_nonzeros( m ) ;
+ detail::indices( typename boost::numeric::bindings::detail::property_at< M, tag::data_order >::type(), data.irn_loc, data.jcn_loc, m ) ;
} // matrix_integer_data()
@@ -233,8 +233,8 @@
//
template <typename M>
void matrix_value_data( mumps<M>& data, M& m ) {
- data.a = detail::cast_2_mumps( boost::numeric::bindings::traits::spmatrix_value_storage( m ) ) ;
- data.a_loc = detail::cast_2_mumps( boost::numeric::bindings::traits::spmatrix_value_storage( m ) ) ;
+ data.a = detail::cast_2_mumps( boost::numeric::bindings::begin_value( m ) ) ;
+ data.a_loc = detail::cast_2_mumps( boost::numeric::bindings::begin_value( m ) ) ;
} // matrix_value_data()
@@ -244,9 +244,9 @@
//
template <typename M, typename X>
void rhs_sol_value_data( mumps<M>& data, X& x ) {
- data.rhs = detail::cast_2_mumps( boost::numeric::bindings::traits::matrix_storage( x ) ) ;
- data.nrhs = boost::numeric::bindings::traits::matrix_num_columns( x ) ;
- data.lrhs = boost::numeric::bindings::traits::leading_dimension( x ) ;
+ data.rhs = detail::cast_2_mumps( boost::numeric::bindings::begin_value( x ) ) ;
+ data.nrhs = boost::numeric::bindings::size_column( x ) ;
+ data.lrhs = boost::numeric::bindings::stride_major( x ) ;
} // matrix_rhs_sol_value_data()
Modified: sandbox/numeric_bindings/boost/numeric/bindings/tag.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/tag.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/tag.hpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -72,7 +72,8 @@
ADD_TAG( linear_array )
ADD_TAG( triangular_array )
ADD_TAG( band_array )
-ADD_TAG( yale_sparse )
+ADD_TAG( compressed_sparse )
+ADD_TAG( coordinate_sparse )
ADD_TAG( structure )
ADD_TAG( general )
@@ -103,6 +104,11 @@
ADD_TAG( right )
ADD_TAG( both )
+// Sparse matrix
+ADD_TAG( index_major )
+ADD_TAG( compressed_index_major )
+ADD_TAG( index_minor )
+
namespace tag {
typedef tensor<0> scalar;
Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_sparse.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_sparse.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/matrix_sparse.hpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -31,13 +31,73 @@
typedef mpl::map<
mpl::pair< tag::value_type, value_type >,
mpl::pair< tag::index_type, index_type >,
- mpl::pair< tag::entity, tag::vector >,
+ 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::yale_sparse >,
+ mpl::pair< tag::matrix_type, tag::general >,
+ mpl::pair< tag::data_structure, tag::compressed_sparse >,
mpl::pair< tag::data_order, data_order >
> property_map;
+ BOOST_STATIC_CONSTANT (std::size_t, index_base = IB);
+
+ 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::end_value( id.value_data() );
+ }
+
+ 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::end_value( id.index2_data() );
+ }
+
+};
+
+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 >
+ > property_map;
+
+ BOOST_STATIC_CONSTANT (std::size_t, index_base = IB);
+
+ static std::ptrdiff_t num_nonzeros ( const Id& id ) {
+ return id.nnz();
+ }
+
static std::ptrdiff_t size1( const Id& id ) {
return id.size1();
}
@@ -54,19 +114,19 @@
return bindings::end_value( id.value_data() );
}
- static index_type* begin_index1( Id& id ) {
+ static index_type* begin_index_major( Id& id ) {
return bindings::begin_value( id.index1_data() );
}
- static index_type* end_index1( Id& id ) {
+ static index_type* end_index_major( Id& id ) {
return bindings::end_value( id.index1_data() );
}
- static index_type* begin_index2( Id& id ) {
+ static index_type* begin_index_minor( Id& id ) {
return bindings::begin_value( id.index2_data() );
}
- static index_type* end_index2( Id& id ) {
+ static index_type* end_index_minor( Id& id ) {
return bindings::end_value( id.index2_data() );
}
Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_sparse.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_sparse.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector_sparse.hpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -27,7 +27,7 @@
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::yale_sparse >
+ mpl::pair< tag::data_structure, tag::compressed_sparse >
> property_map;
static std::ptrdiff_t size1( const Id& t ) {
Modified: sandbox/numeric_bindings/boost/numeric/bindings/umfpack/umfpack.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/umfpack/umfpack.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/umfpack/umfpack.hpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -18,10 +18,11 @@
#define BOOST_NUMERIC_BINDINGS_UMFPACK_HPP
-#include <boost/noncopyable.hpp>
-#include <boost/numeric/bindings/traits/traits.hpp>
-#include <boost/numeric/bindings/traits/sparse_traits.hpp>
+#include <boost/noncopyable.hpp>
#include <boost/numeric/bindings/umfpack/umfpack_overloads.hpp>
+#include <boost/numeric/bindings/value_type.hpp>
+#include <boost/numeric/bindings/begin.hpp>
+#include <boost/numeric/bindings/size.hpp>
namespace boost { namespace numeric { namespace bindings { namespace umfpack {
@@ -100,50 +101,53 @@
template <typename MatrA>
inline
- int symbolic (traits::compressed_t,
+ int symbolic (tag::compressed_sparse,
MatrA const& A, void **Symbolic,
double const* Control = 0, double* Info = 0)
{
- return detail::symbolic (traits::spmatrix_size1 (A),
- traits::spmatrix_size2 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
+ return detail::symbolic (bindings::size_row (A),
+ bindings::size_column (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
Symbolic, Control, Info);
}
template <typename MatrA, typename QVec>
inline
- int symbolic (traits::compressed_t,
+ int symbolic (tag::compressed_sparse,
MatrA const& A, QVec const& Qinit, void **Symbolic,
double const* Control = 0, double* Info = 0)
{
- return detail::qsymbolic (traits::spmatrix_size1 (A),
- traits::spmatrix_size2 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
- traits::vector_storage (Qinit),
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename MatrA::not_yet_tested i_m_still_here;
+#endif
+ return detail::qsymbolic (bindings::size_row (A),
+ bindings::size_column (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
+ bindings::begin_value (Qinit),
Symbolic, Control, Info);
}
template <typename MatrA>
inline
- int symbolic (traits::coordinate_t,
+ int symbolic (tag::coordinate_sparse,
MatrA const& A, void **Symbolic,
double const* Control = 0, double* Info = 0)
{
- int n_row = traits::spmatrix_size1 (A);
- int n_col = traits::spmatrix_size2 (A);
- int nnz = traits::spmatrix_num_nonzeros (A);
-
- typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t;
-
- int const* Ti = traits::spmatrix_index2_storage (A);
- int const* Tj = traits::spmatrix_index1_storage (A);
- traits::detail::array<int> Ap (n_col+1);
+ int n_row = bindings::size_row (A);
+ int n_col = bindings::size_column (A);
+ int nnz = bindings::detail::adaptor_access<MatrA>::num_nonzeros (A);
+
+ typedef typename bindings::value_type<MatrA>::type val_t;
+
+ int const* Ti = bindings::begin_index_minor (A);
+ int const* Tj = bindings::begin_index_major (A);
+ bindings::detail::array<int> Ap (n_col+1);
if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<int> Ai (nnz);
+ bindings::detail::array<int> Ai (nnz);
if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory;
int status = detail::triplet_to_col (n_row, n_col, nnz,
@@ -154,27 +158,30 @@
return detail::symbolic (n_row, n_col,
Ap.storage(), Ai.storage(),
- traits::spmatrix_value_storage (A),
+ bindings::begin_value (A),
Symbolic, Control, Info);
}
template <typename MatrA, typename QVec>
inline
- int symbolic (traits::coordinate_t,
+ int symbolic (tag::coordinate_sparse,
MatrA const& A, QVec const& Qinit, void **Symbolic,
double const* Control = 0, double* Info = 0)
{
- int n_row = traits::spmatrix_size1 (A);
- int n_col = traits::spmatrix_size2 (A);
- int nnz = traits::spmatrix_num_nonzeros (A);
-
- typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t;
-
- int const* Ti = traits::spmatrix_index2_storage (A);
- int const* Tj = traits::spmatrix_index1_storage (A);
- traits::detail::array<int> Ap (n_col+1);
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename MatrA::not_yet_tested i_m_still_here;
+#endif
+ int n_row = bindings::size_row (A);
+ int n_col = bindings::size_column (A);
+ int nnz = bindings::detail::adaptor_access<MatrA>::num_nonzeros (A);
+
+ typedef typename bindings::value_type<MatrA>::type val_t;
+
+ int const* Ti = bindings::begin_index_minor (A);
+ int const* Tj = bindings::begin_index_major (A);
+ bindings::detail::array<int> Ap (n_col+1);
if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<int> Ai (nnz);
+ bindings::detail::array<int> Ai (nnz);
if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory;
int status = detail::triplet_to_col (n_row, n_col, nnz,
@@ -185,8 +192,8 @@
return detail::qsymbolic (n_row, n_col,
Ap.storage(), Ai.storage(),
- traits::spmatrix_value_storage (A),
- traits::vector_storage (Qinit),
+ bindings::begin_value (A),
+ bindings::begin_value (Qinit),
Symbolic, Control, Info);
}
@@ -196,30 +203,30 @@
inline
int symbolic (MatrA const& A,
symbolic_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Symbolic,
double const* Control = 0, double* Info = 0)
{
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::matrix_structure,
- traits::general_t
+ typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
+ tag::general
>::value));
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::ordering_type,
- traits::column_major_t
+ typename bindings::detail::property_at< MatrA, tag::data_order >::type,
+ tag::column_major
>::value));
- BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0);
+ BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
#endif
typedef
- typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f;
+ typename bindings::detail::property_at< MatrA, tag::data_structure >::type storage_f;
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT(
- (boost::is_same<storage_f, traits::compressed_t>::value
+ (boost::is_same<storage_f, tag::compressed_sparse>::value
||
- boost::is_same<storage_f, traits::coordinate_t>::value
+ boost::is_same<storage_f, tag::coordinate_sparse>::value
));
#endif
@@ -230,13 +237,13 @@
inline
int symbolic (MatrA const& A,
symbolic_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Symbolic,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control,
info_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Info)
{
return symbolic (A, Symbolic, Control.ptr, Info.ptr);
@@ -246,10 +253,10 @@
inline
int symbolic (MatrA const& A,
symbolic_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Symbolic,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control)
{
return symbolic (A, Symbolic, Control.ptr);
@@ -259,34 +266,37 @@
inline
int symbolic (MatrA const& A, QVec const& Qinit,
symbolic_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Symbolic,
double const* Control = 0, double* Info = 0)
{
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename MatrA::not_yet_tested i_m_still_here;
+#endif
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::matrix_structure,
- traits::general_t
+ typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
+ tag::general
>::value));
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::ordering_type,
- traits::column_major_t
+ typename bindings::detail::property_at< MatrA, tag::data_order >::type,
+ tag::column_major
>::value));
- BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0);
+ BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
#endif
typedef
- typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f;
+ typename bindings::detail::property_at< MatrA, tag::data_structure >::type storage_f;
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT(
- (boost::is_same<storage_f, traits::compressed_t>::value
+ (boost::is_same<storage_f, tag::compressed_sparse>::value
||
- boost::is_same<storage_f, traits::coordinate_t>::value
+ boost::is_same<storage_f, tag::coordinate_sparse>::value
));
#endif
- assert (traits::spmatrix_size2 (A) == traits::vector_size (Qinit));
+ assert (bindings::size_column (A) == bindings::size (Qinit));
return detail::symbolic (storage_f(), A, Qinit,
&Symbolic.ptr, Control, Info);
@@ -296,13 +306,13 @@
inline
int symbolic (MatrA const& A, QVec const& Qinit,
symbolic_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Symbolic,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control,
info_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Info)
{
return symbolic (A, Qinit, Symbolic, Control.ptr, Info.ptr);
@@ -312,10 +322,10 @@
inline
int symbolic (MatrA const& A, QVec const& Qinit,
symbolic_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Symbolic,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control)
{
return symbolic (A, Qinit, Symbolic, Control.ptr);
@@ -336,35 +346,35 @@
template <typename MatrA>
inline
- int numeric (traits::compressed_t, MatrA const& A,
+ int numeric (tag::compressed_sparse, MatrA const& A,
void *Symbolic, void** Numeric,
double const* Control = 0, double* Info = 0)
{
- return detail::numeric (traits::spmatrix_size1 (A),
- traits::spmatrix_size2 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
+ return detail::numeric (bindings::size_row (A),
+ bindings::size_column (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
Symbolic, Numeric, Control, Info);
}
template <typename MatrA>
inline
- int numeric (traits::coordinate_t, MatrA const& A,
+ int numeric (tag::coordinate_sparse, MatrA const& A,
void *Symbolic, void** Numeric,
double const* Control = 0, double* Info = 0)
{
- int n_row = traits::spmatrix_size1 (A);
- int n_col = traits::spmatrix_size2 (A);
- int nnz = traits::spmatrix_num_nonzeros (A);
-
- typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t;
-
- int const* Ti = traits::spmatrix_index2_storage (A);
- int const* Tj = traits::spmatrix_index1_storage (A);
- traits::detail::array<int> Ap (n_col+1);
+ int n_row = bindings::size_row (A);
+ int n_col = bindings::size_column (A);
+ int nnz = bindings::detail::adaptor_access<MatrA>::num_nonzeros (A);
+
+ typedef typename bindings::value_type<MatrA>::type val_t;
+
+ int const* Ti = bindings::begin_index_minor (A);
+ int const* Tj = bindings::begin_index_major (A);
+ bindings::detail::array<int> Ap (n_col+1);
if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<int> Ai (nnz);
+ bindings::detail::array<int> Ai (nnz);
if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory;
int status = detail::triplet_to_col (n_row, n_col, nnz,
@@ -375,7 +385,7 @@
return detail::numeric (n_row, n_col,
Ap.storage(), Ai.storage(),
- traits::spmatrix_value_storage (A),
+ bindings::begin_value (A),
Symbolic, Numeric, Control, Info);
}
@@ -385,33 +395,33 @@
inline
int numeric (MatrA const& A,
symbolic_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Symbolic,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Numeric,
double const* Control = 0, double* Info = 0)
{
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::matrix_structure,
- traits::general_t
+ typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
+ tag::general
>::value));
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::ordering_type,
- traits::column_major_t
+ typename bindings::detail::property_at< MatrA, tag::data_order >::type,
+ tag::column_major
>::value));
- BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0);
+ BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
#endif
typedef
- typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f;
+ typename bindings::detail::property_at< MatrA, tag::data_structure >::type storage_f;
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT(
- (boost::is_same<storage_f, traits::compressed_t>::value
+ (boost::is_same<storage_f, tag::compressed_sparse>::value
||
- boost::is_same<storage_f, traits::coordinate_t>::value
+ boost::is_same<storage_f, tag::coordinate_sparse>::value
));
#endif
@@ -423,16 +433,16 @@
inline
int numeric (MatrA const& A,
symbolic_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Symbolic,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Numeric,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control,
info_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Info)
{
@@ -445,13 +455,13 @@
inline
int numeric (MatrA const& A,
symbolic_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Symbolic,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Numeric,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control)
{
return umfpack::numeric (A, Symbolic, Numeric, Control.ptr);
@@ -466,45 +476,51 @@
template <typename MatrA>
inline
- int factor (traits::compressed_t, MatrA const& A,
+ int factor (tag::compressed_sparse, MatrA const& A,
void** Numeric, double const* Control = 0, double* Info = 0)
{
- symbolic_type<typename traits::sparse_matrix_traits<MatrA>::value_type>
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename MatrA::not_yet_tested i_m_still_here;
+#endif
+ symbolic_type<typename bindings::value_type<MatrA>::type>
Symbolic;
int status;
- status = detail::symbolic (traits::spmatrix_size1 (A),
- traits::spmatrix_size2 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
+ status = detail::symbolic (bindings::size_row (A),
+ bindings::size_column (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
&Symbolic.ptr, Control, Info);
if (status != UMFPACK_OK) return status;
- return detail::numeric (traits::spmatrix_size1 (A),
- traits::spmatrix_size2 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
+ return detail::numeric (bindings::size_row (A),
+ bindings::size_column (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
Symbolic.ptr, Numeric, Control, Info);
}
template <typename MatrA>
inline
- int factor (traits::coordinate_t, MatrA const& A,
+ int factor (tag::coordinate_sparse, MatrA const& A,
void** Numeric, double const* Control = 0, double* Info = 0)
{
- int n_row = traits::spmatrix_size1 (A);
- int n_col = traits::spmatrix_size2 (A);
- int nnz = traits::spmatrix_num_nonzeros (A);
-
- typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t;
-
- int const* Ti = traits::spmatrix_index2_storage (A);
- int const* Tj = traits::spmatrix_index1_storage (A);
- traits::detail::array<int> Ap (n_col+1);
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename MatrA::not_yet_tested i_m_still_here;
+#endif
+ int n_row = bindings::size_row (A);
+ int n_col = bindings::size_column (A);
+ int nnz = bindings::detail::adaptor_access<MatrA>::num_nonzeros (A);
+
+ typedef typename bindings::value_type<MatrA>::type val_t;
+
+ int const* Ti = bindings::begin_index_minor (A);
+ int const* Tj = bindings::begin_index_major (A);
+ bindings::detail::array<int> Ap (n_col+1);
if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<int> Ai (nnz);
+ bindings::detail::array<int> Ai (nnz);
if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory;
int status = detail::triplet_to_col (n_row, n_col, nnz,
@@ -513,18 +529,18 @@
static_cast<val_t*> (0), 0);
if (status != UMFPACK_OK) return status;
- symbolic_type<typename traits::sparse_matrix_traits<MatrA>::value_type>
+ symbolic_type<typename bindings::value_type<MatrA>::type>
Symbolic;
status = detail::symbolic (n_row, n_col,
Ap.storage(), Ai.storage(),
- traits::spmatrix_value_storage (A),
+ bindings::begin_value (A),
&Symbolic.ptr, Control, Info);
if (status != UMFPACK_OK) return status;
return detail::numeric (n_row, n_col,
Ap.storage(), Ai.storage(),
- traits::spmatrix_value_storage (A),
+ bindings::begin_value (A),
Symbolic.ptr, Numeric, Control, Info);
}
@@ -534,30 +550,33 @@
inline
int factor (MatrA const& A,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Numeric,
double const* Control = 0, double* Info = 0)
{
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename MatrA::not_yet_tested i_m_still_here;
+#endif
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::matrix_structure,
- traits::general_t
+ typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
+ tag::general
>::value));
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::ordering_type,
- traits::column_major_t
+ typename bindings::detail::property_at< MatrA, tag::data_order >::type,
+ tag::column_major
>::value));
- BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0);
+ BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
#endif
typedef
- typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f;
+ typename bindings::detail::property_at< MatrA, tag::data_structure >::type storage_f;
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT(
- (boost::is_same<storage_f, traits::compressed_t>::value
+ (boost::is_same<storage_f, tag::compressed_sparse>::value
||
- boost::is_same<storage_f, traits::coordinate_t>::value
+ boost::is_same<storage_f, tag::coordinate_sparse>::value
));
#endif
@@ -568,13 +587,13 @@
inline
int factor (MatrA const& A,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Numeric,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control,
info_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Info)
{
return factor (A, Numeric, Control.ptr, Info.ptr);
@@ -584,10 +603,10 @@
inline
int factor (MatrA const& A,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Numeric,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control)
{
return factor (A, Numeric, Control.ptr);
@@ -604,36 +623,36 @@
template <typename MatrA, typename VecX, typename VecB>
inline
- int solve (traits::compressed_t, int sys,
+ int solve (tag::compressed_sparse, int sys,
MatrA const& A, VecX& X, VecB const& B,
void *Numeric, double const* Control = 0, double* Info = 0)
{
- return detail::solve (sys, traits::spmatrix_size1 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
- traits::vector_storage (X),
- traits::vector_storage (B),
+ return detail::solve (sys, bindings::size_row (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
+ bindings::begin_value (X),
+ bindings::begin_value (B),
Numeric, Control, Info);
}
template <typename MatrA, typename VecX, typename VecB>
inline
- int solve (traits::coordinate_t, int sys,
+ int solve (tag::coordinate_sparse, int sys,
MatrA const& A, VecX& X, VecB const& B,
void *Numeric, double const* Control = 0, double* Info = 0)
{
- int n = traits::spmatrix_size1 (A);
- int nnz = traits::spmatrix_num_nonzeros (A);
+ int n = bindings::size_row (A);
+ int nnz = bindings::detail::adaptor_access<MatrA>::num_nonzeros (A);
- typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t;
+ typedef typename bindings::value_type<MatrA>::type val_t;
- int const* Ti = traits::spmatrix_index2_storage (A);
- int const* Tj = traits::spmatrix_index1_storage (A);
- traits::detail::array<int> Ap (n+1);
+ int const* Ti = bindings::begin_index_minor (A);
+ int const* Tj = bindings::begin_index_major (A);
+ bindings::detail::array<int> Ap (n+1);
if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<int> Ai (nnz);
+ bindings::detail::array<int> Ai (nnz);
if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory;
int status = detail::triplet_to_col (n, n, nnz,
@@ -643,9 +662,9 @@
if (status != UMFPACK_OK) return status;
return detail::solve (sys, n, Ap.storage(), Ai.storage(),
- traits::spmatrix_value_storage (A),
- traits::vector_storage (X),
- traits::vector_storage (B),
+ bindings::begin_value (A),
+ bindings::begin_value (X),
+ bindings::begin_value (B),
Numeric, Control, Info);
}
@@ -655,36 +674,36 @@
inline
int solve (int sys, MatrA const& A, VecX& X, VecB const& B,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Numeric,
double const* Control = 0, double* Info = 0)
{
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::matrix_structure,
- traits::general_t
+ typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
+ tag::general
>::value));
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::ordering_type,
- traits::column_major_t
+ typename bindings::detail::property_at< MatrA, tag::data_order >::type,
+ tag::column_major
>::value));
- BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0);
+ BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
#endif
typedef
- typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f;
+ typename bindings::detail::property_at< MatrA, tag::data_structure >::type storage_f;
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT(
- (boost::is_same<storage_f, traits::compressed_t>::value
+ (boost::is_same<storage_f, tag::compressed_sparse>::value
||
- boost::is_same<storage_f, traits::coordinate_t>::value
+ boost::is_same<storage_f, tag::coordinate_sparse>::value
));
#endif
- assert (traits::spmatrix_size1 (A) == traits::spmatrix_size1 (A));
- assert (traits::spmatrix_size2 (A) == traits::vector_size (X));
- assert (traits::spmatrix_size2 (A) == traits::vector_size (B));
+ assert (bindings::size_row (A) == bindings::size_row (A));
+ assert (bindings::size_column (A) == bindings::size (X));
+ assert (bindings::size_column (A) == bindings::size (B));
return detail::solve (storage_f(), sys, A, X, B,
Numeric.ptr, Control, Info);
@@ -694,13 +713,13 @@
inline
int solve (int sys, MatrA const& A, VecX& X, VecB const& B,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Numeric,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control,
info_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Info)
{
return solve (sys, A, X, B, Numeric, Control.ptr, Info.ptr);
@@ -710,10 +729,10 @@
inline
int solve (int sys, MatrA const& A, VecX& X, VecB const& B,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Numeric,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control)
{
return solve (sys, A, X, B, Numeric, Control.ptr);
@@ -723,7 +742,7 @@
inline
int solve (MatrA const& A, VecX& X, VecB const& B,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Numeric,
double const* Control = 0, double* Info = 0)
{
@@ -734,13 +753,13 @@
inline
int solve (MatrA const& A, VecX& X, VecB const& B,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Numeric,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control,
info_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Info)
{
return solve (UMFPACK_A, A, X, B, Numeric,
@@ -751,10 +770,10 @@
inline
int solve (MatrA const& A, VecX& X, VecB const& B,
numeric_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Numeric,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control)
{
return solve (UMFPACK_A, A, X, B, Numeric, Control.ptr);
@@ -769,58 +788,64 @@
template <typename MatrA, typename VecX, typename VecB>
inline
- int umf_solve (traits::compressed_t,
+ int umf_solve (tag::compressed_sparse,
MatrA const& A, VecX& X, VecB const& B,
double const* Control = 0, double* Info = 0)
{
- symbolic_type<typename traits::sparse_matrix_traits<MatrA>::value_type>
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename MatrA::not_yet_tested i_m_still_here;
+#endif
+ symbolic_type<typename bindings::value_type<MatrA>::type>
Symbolic;
- numeric_type<typename traits::sparse_matrix_traits<MatrA>::value_type>
+ numeric_type<typename bindings::value_type<MatrA>::type>
Numeric;
int status;
- status = detail::symbolic (traits::spmatrix_size1 (A),
- traits::spmatrix_size2 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
+ status = detail::symbolic (bindings::size_row (A),
+ bindings::size_column (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
&Symbolic.ptr, Control, Info);
if (status != UMFPACK_OK) return status;
- status = detail::numeric (traits::spmatrix_size1 (A),
- traits::spmatrix_size2 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
+ status = detail::numeric (bindings::size_row (A),
+ bindings::size_column (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
Symbolic.ptr, &Numeric.ptr, Control, Info);
if (status != UMFPACK_OK) return status;
- return detail::solve (UMFPACK_A, traits::spmatrix_size1 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
- traits::vector_storage (X),
- traits::vector_storage (B),
+ return detail::solve (UMFPACK_A, bindings::size_row (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
+ bindings::begin_value (X),
+ bindings::begin_value (B),
Numeric.ptr, Control, Info);
}
template <typename MatrA, typename VecX, typename VecB>
inline
- int umf_solve (traits::coordinate_t,
+ int umf_solve (tag::coordinate_sparse,
MatrA const& A, VecX& X, VecB const& B,
double const* Control = 0, double* Info = 0)
{
- int n_row = traits::spmatrix_size1 (A);
- int n_col = traits::spmatrix_size2 (A);
- int nnz = traits::spmatrix_num_nonzeros (A);
-
- typedef typename traits::sparse_matrix_traits<MatrA>::value_type val_t;
-
- int const* Ti = traits::spmatrix_index2_storage (A);
- int const* Tj = traits::spmatrix_index1_storage (A);
- traits::detail::array<int> Ap (n_col+1);
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename MatrAA::not_yet_tested i_m_still_here;
+#endif
+ int n_row = bindings::size_row (A);
+ int n_col = bindings::size_column (A);
+ int nnz = bindings::detail::adaptor_access<MatrA>::num_nonzeros (A);
+
+ typedef typename bindings::value_type<MatrA>::type val_t;
+
+ int const* Ti = bindings::begin_index_minor (A);
+ int const* Tj = bindings::begin_index_major (A);
+ bindings::detail::array<int> Ap (n_col+1);
if (!Ap.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<int> Ai (nnz);
+ bindings::detail::array<int> Ai (nnz);
if (!Ai.valid()) return UMFPACK_ERROR_out_of_memory;
int status = detail::triplet_to_col (n_row, n_col, nnz,
@@ -829,27 +854,27 @@
static_cast<val_t*> (0), 0);
if (status != UMFPACK_OK) return status;
- symbolic_type<typename traits::sparse_matrix_traits<MatrA>::value_type>
+ symbolic_type<typename bindings::value_type<MatrA>::type>
Symbolic;
- numeric_type<typename traits::sparse_matrix_traits<MatrA>::value_type>
+ numeric_type<typename bindings::value_type<MatrA>::type>
Numeric;
status = detail::symbolic (n_row, n_col,
Ap.storage(), Ai.storage(),
- traits::spmatrix_value_storage (A),
+ bindings::begin_value (A),
&Symbolic.ptr, Control, Info);
if (status != UMFPACK_OK) return status;
status = detail::numeric (n_row, n_col,
Ap.storage(), Ai.storage(),
- traits::spmatrix_value_storage (A),
+ bindings::begin_value (A),
Symbolic.ptr, &Numeric.ptr, Control, Info);
if (status != UMFPACK_OK) return status;
return detail::solve (UMFPACK_A, n_row, Ap.storage(), Ai.storage(),
- traits::spmatrix_value_storage (A),
- traits::vector_storage (X),
- traits::vector_storage (B),
+ bindings::begin_value (A),
+ bindings::begin_value (X),
+ bindings::begin_value (B),
Numeric.ptr, Control, Info);
}
@@ -860,32 +885,35 @@
int umf_solve (MatrA const& A, VecX& X, VecB const& B,
double const* Control = 0, double* Info = 0)
{
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename MatrA::not_yet_tested i_m_still_here;
+#endif
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::matrix_structure,
- traits::general_t
+ typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
+ tag::general
>::value));
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::ordering_type,
- traits::column_major_t
+ typename bindings::detail::property_at< MatrA, tag::data_order >::type,
+ tag::column_major
>::value));
- BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0);
+ BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
#endif
typedef
- typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f;
+ typename bindings::detail::property_at< MatrA, tag::data_structure >::type storage_f;
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT(
- (boost::is_same<storage_f, traits::compressed_t>::value
+ (boost::is_same<storage_f, tag::compressed_sparse>::value
||
- boost::is_same<storage_f, traits::coordinate_t>::value
+ boost::is_same<storage_f, tag::coordinate_sparse>::value
));
#endif
- assert (traits::spmatrix_size1 (A) == traits::spmatrix_size1 (A));
- assert (traits::spmatrix_size2 (A) == traits::vector_size (X));
- assert (traits::spmatrix_size2 (A) == traits::vector_size (B));
+ assert (bindings::size_row (A) == bindings::size_row (A));
+ assert (bindings::size_column (A) == bindings::size (X));
+ assert (bindings::size_column (A) == bindings::size (B));
return detail::umf_solve (storage_f(), A, X, B, Control, Info);
}
@@ -894,10 +922,10 @@
inline
int umf_solve (MatrA const& A, VecX& X, VecB const& B,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control,
info_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
>& Info)
{
return umf_solve (A, X, B, Control.ptr, Info.ptr);
@@ -907,7 +935,7 @@
inline
int umf_solve (MatrA const& A, VecX& X, VecB const& B,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control)
{
return umf_solve (A, X, B, Control.ptr);
@@ -925,12 +953,12 @@
inline
int scale (VecX& X, VecB const& B,
numeric_type<
- typename traits::vector_traits<VecB>::value_type
+ typename bindings::value_type<VecB>::type
> const& Numeric)
{
- return detail::scale (traits::vector_size (B),
- traits::vector_storage (X),
- traits::vector_storage (B),
+ return detail::scale (bindings::size (B),
+ bindings::begin_value (X),
+ bindings::begin_value (B),
Numeric.ptr);
}
@@ -1005,28 +1033,28 @@
template <typename MatrA>
inline
- int report_matrix (traits::compressed_t, MatrA const& A,
+ int report_matrix (tag::compressed_sparse, MatrA const& A,
double const* Control)
{
- return detail::report_matrix (traits::spmatrix_size1 (A),
- traits::spmatrix_size2 (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
+ return detail::report_matrix (bindings::size_row (A),
+ bindings::size_column (A),
+ bindings::begin_compressed_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
1, Control);
}
template <typename MatrA>
inline
- int report_matrix (traits::coordinate_t, MatrA const& A,
+ int report_matrix (tag::coordinate_sparse, MatrA const& A,
double const* Control)
{
- return detail::report_triplet (traits::spmatrix_size1 (A),
- traits::spmatrix_size2 (A),
- traits::spmatrix_num_nonzeros (A),
- traits::spmatrix_index1_storage (A),
- traits::spmatrix_index2_storage (A),
- traits::spmatrix_value_storage (A),
+ return detail::report_triplet (bindings::size_row (A),
+ bindings::size_column (A),
+ bindings::detail::adaptor_access<MatrA>::num_nonzeros (A),
+ bindings::begin_index_major (A),
+ bindings::begin_index_minor (A),
+ bindings::begin_value (A),
Control);
}
@@ -1036,29 +1064,29 @@
inline
int report_matrix (MatrA const& A,
control_type<
- typename traits::sparse_matrix_traits<MatrA>::value_type
+ typename bindings::value_type<MatrA>::type
> const& Control)
{
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::matrix_structure,
- traits::general_t
+ typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
+ tag::general
>::value));
BOOST_STATIC_ASSERT((boost::is_same<
- typename traits::sparse_matrix_traits<MatrA>::ordering_type,
- traits::column_major_t
+ typename bindings::detail::property_at< MatrA, tag::data_order >::type,
+ tag::column_major
>::value));
- BOOST_STATIC_ASSERT(traits::sparse_matrix_traits<MatrA>::index_base == 0);
+ BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
#endif
typedef
- typename traits::sparse_matrix_traits<MatrA>::storage_format storage_f;
+ typename bindings::detail::property_at< MatrA, tag::data_structure >::type storage_f;
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
BOOST_STATIC_ASSERT(
- (boost::is_same<storage_f, traits::compressed_t>::value
+ (boost::is_same<storage_f, tag::compressed_sparse>::value
||
- boost::is_same<storage_f, traits::coordinate_t>::value
+ boost::is_same<storage_f, tag::coordinate_sparse>::value
));
#endif
@@ -1072,11 +1100,11 @@
inline
int report_vector (VecX const& X,
control_type<
- typename traits::vector_traits<VecX>::value_type
+ typename bindings::value_type<VecX>::type
> const& Control)
{
- return detail::report_vector (traits::vector_size (X),
- traits::vector_storage (X),
+ return detail::report_vector (bindings::size (X),
+ bindings::begin_value (X),
Control.ptr);
}
@@ -1108,8 +1136,11 @@
template <typename VecP, typename T>
inline
int report_permutation (VecP const& Perm, control_type<T> const& Control) {
+#ifdef CHECK_TEST_COVERAGE
+ typedef typename T::not_yet_tested i_m_still_here;
+#endif
return detail::report_perm (T(), 0,
- traits::vector_storage (Perm),
+ bindings::begin_value (Perm),
Control.ptr);
}
Modified: sandbox/numeric_bindings/boost/numeric/bindings/umfpack/umfpack_overloads.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/umfpack/umfpack_overloads.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/umfpack/umfpack_overloads.hpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -18,8 +18,7 @@
#define BOOST_NUMERIC_BINDINGS_UMFPACK_OVERLOADS_HPP
#include <boost/numeric/bindings/umfpack/umfpack_inc.hpp>
-#include <boost/numeric/bindings/traits/type.hpp>
-#include <boost/numeric/bindings/traits/detail/array.hpp>
+#include <boost/numeric/bindings/detail/array.hpp>
#include <boost/numeric/bindings/traits/detail/utils.hpp>
namespace boost { namespace numeric { namespace bindings {
@@ -47,9 +46,9 @@
void **Symbolic, double const* Control, double* Info)
{
int nnz = Ap[n_col];
- traits::detail::array<double> Axr (nnz);
+ bindings::detail::array<double> Axr (nnz);
if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Axi (nnz);
+ bindings::detail::array<double> Axi (nnz);
if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory;
traits::detail::disentangle (Ax, Ax+nnz,
Axr.storage(), Axi.storage());
@@ -77,9 +76,9 @@
double const* Control, double* Info)
{
int nnz = Ap[n_col];
- traits::detail::array<double> Axr (nnz);
+ bindings::detail::array<double> Axr (nnz);
if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Axi (nnz);
+ bindings::detail::array<double> Axi (nnz);
if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory;
traits::detail::disentangle (Ax, Ax+nnz,
Axr.storage(), Axi.storage());
@@ -106,21 +105,21 @@
void *Numeric, double const* Control, double* Info)
{
int nnz = Ap[n];
- traits::detail::array<double> Axr (nnz);
+ bindings::detail::array<double> Axr (nnz);
if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Axi (nnz);
+ bindings::detail::array<double> Axi (nnz);
if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory;
traits::detail::disentangle (Ax, Ax+nnz,
Axr.storage(), Axi.storage());
- traits::detail::array<double> Br (n);
+ bindings::detail::array<double> Br (n);
if (!Br.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Bi (n);
+ bindings::detail::array<double> Bi (n);
if (!Bi.valid()) return UMFPACK_ERROR_out_of_memory;
traits::detail::disentangle (B, B+n,
Br.storage(), Bi.storage());
- traits::detail::array<double> Xr (n);
+ bindings::detail::array<double> Xr (n);
if (!Xr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Xi (n);
+ bindings::detail::array<double> Xi (n);
if (!Xi.valid()) return UMFPACK_ERROR_out_of_memory;
int status = umfpack_zi_solve (sys, Ap, Ai,
@@ -194,9 +193,9 @@
void **Symbolic, double const* Control, double* Info)
{
int nnz = Ap[n_col];
- traits::detail::array<double> Axr (nnz);
+ bindings::detail::array<double> Axr (nnz);
if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Axi (nnz);
+ bindings::detail::array<double> Axi (nnz);
if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory;
traits::detail::disentangle (Ax, Ax+nnz,
Axr.storage(), Axi.storage());
@@ -232,9 +231,9 @@
assert (Tx == 0 && Ax == 0 || Tx != 0 && Ax != 0);
double *Txr = 0, *Txi = 0;
if (Tx != 0) {
- traits::detail::array<double> ATxr (nz);
+ bindings::detail::array<double> ATxr (nz);
if (!ATxr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> ATxi (nz);
+ bindings::detail::array<double> ATxi (nz);
if (!ATxi.valid()) return UMFPACK_ERROR_out_of_memory;
Txr = ATxr.storage();
Txi = ATxi.storage();
@@ -242,9 +241,9 @@
}
double *Axr = 0, *Axi = 0;
if (Ax != 0) {
- traits::detail::array<double> AAxr (nz);
+ bindings::detail::array<double> AAxr (nz);
if (!AAxr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> AAxi (nz);
+ bindings::detail::array<double> AAxi (nz);
if (!AAxi.valid()) return UMFPACK_ERROR_out_of_memory;
Axr = AAxr.storage();
Axi = AAxi.storage();
@@ -272,15 +271,15 @@
int scale (int n, traits::complex_d* X,
traits::complex_d const* B, void* Numeric)
{
- traits::detail::array<double> Br (n);
+ bindings::detail::array<double> Br (n);
if (!Br.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Bi (n);
+ bindings::detail::array<double> Bi (n);
if (!Bi.valid()) return UMFPACK_ERROR_out_of_memory;
traits::detail::disentangle (B, B+n,
Br.storage(), Bi.storage());
- traits::detail::array<double> Xr (n);
+ bindings::detail::array<double> Xr (n);
if (!Xr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Xi (n);
+ bindings::detail::array<double> Xi (n);
if (!Xi.valid()) return UMFPACK_ERROR_out_of_memory;
int status = umfpack_zi_scale (Xr.storage(), Xi.storage(),
@@ -356,9 +355,9 @@
int col_form, double const* Control)
{
int nnz = Ap[n_col];
- traits::detail::array<double> Axr (nnz);
+ bindings::detail::array<double> Axr (nnz);
if (!Axr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Axi (nnz);
+ bindings::detail::array<double> Axi (nnz);
if (!Axi.valid()) return UMFPACK_ERROR_out_of_memory;
traits::detail::disentangle (Ax, Ax+nnz,
Axr.storage(), Axi.storage());
@@ -384,9 +383,9 @@
traits::complex_d const* Tx,
double const* Control)
{
- traits::detail::array<double> Txr (nz);
+ bindings::detail::array<double> Txr (nz);
if (!Txr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Txi (nz);
+ bindings::detail::array<double> Txi (nz);
if (!Txi.valid()) return UMFPACK_ERROR_out_of_memory;
traits::detail::disentangle (Tx, Tx+nz,
Txr.storage(), Txi.storage());
@@ -409,9 +408,9 @@
{
#if 0
// see UMFPACK v 4.1 User Guide
- traits::detail::array<double> Xr (n);
+ bindings::detail::array<double> Xr (n);
if (!Xr.valid()) return UMFPACK_ERROR_out_of_memory;
- traits::detail::array<double> Xi (n);
+ bindings::detail::array<double> Xi (n);
if (!Xi.valid()) return UMFPACK_ERROR_out_of_memory;
traits::detail::disentangle (X, X+n,
Xr.storage(), Xi.storage());
Modified: sandbox/numeric_bindings/libs/numeric/bindings/mumps/test/mumps_ublas.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/mumps/test/mumps_ublas.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/mumps/test/mumps_ublas.cpp 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -1,8 +1,8 @@
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
-#include <boost/numeric/bindings/traits/ublas_vector2.hpp>
-#include <boost/numeric/bindings/traits/ublas_sparse.hpp>
+#include <boost/numeric/bindings/ublas/vector.hpp>
+#include <boost/numeric/bindings/ublas/matrix_sparse.hpp>
#include <boost/numeric/bindings/mumps/mumps_driver.hpp>
#include <iostream>
#include <fstream>
Modified: sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umf4.cc
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umf4.cc (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umf4.cc 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -93,8 +93,8 @@
#ifdef __ICC
# include <mathimf.h>
#endif
-#include <boost/numeric/bindings/traits/ublas_vector.hpp>
-#include <boost/numeric/bindings/traits/ublas_sparse.hpp>
+#include <boost/numeric/bindings/ublas/vector.hpp>
+#include <boost/numeric/bindings/ublas/matrix_sparse.hpp>
#include <boost/numeric/bindings/umfpack/umfpack.hpp>
using std::max;
@@ -108,7 +108,7 @@
namespace ublas = boost::numeric::ublas;
namespace umf = boost::numeric::bindings::umfpack;
-namespace traits = boost::numeric::bindings::traits;
+namespace bindings = boost::numeric::bindings;
#ifndef COORDINATE
typedef ublas::compressed_matrix<double, ublas::column_major, 0,
@@ -137,13 +137,17 @@
template <typename M, typename V>
double resid (M const& m, V const& x, V const& b, V& r) {
- int const* Ap = traits::spmatrix_index1_storage (m);
- int const* Ai = traits::spmatrix_index2_storage (m);
- double const* Ax = traits::spmatrix_value_storage (m);
+#ifndef COORDINATE
+ int const* Ap = bindings::begin_compressed_index_major (m);
+#else
+ int const* Ap = bindings::begin_index_major (m);
+#endif
+ int const* Ai = bindings::begin_index_minor (m);
+ double const* Ax = bindings::begin_value (m);
double rnorm, bnorm, absr, absb;
- int n = traits::vector_size (r);
+ int n = bindings::size (r);
r = prod (m, x);
Modified: sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_di_demo.cc
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_di_demo.cc (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_di_demo.cc 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -76,9 +76,8 @@
#include <algorithm>
#include <math.h>
#include <boost/mpl/and.hpp>
-#include <boost/numeric/bindings/traits/c_array.hpp>
-#include <boost/numeric/bindings/traits/std_vector.hpp>
-#include <boost/numeric/bindings/traits/ublas_sparse.hpp>
+#include <boost/numeric/bindings/std/vector.hpp>
+#include <boost/numeric/bindings/ublas/matrix_sparse.hpp>
#include <boost/numeric/bindings/umfpack/umfpack.hpp>
using std::max;
@@ -89,10 +88,15 @@
namespace ublas = boost::numeric::ublas;
namespace umf = boost::numeric::bindings::umfpack;
-namespace traits = boost::numeric::bindings::traits;
+namespace bindings = boost::numeric::bindings;
+#ifndef COORDINATE
typedef ublas::compressed_matrix<double, ublas::column_major, 0,
ublas::unbounded_array<int>, ublas::unbounded_array<double> > cm_t;
+#else
+typedef ublas::coordinate_matrix<double, ublas::column_major, 0,
+ ublas::unbounded_array<int>, ublas::unbounded_array<double> > cm_t;
+#endif
/* --------------------------------------------------------------- */
/* wait for 'y' */
@@ -128,11 +132,15 @@
double resid (M const& A, V const& x, V const& b, V& r, int transpose = 0) {
double norm;
- int const* Ap = traits::spmatrix_index1_storage (A);
- int const* Ai = traits::spmatrix_index2_storage (A);
- double const* Ax = traits::spmatrix_value_storage (A);
+#ifndef COORDINATE
+ int const* Ap = bindings::begin_compressed_index_major (A);
+#else
+ int const* Ap = bindings::begin_index_major (A);
+#endif
+ int const* Ai = bindings::begin_index_minor (A);
+ double const* Ax = bindings::begin_value (A);
- int n = traits::vector_size (r);
+ int n = bindings::size (r);
for (int i = 0; i < n; i++)
r [i] = -b [i];
Modified: sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_simple.cc
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_simple.cc (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_simple.cc 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -50,8 +50,8 @@
#include <iostream>
-#include <boost/numeric/bindings/traits/ublas_vector.hpp>
-#include <boost/numeric/bindings/traits/ublas_sparse.hpp>
+#include <boost/numeric/bindings/ublas/vector.hpp>
+#include <boost/numeric/bindings/ublas/matrix_sparse.hpp>
#include <boost/numeric/bindings/umfpack/umfpack.hpp>
#include <boost/numeric/ublas/io.hpp>
Modified: sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_zi_demo.cc
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_zi_demo.cc (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/umfpack/test/umfpack_zi_demo.cc 2010-03-19 20:36:45 EDT (Fri, 19 Mar 2010)
@@ -77,9 +77,8 @@
#include <complex>
#include <math.h>
#include <boost/mpl/and.hpp>
-#include <boost/numeric/bindings/traits/c_array.hpp>
-#include <boost/numeric/bindings/traits/std_vector.hpp>
-#include <boost/numeric/bindings/traits/ublas_sparse.hpp>
+#include <boost/numeric/bindings/std/vector.hpp>
+#include <boost/numeric/bindings/ublas/matrix_sparse.hpp>
#include <boost/numeric/bindings/umfpack/umfpack.hpp>
using std::max;
@@ -90,9 +89,13 @@
namespace ublas = boost::numeric::ublas;
namespace umf = boost::numeric::bindings::umfpack;
-namespace traits = boost::numeric::bindings::traits;
+namespace bindings = boost::numeric::bindings;
+#ifndef COORDINATE
typedef ublas::compressed_matrix<
+#else
+typedef ublas::coordinate_matrix<
+#endif
std::complex<double>,
ublas::column_major,
0,
@@ -138,11 +141,15 @@
double resid (M const& A, V const& x, V const& b, V& r, int transpose = 0) {
double norm;
- int const* Ap = traits::spmatrix_index1_storage (A);
- int const* Ai = traits::spmatrix_index2_storage (A);
- std::complex<double> const* Ax = traits::spmatrix_value_storage (A);
+#ifndef COORDINATE
+ int const* Ap = bindings::begin_compressed_index_major (A);
+#else
+ int const* Ap = bindings::begin_index_major (A);
+#endif
+ int const* Ai = bindings::begin_index_minor (A);
+ std::complex<double> const* Ax = bindings::begin_value (A);
- int n = traits::vector_size (r);
+ int n = bindings::size (r);
for (int i = 0; i < n; i++)
r [i] = -b [i];
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