Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58486 - sandbox/numeric_bindings/libs/numeric/bindings/lapack/test
From: thomas.klimpel_at_[hidden]
Date: 2009-12-22 08:31:33


Author: klimpel
Date: 2009-12-22 08:31:33 EST (Tue, 22 Dec 2009)
New Revision: 58486
URL: http://svn.boost.org/trac/boost/changeset/58486

Log:
Continue of regression tests update
Text files modified:
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gbsv.cpp | 13 ++++++++++---
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_getrf_getrs.cc | 7 +++++--
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_getrf_getrs1.cpp | 5 ++++-
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hetrf_hetrs.cc | 17 +++++++++++------
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_potrf_potrs.cc | 12 +++++++-----
   5 files changed, 37 insertions(+), 17 deletions(-)

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gbsv.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gbsv.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gbsv.cpp 2009-12-22 08:31:33 EST (Tue, 22 Dec 2009)
@@ -1,11 +1,14 @@
+#include <boost/numeric/bindings/traits/std_vector.hpp>
 #include <boost/numeric/bindings/traits/ublas_banded.hpp>
 #include <boost/numeric/bindings/traits/ublas_vector2.hpp>
-#include <boost/numeric/bindings/lapack/gbsv.hpp>
+#include <boost/numeric/bindings/lapack/computational/gbtrf.hpp>
+#include <boost/numeric/bindings/lapack/computational/gbtrs.hpp>
 #include <vector>
 #include <stdexcept>
 
 namespace ublas = boost::numeric::ublas;
 namespace lapack = boost::numeric::bindings::lapack;
+namespace traits = boost::numeric::bindings::traits;
 
 static const char NORMAL = 'N';
 static const char TRANSPOSE = 'T';
