|
Boost : |
Subject: Re: [boost] How do you test complex transformations?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-03-18 17:57:39
On 18/03/2011 22:32, Vicente Botet wrote:
>
> Mathias Gaunard-2 wrote:
>>
>> On 18/03/2011 18:23, Vicente Botet wrote:
>>
>>> One technique could be to make the transformation by hand and keep track
>>> of
>>> the input -> output association.
>>> Another technique consist in re-implementing the algorithm and check that
>>> both implementations match.
>>
>> Checking that both implementations match is not really possible if the
>> range of all inputs is big.
>>
>> What we do to validate the precision of our math functions in the NT2
>> project is that we perform random tests and compare the results to that
>> obtained with a library that we know to be correct.
>>
>
> Hi,
>
> yes, I'm in the same situation, the samples are often generated randomly.
>
> If you are developing new algorithms, this is equivalent to implement the
> algorithm (possibly with less constraints) and compare the results. Of
> course both implementation can be wrong.
>
> If you didn't have a library that gives you the correct answer, do you think
> that you will find re-implementing the transformation a good practice?
It is usually much easier to write a correct but slow implementation
than to write a fast one.
So if the code of your algorithm is complicated because it does smart
things for speed purposes or is parallelized, it is useful to validate
it against a simple implementation that is less likely to be wrong.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk