Boost logo

Boost-Commit :

From: thomas.klimpel_at_[hidden]
Date: 2008-05-22 07:01:39


Author: klimpel
Date: 2008-05-22 07:01:38 EDT (Thu, 22 May 2008)
New Revision: 45644
URL: http://svn.boost.org/trac/boost/changeset/45644

Log:
replace reinterpret cast by traits:complex_ptr and some cleanup

Text files modified:
   sandbox/boost/numeric/bindings/lapack/heev.hpp | 8 ++++----
   sandbox/boost/numeric/bindings/lapack/heevd.hpp | 26 +++++++++++++-------------
   sandbox/boost/numeric/bindings/lapack/heevx.hpp | 29 ++++++++++++++---------------
   sandbox/boost/numeric/bindings/lapack/ormqr.hpp | 28 ++++++++++++++--------------
   4 files changed, 45 insertions(+), 46 deletions(-)

Modified: sandbox/boost/numeric/bindings/lapack/heev.hpp
==============================================================================
--- sandbox/boost/numeric/bindings/lapack/heev.hpp (original)
+++ sandbox/boost/numeric/bindings/lapack/heev.hpp 2008-05-22 07:01:38 EDT (Thu, 22 May 2008)
@@ -63,8 +63,8 @@
                  float* rwork, int& info)
       {
         LAPACK_CHEEV (&jobz, &uplo, &n,
- reinterpret_cast<fcomplex_t*>(a), &lda, w,
- reinterpret_cast<fcomplex_t*>(work), &lwork,
+ traits::complex_ptr(a), &lda, w,
+ traits::complex_ptr(work), &lwork,
                       rwork, &info);
       }
 
@@ -75,8 +75,8 @@
                  double* rwork, int& info)
       {
         LAPACK_ZHEEV (&jobz, &uplo, &n,
- reinterpret_cast<dcomplex_t*>(a), &lda, w,
- reinterpret_cast<dcomplex_t*>(work), &lwork,
+ traits::complex_ptr(a), &lda, w,
+ traits::complex_ptr(work), &lwork,
                       rwork, &info);
       }
 

Modified: sandbox/boost/numeric/bindings/lapack/heevd.hpp
==============================================================================
--- sandbox/boost/numeric/bindings/lapack/heevd.hpp (original)
+++ sandbox/boost/numeric/bindings/lapack/heevd.hpp 2008-05-22 07:01:38 EDT (Thu, 22 May 2008)
@@ -94,9 +94,9 @@
       {
         LAPACK_CHEEVD (
           &jobz, &uplo, &n,
- reinterpret_cast<fcomplex_t*>(a), &lda,
- reinterpret_cast<fcomplex_t*>(w),
- reinterpret_cast<fcomplex_t*>(work), &lwork,
+ traits::complex_ptr(a), &lda,
+ w,
+ traits::complex_ptr(work), &lwork,
           rwork, &lrwork, iwork, &liwork, &info);
       }
 
@@ -108,9 +108,9 @@
       {
         LAPACK_ZHEEVD (
           &jobz, &uplo, &n,
- reinterpret_cast<dcomplex_t*>(a), &lda,
- reinterpret_cast<dcomplex_t*>(w),
- reinterpret_cast<dcomplex_t*>(work), &lwork,
+ traits::complex_ptr(a), &lda,
+ w,
+ traits::complex_ptr(work), &lwork,
           rwork, &lrwork, iwork, &liwork, &info);
       }
     } // namespace detail
