|
Ublas : |
From: Arun Tom Abraham (aruntom55_at_[hidden])
Date: 2008-02-03 08:00:30
Hi,
I tried the suggestion of
ublas::matrix<float, column_major> A(3,3);
ublas::vector<float> b(3);
but this has given me huge compilation errors -- >
The system i am solving is
2x-3y+2z=21
x+4y-z=1
-x+2y+z=17
####################code #############################
#include<boost/numeric/ublas/matrix.hpp>
#include<boost/numeric/ublas/io.hpp>
#include<boost/numeric/bindings/traits/ublas_matrix.hpp>
#include<boost/numeric/bindings/lapack/gesv.hpp>
namespace ublas = boost::numeric::ublas;
namespace lapack= boost::numeric::bindings::lapack;
int main()
{
ublas::matrix<float,ublas::column_major> 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 "<<i << j << std::endl;
std::cin >> 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;
}
############################################################
the error seems to be with the lapack part of the code now
################ compile error messages #####################################
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:
In function 'int boost::numeric::bindings::lapack::gesv(MatrA&,
IVec&, MatrB&) [with MatrA = boost::numeric::ublas::matrix<float,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, MatrB = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, IVec = boost::numeric::bindings::traits::detail::array<int>]':
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:139:
instantiated from 'int
boost::numeric::bindings::lapack::gesv(MatrA&, MatrB&) [with MatrA =
boost::numeric::ublas::matrix<float,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, MatrB = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>]'
exp2.cpp:35: instantiated from here
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:104:
error: no type named 'matrix_structure' in 'struct
boost::numeric::bindings::traits::matrix_traits<boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
> >'
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:139:
instantiated from 'int
boost::numeric::bindings::lapack::gesv(MatrA&, MatrB&) [with MatrA =
boost::numeric::ublas::matrix<float,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, MatrB = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>]'
exp2.cpp:35: instantiated from here
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:116:
error: no matching function for call to
'matrix_storage(boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>&)'
/home/iitb-aero/boost/boost/boost/numeric/bindings/traits/matrix_traits.hpp:
In function 'int boost::numeric::bindings::traits::matrix_size1(M&)
[with M = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>]':
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:112:
instantiated from 'int
boost::numeric::bindings::lapack::gesv(MatrA&, IVec&, MatrB&) [with
MatrA = boost::numeric::ublas::matrix<float,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, MatrB = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, IVec = boost::numeric::bindings::traits::detail::array<int>]'
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:139:
instantiated from 'int
boost::numeric::bindings::lapack::gesv(MatrA&, MatrB&) [with MatrA =
boost::numeric::ublas::matrix<float,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, MatrB = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>]'
exp2.cpp:35: instantiated from here
/home/iitb-aero/boost/boost/boost/numeric/bindings/traits/matrix_traits.hpp:102:
error: 'size1' is not a member of
'boost::numeric::bindings::traits::matrix_traits<boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
> >'
/home/iitb-aero/boost/boost/boost/numeric/bindings/traits/matrix_traits.hpp:
In function 'int boost::numeric::bindings::traits::matrix_size2(M&)
[with M = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>]':
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:116:
instantiated from 'int
boost::numeric::bindings::lapack::gesv(MatrA&, IVec&, MatrB&) [with
MatrA = boost::numeric::ublas::matrix<float,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, MatrB = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, IVec = boost::numeric::bindings::traits::detail::array<int>]'
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:139:
instantiated from 'int
boost::numeric::bindings::lapack::gesv(MatrA&, MatrB&) [with MatrA =
boost::numeric::ublas::matrix<float,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, MatrB = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>]'
exp2.cpp:35: instantiated from here
/home/iitb-aero/boost/boost/boost/numeric/bindings/traits/matrix_traits.hpp:106:
error: 'size2' is not a member of
'boost::numeric::bindings::traits::matrix_traits<boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
> >'
/home/iitb-aero/boost/boost/boost/numeric/bindings/traits/matrix_traits.hpp:
In function 'int
boost::numeric::bindings::traits::leading_dimension(M&) [with M =
boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>]':
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:116:
instantiated from 'int
boost::numeric::bindings::lapack::gesv(MatrA&, IVec&, MatrB&) [with
MatrA = boost::numeric::ublas::matrix<float,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, MatrB = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, IVec = boost::numeric::bindings::traits::detail::array<int>]'
/home/iitb-aero/boost/boost/boost/numeric/bindings/lapack/gesv.hpp:139:
instantiated from 'int
boost::numeric::bindings::lapack::gesv(MatrA&, MatrB&) [with MatrA =
boost::numeric::ublas::matrix<float,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>, MatrB = boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
>]'
exp2.cpp:35: instantiated from here
/home/iitb-aero/boost/boost/boost/numeric/bindings/traits/matrix_traits.hpp:131:
error: 'leading_dimension' is not a member of
'boost::numeric::bindings::traits::matrix_traits<boost::numeric::ublas::vector<float,
boost::numeric::ublas::unbounded_array<float, std::allocator<float> >
> >'
#########################################################
regards,
Arun