TDMS
Time Domain Maxwell Solver
All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
test_BLi_vs_cubic_interpolation.cpp File Reference

Tests the performance of bandlimited interpolation against cubic interpolation. More...

#include "interpolation_methods.h"
#include <algorithm>
#include <cmath>
#include <catch2/catch_test_macros.hpp>
#include <spdlog/spdlog.h>
#include "input_flags.h"
#include "unit_test_utils.h"
Include dependency graph for test_BLi_vs_cubic_interpolation.cpp:

Functions

double f_BLi_vs_Cubic (double x)
 
 TEST_CASE ("Benchmark: BLi is better than cubic interpolation")
 We will check that BLi gives a better approximation than cubic interpolation.
 

Detailed Description

Tests the performance of bandlimited interpolation against cubic interpolation.

Author
William Graham (ccaeg.nosp@m.ra@u.nosp@m.cl.ac.nosp@m..uk)

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "Benchmark: BLi is better than cubic interpolation"  )

We will check that BLi gives a better approximation than cubic interpolation.

The metric we will use is the norm of the error-vector. As the cell-size becomes larger (across the same domain), BLi should begin to perform better than cubic interpolation.

For the following cell sizes, over the range -2 to 2, and for the function f(x) = 1/(10x^2+1), MATLAB predicts the following errors: Cell size | BLi err | Cubic err 0.25 | 1.25953429e-02 | 3.28105674e-02 0.1 | 7.10587711e-04 | 5.49601748e-03 0.05 | 7.80325615e-04 | 5.53430587e-04 0.01 | 1.97562511e-03 | 2.06917814e-06 Values computed via the benchmark_test_BLi_vs_cubic.m script.

We will test the following:

  • The norm-error of BLi is lesser/greater than cubic in each case
  • The order of the magnitude (of BOTH) errors is the same as that obtained from MATLAB (for validation reasons)