Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62048 - sandbox/numeric_bindings/boost/numeric/bindings/umfpack
From: thomas.klimpel_at_[hidden]
Date: 2010-05-16 18:58:17


Author: klimpel
Date: 2010-05-16 18:58:16 EDT (Sun, 16 May 2010)
New Revision: 62048
URL: http://svn.boost.org/trac/boost/changeset/62048

Log:
minor cleanup (now the unwanted "bindings::detail::adaptor_access<MatrA>::index_base" occurs only in exactly one place)
Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/umfpack/umfpack.hpp | 207 ++++++++++-----------------------------
   1 files changed, 53 insertions(+), 154 deletions(-)

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-05-16 18:58:16 EDT (Sun, 16 May 2010)
@@ -28,6 +28,24 @@
 
 namespace boost { namespace numeric { namespace bindings { namespace umfpack {
 
+ template <typename MatrA>
+ void check_umfpack_structure()
+ {
+ BOOST_STATIC_ASSERT((boost::is_same<
+ typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
+ tag::general
+ >::value));
+ BOOST_STATIC_ASSERT((boost::is_same<
+ typename bindings::detail::property_at< MatrA, tag::data_order >::type,
+ tag::column_major
+ >::value));
+ BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
+ typedef typename bindings::detail::property_at<
+ MatrA, tag::data_structure >::type storage_f;
+ BOOST_STATIC_ASSERT(
+ (boost::is_same<storage_f, tag::compressed_sparse>::value ||
+ boost::is_same<storage_f, tag::coordinate_sparse>::value ));
+ }
 
   template <typename T = double>
   struct symbolic_type : private noncopyable {
@@ -208,28 +226,11 @@
>& Symbolic,
                 double const* Control = 0, double* Info = 0)
   {
-#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
- tag::general
- >::value));
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::data_order >::type,
- tag::column_major
- >::value));
- BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
-#endif
-
- typedef
- 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, tag::compressed_sparse>::value
- ||
- boost::is_same<storage_f, tag::coordinate_sparse>::value
- ));
-#endif
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ check_umfpack_structure<MatrA>();
+#endif
+ typedef typename bindings::detail::property_at<
+ MatrA, tag::data_structure >::type storage_f;
 
     return detail::symbolic (storage_f(), A, &Symbolic.ptr, Control, Info);
   }
@@ -274,28 +275,11 @@
 #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 bindings::detail::property_at< MatrA, tag::matrix_type >::type,
- tag::general
- >::value));
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::data_order >::type,
- tag::column_major
- >::value));
- BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
-#endif
-
- typedef
- 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, tag::compressed_sparse>::value
- ||
- boost::is_same<storage_f, tag::coordinate_sparse>::value
- ));
-#endif
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ check_umfpack_structure<MatrA>();
+#endif
+ typedef typename bindings::detail::property_at<
+ MatrA, tag::data_structure >::type storage_f;
 
     assert (bindings::size_column (A) == bindings::size (Qinit));
 
@@ -403,28 +387,11 @@
>& Numeric,
                double const* Control = 0, double* Info = 0)
   {
-#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
- tag::general
- >::value));
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::data_order >::type,
- tag::column_major
- >::value));
- BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
-#endif
-
- typedef
- 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, tag::compressed_sparse>::value
- ||
- boost::is_same<storage_f, tag::coordinate_sparse>::value
- ));
-#endif
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ check_umfpack_structure<MatrA>();
+#endif
+ typedef typename bindings::detail::property_at<
+ MatrA, tag::data_structure >::type storage_f;
 
     return detail::numeric (storage_f(), A,
                             Symbolic.ptr, &Numeric.ptr, Control, Info);
@@ -558,28 +525,11 @@
 #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 bindings::detail::property_at< MatrA, tag::matrix_type >::type,
- tag::general
- >::value));
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::data_order >::type,
- tag::column_major
- >::value));
- BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
-#endif
-
- typedef
- 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, tag::compressed_sparse>::value
- ||
- boost::is_same<storage_f, tag::coordinate_sparse>::value
- ));
-#endif
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ check_umfpack_structure<MatrA>();
+#endif
+ typedef typename bindings::detail::property_at<
+ MatrA, tag::data_structure >::type storage_f;
 
     return detail::factor (storage_f(), A, &Numeric.ptr, Control, Info);
   }
@@ -679,28 +629,11 @@
> const& Numeric,
              double const* Control = 0, double* Info = 0)
   {
-#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
- tag::general
- >::value));
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::data_order >::type,
- tag::column_major
- >::value));
- BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
-#endif
-
- typedef
- 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, tag::compressed_sparse>::value
- ||
- boost::is_same<storage_f, tag::coordinate_sparse>::value
- ));
-#endif
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ check_umfpack_structure<MatrA>();
+#endif
+ typedef typename bindings::detail::property_at<
+ MatrA, tag::data_structure >::type storage_f;
 
     assert (bindings::size_row (A) == bindings::size_row (A));
     assert (bindings::size_column (A) == bindings::size (X));
@@ -889,28 +822,11 @@
 #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 bindings::detail::property_at< MatrA, tag::matrix_type >::type,
- tag::general
- >::value));
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::data_order >::type,
- tag::column_major
- >::value));
- BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
-#endif
-
- typedef
- 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, tag::compressed_sparse>::value
- ||
- boost::is_same<storage_f, tag::coordinate_sparse>::value
- ));
-#endif
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ check_umfpack_structure<MatrA>();
+#endif
+ typedef typename bindings::detail::property_at<
+ MatrA, tag::data_structure >::type storage_f;
 
     assert (bindings::size_row (A) == bindings::size_row (A));
     assert (bindings::size_column (A) == bindings::size (X));
@@ -1068,28 +984,11 @@
                        typename bindings::value_type<MatrA>::type
> const& Control)
   {
-#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::matrix_type >::type,
- tag::general
- >::value));
- BOOST_STATIC_ASSERT((boost::is_same<
- typename bindings::detail::property_at< MatrA, tag::data_order >::type,
- tag::column_major
- >::value));
- BOOST_STATIC_ASSERT(bindings::detail::adaptor_access<MatrA>::index_base == 0);
-#endif
-
- typedef
- 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, tag::compressed_sparse>::value
- ||
- boost::is_same<storage_f, tag::coordinate_sparse>::value
- ));
-#endif
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ check_umfpack_structure<MatrA>();
+#endif
+ typedef typename bindings::detail::property_at<
+ MatrA, tag::data_structure >::type storage_f;
 
     return detail::report_matrix (storage_f(), A, Control.ptr);
   }


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