commit 83bcb658fe11bb59afa6f4572067fceb185362b7
parent 70ac4cf4b0ca453cd0c5dfe634c64b6eb7e45a1d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 11 Mar 2024 14:44:24 +0100
Delete unnecessary function swf_tabulation_max_x_error
In fact, the estimated error gave no indication of the accuracy of the
tabulation. For example, the error with quadratic extrapolation was so
overestimated that it was greater than the estimated error with linear
interpolation, whereas in practice, quadratic extrapolation gives better
results.
Diffstat:
2 files changed, 0 insertions(+), 38 deletions(-)
diff --git a/src/swf.h b/src/swf.h
@@ -101,12 +101,6 @@ swf_tabulation_inverse
const enum swf_interpolation interpolation,
const double y); /* in [0, 1[ */
-/* Estimation of maximum tabulation error on X */
-SWF_API double
-swf_tabulation_max_x_error
- (const struct swf_tabulation* tab,
- const enum swf_interpolation interpolation);
-
END_DECLS
#endif /* SWF_H */
diff --git a/src/swf_tabulation.c b/src/swf_tabulation.c
@@ -137,38 +137,6 @@ swf_tabulation_inverse
return x;
}
-double
-swf_tabulation_max_x_error
- (const struct swf_tabulation* tab,
- const enum swf_interpolation interpolation)
-{
- const struct item* items = NULL;
- size_t i, n;
- double max_error = 0;
- ASSERT(tab);
- ASSERT(interpolation == SWF_LINEAR || interpolation == SWF_QUADRATIC);
-
- items = darray_item_cdata_get(&tab->items);
- n = darray_item_size_get(&tab->items);
-
- FOR_EACH(i, 1, n) {
- const double delta = items[i].x - items[i-1].x;
- double err = INF;
-
- switch(interpolation) {
- case SWF_LINEAR:
- err = (items[i].d2fx * (delta*delta)/2.0) / items[i].dfx;
- break;
- case SWF_QUADRATIC:
- err = (items[i].d3fx * (delta*delta*delta)/6.0) / items[i].dfx;
- break;
- default: FATAL("Unreachable code\n"); break;
- }
- max_error = MMAX(max_error, err);
- }
- return max_error;
-}
-
/*******************************************************************************
* Local functions
******************************************************************************/