### add -lrinterpolate to the cflags

parent 921c661f
 ... ... @@ -3,21 +3,21 @@ librinterpolate: a library to perform linear interpolation on a constant gridded dataset. (c) Robert Izzard 2005-2019 Usage: Usage: The table should be organised (in memory) like this ``` p1 p2 p3 ... d1 d2 d3 d4 ... p1 p2 p3 ... d1 d2 d3 d4 ... p1 p2 p3 ... d1 d2 d3 d4 ... p1 p2 p3 ... d1 d2 d3 d4 ... p1 p2 p3 ... d1 d2 d3 d4 ... p1 p2 p3 ... d1 d2 d3 d4 ... ``` so there are n parameters (p1, p2, p3...) and d data items per data line (d1, d2, d3, d4 ...). There are l lines of data. The parameters should be ordered from low to high values. The parameters should be ordered from low to high values. The parameters should be on aconstant* grid (which does NOT need to be regular). ... ... @@ -37,13 +37,13 @@ This is a good data table: 0.3 -100 30 ...data... 0.3 -50 10 ...data... 0.3 -50 25 ...data... 0.3 -50 30 ...data... 0.3 -50 30 ...data... 0.9 -100 10 ...data... 0.9 -100 25 ...data... 0.9 -100 30 ...data... 0.9 -50 10 ...data... 0.9 -50 25 ...data... 0.9 -50 30 ...data... 0.9 -50 30 ...data... ``` ... ... @@ -65,9 +65,9 @@ Note that the table is assumed to be sorted from SMALLEST to LARGEST parameter values. It is also assumed to be regular and filled. So no missing data please, just put some dummy values in the table. In order to interpolate data, n parameters are passed into this In order to interpolate data, n parameters are passed into this routine in the array x. The result of the interpolation is put into the array r (of size d). into the array r (of size d). If you enable RINTERPOLATE_CACHE (set on by default) then results are cached to avoid slowing the code too much. This means ... ... @@ -86,13 +86,13 @@ in the above it is 8, for simple 1D linear interpolation it would be the two spanning values). Linear interpolation is then done in the largest dimension, above this is the third parameter (p2), then the second (p1) and finally on the remaining variable (p0). This would reduce the table from 2^3 lines to 2^2 to 2^1 to (finally) 2^0 i.e. one line which is the from 2^3 lines to 2^2 to 2^1 to (finally) 2^0 i.e. one line which is the interpolation result. To find the spanning lines a binary search is performed. This code was originally donated by Evert Glebbeek. See e.g. donated by Evert Glebbeek. See e.g. http://en.wikipedia.org/wiki/Binary_search_algorithm and note the comment "Although the basic idea of binary search is comparatively and note the comment "Although the basic idea of binary search is comparatively straightforward, the details can be surprisingly tricky... " haha! :) Each table has its own unique table_id number. This is just to allow ... ... @@ -107,38 +107,38 @@ Example code is given in test_rinterpolate.c and reproduced here ``` /* Number of parameters */ const rinterpolate_counter_t N = 2; /* Number of data */ const rinterpolate_counter_t D = 3; /* length of each line (in doubles) i.e. N+D */ const rinterpolate_counter_t ND = N + D; /* total number of lines */ const rinterpolate_counter_t L = 100; /* make rinterpolate data (for cache etc.) */ /* make rinterpolate data (for cache etc.) */ struct rinterpolate_data_t * rinterpolate_data = NULL; rinterpolate_counter_t status = rinterpolate_alloc_data(&rinterpolate_data); rinterpolate_counter_t status = rinterpolate_alloc_dataspace(&rinterpolate_data); /* data table : it is up to you to set the data in here*/ rinterpolate_float_t table[ND*L]; rinterpolate_float_t table[ND*L]; /* ... set the data ... */ /* * Arrays for the interpolation location and * interpolated data. You need to set * Arrays for the interpolation location and * interpolated data. You need to set * the interpolation location, x. */ rinterpolate_float_t x[N],r[D]; /* ... set the x array ... */ /* choose whether to cache (0=no, 1=yes) */ int usecache = 1; int usecache = 1; /* do the interpolation */ rinterpolate(table, rinterpolate_data, ... ... @@ -150,22 +150,22 @@ Example code is given in test_rinterpolate.c and reproduced here usecache); /* the array r contains the result */ /* ... rest of code ... */ /* free memory on exit */ rinterpolate_free_data(rinterpolate_data); Safe_free(rinterpolate_data); ``` I have optimized this as best I can, please let me know if you can squeeze any more speed out of the function. I am sorry this has made most of the function unreadable! The I am sorry this has made most of the function unreadable! The comments should help, but you will need to know some tricks... (c) Robert Izzard, 2005-2019, please send bug fixes! \ No newline at end of file
 ... ... @@ -29,7 +29,7 @@ int main (int argc, } else if(strncmp(c,"cflags",6)==0) { printf("-I%s%s/%s\n",DESTDIR,PREFIX,"include"); printf("-lrinterpolate -I%s%s/%s\n",DESTDIR,PREFIX,"include"); } else if(strncmp(c,"version",7)==0) { ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!