5 integer,
parameter :: dp = kind(0.0d0)
6 integer,
parameter :: n_points = 1024
7 integer,
parameter :: n_samples = 2**20
8 real(dp),
allocatable :: x(:)
13 lt(1) =
lt_create(0.0_dp, 1.0_dp, n_points, n_cols=0, &
15 lt(2) =
lt_create(0.0_dp, 1.0_dp, n_points, n_cols=0, &
17 lt(3) =
lt_create(0.0_dp, 1.0_dp, n_points, n_cols=0, &
20 allocate(x(n_samples))
28 if (x(n) < lt(k)%x(loc%low_ix) .or. x(n) > lt(k)%x(loc%low_ix+1))
then
29 print *,
"For table with xspacing of order", k
30 print *, lt(k)%x(loc%low_ix), x(n), lt(k)%x(loc%low_ix+1)
31 error stop
"FAIL (should have xa <= x <= xb)"
A Fortran 90 module for creating lookup tables. These tables can be used to efficiently interpolate o...
type(lt_t) function, public lt_create(x_min, x_max, n_points, n_cols, xspacing, extrapolate_above)
This function returns a new lookup table.
integer, parameter, public lt_xspacing_cubic
integer, parameter, public lt_xspacing_linear
integer, parameter, public lt_xspacing_quadratic
elemental type(lt_loc_t) function, public lt_get_loc(my_lt, x)
Get a location in the lookup table.
Type to indicate a location in the lookup table, which can be used to speed up multiple lookups of di...
The lookup table type. There can be one or more columns, for which values can be looked up for a give...
program test_lookup_table_index