|
Ublas : |
Subject: [ublas] Trouble with gemv and boost::numeric::bindings::blas
From: Alex Winbow (awinbow_at_[hidden])
Date: 2008-12-06 18:31:07
I've successfully used boost::numeric::bindings to call ATLAS's
gemm and gemv (thanks, guys, for the fantastic work!). I'd like to use the
GotoBLAS instead. blas::gemm builds fine, but blas::gemv errors with "no
matching function". A minimal example:
-------------------------------------------------
#include <numeric>
#include <complex>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/bindings/traits/ublas_matrix.hpp>
#include <boost/numeric/bindings/traits/ublas_vector.hpp>
#include <boost/numeric/bindings/blas/blas.hpp>
#include <boost/numeric/bindings/blas/blas2_overloads.hpp>
//#include <boost/numeric/bindings/atlas/cblas.hpp>
//#include <boost/numeric/bindings/atlas/cblas_inc.hpp>
namespace ublas = boost::numeric::ublas;
namespace externalblas = boost::numeric::bindings::blas;
//namespace externalblas = boost::numeric::bindings::atlas;
int main () {
typedef std::complex<double> Complex;
const int size = 100;
ublas::vector<Complex> x(size);
ublas::vector<Complex> y(size);
ublas::matrix<Complex> A(size, size);
ublas::matrix<Complex> B(size, size);
ublas::matrix<Complex> C(size, size);
externalblas::gemm(A, B, C);
externalblas::gemv(A, x, y);
};
-------------------------------------------------
If you swap the commented lines for blas<->atlas, it works fine. I'm using
g++ 4.3.2, version 20081116 of the bindings, and boost_1_37_0.
gemvtest.cpp: In function 'int main()':
gemvtest.cpp:34: error: no matching function for call to
'gemv(boost::numeric::ublas::matrix<std::complex<double>,
boost::numeric::ublas::basic_row_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<std::complex<double>,
std::allocator<std::complex<double> > > >&,
boost::numeric::ublas::vector<std::complex<double>,
boost::numeric::ublas::unbounded_array<std::complex<double>,
std::allocator<std::complex<double> > > >&,
boost::numeric::ublas::vector<std::complex<double>,
boost::numeric::ublas::unbounded_array<std::complex<double>,
std::allocator<std::complex<double> > > >&)'
Am I doing something wrong? blas2.hpp includes a prototype for
gemv(const matrix_type &a, const vector_type_x &x, vector_type_y &y).
Thanks,
-Alex