Boost logo

Boost :

From: Matthias Schabel (boost_at_[hidden])
Date: 2003-12-10 22:09:29

> Beautiful code. Poetry. I did get lost, somewhere along the way.
> Lack of familiarity with MPL on my part, I guess.

Thanks for the flattery - it was fun learning how to use MPL (after
getting over my annoyance at the lack of documentation - talk about the
pot calling the kettle black, though...). I don't think I would have
had the fortitude to stick with it if MPL didn't exist. I'm eagerly
awaiting the arrival of the mpl::set since I have a number of
algorithms which are almost certainly suboptimal in efficiency.

> Haven't yet figured out where the code is that numerically scales
> values when switching between units.

The actual code to do the conversion is in the templated conversion
constructor in dimensioned_quantity.hpp, which relies on
specializations of the UnitInfo class (found in si_units.hpp, etc...)
to get the actual conversion factors for any given model.

> Have you thought of supporting run-time extensibility? I'm thinking,
> imagine someone wants to write a math package with it, and the user of
> it decides, at run-time, that luminosity per distance-squared per
> degree Kelvin is an interesting parameter to graph versus stars' iron
> content. Can she invent units at run-time and apply them to graphs?

I thought about it briefly; since most of the mpl algorithms have
nearly direct stl analogues, the translation would probably be
straightforward. For my needs, however, runtime performance is
critical, so I'm going to focus on the zero-overhead stuff (which is
harder to do well anyway) for now.

> Here's another trick question for you: The Hubble Constant, is
> measured in meters per second per light-year. Dimensionally, that's
> distance per time per distance, which simplifies to time^(-1), in
> other words, Frequency (Hz)!!! Is there, or could there be a way to
> prevent the library from simplifying things too much? ;-)

I've thought about the possibility of having dimensions comprised of
units from mixed models; I think it's possible, but probably another
significant jump in the level of difficulty in implementation (and
_even_ more compile time overhead). Maybe I'll tackle it if there
emerges a consensus that my approach is a worthwhile and there's
sufficient interest in something esoteric like that...


Matthias Schabel, Ph.D.
Utah Center for Advanced Imaging Research
729 Arapeen Drive
Salt Lake City, UT 84108
801-587-9413 (work)
801-585-3592 (fax)
801-706-5760 (cell)
801-484-0811 (home)
mschabel at ucair med utah edu

Boost list run by bdawes at, gregod at, cpdaniel at, john at