Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67029 - in sandbox/numeric_bindings: boost/numeric/bindings/lapack/computational boost/numeric/bindings/lapack/driver libs/numeric/bindings/lapack/test
From: thomas.klimpel_at_[hidden]
Date: 2010-12-05 15:11:11


Author: klimpel
Date: 2010-12-05 15:11:09 EST (Sun, 05 Dec 2010)
New Revision: 67029
URL: http://svn.boost.org/trac/boost/changeset/67029

Log:
manual editing of computational/hseqr.hpp and driver/gees.hpp to test the feasibility of the new overloads for complex eigenvalues of real matrices
Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/lapack/computational/hseqr.hpp | 48 +++++++++++++++++++++++++++++++++++++-
   sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gees.hpp | 49 ++++++++++++++++++++++++++++++++++++++-
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/hseqr.cpp | 8 +++++
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gees.cpp | 5 +++
   4 files changed, 104 insertions(+), 6 deletions(-)

Modified: sandbox/numeric_bindings/boost/numeric/bindings/lapack/computational/hseqr.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/lapack/computational/hseqr.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/lapack/computational/hseqr.hpp 2010-12-05 15:11:09 EST (Sun, 05 Dec 2010)
@@ -17,6 +17,7 @@
 #include <boost/assert.hpp>
 #include <boost/numeric/bindings/begin.hpp>
 #include <boost/numeric/bindings/detail/array.hpp>
+#include <boost/numeric/bindings/detail/complex_utils.hpp>
 #include <boost/numeric/bindings/is_column_major.hpp>
 #include <boost/numeric/bindings/is_complex.hpp>
 #include <boost/numeric/bindings/is_mutable.hpp>
@@ -386,7 +387,9 @@
 //
 template< typename MatrixH, typename VectorW, typename MatrixZ,
         typename Workspace >
-inline typename boost::enable_if< detail::is_workspace< Workspace >,
+inline typename boost::enable_if< mpl::and_< is_complex<
+ typename bindings::value_type< MatrixH >::type >,
+ detail::is_workspace< Workspace > >,
         std::ptrdiff_t >::type
 hseqr( const char job, const char compz, const fortran_int_t ilo,
         const fortran_int_t ihi, MatrixH& h, VectorW& w, MatrixZ& z,
@@ -400,7 +403,9 @@
 // * Default workspace-type (optimal)
 //
 template< typename MatrixH, typename VectorW, typename MatrixZ >
-inline typename boost::disable_if< detail::is_workspace< MatrixZ >,
+inline typename boost::disable_if< mpl::or_< is_real<
+ typename bindings::value_type< MatrixH >::type >,
+ detail::is_workspace< MatrixZ > >,
         std::ptrdiff_t >::type
 hseqr( const char job, const char compz, const fortran_int_t ilo,
         const fortran_int_t ihi, MatrixH& h, VectorW& w, MatrixZ& z ) {
@@ -408,6 +413,45 @@
             MatrixH >::type >::invoke( job, compz, ilo, ihi, h, w, z,
             optimal_workspace() );
 }
+//
+// Overloaded function for hseqr. Its overload differs for
+// * User-defined workspace
+//
+template< typename MatrixH, typename VectorW, typename MatrixZ,
+ typename Workspace >
+inline typename boost::enable_if< mpl::and_< is_real<
+ typename bindings::value_type< MatrixH >::type >,
+ detail::is_workspace< Workspace > >,
+ std::ptrdiff_t >::type
+hseqr( const char job, const char compz, const fortran_int_t ilo,
+ const fortran_int_t ihi, MatrixH& h, VectorW& w, MatrixZ& z,
+ Workspace work ) {
+ std::ptrdiff_t info = hseqr_impl< typename bindings::value_type<
+ MatrixH >::type >::invoke( job, compz, ilo, ihi, h,
+ bindings::detail::real_part_view(w), bindings::detail::imag_part_view(w),
+ z, work );
+ bindings::detail::interlace(w);
+ return info;
+}
+
+//
+// Overloaded function for hseqr. Its overload differs for
+// * Default workspace-type (optimal)
+//
+template< typename MatrixH, typename VectorW, typename MatrixZ >
+inline typename boost::disable_if< mpl::or_< is_complex<
+ typename bindings::value_type< MatrixH >::type >,
+ detail::is_workspace< MatrixZ > >,
+ std::ptrdiff_t >::type
+hseqr( const char job, const char compz, const fortran_int_t ilo,
+ const fortran_int_t ihi, MatrixH& h, VectorW& w, MatrixZ& z ) {
+ std::ptrdiff_t info = hseqr_impl< typename bindings::value_type<
+ MatrixH >::type >::invoke( job, compz, ilo, ihi, h,
+ bindings::detail::real_part_view(w), bindings::detail::imag_part_view(w),
+ z, optimal_workspace() );
+ bindings::detail::interlace(w);
+ return info;
+}
 
 } // namespace lapack
 } // namespace bindings

