|
Boost : |
From: Matthias Troyer (troyer_at_[hidden])
Date: 2006-08-20 08:28:59
On Aug 20, 2006, at 10:42 AM, Andy Little wrote:
>
> "Janek Kozicki" <janek_listy_at_[hidden]> wrote in message
> news:20060819212430.739b0920_at_absurd...
>> Andy Little said: (by the date of Sat, 19 Aug 2006 13:03:42
>> +0100)
>>
>>> In fact there is a 2D and 3d vector in quan so you can do:
>>>
>>> quan::some_vect< quan::length:: m > position_a, position_b;
>>>
>>> quan::length:: m distance_a_to_b = magnitude(position_b -
>>> position_a);
>>>
>>> Because of that useage It might get confusing.
>>
>> I still hold my position that linear algerbra library should not be a
>> part of _two_ separate libraries: Dimensions and Units.
>
> FWIW I brought this up only in relation to magnitude. That said, I
> have found
> that being able to write code like the above is a lot of fun, much
> more so than
> if I was using doubles to represent lengths. However suddenly you are
> restricted in what you can do. For example:
>
> double var1= 10; // var1 meters
> double var2 = 10 ; // var2 represents meters.
>
> var1 *= var2 ; // var1 now represents an area in square meters.
>
> Of course you cant do this with a fixed_quantity:
>
> quan::length::m var1(10);
> quan::length::m var2(10);
> var1 *= var2 ; // Error
>
>
> I would guess that is an unacceptable restriction for many authors
> of algebra
> libraries.
Why should this be an unacceptable restriction? All it says is that a
quantity with units is not a field, but that is obvious from the
start. I can multiply a vector (3m, 2m, 1m) by a factor of 5 but not
by a factor of 5m. I see no problem here at all, except if you assume
that the element type of a vector is the same type as the scalar
factor in your expression.
> As far as I am concerned though I am more interested to see what
> happens if I do
> play by the rules that are imposed by having strongly typed
> quantities, but it
> is kind of difficult to ask everyone to play by these rules, so I
> am happy to
> create vector types myself, that work with Quan.
I don't see any reason why a correctly designed linera algebra
library should not work with quantities with units
>
> Maybe, if we can get Quan into Boost then we will be in a stronger
> position and
> there may then be interest in creating a linear generic algebra
> library for
> physical quantities, but I suspect that due to the above kind of
> issues, there
> will always be a great divide between a 'raw' linear algebra
> library and one
> that is designed to work with physical quantities.
I don't agree. For me there is no such thing as 'raw' linear
algebra. All linear algebra concepts work perfectly with quantities
with units.
matthias
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk