Boost.Units and Ublas and Math
Hi, I have been trying to use ublas with a user-defined numeric type and have been having problems with that--problems with resolving sqrt etc since the sqrt in ublas invokes std::sqrt. I wanted to use the policy and exception handling in the Math library with the ublas class, but I haven't been able to figure out the helper functions that would allow the use of my numeric types. Can this be done? Any suggestions would be appreciated. My next step would be to add units to the numeric values--assuming this can be done in the context of ublas. Is it possible to use Boost.Units and Boost.Ublas together? For example create a ublas vector of positions? What's the best approach for arithmetic operations, units, vectors, matrices, and user-defined exceptions using Boost? Thanks for your help, Pat
AMDG Pat Hawley wrote:
My next step would be to add units to the numeric values--assuming this can be done in the context of ublas.
Is it possible to use Boost.Units and Boost.Ublas together? For example create a ublas vector of positions?
It is possible to create such a vector, but there isn't a whole lot you can do with it. You certainly won't be able to do anything that requires quantities to be multiplied and divided inside uBlas. In Christ, Steven Watanabe
Pat Hawley wrote:
My next step would be to add units to the numeric values--assuming this can be done in the context of ublas.
Is it possible to use Boost.Units and Boost.Ublas together? For example create a ublas vector of positions?
It is possible to create such a vector, but there isn't a whole lot you can do with it. You certainly won't be able to do anything that requires quantities to be multiplied and divided inside uBlas.
*vector
is vector ... In
The problem being that ublas currently does not correctly resolve the
value type for arithmetic operations. For "normal" numeric types, even
if not strictly correct, this is usually not a problem : the type of
vector<double>*vector<double> is vector<double>. Since all the unit
magic in Boost.Units is encoded in the types, this isn't true with
quantities : the type of vector
AMDG Matthias Schabel wrote:
*vector
is vector ... In The problem being that ublas currently does not correctly resolve the value type for arithmetic operations. For "normal" numeric types, even if not strictly correct, this is usually not a problem : the type of vector<double>*vector<double> is vector<double>. Since all the unit magic in Boost.Units is encoded in the types, this isn't true with quantities : the type of vector
I've started working on it, and it's actually pretty easy. I already have matrix multiplication working. In Christ, Steven Watanabe
Steven Watanabe
AMDG
Pat Hawley wrote:
It is possible to create such a vector, but there isn't a whole lot you can do with it. You certainly won't be able to do anything that requires quantities to be multiplied and divided inside uBlas.
In Christ, Steven Watanabe
Is the better approach to use another container with Units? Which container class would be compatible? Thanks, Pat
participants (3)
-
Matthias Schabel
-
Pat Hawley
-
Steven Watanabe