Boost logo

Glas :

Re: [glas] value_type

From: Robert P. Goddard (Robert_Goddard_at_[hidden])
Date: 2005-10-04 14:31:00

Glas list,

A word of caution: Please make sure that the Glas value_type is not
restricted to "plain old data" that can be copied by bit-blasting. An
important class of counter-examples involves algorithmic differentiation
(see, esp. Tools therein). One approach is, you write
an efficient algorithm but leave the numeric type open as a template
parameter. When instantiated with float or double, it's fast. When
instantiated with CppAD::AD<double> (example for Brad Bell's CppAD,, it's slower, but it leaves a trail (the
"tape") that can be used by a post-processor to create an efficient
algorithm for computing the derivatives of any number of output
variables with respect to any number of input variables. To make this
work, it's essential that the AD<T> constructors, destructors,
assignment operators, etc. NOT be bypassed.

The NumericValue concept, as documented in Toon's 10/3 message, is
sufficiently general. Just don't add more constraints or limit it to a
fixed list. That is one of the mistakes (of several) that reduce the
utility of std::valarray.

Robert P. Goddard