@@ -15,8 +18,12 @@
 template <typename MatrA, typename MatrB>
 void InPlaceSolve(MatrA& a, MatrB& b)
 {
+ // if the matrix has kl lower and ku upper diagonals, then we should have
+ // allocated kl lower and kl+ku upper diagonals
+ integer_t const kl = traits::matrix_lower_bandwidth (a);
+ integer_t const ku = traits::matrix_upper_bandwidth (a) - kl;
   std::vector<integer_t> piv(a.size1());
- int ret = lapack::gbtrf(a, piv);
+ int ret = lapack::gbtrf(traits::matrix_size1(a), traits::matrix_size2(a), kl, ku, a, piv);
   if (ret < 0) {
     //CStdString err;
     //err.Format("banded::Solve: argument %d in DGBTRF had an illegal value", -ret);
@@ -30,7 +37,7 @@
     throw std::runtime_error("banded::Solve: the (%d,%d) diagonal element is 0 after DGBTRF");
   }
 
- ret = lapack::gbtrs(NORMAL, a, piv, b);
+ ret = lapack::gbtrs(NORMAL, traits::matrix_size1(a), kl, ku, a, piv, b);
   if (ret < 0) {
     //CStdString err;
     //err.Format("banded::Solve: argument %d in DGBTRS had an illegal value", -ret);

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_getrf_getrs.cc
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_getrf_getrs.cc (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_getrf_getrs.cc 2009-12-22 08:31:33 EST (Tue, 22 Dec 2009)
@@ -5,7 +5,10 @@
 #include <cstddef>
 #include <iostream>
 #include <complex>
-#include <boost/numeric/bindings/lapack/gesv.hpp>
+#include <boost/numeric/bindings/lapack/computational/getrf.hpp>
+#include <boost/numeric/bindings/lapack/computational/getri.hpp>
+#include <boost/numeric/bindings/lapack/computational/getrs.hpp>
+#include <boost/numeric/bindings/traits/ublas_vector.hpp>
 #include <boost/numeric/bindings/traits/ublas_matrix.hpp>
 #include <boost/numeric/bindings/traits/std_vector.hpp>
 #include <boost/numeric/ublas/matrix_proxy.hpp>
@@ -80,7 +83,7 @@
 
   lapack::getrf (a, ipiv); // factor a
   m_t ia (a);
- lapack::getrs (a, ipiv, b); // solve from factorization
+ lapack::getrs ('N', a, ipiv, b); // solve from factorization
   print_m (b, "X");
   cout << endl;
   lapack::getri (ia, ipiv); // invert a

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_getrf_getrs1.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_getrf_getrs1.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_getrf_getrs1.cpp 2009-12-22 08:31:33 EST (Tue, 22 Dec 2009)
@@ -1,5 +1,8 @@
 #include "../../blas/test/blas.hpp"
-#include <boost/numeric/bindings/lapack/gesv.hpp>
+#include <boost/numeric/bindings/lapack/computational/getrf.hpp>
+#include <boost/numeric/bindings/lapack/computational/getri.hpp>
+#include <boost/numeric/bindings/lapack/computational/getrs.hpp>
+#include <boost/numeric/bindings/traits/std_vector.hpp>
 #include <boost/numeric/bindings/traits/ublas_vector.hpp>
 #include <boost/numeric/bindings/traits/ublas_matrix.hpp>
 

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hetrf_hetrs.cc
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hetrf_hetrs.cc (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hetrf_hetrs.cc 2009-12-22 08:31:33 EST (Tue, 22 Dec 2009)
@@ -6,7 +6,9 @@
 #include <cstddef>
 #include <iostream>
 #include <complex>
-#include <boost/numeric/bindings/lapack/hesv.hpp>
+#include <boost/numeric/bindings/lapack/computational/hetrf.hpp>
+#include <boost/numeric/bindings/lapack/computational/hetrs.hpp>
+#include <boost/numeric/bindings/traits/ublas_vector.hpp>
 #include <boost/numeric/bindings/traits/ublas_matrix.hpp>
 #include <boost/numeric/bindings/traits/ublas_hermitian.hpp>
 #include <boost/numeric/bindings/traits/std_vector.hpp>
@@ -15,6 +17,7 @@
 
 namespace ublas = boost::numeric::ublas;
 namespace lapack = boost::numeric::bindings::lapack;
+namespace traits = boost::numeric::bindings::traits;
 
 using std::size_t;
 using std::cin;
@@ -73,7 +76,7 @@
 
   int ierr = lapack::hetrf (hcal, ipiv);
   if (ierr == 0) {
- lapack::hetrs (hcal, ipiv, cbl);
+ lapack::hetrs (traits::matrix_uplo_tag(hcal), hcal, ipiv, cbl);
     print_m (cbl, "cxl");
   }
   else
@@ -84,9 +87,9 @@
   std::vector<cmplx_t> cwork (3*64);
   // 3*64 -- optimal size
 
- ierr = lapack::hetrf (hcau, ipiv, cwork);
+ ierr = lapack::hetrf (hcau, ipiv, lapack::workspace(cwork));
   if (ierr == 0) {
- lapack::hetrs (hcau, ipiv, cbu);
+ lapack::hetrs (traits::matrix_uplo_tag(hcau), hcau, ipiv, cbu);
     print_v (ipiv, "ipiv");
     cout << endl;
     print_m (cbu, "cxu");
@@ -116,7 +119,8 @@
   print_m (cbu2, "cbu2");
   cout << endl;
 
- ierr = lapack::hetrf ('L', cal2, ipiv);
+ cherml_t hcal2 (cal2);
+ ierr = lapack::hetrf (hcal2, ipiv);
   if (ierr == 0) {
     lapack::hetrs ('L', cal2, ipiv, cbl2);
     print_m (cbl2, "cxl2");
@@ -126,7 +130,8 @@
          << ierr << endl;
   cout << endl;
 
- ierr = lapack::hetrf ('U', cau2, ipiv, cwork);
+ chermu_t hcau2 (cau2);
+ ierr = lapack::hetrf (hcau2, ipiv, lapack::workspace(cwork));
   if (ierr == 0) {
     lapack::hetrs ('U', cau2, ipiv, cbu2);
     print_v (ipiv, "ipiv");

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_potrf_potrs.cc
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_potrf_potrs.cc (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_potrf_potrs.cc 2009-12-22 08:31:33 EST (Tue, 22 Dec 2009)
@@ -6,7 +6,9 @@
 #include <cstddef>
 #include <iostream>
 #include <complex>
-#include <boost/numeric/bindings/lapack/posv.hpp>
+#include <boost/numeric/bindings/lapack/computational/potrf.hpp>
+#include <boost/numeric/bindings/lapack/computational/potrs.hpp>
+#include <boost/numeric/bindings/traits/ublas_vector.hpp>
 #include <boost/numeric/bindings/traits/ublas_matrix.hpp>
 #include <boost/numeric/bindings/traits/ublas_symmetric.hpp>
 #include <boost/numeric/bindings/traits/ublas_hermitian.hpp>
@@ -79,9 +81,9 @@
   }
   cout << endl;
 
- ierr = lapack::potrf ('U', au);
+ ierr = lapack::potrf (sau);
   if (!ierr) {
- lapack::potrs ('U', au, bu);
+ lapack::potrs (sau, bu);
     print_m (bu, "xu");
   }
   cout << endl;
@@ -127,9 +129,9 @@
   print_m (cbl2, "cbl");
   cout << endl;
   
- ierr = lapack::potrf ('L', cal);
+ ierr = lapack::potrf (hal);
   if (ierr == 0) {
- lapack::potrs ('L', cal, cbl2);
+ lapack::potrs (hal, cbl2);
     print_m (cbl2, "cxl");
   }
   else


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