|
Boost : |
From: David Bergman (davidb_at_[hidden])
Date: 2003-10-15 14:32:16
David wrote:
> David Abrahams wrote:
> > David Richardson wrote:
> >
> >> Deane Yang wrote:
> >>
> >>> c) Automatic generation of new types when two different
> quantities
> >>> are multiplied or divided
> >>
> >> I'm a bit confused how this would work (maybe because I've been
> >> thinking about this as a physics problem). Do we just pick an
> >> arbtrary rule for the production of new types/units?
> >
> >
> > No, mathematics gives the rules. You can see examples in
> my slides at
> > http://www.boost-consulting.com/writing/ACCU_MPL_slides.ppt
>
> The slides have examples where the units are from physics.
> So you represent a number's units as a n-tuple of exponents
> with each exponent corresponding to one of the fundamental SI units.
> Arithmetic operations on numbers with these units have well
> defined rules to compute the resulting units.
If we want to be really generic, we could skip vector spaces and go directly
to Clifford Algebras, and allow for addition of dimensionally separate
entities, ending up with units such as "m^2 + s" ;-)
In general, I like the idea of having one library for dimensionality
operators, for vector spaces in general, and then have a "physics library"
attached to that one. We should not be too attached to physics, since there
are applications elsewhere. What could reside in the generic dimensionality
operator library is "preferred unit" for a given dimension, in case we have
linear variants (meter and feet, liter and gallon...)
/David (one of many)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk