|
Boost-Commit : |
From: thomas.klimpel_at_[hidden]
Date: 2008-08-09 18:16:27
Author: klimpel
Date: 2008-08-09 18:16:27 EDT (Sat, 09 Aug 2008)
New Revision: 48049
URL: http://svn.boost.org/trac/boost/changeset/48049
Log:
Added tests for getri, sytri, sptri.
Text files modified:
sandbox/libs/numeric/bindings/lapack/test/ublas_getrf_getrs.cc | 8 ++++++++
sandbox/libs/numeric/bindings/lapack/test/ublas_getrf_getrs1.cpp | 5 ++++-
sandbox/libs/numeric/bindings/lapack/test/ublas_sptrf_sptrs.cc | 12 ++++++++++++
sandbox/libs/numeric/bindings/lapack/test/ublas_sytrf_sytrs.cc | 12 ++++++++++++
4 files changed, 36 insertions(+), 1 deletions(-)
Modified: sandbox/libs/numeric/bindings/lapack/test/ublas_getrf_getrs.cc
==============================================================================
--- sandbox/libs/numeric/bindings/lapack/test/ublas_getrf_getrs.cc (original)
+++ sandbox/libs/numeric/bindings/lapack/test/ublas_getrf_getrs.cc 2008-08-09 18:16:27 EDT (Sat, 09 Aug 2008)
@@ -79,9 +79,13 @@
std::vector<int> ipiv (n); // pivot vector
lapack::getrf (a, ipiv); // factor a
+ m_t ia (a);
lapack::getrs (a, ipiv, b); // solve from factorization
print_m (b, "X");
cout << endl;
+ lapack::getri (ia, ipiv); // invert a
+ print_m (ia, "InvA");
+ cout << endl;
print_v (ipiv, "pivots");
@@ -97,9 +101,13 @@
cout << endl;
lapack::getrf (a2, ipiv); // factor a
+ m_t ia2 (a2);
lapack::getrs ('T', a2, ipiv, b2); // solve
print_m (b2, "X");
cout << endl;
+ lapack::getri (ia2, ipiv); // invert a2
+ print_m (ia2, "InvA2");
+ cout << endl;
print_v (ipiv, "pivots");
Modified: sandbox/libs/numeric/bindings/lapack/test/ublas_getrf_getrs1.cpp
==============================================================================
--- sandbox/libs/numeric/bindings/lapack/test/ublas_getrf_getrs1.cpp (original)
+++ sandbox/libs/numeric/bindings/lapack/test/ublas_getrf_getrs1.cpp 2008-08-09 18:16:27 EDT (Sat, 09 Aug 2008)
@@ -1,5 +1,5 @@
#include "../../blas/test/blas.hpp"
-#include <boost/numeric/bindings/lapack/lapack.hpp>
+#include <boost/numeric/bindings/lapack/gesv.hpp>
#include <boost/numeric/bindings/traits/ublas_vector.hpp>
#include <boost/numeric/bindings/traits/ublas_matrix.hpp>
@@ -13,9 +13,12 @@
std::vector< int > ipiv( x.size1() ) ;
boost::numeric::bindings::lapack::getrf( lu, ipiv ) ;
+ matrix_type ia( lu );
boost::numeric::bindings::lapack::getrs( 'N', lu, ipiv, x ) ;
+ boost::numeric::bindings::lapack::getri( ia, ipiv ) ;
std::cout << prod(a,x) - b << std::endl ;
+ std::cout << prod(a,ia) << std::endl ;
}
template < typename value_type, typename orientation, int size >
Modified: sandbox/libs/numeric/bindings/lapack/test/ublas_sptrf_sptrs.cc
==============================================================================
--- sandbox/libs/numeric/bindings/lapack/test/ublas_sptrf_sptrs.cc (original)
+++ sandbox/libs/numeric/bindings/lapack/test/ublas_sptrf_sptrs.cc 2008-08-09 18:16:27 EDT (Sat, 09 Aug 2008)
@@ -90,15 +90,21 @@
int err = lapack::sptrf (sal, ipiv);
if (err == 0) {
+ symml_t isal (sal);
lapack::sptrs (sal, ipiv, bl);
print_m (bl, "xl");
+ lapack::sptri (isal, ipiv);
+ print_m (isal, "isal");
}
cout << endl;
err = lapack::sptrf (sau, ipiv);
if (err == 0) {
+ symmu_t isau (sau);
lapack::sptrs (sau, ipiv, bu);
print_m (bu, "xu");
+ lapack::sptri (isau, ipiv);
+ print_m (isau, "isau");
}
else
cout << "?" << endl;
@@ -136,8 +142,11 @@
int ierr = lapack::sptrf (scal, ipiv);
if (ierr == 0) {
+ csymml_t iscal (scal);
lapack::sptrs (scal, ipiv, cbl);
print_m (cbl, "cxl");
+ lapack::sptri (iscal, ipiv);
+ print_m (iscal, "iscal");
}
else
cout << "?" << endl;
@@ -145,8 +154,11 @@
ierr = lapack::sptrf (scau, ipiv);
if (ierr == 0) {
+ csymmu_t iscau (scau);
lapack::sptrs (scau, ipiv, cbu);
print_m (cbu, "cxu");
+ lapack::sptri (iscau, ipiv);
+ print_m (iscau, "iscau");
}
else
cout << "?" << endl;
Modified: sandbox/libs/numeric/bindings/lapack/test/ublas_sytrf_sytrs.cc
==============================================================================
--- sandbox/libs/numeric/bindings/lapack/test/ublas_sytrf_sytrs.cc (original)
+++ sandbox/libs/numeric/bindings/lapack/test/ublas_sytrf_sytrs.cc 2008-08-09 18:16:27 EDT (Sat, 09 Aug 2008)
@@ -97,15 +97,21 @@
int err = lapack::sytrf (sal, ipiv);
if (err == 0) {
+ symml_t isal (sal);
lapack::sytrs (sal, ipiv, bl);
print_m (bl, "xl");
+ lapack::sytri (isal, ipiv);
+ print_m (isal, "isal");
}
cout << endl;
err = lapack::sytrf (sau, ipiv);
if (err == 0) {
+ symmu_t isau (sau);
lapack::sytrs (sau, ipiv, bu);
print_m (bu, "xu");
+ lapack::sytri (isau, ipiv);
+ print_m (isau, "isau");
}
else
cout << "?" << endl;
@@ -196,8 +202,11 @@
int ierr = lapack::sytrf (scal, ipiv);
if (ierr == 0) {
+ csymml_t iscal (scal);
lapack::sytrs (scal, ipiv, cbl);
print_m (cbl, "cxl");
+ lapack::sytri (iscal, ipiv);
+ print_m (iscal, "iscal");
}
else
cout << "?" << endl;
@@ -215,10 +224,13 @@
ierr = lapack::sytrf (scau, ipiv, cwork);
if (ierr == 0) {
+ csymmu_t iscau (scau);
lapack::sytrs (scau, ipiv, cbu);
print_v (ipiv, "ipiv");
cout << endl;
print_m (cbu, "cxu");
+ lapack::sytri (iscau, ipiv);
+ print_m (iscau, "iscau");
}
else
cout << "?" << endl;
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