I am using Numeric Library Bindings for Boost UBlas to solve a simple
linear system:
__BEGIN__
#include
#include
#include
#include
#include
namespace ublas = boost::numeric::ublas;
namespace lapack= boost::numeric::bindings::lapack;
int main()
{
ublas::matrix A(3,3);
ublas::vector<float> b(3);
for(unsigned i=0;i < A.size1();i++)
for(unsigned j =0;j < A.size2();j++)
{
std::cout << "enter element "<> A(i,j);
}
std::cout << A << std::endl;
b(0) = 21; b(1) = 1; b(2) = 17;
lapack::gesv(A,b);
std::cout << b << std::endl;
return 0;
}
__END__
I tried compiling it with the following command:
g++ -I/home/foolb/.boost/include/boost-1_38
-I/home/foolb/.boostnumbind/include/boost-numeric-bindings
solve_Axb_byhand.cc -o solve_Axb_byhand
but fail with the following error:
media/disk/tmp/ccbd973l.o: In function
`boost::numeric::bindings::lapack::detail::gesv(int, int, float*, int,
int*, float*, int, int*)':
solve_Axb_byhand2.cc:(.text._ZN5boost7numeric8bindings6lapack6detail4gesvEiiPfiPiS4_iS5_[boost::numeric::bindings::lapack::detail::gesv(int,
int, float*, int, int*, float*, int, int*)]+0x59): undefined reference
to `sgesv_'
collect2: ld returned 1 exit status
__END__
What's wrong with my approach?
- G.V