Boost logo

Boost Users :

From: Andy Little (andy_at_[hidden])
Date: 2005-10-17 05:03:17


"Malte Clasen" wrote

> Now it's tempting to use boost uBLAS with these quantities: A position
> in space can be expressed as a vector of length quantities etc. But
> there's one problem:
>
> "// uBLAS assumes a common return type for all binary arithmetic operators"
> (traits.hpp, line 42, boost release 1.33)
>
> The promote_traits class relies on this when computing the following:

(FWIW Boost.Typeof could be tried here instead of promote_traits)

> static const std::size_t size = sizeof (
> type_deduction_detail::test<
> typename base_type::x_type
> , typename base_type::y_type
> >(x + y) // Use x+y to stand of all the arithmetic actions
> );

I died some experiments on matrices with my quantities library pqs.
http://www.servocomm.freeserve.co.uk/Cpp/physical_quantity/index.html

I dont believe a simple use in UBLAS is possible because the members of a
quantity<> matrix arent all the same type.
Here for example are a couple of types representing homogeneous vectors and
transformation matrices for 2D transforms.

 PQ == the physical-quantity parameter type ( eg length::m)
 K/PQ == the 'reciprocal' of the type ( eg reciprocal_length::div_m ( }
 N == numeric type ( eg double)

 rc_matrix<PQ>( // 2D transformation matrix laid out in row/column format
//using a tuple of tuples
  N, N, K/PQ,
  N, N, K/PQ,
  PQ, PQ, N
 );

   row_vector<PQ>( // 2D vertex in homogeneous coordinates implicit
//conversion to/from x,y vertex<PQ>.
  N, N, K/PQ
  );

However I an pretty sure that UBLAS isnt laid out this way!

regards
Andy Little


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