|
Boost Users : |
From: Zhang Le (ejoy_at_[hidden])
Date: 2003-04-27 07:39:36
Hi all,
I just write a simple program to test the efficiency of sparse matrix
operation in uBLAS and get the following error message on a FreeBSD
with gcc 2.95 :
!gmake 2>&1| tee /tmp/v446688/2g++ -c test.cpp -I.
-I/usr/local/include -Wall -g -O2 -march=i686 -pipe
-ftemplate-depth-30 -g3 -O0 -o test.o
g++ test.o -o a.out
test.o: In function `pair<unsigned int, unsigned int> *
__copy_backward<pair<unsigned int, unsigned int> *, pair<unsigned
int, unsigned int> *, int>(pair<unsigned int, unsigned int> *,
pair<unsigned int, unsigned int> *, pair<unsigned int,
unsigned int> *, random_access_iterator_tag, int *)':
/usr/include/g++/stl_algobase.h(.gnu.linkonce.t.norm_inf__Q45boost7numeric5ublast11type_traits1ZUiRCUi+0x15):
undefined reference to `boost::numeric::ublas::type_traits<unsigned
int>::imag(unsigned int const &)'
/usr/include/g++/stl_algobase.h(.gnu.linkonce.t.norm_inf__Q45boost7numeric5ublast11type_traits1ZUiRCUi+0x24):
undefined reference to `boost::numeric::ublas::type_traits<unsigned
int>::abs(unsigned int const &)'
/usr/include/g++/stl_algobase.h(.gnu.linkonce.t.norm_inf__Q45boost7numeric5ublast11type_traits1ZUiRCUi+0x3a):
undefined reference to `boost::numeric::ublas::type_traits<unsigned
int>::real(unsigned int const &)'
/usr/include/g++/stl_algobase.h(.gnu.linkonce.t.norm_inf__Q45boost7numeric5ublast11type_traits1ZUiRCUi+0x49):
undefined reference to `boost::numeric::ublas::type_traits<unsigned
int>::abs(unsigned int const &)'
/usr/include/g++/stl_algobase.h(.gnu.linkonce.t.equals__H2ZQ45boost7numeric5ublast6vector2ZUiZQ45boost7numeric5ublast15unbounded_array1ZUiZQ45boost7numeric5ublast6vector2ZUiZQ45boost7numeric5ublast15unbounded_array1ZUi_Q35boost7numeric5ublasRCQ45boost7numeric5ublast17vector_expression1ZX01RCQ45boost7numeric5ublast17vector_expression1ZX11_b+0x2e):
undefined reference to `boost::numeric::ublas::type_traits<unsigned
int>::sqrt(unsigned int const &)'
If I comment out the second prod() or use -DNDEBUG
everything is ok. So I suspect the
error is caused by debug code in sparse matrix prod operation.
here is the main code block:
int main(int argc,char* argv[]) {
try {
namespace ublas = boost::numeric::ublas;
using namespace ublas;
size_t d = 7000;
ublas::vector<unsigned> v(d);
ublas::matrix<unsigned> m (d,d);
ublas::sparse_matrix<unsigned> ms (d,d);
for (size_t i = 0;i < 10000;++i) {
size_t r = (size_t)(drand48() * d);
size_t c = (size_t)(drand48() * d);
++m(r,c);
++ms(r,c);
++v(r);
++v(c);
}
{
progress_timer t;
std::cout << "matrix * vector" << endl;
ublas::prod(m,v);
}
{
progress_timer t;
std::cout << "sparse matrix * vector" << endl;
ublas::prod(ms,v);
}
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net