Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-04-14 13:36:11


on 4/10/01 8:58 PM, Hubert HOLIN at Hubert.Holin_at_[hidden] wrote:

> I would like to request a review of the following three
> libraries:
>
> 1) Special functions
>
> 2) Quaternions
>
> 3) Octonions
>
> There is a simple (and necessary) dependency between the
> three: "Octonions" depends upon "Quaternions" which in turn depends
> upon "Special functions".
>
> To the best of my knowledge, I have striven to abide by the
> guidelines but one: limitation to 80 columns proved to be too
> impractical, for all files except the tests.

I can think of ways to compact your code. I want to test my ideas out
first, though.

> The libraries work correctly with Metrowerk's CodeWarrior
> compiler, MacOs version, and so should also work with their Wintel
> stuff. It is anticipated that it should work also with the Comeau
> compiler. There might be some problems with gcc (locale deficiency, or
> missing overloads for abs and sin & co), and I would welcome
> suggestions as to how to get around them (I do not currently have
> access to that compiler). I could not care less, however, about what
> M$VC++ might have to say about these libraries...
>
> These libraries have independent (though cross-referenced)
> documentation and are implemented thru three separate files (each a
> single header). They are currently packaged as the file
> "spefquatocto_sc1.tgz", which resides in the Vault.

I like math stuff, so I tried these out on my CodeWarrior compiler on the
Mac OS. I think you have version 6(.1), while I'm using 5.3, because
there's some code I can't handle.

In "special_functions.hpp", I got unimplemented feature and internal
compiler errors when processing the second versions of sinc_pi and sinhc_pi.
With the problems various compilers have with templates, I don't think it's
a good idea to depend on the rarest template feature, template-based
template parameters. That code also has the problem of possibly be
inappropriate for some types; it's OK for your quaternion and octonion
template classes, but what about stuff like rational, which would also
match. I think something like my workaround, special versions of those
functions, could be better.

In "quaternion.hpp", you needed the actual definition of
basic_ostringstream, which needed a <sstream> #include. As I said above, I
added specialized version of sinc_pi and sinhc_pi. The "octonion.hpp"
header needed those same solutions.

In "quaternion_test.cpp" and "octonion_test.cpp", I corrected the explicit
instantiation to lines like:

//=========================================================================
/*template*/ class ::boost::quaternion<int>;

/*template*/ class ::boost::octonion<int>;
//=========================================================================

I don't know if this is right, but the compiler doesn't complain because the
instantiation is never used.

The test runs came out OK; there was no difference between your supplied
output results and the ones I got.

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

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