Boost logo

Ublas :

Subject: Re: [ublas] Testing the new bindings
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2009-02-18 07:02:22


Thanks Rutger:
It appears I am having trouble with the numeric traits for the pivot vector.
 My code:

#include<boost/numeric/bindings/lapack/driver/gesv.hpp>
ublas::matrix<double, column_major> A(3,3);
A(0,0) = 2; A(0,1) = 0; A(0,2) = 0;
A(1,0) = 0; A(1,1) = 1; A(1,2) = 0;
A(2,0) = 0; A(2,1) = 0; A(2,2) = 2;

ublas::matrix<double, column_major> b(3,1);
b(0,0) = 2;
b(1,0) = 1;
b(2,0) = 2;

ublas::vector<int> ipiv(3);
//std::vector<int> ipiv (3); //tried this as well
//int ipiv[3]; //tried this as well

lapack::gesv(A, ipiv, b);

In all circumstances, it says:
1>C:\working\libraries\boost\boost/numeric/bindings/lapack/driver/gesv.hpp(71):
error: no instance of function template
"boost::numeric::bindings::traits::vector_size" matches the argument list
1> argument types are: (int *)
1> assert( traits::vector_size(traits::vector_storage(ipiv)) >=
1> ^
1> detected during:
1> instantiation of "void
boost::numeric::bindings::lapack::gesv_impl<ValueType>::compute(MatrixA &,
VectorIPIV &, MatrixB &, integer_t={int} &) [with ValueType=double,
MatrixA=boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>,
VectorIPIV=boost::numeric::ublas::vector<int,
boost::numeric::ublas::unbounded_array<int, std::allocator<int>>>,
1> MatrixB=boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 89
1> instantiation of "integer_t={int}
boost::numeric::bindings::lapack::gesv(MatrixA &, VectorIPIV &, MatrixB &)
[with MatrixA=boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>,
VectorIPIV=boost::numeric::ublas::vector<int,
boost::numeric::ublas::unbounded_array<int, std::allocator<int>>>,
MatrixB=boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
1> boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>]" at line 61 of ".\test_ublas.hpp"

To check if the problem was a missing header I threw in the following as
well and tried different pivot type permutations, to no avail:
#include<boost/numeric/bindings/traits/ublas_vector.hpp>
#include<boost/numeric/bindings/traits/ublas_matrix.hpp>
#include<boost/numeric/bindings/traits/std_vector.hpp>
#include<boost/numeric/bindings/traits/std_vector2.hpp>
#include<boost/numeric/bindings/traits/c_array.hpp>
#include<boost/numeric/bindings/traits/c_array2.hpp>

Do you expect that the interfaces to the direct drivers will stay fairly
stable? (i.e. gesv(matrixA, pivots, matrixB)?) Will there be optimal
workspaces generated for the direct drivers so you can call gesv(matrixA,
matrixB)?

Thanks,
Jesse