Modified: sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gees.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gees.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gees.hpp 2010-12-05 15:11:09 EST (Sun, 05 Dec 2010)
@@ -17,6 +17,7 @@
 #include <boost/assert.hpp>
 #include <boost/numeric/bindings/begin.hpp>
 #include <boost/numeric/bindings/detail/array.hpp>
+#include <boost/numeric/bindings/detail/complex_utils.hpp>
 #include <boost/numeric/bindings/is_column_major.hpp>
 #include <boost/numeric/bindings/is_complex.hpp>
 #include <boost/numeric/bindings/is_mutable.hpp>
@@ -442,7 +443,9 @@
 //
 template< typename MatrixA, typename VectorW, typename MatrixVS,
         typename Workspace >
-inline typename boost::enable_if< detail::is_workspace< Workspace >,
+inline typename boost::enable_if< mpl::and_< is_complex<
+ typename bindings::value_type< MatrixA >::type >,
+ detail::is_workspace< Workspace > >,
         std::ptrdiff_t >::type
 gees( const char jobvs, const char sort, external_fp select, MatrixA& a,
         fortran_int_t& sdim, VectorW& w, MatrixVS& vs, Workspace work ) {
@@ -456,7 +459,9 @@
 // * Default workspace-type (optimal)
 //
 template< typename MatrixA, typename VectorW, typename MatrixVS >
-inline typename boost::disable_if< detail::is_workspace< MatrixVS >,
+inline typename boost::disable_if< mpl::or_< is_real<
+ typename bindings::value_type< MatrixA >::type >,
+ detail::is_workspace< MatrixVS > >,
         std::ptrdiff_t >::type
 gees( const char jobvs, const char sort, external_fp select, MatrixA& a,
         fortran_int_t& sdim, VectorW& w, MatrixVS& vs ) {
@@ -464,6 +469,46 @@
             MatrixA >::type >::invoke( jobvs, sort, select, a, sdim, w, vs,
             optimal_workspace() );
 }
+//
+// Overloaded function for gees. Its overload differs for
+// * VectorW
+// * User-defined workspace
+//
+template< typename MatrixA, typename VectorW, typename MatrixVS,
+ typename Workspace >
+inline typename boost::enable_if< mpl::and_< is_real<
+ typename bindings::value_type< MatrixA >::type >,
+ detail::is_workspace< Workspace > >,
+ std::ptrdiff_t >::type
+gees( const char jobvs, const char sort, external_fp select, MatrixA& a,
+ fortran_int_t& sdim, VectorW& w, MatrixVS& vs, Workspace work ) {
+ std::ptrdiff_t info = gees_impl< typename bindings::value_type<
+ MatrixA >::type >::invoke( jobvs, sort, select, a, sdim,
+ bindings::detail::real_part_view(w), bindings::detail::imag_part_view(w),
+ vs, work );
+ bindings::detail::interlace(w);
+ return info;
+}
+
+//
+// Overloaded function for gees. Its overload differs for
+// * VectorW
+// * Default workspace-type (optimal)
+//
+template< typename MatrixA, typename VectorW, typename MatrixVS >
+inline typename boost::disable_if< mpl::or_< is_complex<
+ typename bindings::value_type< MatrixA >::type >,
+ detail::is_workspace< MatrixVS > >,
+ std::ptrdiff_t >::type
+gees( const char jobvs, const char sort, external_fp select, MatrixA& a,
+ fortran_int_t& sdim, VectorW& w, MatrixVS& vs ) {
+ std::ptrdiff_t info = gees_impl< typename bindings::value_type<
+ MatrixA >::type >::invoke( jobvs, sort, select, a, sdim,
+ bindings::detail::real_part_view(w), bindings::detail::imag_part_view(w),
+ vs, optimal_workspace() );
+ bindings::detail::interlace(w);
+ return info;
+}
 
 } // namespace lapack
 } // namespace bindings

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/hseqr.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/hseqr.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/hseqr.cpp 2010-12-05 15:11:09 EST (Sun, 05 Dec 2010)
@@ -8,7 +8,7 @@
 #include <boost/numeric/ublas/io.hpp>
 #include <boost/numeric/bindings/ublas/matrix.hpp>
 #include <boost/numeric/bindings/ublas/vector.hpp>
