|
Ublas : |
Subject: [ublas] Testing the new bindings
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2009-02-18 00:21:03
Hi guys:I am having trouble using the package of the bindings with the solve
function/etc in the downloaded file:
http://www.terborg.net/numeric_bindings_20090209.zip
Sorry as usual if this is an idiotic question. Please tell me if I should
update to a newer version or download directly from the sandbox.
I am using Intel C++ 11.0 on Windows binding to MKL (eventually).
When I run the following code, it won't compile:
#include<boost/numeric/bindings/lapack/lapack.h>
#include<boost/numeric/bindings/lapack/lapack_names.h>
#include<boost/numeric/bindings/lapack/workspace.hpp>
#include<boost/numeric/bindings/lapack/solve.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;
lapack::solve(A,b);
cout << b << endl;
The error I get is:
1>etk_testsuite.cpp
1>.\test_ublas.hpp(51): error: no instance of function template
"boost::numeric::bindings::lapack::solve" matches the argument list
1> argument types are: (boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real>>>, boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real>>>)
1> lapack::solve(A,b);
Now, if I put in the default optional parameter I get something that makes
it clear that it is instantiating the function, but it isn't binding
properly to the code driver.
i.e. use:
lapack::solve(A,b), optimal_workspace());
1>C:\working\libraries\boost\boost/numeric/bindings/lapack/solve.hpp(50):
error: no instance of function template
"boost::numeric::bindings::lapack::gesv_impl<ValueType>::compute [with
ValueType=double]" matches the argument list
1> argument types are: (boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real>>>, boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real>>>, int,
boost::numeric::bindings::lapack::optimal_workspace)
1> driver_routine::compute( a, b, info, work );
1> ^
1> detected during instantiation of "integer_t={int}
boost::numeric::bindings::lapack::solve(MatrixA &, MatrixB &, Workspace)
[with MatrixA=boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>,
MatrixB=boost::numeric::ublas::matrix<double,
boost::numeric::ublas::column_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>,
1>
Workspace=boost::numeric::bindings::lapack::optimal_workspace]" at line 51
of ".\test_ublas.hpp"
It appears to me doing a quick read of the sourcecode that the solve
function is calling the driver::compute(a,b, info, workspace);
where the gesv_impl is expecting: driver::compute(a, pivotvector, b, info);
I am not sure how the "workspace" is related to the pivot vectors in this
case, but calling ::compute(a, workspace, b, info) didn't help.
Thanks,
Jesse