Using boostbindings with lapack

P

Preben

Hi,

don't know if this is the correct group, but try anyway.

I would like to use boostbindings from the boost sandbox together with
my project where I use boost::numeric::ublas vectors and matrices.

I would guess that I could use these directly with the bindings in the
boost sandbox like:

----
#include <boost/numeric/bindings/lapack/gesv.hpp>
#include "MechComputer.hpp"

#include <iostream>

using namespace boost::numeric;
namespace lapack = boost::numeric::bindings::lapack;
using namespace std;


namespace rw {
namespace dynamics {
MechComputer::MechComputer(const MechSystem& msystem,
const ublas::vector<double>& q0,
const ublas::vector<double>& v0)
: _system(msystem), _q(q0), _v(v0) {
}


const ublas::vector<double>& MechComputer::step(double h) {
ublas::matrix<double> dG = _system.DConstraints(_q);
std::vector<ublas::matrix<double> > ddG =
_system.DDConstraints(_q);
ublas::vector<double> dV = _system.DV(_q);
ublas::vector<double> m = _system.GetMass();

ublas::matrix<double> mM = M(dG, m);
ublas::vector<double> vFT = mFmT(dG, ddG, dV, _v, m);

ublas::matrix<double> B(vFT.size(), 1);

lapack::gesv(M,B); // Result in B

return m; // Just return something
}
}
}
----

Compiling with this command-line:
----
preben@thinkgen ~/working/master/src $ icc -I
/home/preben/working/boost-sandbox -c MechComputer.cpp
MechComputer.cpp(31): error: no instance of overloaded function
"boost::numeric::bindings::lapack::gesv" matches the argument list
argument types are: (boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>>>
(const boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>>>
&, const boost::numeric::ublas::vector<double,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>>>
&), boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>>>)
lapack::gesv(M,B); // Result in B
^

compilation aborted for MechComputer.cpp (code 2)
preben@thinkgen ~/working/master/src $
----

I don't understand the error and why it's wrong.
g++ complains even more and the error message is even more unclear for me.


/ Preben
 
M

mlimber

Preben said:
don't know if this is the correct group, but try anyway.

I would like to use boostbindings from the boost sandbox together with
my project where I use boost::numeric::ublas vectors and matrices.

I would guess that I could use these directly with the bindings in the
boost sandbox like:

----
#include <boost/numeric/bindings/lapack/gesv.hpp>
#include "MechComputer.hpp"

#include <iostream>

using namespace boost::numeric;
namespace lapack = boost::numeric::bindings::lapack;
using namespace std;


namespace rw {
namespace dynamics {
MechComputer::MechComputer(const MechSystem& msystem,
const ublas::vector<double>& q0,
const ublas::vector<double>& v0)
: _system(msystem), _q(q0), _v(v0) {
}


const ublas::vector<double>& MechComputer::step(double h) {
ublas::matrix<double> dG = _system.DConstraints(_q);
std::vector<ublas::matrix<double> > ddG =
_system.DDConstraints(_q);
ublas::vector<double> dV = _system.DV(_q);
ublas::vector<double> m = _system.GetMass();

ublas::matrix<double> mM = M(dG, m);
ublas::vector<double> vFT = mFmT(dG, ddG, dV, _v, m);

ublas::matrix<double> B(vFT.size(), 1);

lapack::gesv(M,B); // Result in B

return m; // Just return something
}
}
}
----

Compiling with this command-line:
----
preben@thinkgen ~/working/master/src $ icc -I
/home/preben/working/boost-sandbox -c MechComputer.cpp
MechComputer.cpp(31): error: no instance of overloaded function
"boost::numeric::bindings::lapack::gesv" matches the argument list
argument types are: (boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>>>
(const boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>>>
&, const boost::numeric::ublas::vector<double,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>>>
&), boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>>>)
lapack::gesv(M,B); // Result in B
^

compilation aborted for MechComputer.cpp (code 2)
preben@thinkgen ~/working/master/src $

Probably better to try the Boost User list. Also, you might consider
using STLFilt to make template error messages more readable.

Cheers! --M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,049
Members
48,769
Latest member
Clifft

Latest Threads

Top