|
Boost-Commit : |
From: karl.meerbergen_at_[hidden]
Date: 2008-08-25 08:37:47
Author: karlmeerbergen
Date: 2008-08-25 08:37:47 EDT (Mon, 25 Aug 2008)
New Revision: 48375
URL: http://svn.boost.org/trac/boost/changeset/48375
Log:
added complex/floa/double tests
Text files modified:
sandbox/libs/numeric/bindings/mumps/test/makefile | 25 ++++++++++++++------
sandbox/libs/numeric/bindings/mumps/test/mumps_ublas.cpp | 48 +++++++++++++++++++++++++--------------
2 files changed, 48 insertions(+), 25 deletions(-)
Modified: sandbox/libs/numeric/bindings/mumps/test/makefile
==============================================================================
--- sandbox/libs/numeric/bindings/mumps/test/makefile (original)
+++ sandbox/libs/numeric/bindings/mumps/test/makefile 2008-08-25 08:37:47 EDT (Mon, 25 Aug 2008)
@@ -1,9 +1,18 @@
-BOOST = -I$(HOME)/local_disk/ext/boost
-BOOSTSANDBOX = -I$(HOME)/local_disk/svn/boost-sandbox
-BLAS = -L$(HOME)/local_disk/ext/lib -lf77blas -latlas /usr/lib/libf2c.a
-LAPACK = -L$(HOME)/local_disk/ext/lapack -llapack-gfortran411 -llapack_tools
-CPP = $(HOME)/local_disk/ext/bin/g++ -g
-MUMPS = -I$(HOME)/local_disk/ext/mumps/MUMPS_4.6.4/include -L$(HOME)/local_disk/ext/mumps/MUMPS_4.6.4/lib -ldmumps -lsmumps -lcmumps -lzmumps -lpord -L$(HOME)/local_disk/ext/mumps/MUMPS_4.6.4/libseq -lmpiseq
+CXXFLAGS = -I/home/karlm/local_disk/svn/glas/trunk/glas -I/home/karlm/local_disk/svn/boost/ -I/home/karlm/local_disk/svn/boost-sandbox/ -I/home/karlm/local_disk/ext/mumps/MUMPS_4.6.4/include
+LDFLAGS =
+LIBS = -L/home/karlm/local_disk/svn/glas/trunk/glas/libs/ -lglas -L/home/karlm/local_disk/svn/boost/libs/ -lboost_programoptions -lboost_system -lboost_filesystem -L/home/karlm/local_disk/ext/mumps/MUMPS_4.6.4/lib -lsmumps -lcmumps -ldmumps -lzmumps -lpord -L/home/karlm/local_disk/ext/mumps/MUMPS_4.6.4/libseq -lmpiseq -lpthread -L/home/karlm/local_disk/ext/lapack/ -llapack-gfortran.4.2 -llapack_tools-gfortran.4.2 -L/home/karlm/local_disk/ext/lib -lf77blas -latlas -lg2c -L/cw/cc/gcc/lib -lstdc++ -lgfortran
-mumps_ublas: mumps_ublas.cpp
- $(CPP) -o mumps_ublas mumps_ublas.cpp $(BOOST) $(BOOSTSANDBOX) $(MUMPS) $(BLAS) -lgfortran -lpthread
+MUMPS_UBLAS_DEPS =
+
+mumps_ublas_d.o : mumps_ublas.cpp $(MUMPS_UBLAS_DEPS)
+ @/cw/cc/gcc/bin/g++-4.2 -c -g $(CXXFLAGS) -o mumps_ublas_d.o mumps_ublas.cpp
+
+mumps_ublas.o : mumps_ublas.cpp $(MUMPS_UBLAS_DEPS)
+ @/cw/cc/gcc/bin/g++-4.2 -c -DNDEBUG -O3 $(CXXFLAGS) -o mumps_ublas.o mumps_ublas.cpp
+
+
+mumps_ublas_d: mumps_ublas_d.o
+ @/cw/cc/gcc/bin/g++-4.2 -o mumps_ublas_d $(LDFLAGS) mumps_ublas_d.o $(LIBS)
+
+mumps_ublas: mumps_ublas.o
+ @/cw/cc/gcc/bin/g++-4.2 -o mumps_ublas $(LDFLAGS) mumps_ublas.o $(LIBS)
Modified: sandbox/libs/numeric/bindings/mumps/test/mumps_ublas.cpp
==============================================================================
--- sandbox/libs/numeric/bindings/mumps/test/mumps_ublas.cpp (original)
+++ sandbox/libs/numeric/bindings/mumps/test/mumps_ublas.cpp 2008-08-25 08:37:47 EDT (Mon, 25 Aug 2008)
@@ -6,31 +6,33 @@
#include <boost/numeric/bindings/mumps/mumps_driver.hpp>
#include <iostream>
#include <fstream>
+#include <complex>
-int main() {
+template <typename T>
+int test() {
namespace ublas = ::boost::numeric::ublas ;
namespace mumps = ::boost::numeric::bindings::mumps ;
int const n = 10 ;
- typedef ublas::coordinate_matrix<double, ublas::column_major, 1, ublas::unbounded_array<int> > coo_type ;
+ typedef ublas::coordinate_matrix<T, ublas::column_major, 1, ublas::unbounded_array<int> > coo_type ;
coo_type coo( n, n, n + 6 ) ;
for (int i=0; i<n; ++i) coo(i,i) = i+1.0 ;
- coo(2,3) = 1.0 ;
- coo(2,4) = 1.0 ;
- coo(5,6) = -1.0 ;
- coo(2,6) = 1.0 ;
- coo(9,0) = 1.0 ;
- coo(2,7) = -1.0 ;
+ coo(2,3) = T(1.0) ;
+ coo(2,4) = T(1.0) ;
+ coo(5,6) = T(-1.0) ;
+ coo(2,6) = T(1.0) ;
+ coo(9,0) = T(1.0) ;
+ coo(2,7) = T(-1.0) ;
coo.sort() ;
std::cout << "matrix " << coo << std::endl ;
- ublas::vector<double> v( 10 ) ;
- ublas::vector<double> w( 10 ) ;
+ ublas::vector<T> v( 10 ) ;
+ ublas::vector<T> w( 10 ) ;
std::fill( w.begin(), w.end(), 1.0 ) ;
@@ -39,14 +41,15 @@
}
for (int i=0; i<n; ++i) {
- v(i) = coo(i,i) * w(i) ;
+ v[i] = T(coo(i,i)) * w[i] ;
}
- v(2) += coo(2,3) * w(3) ;
- v(2) += coo(2,4) * w(4) ;
- v(5) += coo(5,6) * w(6) ;
- v(2) += coo(2,6) * w(6) ;
- v(9) += coo(9,0) * w(0) ;
- v(2) += coo(2,7) * w(7) ;
+ v[2] += T(coo(2,3)) * w[3] ;
+ v[2] += T(coo(2,4)) * w[4] ;
+ v[5] += T(coo(5,6)) * w[6] ;
+ v[2] += T(coo(2,6)) * w[6] ;
+ v[9] += T(coo(9,0)) * w[0] ;
+ v[2] += T(coo(2,7)) * w[7] ;
+ std::cout << "rhs : " << v << std::endl ;
mumps::mumps< coo_type > mumps_coo ;
@@ -70,4 +73,15 @@
std::cout << "w : " << w << std::endl ;
std::cout << "v : " << v << std::endl ;
+ if ( norm_2( v - w ) > 1.e-10 * norm_2( v ) ) return 1 ;
+
+ return 0 ;
+}
+
+int main() {
+ if ( test<float>() ) return 1 ;
+ if ( test<double>() ) return 2 ;
+ if ( test< std::complex<float> >() ) return 3 ;
+ if ( test< std::complex<double> >() ) return 4 ;
+ return 0 ;
}
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