[Developers] [Patches] Make ADMConstraints GF public
jthorn at aei.mpg.de
Mon Sep 18 01:39:08 CDT 2006
On Mon, 18 Sep 2006, Luca Baiotti wrote:
> what about comparing the numbers in the data character by character and
> checking whether only the rightmost character (or the two rightmost
> ones) differ by at most a unit, while all the others are identical?
Then 0.499999999999 and 0.500000000000 compare "different". :(
This example shows we really need to compare *numbers*, not *strings*.
The standard ways to do "fuzzy comparison" of numbers in numerical
// absolute error tolerance
x fuzzy_eq y <==> |x-y| <= epsilon
// relative error tolerance
x fuzzy_eq y <==> |x-y| <= epsilon*max(|x|,|y|)
// mixed relative-absolute error tolerance
x fuzzy_eq y <==> |x-y| <= epsilon_abs + epsilon_rel*max(|x|,|y|)
The last of these is probably best for general use. It is used, for
example, by the ODEPACK ODE-solver codes (http://www.netlib.org/odepack/).
However, in Cactus things are more complicated -- we want to compare
*grid functions*, where we can have things like (to use made-up data)
true result = 1.0e-3 * sin(x*1.234)
numerical result = 1.0000001e-3 * sin(x*1.23400001)
so that the zero crossings of the true & numerical gridfns occur in
slightly different places. This suggests something along the lines
of my previous message, where we incorporate a norm of the gridfn
into the pointwise comparison, i.e. for gridfns f and g,
f fuzzy_eq g <==> at all points,
|f-g| <= epsilon_abs + epsilon_rel*max(||f||, ||g||)
I would like to see Cactus allow this (with the parameters epsilon_abs,
epsilon_rel, and the choice of the norm ||.|| specified in the testsuite
test.ccl control file).
(The norm ||f|| could reasonably be any of the infinity-norm,
the 1-norm [average of |f| over the grid], or the root-mean-square
norm [sqrt(average of f^2 over the grid)].)
-- Jonathan Thornburg <jthorn at aei.mpg.de>
Max-Planck-Institut fuer Gravitationsphysik (Albert-Einstein-Institut),
Golm, Germany, "Old Europe" http://www.aei.mpg.de/~jthorn/home.html
"Washing one's hands of the conflict between the powerful and the
powerless means to side with the powerful, not to be neutral."
-- quote by Freire / poster by Oxfam
More information about the Developers