-#include <boost/numeric/bindings/detail/complex_utils.hpp>
+//#include <boost/numeric/bindings/detail/complex_utils.hpp>
 #include <boost/numeric/bindings/vector_view.hpp>
 #include <boost/numeric/bindings/lapack/computational/hseqr.hpp>
 #include <boost/numeric/bindings/lapack/computational/trevc.hpp>
@@ -48,22 +48,28 @@
 
     cout << "\nHSEQR for only eigenvalues." << endl;
     ublas::matrix<double, ublas::column_major> Z_dummy(1,1);
+ lapack::hseqr('E', 'N', 1, n, H, values, Z_dummy);
+ /*
     lapack::hseqr('E', 'N', 1, n, H,
         bindings::detail::real_part_view(values),
         bindings::detail::imag_part_view(values),
         Z_dummy);
     bindings::detail::interlace(values);
+ */
     cout << "\nH:\n" << H << endl;
     cout << "\nvalues: " << values << endl;
 
     cout << "\nHSEQR for eigenvalues and Schur vectors." << endl;
     Hessenberg(H);
     cout << "H:\n" << H << endl;
+ lapack::hseqr('S', 'I', 1, n, H, values, Z);
+ /*
     lapack::hseqr('S', 'I', 1, n, H,
         bindings::detail::real_part_view(values),
         bindings::detail::imag_part_view(values),
         Z);
     bindings::detail::interlace(values);
+ */
     cout << "\nH: " << H << endl;
     cout << "\nvalues: " << values << endl;
     cout << "\nZ: " << Z << endl;

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gees.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gees.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gees.cpp 2010-12-05 15:11:09 EST (Sun, 05 Dec 2010)
@@ -16,7 +16,7 @@
 #include <boost/numeric/bindings/lapack/driver/gees.hpp>
 #include <boost/numeric/bindings/detail/array.hpp>
 #include <boost/numeric/bindings/vector_view.hpp>
-#include <boost/numeric/bindings/detail/complex_utils.hpp>
+//#include <boost/numeric/bindings/detail/complex_utils.hpp>
 #include <boost/numeric/ublas/io.hpp>
 #include <boost/type_traits/is_complex.hpp>
 #include <boost/mpl/if.hpp>
@@ -35,11 +35,14 @@
   static inline std::ptrdiff_t gees( const char jobvs, const char sort,
         external_fp select, MatrixA& a, fortran_int_t& sdim, VectorW& w,
         MatrixVS& vs, Workspace work ) {
+ return lapack::gees( jobvs, sort, select, a, sdim, w, vs, work );
+ /*
     fortran_int_t info = lapack::gees( jobvs, sort, select, a, sdim,
       bindings::detail::real_part_view(w), bindings::detail::imag_part_view(w),
       vs, work );
     bindings::detail::interlace(w);
     return info;
+ */
   }
 };
 


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