Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49363 - sandbox/boost/numeric/bindings/lapack
From: karl.meerbergen_at_[hidden]
Date: 2008-10-16 09:36:13


Author: karlmeerbergen
Date: 2008-10-16 09:36:13 EDT (Thu, 16 Oct 2008)
New Revision: 49363
URL: http://svn.boost.org/trac/boost/changeset/49363

Log:
error in ormqr in asserts corrected
added uplo selection from type for syev

Text files modified:
   sandbox/boost/numeric/bindings/lapack/ormqr.hpp | 5 ++
   sandbox/boost/numeric/bindings/lapack/syev.hpp | 76 ++++++++++++++++++++++++++++++++++++++++
   2 files changed, 80 insertions(+), 1 deletions(-)

Modified: sandbox/boost/numeric/bindings/lapack/ormqr.hpp
==============================================================================
--- sandbox/boost/numeric/bindings/lapack/ormqr.hpp (original)
+++ sandbox/boost/numeric/bindings/lapack/ormqr.hpp 2008-10-16 09:36:13 EDT (Thu, 16 Oct 2008)
@@ -72,6 +72,7 @@
                  int const ldc, float* work, int const lwork,
                  int& info)
       {
+ assert ( trans=='N' || trans=='T' );
         LAPACK_SORMQR (&side, &trans, &m, &n, &k,
                       a, &lda,
                       tau,
@@ -87,6 +88,7 @@
                  int const ldc, double* work, int const lwork,
                  int& info)
       {
+ assert ( trans=='N' || trans=='T' );
         LAPACK_DORMQR (&side, &trans, &m, &n, &k,
                       a, &lda,
                       tau,
@@ -102,6 +104,7 @@
                  int const ldc, traits::complex_f* work, int const lwork,
                  int& info)
       {
+ assert ( trans=='N' || trans=='C' );
         LAPACK_CUNMQR (&side, &trans, &m, &n, &k,
                       traits::complex_ptr(a), &lda,
                       traits::complex_ptr(tau),
@@ -117,6 +120,7 @@
                  int const ldc, traits::complex_d* work, int const lwork,
                  int& info)
       {
+ assert ( trans=='N' || trans=='C' );
         LAPACK_ZUNMQR (&side, &trans, &m, &n, &k,
                       traits::complex_ptr(a), &lda,
                       traits::complex_ptr(tau),
@@ -148,7 +152,6 @@
         int const lwork = traits::vector_size (work);
 
         assert ( side=='L' || side=='R' );
- assert ( trans=='N' || trans=='C' || trans=='T' );
         assert ( (side=='L' ? m >= k : n >= k ) );
 
         assert ( (side=='L' ?

Modified: sandbox/boost/numeric/bindings/lapack/syev.hpp
==============================================================================
--- sandbox/boost/numeric/bindings/lapack/syev.hpp (original)
+++ sandbox/boost/numeric/bindings/lapack/syev.hpp 2008-10-16 09:36:13 EDT (Thu, 16 Oct 2008)
@@ -148,8 +148,84 @@
        return syev(jobz, uplo, a, w, optimal_workspace());
     } // syev()
 
+ //
+ // With UPLO integrated in matrix type
+ //
+ template <typename A, typename W>
+ inline
+ int syev (char jobz, A& a, W& w, optimal_workspace ) {
+ typedef typename A::value_type value_type ;
+
+ int const n = traits::matrix_size1 (a);
+ char uplo = traits::matrix_uplo_tag( a ) ;
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ typedef typename traits::matrix_traits<A>::matrix_structure matrix_structure ;
+ BOOST_STATIC_ASSERT( (boost::mpl::or_< boost::is_same< matrix_structure, traits::symmetric_t >
+ , boost::is_same< matrix_structure, traits::hermitian_t >
+ >::value)
+ ) ;
+#endif
+
+ traits::detail::array<value_type> work( std::max<int>(1,34*n) );
+ return detail::syev(jobz, uplo, a, w, work);
+ } // syev()
+
+
+ // Function that allocates work arrays
+ template <typename A, typename W>
+ inline
+ int syev (char jobz, A& a, W& w, minimal_workspace ) {
+ typedef typename A::value_type value_type ;
+
+ int const n = traits::matrix_size1 (a);
+ char uplo = traits::matrix_uplo_tag( a ) ;
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ typedef typename traits::matrix_traits<A>::matrix_structure matrix_structure ;
+ BOOST_STATIC_ASSERT( (boost::mpl::or_< boost::is_same< matrix_structure, traits::symmetric_t >
+ , boost::is_same< matrix_structure, traits::hermitian_t >
+ >::value)
+ ) ;
+#endif
+ traits::detail::array<value_type> work( std::max<int>(1,3*n-1) );
+ return detail::syev(jobz, uplo, a, w, work);
+ } // syev()
+
+
+ // Function that allocates work arrays
+ template <typename A, typename W, typename Work>
+ inline
+ int syev (char jobz, A& a, W& w, detail::workspace1<Work> workspace ) {
+ typedef typename A::value_type value_type ;
+ char uplo = traits::matrix_uplo_tag( a ) ;
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ typedef typename traits::matrix_traits<A>::matrix_structure matrix_structure ;
+ BOOST_STATIC_ASSERT( (boost::mpl::or_< boost::is_same< matrix_structure, traits::symmetric_t >
+ , boost::is_same< matrix_structure, traits::hermitian_t >
+ >::value)
+ ) ;
+#endif
+ return detail::syev(jobz, uplo, a, w, workspace.w_);
+ } // syev()
+
+ // Function without workarray as argument
+ template <typename A, typename W>
+ inline
+ int syev (char jobz, A& a, W& w) {
+ char uplo = traits::matrix_uplo_tag( a ) ;
+#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
+ typedef typename traits::matrix_traits<A>::matrix_structure matrix_structure ;
+ BOOST_STATIC_ASSERT( (boost::mpl::or_< boost::is_same< matrix_structure, traits::symmetric_t >
+ , boost::is_same< matrix_structure, traits::hermitian_t >
+ >::value)
+ ) ;
+#endif
+ return syev(jobz, uplo, a, w, optimal_workspace());
+ } // syev()
+
   }
 
+
+
 }}}
 
 #endif


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