|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50301 - sandbox/boost/numeric/bindings/lapack
From: thomas.klimpel_at_[hidden]
Date: 2008-12-17 04:18:41
Author: klimpel
Date: 2008-12-17 04:18:38 EST (Wed, 17 Dec 2008)
New Revision: 50301
URL: http://svn.boost.org/trac/boost/changeset/50301
Log:
minor cleanup
Text files modified:
sandbox/boost/numeric/bindings/lapack/geev.hpp | 20 ++++++++++++--------
sandbox/boost/numeric/bindings/lapack/gesdd.hpp | 3 ++-
sandbox/boost/numeric/bindings/lapack/hseqr.hpp | 13 +++++++------
3 files changed, 21 insertions(+), 15 deletions(-)
Modified: sandbox/boost/numeric/bindings/lapack/geev.hpp
==============================================================================
--- sandbox/boost/numeric/bindings/lapack/geev.hpp (original)
+++ sandbox/boost/numeric/bindings/lapack/geev.hpp 2008-12-17 04:18:38 EST (Wed, 17 Dec 2008)
@@ -20,6 +20,7 @@
#include <boost/numeric/bindings/lapack/lapack.h>
#include <boost/numeric/bindings/lapack/workspace.hpp>
#include <boost/numeric/bindings/traits/detail/array.hpp>
+#include <boost/numeric/bindings/traits/detail/utils.hpp>
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
# include <boost/static_assert.hpp>
@@ -169,8 +170,10 @@
vl_real, &ldvl, vr_real, &ldvr,
work.storage(), &lwork);
- for (int i = 0; i < n; i++)
- traits::vector_storage(w)[i] = std::complex<value_type>(wr[i], wi[i]);
+ traits::detail::interlace(traits::vector_storage(wr),
+ traits::vector_storage(wr)+n,
+ traits::vector_storage(wi),
+ traits::vector_storage(w));
return result;
}
@@ -223,27 +226,28 @@
ldvr = traits::matrix_size2(*vr);
}
+ typedef std::complex<value_type> cmplx_t;
for (int i = 0; i < n; i++)
{
- traits::vector_storage(w)[i] = std::complex<value_type>(wr[i], wi[i]);
+ traits::vector_storage(w)[i] = cmplx_t(wr[i], wi[i]);
if (wi[i] != 0)
{
assert(i+1 < n);
assert(wr[i+1] == wr[i]);
assert(wi[i+1] == -wi[i]);
- traits::vector_storage(w)[i+1] = std::complex<value_type>(wr[i+1], wi[i+1]);
+ traits::vector_storage(w)[i+1] = cmplx_t(wr[i+1], wi[i+1]);
for (int j = 0; j < n; j++)
{
if (vl)
{
- vl_stor[i*ldvl+j] = std::complex<value_type>(vl2[i*n+j], vl2[(i+1)*n+j]);
- vl_stor[(i+1)*ldvl+j] = std::complex<value_type>(vl2[i*n+j], -vl2[(i+1)*n+j]);
+ vl_stor[i*ldvl+j] = cmplx_t(vl2[i*n+j], vl2[(i+1)*n+j]);
+ vl_stor[(i+1)*ldvl+j] = cmplx_t(vl2[i*n+j], -vl2[(i+1)*n+j]);
}
if (vr)
{
- vr_stor[i*ldvr+j] = std::complex<value_type>(vr2[i*n+j], vr2[(i+1)*n+j]);
- vr_stor[(i+1)*ldvr+j] = std::complex<value_type>(vr2[i*n+j], -vr2[(i+1)*n+j]);
+ vr_stor[i*ldvr+j] = cmplx_t(vr2[i*n+j], vr2[(i+1)*n+j]);
+ vr_stor[(i+1)*ldvr+j] = cmplx_t(vr2[i*n+j], -vr2[(i+1)*n+j]);
}
}
Modified: sandbox/boost/numeric/bindings/lapack/gesdd.hpp
==============================================================================
--- sandbox/boost/numeric/bindings/lapack/gesdd.hpp (original)
+++ sandbox/boost/numeric/bindings/lapack/gesdd.hpp 2008-12-17 04:18:38 EST (Wed, 17 Dec 2008)
@@ -153,6 +153,7 @@
int m3 = 3 * minmn;
int m4 = 4 * minmn;
int minw;
+ assert(jobz == 'N' || jobz == 'O' || jobz == 'S' || jobz == 'A');
if (jobz == 'N') {
// leading comments:
// LWORK >= 3*min(M,N) + max(max(M,N), 6*min(M,N))
@@ -177,7 +178,7 @@
minw += m3 * minmn;
}
else {
- std::cerr << "Invalid option passed to gesdd" << std::endl ;
+ assert(false);
return 0 ;
}
return minw;
Modified: sandbox/boost/numeric/bindings/lapack/hseqr.hpp
==============================================================================
--- sandbox/boost/numeric/bindings/lapack/hseqr.hpp (original)
+++ sandbox/boost/numeric/bindings/lapack/hseqr.hpp 2008-12-17 04:18:38 EST (Wed, 17 Dec 2008)
@@ -18,6 +18,7 @@
#include <boost/numeric/bindings/lapack/lapack.h>
#include <boost/numeric/bindings/lapack/workspace.hpp>
#include <boost/numeric/bindings/traits/detail/array.hpp>
+#include <boost/numeric/bindings/traits/detail/utils.hpp>
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK
# include <boost/static_assert.hpp>
@@ -115,7 +116,7 @@
return info;
}
- // complex<float>
+ // complex_f
inline
int hseqr_backend(const char* job, const char* compz, int* n,
const int ilo, const int ihi, traits::complex_f* H, const int ldH,
@@ -130,7 +131,7 @@
return info;
}
- // complex<double>
+ // complex_d
inline
int hseqr_backend(const char* job, const char* compz, int* n,
const int ilo, const int ihi, traits::complex_d* H, const int ldH,
@@ -180,10 +181,10 @@
traits::matrix_storage(Z),
traits::leading_dimension(Z),
work.storage(), &lwork);
-
- for (int i = 0; i < n; i++)
- w[i] = std::complex<value_type>(wr[i], wi[i]);
-
+ traits::detail::interlace(traits::vector_storage(wr),
+ traits::vector_storage(wr)+n,
+ traits::vector_storage(wi),
+ traits::vector_storage(w));
return result;
}
};
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