Boost logo

Boost :

From: Dean Foster (foster_at_[hidden])
Date: 2001-10-01 16:26:08


> What about assigning a different prime number to each dimension, and
> representing multiplication of units as multiplication of the associated
> primes?

This would be great espicially if we could work mod-a-prime. Using
the GCD I think we can find the multiplicative inverse mod-a-prime.
Then division can be represented also. I don't think you get unique
factorizations when working mod-a-prime. So it still only provides
limited protection. But good enough to prove that most illegal
conversions would be caught with high probability.

> It also solves the decomposition problem (extracting the basic units and
> their exponents from a composite unit), which I suspect may be a
> showstopper for your addition-of-hash-values approach.

I wasn't planning on providing any way of extracting basic units from
the hash values. Should these be desired, probably a trait class
could be added to compute them. But I don't think it is actually
important to be able to do. These ARE compile time classes, so it
isn't as if we need to dynamically figure out the units.

dean

=============================================================================
Dean Foster dean_at_[hidden]
Statistics, Wharton, U. Penn 215 898 8233
Philadelphia PA 19104-6302 http://diskworld.wharton.upenn.edu


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk