[units][uBlas] Problems using matrix operations with dimension constraints

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

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
rotate = identity_matrix<double>(3); //How do I initialize a vector of dimension lengths with something like the zero_matrix? bounded_vector
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
si::length, 3> result = prod(rotate, diff);
uBlas doesn't currently support value types that have unconventional algebra (i.e. typeof(X*Y) != typeof(X)). It could be fixed, but would require injection of the XXX_typeof_helper operators (or decltype) throughout the library. I don't use uBlas and I'm not aware of any effort to do this as yet. Would be a good project, though... Matthias

On Wed, Apr 27, 2011 at 12:37 PM, Matthias Schabel wrote: It could be fixed, but would require injection of the XXX_typeof_helper
operators (or decltype) throughout the library. What is the level of difficulty? Two months, four months or a lot longer? I don't use uBlas and I'm not aware of any effort to do this as yet. Would
be a good project, though... Is this even on the uBlas developers road map? It seemed like
an obvious synergy for these two libraries.
Thank you for your response. It lets me create a couple of quick methods to
accomplish what I need rather than trying to find just the right syntax to
get it to work.
Ryan

It could be fixed, but would require injection of the XXX_typeof_helper operators (or decltype) throughout the library.
What is the level of difficulty? Two months, four months or a lot longer?
I don't know enough about the internals of uBlas to say; I use an array library I wrote myself and retrofitting that library took me a week or so, including testing. I imaging it could be done in a couple of months of concerted effort by a competent programmer.
I don't use uBlas and I'm not aware of any effort to do this as yet. Would be a good project, though...
Is this even on the uBlas developers road map? It seemed like an obvious synergy for these two libraries.
Not that I know of. The issue has been raised before, but there didn't seem to be much interest in the uBlas community. I agree that it is an obvious synergy; it would also make uBlas more correct in general.
Thank you for your response. It lets me create a couple of quick methods to accomplish what I need rather than trying to find just the right syntax to get it to work.
Happy to help. Good luck - if you do decide to extend uBlas, I imagine that the work would be well-received. Matthias
participants (2)
-
Matthias Schabel
-
Ryan