From 5344028c40ce984f69dbf8eb779722ad2b3aa139 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 17 Aug 2010 17:49:16 +0200 Subject: [PATCH] Use 5% critical region for number of runs This results in more samples used in regression and slightly improved response with high jitters. --- regress.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/regress.c b/regress.c index 6913fed..7adbb10 100644 --- a/regress.c +++ b/regress.c @@ -172,23 +172,23 @@ typedef struct { } RegressionResult; /* ================================================== */ -/* Critical value for number of runs of residuals with same sign. 10% - critical region for now */ +/* Critical value for number of runs of residuals with same sign. + 5% critical region for now. */ -static char critical_runs10[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, - 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, - 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, - 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, - 17, 17, 17, 18, 18, 19, 19, 20, 20, 21, - 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, - 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, - 30, 31, 31, 32, 32, 32, 33, 33, 34, 34, - 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, - 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, - 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, - 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, - 54, 54, 54, 55, 55, 56, 56, 57, 57, 58 +static char critical_runs[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, + 3, 3, 4, 4, 5, 5, 5, 6, 6, 7, + 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, + 11, 11, 12, 12, 13, 13, 14, 14, 14, 15, + 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, + 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, + 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, + 29, 29, 30, 30, 30, 31, 31, 32, 32, 33, + 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, + 38, 38, 39, 39, 40, 40, 40, 41, 41, 42, + 42, 43, 43, 44, 44, 45, 45, 46, 46, 46, + 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, + 52, 52, 52, 53, 53, 54, 54, 55, 55, 56 }; /* ================================================== */ @@ -260,7 +260,7 @@ RGR_FindBestRegression int i; assert(n <= MAX_POINTS); - assert(n * REGRESS_RUNS_RATIO < sizeof (critical_runs10) / sizeof (critical_runs10[0])); + assert(n * REGRESS_RUNS_RATIO < sizeof (critical_runs) / sizeof (critical_runs[0])); if (n < MIN_SAMPLES_FOR_REGRESS) { return 0; @@ -300,7 +300,7 @@ RGR_FindBestRegression /* Count number of runs */ nruns = n_runs_from_residuals(resid, n - resid_start); - if (nruns > critical_runs10[n - resid_start] || n - start <= MIN_SAMPLES_FOR_REGRESS) { + if (nruns > critical_runs[n - resid_start] || n - start <= MIN_SAMPLES_FOR_REGRESS) { break; } else { /* Try dropping one sample at a time until the runs test passes. */ @@ -637,7 +637,7 @@ RGR_FindBestRobustRegression nruns = n_runs_from_residuals(resids + start, n_points); - if (nruns > critical_runs10[n_points]) { + if (nruns > critical_runs[n_points]) { break; } else { start++;