Boost logo

Boost Users :

Subject: [Boost-users] [units][uBlas] Problems using matrix operations with dimension constraints
From: Ryan (mccorywork_at_[hidden])
Date: 2011-04-22 16:38:54


I'm currently trying to use the uBlas library with the units library and I'm
running into some problems. The matrix and vector classes I've instantiated
with unit constraints don't seem to play well with uBlas methods. Has
anyone found ways of using the two libraries together? I've included some
lines of what I'm trying to do and would really appreciate some help.

Ryan

using namespace boost::numeric::ublas;
using namespace boost::units;

//Works fine. This is expected though since dimensionless quantity can
accept
//regular built in types.
bounded_matrix<quantity<si::dimensionless, 3, 3> rotate =
identity_matrix<double>(3);

//How do I initialize a vector of dimension lengths with something like the
zero_matrix?
bounded_vector<quantity<si::length>, 3> diff = zero_matrix<double>(3) *
si::meter; //???

//Lets pretend the diff variable has values in it. This line doesn't
compile.
//The compiler is saying it can't deduce the template argument.
//What can I do to help the compiler out so I can get the correct result?
bounded_vector<quantity<si::length>, 3> result = prod(rotate, diff);



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net