Subject: Re: [boost] different matrix library?
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2009-08-14 13:37:15
> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]]
> Behalf Of joel
> Sent: 14 August 2009 17:46
> To: boost_at_[hidden]
> Subject: Re: [boost] different matrix library?
> You should have one matrix class whose tempalte parameters allow for
> Want a matrix with static data : matrix<float, settings<static_> >
This is a really good idea - but can appear (and be!) quite complicated - if
you want an example of policies and their use, you might like to look at the
documentation (and the source code later) of John Maddock's Boost Math
In the Math Toolkit, a template parameter allows one to control what happens
when a math function call causes trouble - like going to infinity. You can
choose to return std::numeric_limits infinity, or max, throw an exception,
define your own special policy even, or ignore it completely. All the
options have some merit.
The most popular is chosen as the default for the math function. If users
don't care, or don't understand policies, they get the default - which is
hopefully what they wanted anyway. Users still have fine-grained choice that
is quite easy to use.
The downside is that it badly obscures the source code to readers and is a
whole lot of work to implement for the writer. And even more trouble to
test - even corner cases mount up horribly. Documenting it takes yet more
effort. Finally maintenance later is made more difficult.
It may be best to add policies when the code is reasonably stable for what
you guess is the default?
--- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow_at_[hidden]