diff options
author | Thomas White <taw@physics.org> | 2015-04-14 22:57:27 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2015-04-20 15:50:40 +0200 |
commit | 3d39e8fb7688f6469b060cd1b05f62348ea32c1a (patch) | |
tree | 33ec5becd5fb1423b9a1ef89fe09a9aa0497015b | |
parent | b566a61d7822c66034563f34920d6e9d3b8a36de (diff) |
Avoid testing gradients which don't make sense
-rw-r--r-- | tests/prediction_gradient_check.c | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/tests/prediction_gradient_check.c b/tests/prediction_gradient_check.c index 21c4088e..18c9f023 100644 --- a/tests/prediction_gradient_check.c +++ b/tests/prediction_gradient_check.c @@ -467,31 +467,39 @@ int main(int argc, char *argv[]) cell_get_reciprocal(rot, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz); - incr_val = incr_frac * ax; - val = test_gradients(cr, incr_val, GPARAM_ASX, "ax*", "ax", - quiet, plot); - if ( val < 0.99 ) fail = 1; - incr_val = incr_frac * bx; - val = test_gradients(cr, incr_val, GPARAM_BSX, "bx*", "bx", - quiet, plot); - if ( val < 0.99 ) fail = 1; - incr_val = incr_frac * cx; - val = test_gradients(cr, incr_val, GPARAM_CSX, "cx*", "cx", - quiet, plot); - if ( val < 0.99 ) fail = 1; + if ( checkrxy != 2 ) { + + incr_val = incr_frac * ax; + val = test_gradients(cr, incr_val, GPARAM_ASX, + "ax*", "ax", quiet, plot); + if ( val < 0.99 ) fail = 1; + incr_val = incr_frac * bx; + val = test_gradients(cr, incr_val, GPARAM_BSX, + "bx*", "bx", quiet, plot); + if ( val < 0.99 ) fail = 1; + incr_val = incr_frac * cx; + val = test_gradients(cr, incr_val, GPARAM_CSX, + "cx*", "cx", quiet, plot); + if ( val < 0.99 ) fail = 1; - incr_val = incr_frac * ay; - val = test_gradients(cr, incr_val, GPARAM_ASY, "ay*", "ay", - quiet, plot); - if ( val < 0.99 ) fail = 1; - incr_val = incr_frac * by; - val = test_gradients(cr, incr_val, GPARAM_BSY, "by*", "by", - quiet, plot); - if ( val < 0.99 ) fail = 1; - incr_val = incr_frac * cy; - val = test_gradients(cr, incr_val, GPARAM_CSY, "cy*", "cy", - quiet, plot); - if ( val < 0.99 ) fail = 1; + } + + if ( checkrxy != 1 ) { + + incr_val = incr_frac * ay; + val = test_gradients(cr, incr_val, GPARAM_ASY, + "ay*", "ay", quiet, plot); + if ( val < 0.99 ) fail = 1; + incr_val = incr_frac * by; + val = test_gradients(cr, incr_val, GPARAM_BSY, + "by*", "by", quiet, plot); + if ( val < 0.99 ) fail = 1; + incr_val = incr_frac * cy; + val = test_gradients(cr, incr_val, GPARAM_CSY, + "cy*", "cy", quiet, plot); + if ( val < 0.99 ) fail = 1; + + } incr_val = incr_frac * az; val = test_gradients(cr, incr_val, GPARAM_ASZ, "az*", "az", |