@@ -167,8 +167,8 @@
           T* a, int const lda,
           R* w, std::pair<detail::workspace1<W>, detail::workspace1<WI> > work, int& info) {
 
- assert (jobz=='N' ? 1+2*n : 1+6*n+2*n*n <= traits::vector_size (work.first.w_));
- assert (jobz=='N' ? 1 : 3+5*n <= traits::vector_size (work.second.w_));
+ assert (traits::vector_size (work.first.w_) >= jobz=='N' ? 1+2*n : 1+6*n+2*n*n);
+ assert (traits::vector_size (work.second.w_) >= jobz=='N' ? 1 : 3+5*n);
 
           heevd( jobz, uplo, n, a, lda, w,
             traits::vector_storage (work.first.w_), traits::vector_size (work.first.w_),
@@ -229,9 +229,9 @@
           T* a, int const lda,
           R* w, std::pair<detail::workspace2<WC,WR>, detail::workspace1<WI> > work, int& info) {
 
- assert (jobz=='N' ? 1+n : 2*n+n*n <= traits::vector_size (work.first.w_));
- assert (jobz=='N' ? n : 1+5*n+2*n*n <= traits::vector_size (work.first.wr_));
- assert (jobz=='N' ? 1 : 3+5*n <= traits::vector_size (work.second.w_));
+ assert (traits::vector_size (work.first.w_) >= jobz=='N' ? 1+n : 2*n+n*n);
+ assert (traits::vector_size (work.first.wr_) >= jobz=='N' ? n : 1+5*n+2*n*n);
+ assert (traits::vector_size (work.second.w_) >= jobz=='N' ? 1 : 3+5*n);
 
           heevd( jobz, uplo, n, a, lda, w,
             traits::vector_storage (work.first.w_), traits::vector_size (work.first.w_),
@@ -255,8 +255,8 @@
 #endif
 
       int const n = traits::matrix_size1 (a);
- assert (traits::matrix_size2 (a)==n);
- assert (traits::vector_size (w)==n);
+ assert (traits::matrix_size2 (a) == n);
+ assert (traits::vector_size (w) == n);
       assert ( uplo=='U' || uplo=='L' );
       assert ( jobz=='N' || jobz=='V' );
 

Modified: sandbox/boost/numeric/bindings/lapack/heevx.hpp
==============================================================================
--- sandbox/boost/numeric/bindings/lapack/heevx.hpp (original)
+++ sandbox/boost/numeric/bindings/lapack/heevx.hpp 2008-05-22 07:01:38 EDT (Thu, 22 May 2008)
@@ -109,10 +109,10 @@
       {
         LAPACK_CHEEVX (
           &jobz, &range, &uplo, &n,
- reinterpret_cast<fcomplex_t*>(a), &lda,
+ traits::complex_ptr(a), &lda,
           &vl, &vu, &il, &iu, &abstol, &m, w,
- reinterpret_cast<fcomplex_t*>(z), &ldz,
- reinterpret_cast<fcomplex_t*>(work), &lwork,
+ traits::complex_ptr(z), &ldz,
+ traits::complex_ptr(work), &lwork,
           rwork, iwork, ifail, &info);
       }
 
@@ -126,10 +126,10 @@
       {
         LAPACK_ZHEEVX (
           &jobz, &range, &uplo, &n,
- reinterpret_cast<dcomplex_t*>(a), &lda,
+ traits::complex_ptr(a), &lda,
           &vl, &vu, &il, &iu, &abstol, &m, w,
- reinterpret_cast<dcomplex_t*>(z), &ldz,
- reinterpret_cast<dcomplex_t*>(work), &lwork,
+ traits::complex_ptr(z), &ldz,
+ traits::complex_ptr(work), &lwork,
           rwork, iwork, ifail, &info);
       }
     } // namespace detail
@@ -192,8 +192,8 @@
           R abstol, int& m,
           R* w, T* z, int const ldz, std::pair<detail::workspace1<W>, detail::workspace1<WI> > work, int* ifail, int& info) {
 
- assert (8*n <= traits::vector_size (work.first.w_));
- assert (5*n <= traits::vector_size (work.second.w_));
+ assert (traits::vector_size (work.first.w_) >= 8*n);
+ assert (traits::vector_size (work.second.w_) >= 5*n);
 
           heevx( jobz, range, uplo, n, a, lda, vl, vu, il, iu, abstol, m, w, z, ldz,
             traits::vector_storage (work.first.w_), traits::vector_size (work.first.w_),
@@ -260,9 +260,9 @@
           R abstol, int& m,
           R* w, T* z, int const ldz, std::pair<detail::workspace2<WC,WR>, detail::workspace1<WI> > work, int* ifail, int& info) {
 
- assert (2*n <= traits::vector_size (work.first.w_));
- assert (7*n <= traits::vector_size (work.first.wr_));
- assert (5*n <= traits::vector_size (work.second.w_));
+ assert (traits::vector_size (work.first.w_) >= 2*n);
+ assert (traits::vector_size (work.first.wr_) >= 7*n);
+ assert (traits::vector_size (work.second.w_) >= 5*n);
 
           heevx( jobz, range, uplo, n, a, lda, vl, vu, il, iu, abstol, m, w, z, ldz,
             traits::vector_storage (work.first.w_), traits::vector_size (work.first.w_),
@@ -276,7 +276,6 @@
     template <typename A, typename T, typename W, typename Z, typename IFail, typename Work>
     inline int heevx (
       char jobz, char range, A& a, T vl, T vu, int il, int iu, T abstol, int& m,
- //char jobz, char range, char uplo, A& a, T vl, T vu, int il, int iu, T abstol, int& m,
       W& w, Z& z, IFail& ifail, Work work = optimal_workspace() ) {
 
 #ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
@@ -292,9 +291,9 @@
 #endif
 
       int const n = traits::matrix_size1 (a);
- assert (traits::matrix_size2 (a)==n);
- assert (traits::vector_size (w)==n);
- assert (n == traits::vector_size (ifail));
+ assert (traits::matrix_size2 (a) == n);
+ assert (traits::vector_size (w) == n);
+ assert (traits::vector_size (ifail) == n);
       assert ( range=='A' || range=='V' || range=='I' );
       char uplo = traits::matrix_uplo_tag (a);
       assert ( uplo=='U' || uplo=='L' );

Modified: sandbox/boost/numeric/bindings/lapack/ormqr.hpp
==============================================================================
--- sandbox/boost/numeric/bindings/lapack/ormqr.hpp (original)
+++ sandbox/boost/numeric/bindings/lapack/ormqr.hpp 2008-05-22 07:01:38 EDT (Thu, 22 May 2008)
@@ -97,31 +97,31 @@
 
       inline
       void ormqr (char const side, char const trans, int const m, int const n,
- int const k, const std::complex<float>* a, int const lda,
- const std::complex<float>* tau, std::complex<float>* c,
- int const ldc, std::complex<float>* work, int const lwork,
+ int const k, const traits::complex_f* a, int const lda,
+ const traits::complex_f* tau, traits::complex_f* c,
+ int const ldc, traits::complex_f* work, int const lwork,
                  int& info)
       {
         LAPACK_CUNMQR (&side, &trans, &m, &n, &k,
- reinterpret_cast<const fcomplex_t*>(a), &lda,
- reinterpret_cast<const fcomplex_t*>(tau),
- reinterpret_cast<fcomplex_t*>(c), &ldc,
- reinterpret_cast<fcomplex_t*>(work), &lwork,
+ traits::complex_ptr(a), &lda,
+ traits::complex_ptr(tau),
+ traits::complex_ptr(c), &ldc,
+ traits::complex_ptr(work), &lwork,
                       &info);
       }
 
       inline
       void ormqr (char const side, char const trans, int const m, int const n,
- int const k, const std::complex<double>* a, int const lda,
- const std::complex<double>* tau, std::complex<double>* c,
- int const ldc, std::complex<double>* work, int const lwork,
+ int const k, const traits::complex_d* a, int const lda,
+ const traits::complex_d* tau, traits::complex_d* c,
+ int const ldc, traits::complex_d* work, int const lwork,
                  int& info)
       {
         LAPACK_ZUNMQR (&side, &trans, &m, &n, &k,
- reinterpret_cast<const dcomplex_t*>(a), &lda,
- reinterpret_cast<const dcomplex_t*>(tau),
- reinterpret_cast<dcomplex_t*>(c), &ldc,
- reinterpret_cast<dcomplex_t*>(work), &lwork,
+ traits::complex_ptr(a), &lda,
+ traits::complex_ptr(tau),
+ traits::complex_ptr(c), &ldc,
+ traits::complex_ptr(work), &lwork,
                       &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