Commit 73902acc authored by Izzard, Robert Dr (Physics)'s avatar Izzard, Robert Dr (Physics)

Merge branch 'master' of gitlab.eps.surrey.ac.uk:ri0005/librinterpolate

parents 01e4155c 11d97b2a
Version 1.5 04/09/2019
Updated formatting of function macros to binary_c coding standards.
Version 1.3 Monday 01/04/2019
No April fool! I've rewritten the code to be more
......
......@@ -12,7 +12,7 @@ C_SRC := $(wildcard *.c)
OBJECTS := $(C_SRC:.c=.o)
#OBJECTS := rinterpolate.o rinterpolate-debug.o
LIBRINTERPOLATE_ARCHFLAGS ?= -march=native -mtune=native
CFLAGS := -fPIC -O2 -g $(LIBRINTERPOLATE_ARCHFLAGS) -Wall -Wstrict-prototypes -ffast-math -D__RINTERPOLATE__ -D__RINTERPOLATE_BUILD_BUILD_FLAGS__ $(COPTFLAGS)
CFLAGS := -fPIC -O2 -g $(LIBRINTERPOLATE_ARCHFLAGS) -Wall -Wstrict-prototypes -ffast-math -D__RINTERPOLATE__ -D__RINTERPOLATE_BUILD_BUILD_FLAGS__ $(COPTFLAGS)
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
......
......@@ -137,7 +137,7 @@
* are using. Usually 5 is good, less means faster cache compares
* but you're less likely to match!
*
* Note: uses FEQUAL macros to check for floating-point equality, you should
* Note: uses Fequal macros to check for floating-point equality, you should
* check that TINY (current the smallest floating point epsilon)
* is small enough for your parameters, or rescale your
* parameters so they are much bigger than TINY (that's best,
......@@ -149,13 +149,13 @@
struct rinterpolate_data_t * rinterpolate(
const rinterpolate_float_t * RESTRICT datatable, // (pointer to) the data table
const rinterpolate_float_t * RESTRICT const datatable, // (const pointer to) the data table
struct rinterpolate_data_t * rinterpolate_data, // where rinterpolate stores data
const rinterpolate_counter_t n, // the number of parameters (i.e. dimensions)
const rinterpolate_counter_t d, // the number of data items
const rinterpolate_counter_t l, // the number of lines of data
const rinterpolate_float_t * RESTRICT x, // the values of the parameters
rinterpolate_float_t * RESTRICT r, // the result of the interpolation
const rinterpolate_float_t * RESTRICT const x, // the values of the parameters
rinterpolate_float_t * RESTRICT const r, // the result of the interpolation
const rinterpolate_counter_t cache_length // number of cache lines
)
{
......
......@@ -21,9 +21,9 @@
* rinterpolate's macros
*************************************************************/
#define RINTERPOLATE_VERSION "1.3"
#define RINTERPOLATE_VERSION "1.5"
#define RINTERPOLATE_MAJOR_VERSION 1
#define RINTERPOLATE_MINOR_VERSION 3
#define RINTERPOLATE_MINOR_VERSION 5
/* types */
typedef unsigned int rinterpolate_counter_t;
......@@ -61,9 +61,9 @@ typedef unsigned int rinterpolate_Boolean_t;
/*
* Use standard *alloc
*/
#define RINTERPOLATE_MALLOC(A) malloc(A)
#define RINTERPOLATE_CALLOC(A,B) calloc((A),(B))
#define RINTERPOLATE_REALLOC(A,B) realloc((A),(B))
#define Rinterpolate_malloc(A) malloc(A)
#define Rinterpolate_calloc(A,B) calloc((A),(B))
#define Rinterpolate_realloc(A,B) realloc((A),(B))
/*
* In some places I have different algorithms based on either
......@@ -87,7 +87,7 @@ typedef unsigned int rinterpolate_Boolean_t;
#define RINTERPOLATE_CACHE_LINE (table->n+table->d)
/* pointer to cache result A */
#define RINTERPOLATE_CACHE_PARAM(A) (table->cache+RINTERPOLATE_CACHE_LINE*(A))
#define Rinterpolate_cache_param(A) (table->cache+RINTERPOLATE_CACHE_LINE*(A))
/* pointer to the location of cache result A */
#define RINTERPOLATE_CACHE_RESULT(A) (table->cache+RINTERPOLATE_CACHE_LINE*(A)+table->n)
......@@ -107,7 +107,7 @@ typedef unsigned int rinterpolate_Boolean_t;
/*
* Use memcmp to compare cache lines?
* The alternative is !FEQUAL, which is usually a bit faster.
* The alternative is !Fequal, which is usually a bit faster.
* Your mileage may vary.
*/
#define RINTERPOLATE_CACHE_USE_MEMCMP
......
......@@ -2,8 +2,8 @@
#include "rinterpolate_internal.h"
rinterpolate_counter_t rinterpolate_add_new_table(
struct rinterpolate_data_t * RESTRICT rinterpolate_data,
const rinterpolate_float_t * RESTRICT data,
struct rinterpolate_data_t * RESTRICT const rinterpolate_data,
const rinterpolate_float_t * RESTRICT const data,
const rinterpolate_counter_t n,
const rinterpolate_counter_t d,
const rinterpolate_counter_t l,
......@@ -20,11 +20,11 @@ rinterpolate_counter_t rinterpolate_add_new_table(
rinterpolate_data->number_of_interpolation_tables++;
rinterpolate_data->tables =
RINTERPOLATE_REALLOC(rinterpolate_data->tables,
Rinterpolate_realloc(rinterpolate_data->tables,
sizeof(struct rinterpolate_table_t *) * rinterpolate_data->number_of_interpolation_tables);
struct rinterpolate_table_t * table =
RINTERPOLATE_MALLOC(sizeof(struct rinterpolate_table_t));
Rinterpolate_malloc(sizeof(struct rinterpolate_table_t));
rinterpolate_data->tables[table_number] = table;
/*
......@@ -41,7 +41,7 @@ rinterpolate_counter_t rinterpolate_add_new_table(
table->d = d;
table->l = l;
table->line_length = n + d;
table->hypertable_length = POWER2_INT(n);
table->hypertable_length = Intger_power_of_two(n);
#ifdef RINTERPOLATE_CACHE
table->cache_length = cache_length;
#endif
......
......@@ -3,7 +3,7 @@
#ifdef RINTERPOLATE_CACHE
void rinterpolate_alloc_cacheline(struct rinterpolate_table_t * table)
void rinterpolate_alloc_cacheline(struct rinterpolate_table_t * RESTRICT const table)
{
table->cache_match_line = 0;
table->cache_spin_line = -1;
......@@ -16,7 +16,7 @@ void rinterpolate_alloc_cacheline(struct rinterpolate_table_t * table)
* Allocate cache space for this interpolation table
*/
table->cache =
RINTERPOLATE_CALLOC(table->line_length*table->cache_length,
Rinterpolate_calloc(table->line_length*table->cache_length,
sizeof(rinterpolate_float_t));
#ifdef RINTERPOLATE_ALLOC_CHECKS
......
......@@ -8,14 +8,13 @@
int rinterpolate_debug;
#endif
rinterpolate_counter_t rinterpolate_alloc_dataspace(struct rinterpolate_data_t ** RESTRICT r)
rinterpolate_counter_t rinterpolate_alloc_dataspace(struct rinterpolate_data_t ** RESTRICT const r)
{
if(*r != NULL)
{
rinterpolate_error(RINTERPOLATE_ALLOCATE_OVER,
"Attempted to allocate rinterpolate into %p (* = %p) which is non-NULL\n",
*r,
r);
"Attempted to allocate rinterpolate a non-NULL pointer\n",
*r);
return RINTERPOLATE_ALLOCATE_OVER;
}
else
......@@ -23,7 +22,7 @@ rinterpolate_counter_t rinterpolate_alloc_dataspace(struct rinterpolate_data_t *
/*
* Allocate space
*/
*r = RINTERPOLATE_CALLOC(1,sizeof(struct rinterpolate_data_t));
*r = Rinterpolate_calloc(1,sizeof(struct rinterpolate_data_t));
return 0;
}
}
......
......@@ -4,18 +4,18 @@
#include <malloc.h>
#endif
void rinterpolate_alloc_hypertable(struct rinterpolate_table_t * RESTRICT table)
void rinterpolate_alloc_hypertable(struct rinterpolate_table_t * RESTRICT const table)
{
/* make space for hypertable */
table->hypertable = RINTERPOLATE_MALLOC(sizeof(struct rinterpolate_hypertable_t));
table->hypertable = Rinterpolate_malloc(sizeof(struct rinterpolate_hypertable_t));
#ifdef RINTERPOLATE_DEBUG
Rinterpolate_print("Interpolate: memory allocation\n");FLUSH;
#endif
table->hypertable->table = table;
table->hypertable->data = RINTERPOLATE_MALLOC(table->hypertable_length*table->line_length_sizeof);
table->hypertable->f = RINTERPOLATE_MALLOC(table->n_float_sizeof);
table->hypertable->sum = RINTERPOLATE_CALLOC(1,table->sum_sizeof);
table->hypertable->data = Rinterpolate_malloc(table->hypertable_length*table->line_length_sizeof);
table->hypertable->f = Rinterpolate_malloc(table->n_float_sizeof);
table->hypertable->sum = Rinterpolate_calloc(1,table->sum_sizeof);
#ifdef RINTERPOLATE_DEBUG
Rinterpolate_print("MALLOC data at %p size %zu, f at %p size %zu, sum at %p size %zu\n",
......
#include "rinterpolate.h"
#include "rinterpolate_internal.h"
void rinterpolate_alloc_varcount(struct rinterpolate_table_t * RESTRICT table)
void rinterpolate_alloc_varcount(struct rinterpolate_table_t * RESTRICT const table)
{
table->varcount = RINTERPOLATE_CALLOC(table->n,sizeof(rinterpolate_counter_t));
table->varcount = Rinterpolate_calloc(table->n,sizeof(rinterpolate_counter_t));
#ifdef RINTERPOLATE_ALLOC_CHECKS
if(unlikely(table->varcount==NULL))
{
......
......@@ -30,7 +30,7 @@
Stringify(macro)) ? "on" : "off" ));
#endif
void rinterpolate_build_flags(struct rinterpolate_data_t * RESTRICT rinterpolate_data)
void rinterpolate_build_flags(struct rinterpolate_data_t * RESTRICT const rinterpolate_data)
{
Macrotest(RINTERPOLATE_USE_REALLOC);
Macrotest(RINTERPOLATE_USE_POINTER_ARITHMETIC);
......
......@@ -2,9 +2,9 @@
#ifdef RINTERPOLATE_CACHE
#include "rinterpolate_internal.h"
rinterpolate_Boolean_t rinterpolate_check_cache(
struct rinterpolate_table_t * RESTRICT table,
const rinterpolate_float_t * RESTRICT x,
rinterpolate_float_t * RESTRICT r)
struct rinterpolate_table_t * RESTRICT const table,
const rinterpolate_float_t * RESTRICT const x,
rinterpolate_float_t * RESTRICT const r)
{
/*
* Set the cache location
......@@ -47,25 +47,25 @@ rinterpolate_Boolean_t rinterpolate_check_cache(
{
Rinterpolate_print("%g%s",*(x+m),m==(table->n-1) ? " }\n":",");
}
rinterpolate_float_t * cl = RINTERPOLATE_CACHE_PARAM(iline);
rinterpolate_float_t * cl = Rinterpolate_cache_param(iline);
Rinterpolate_print(" c={ ");
for(m=0;m<table->n;m++)
{
Rinterpolate_print("%g%s",*(cl+m),m==(table->n-1) ? " }\n":",");
}
Rinterpolate_print("memcmp = %d\n",
memcmp(RINTERPOLATE_CACHE_PARAM(iline),x,table->n_float_sizeof));
memcmp(Rinterpolate_cache_param(iline),x,table->n_float_sizeof));
}
#endif//RINTERPOLATE_DEBUG
match = (memcmp(RINTERPOLATE_CACHE_PARAM(iline),x,table->n_float_sizeof)==0) ? TRUE : FALSE;
match = (memcmp(Rinterpolate_cache_param(iline),x,table->n_float_sizeof)==0) ? TRUE : FALSE;
#else // RINTERPOLATE_CACHE_USE_MEMCMP
rinterpolate_counter_t m;
rinterpolate_float_t * cacheline = RINTERPOLATE_CACHE_PARAM(iline);
rinterpolate_float_t * cacheline = Rinterpolate_cache_param(iline);
match = TRUE;
Rinterpolate_print("start of for loop\n");
for(m=0; m<table->n; m++)
{
if(!FEQUAL(x[m],cacheline[m]))
if(!Fequal(x[m],cacheline[m]))
{
match = FALSE;
break;
......
......@@ -5,7 +5,6 @@
/*
* macros which depend on the compiler, for librinterpolate
*/
#ifndef Autotype
#if defined __GNUC__ && __GNUC__ > 4 && __GNUC_MINOR__ > 9
#define Autotype(X) __auto_type
......@@ -86,10 +85,49 @@
#define prefetch(...) /* prefetch: do nothing */
#endif
#endif // __GNUC__
#ifndef MAYBE_UNUSED
# define MAYBE_UNUSED
#endif
#ifndef Pure_function
#if defined __GNUC__ && __GNUC__ >=3
#define Pure_function __attribute__((pure))
#endif
#endif
#ifndef Constant_function
#if defined __GNUC__ && __GNUC__ >=3
#define Constant_function __attribute__((const))
#endif
#endif
#ifndef No_return
#if defined __GNUC__ && __GNUC__ >=4
#define No_return __attribute__((noreturn))
#endif
#endif
#ifndef Gnu_format_args
#if (__GNUC__ ==4 && __GNU_MINOR__>=7) || __GNUC__ > 4
#define Gnu_format_args(...) __attribute__((format (gnu_printf,__VA_ARGS__)))
#endif
#endif
#ifndef Constant_function
#define Constant_function
#endif
#ifndef Pure_function
#define Pure_function
#endif
#ifndef No_return
# define No_return
#endif
#ifndef Gnu_format_args
# define Gnu_format_args(...)
#endif
#endif // RINTERPOLATE_COMPILER_H
#include "rinterpolate.h"
#include "rinterpolate_internal.h"
void rinterpolate_construct_hypercube(struct rinterpolate_table_t * RESTRICT table)
void rinterpolate_construct_hypercube(struct rinterpolate_table_t * RESTRICT const table)
{
/*
* Construct hypercube
......
......@@ -2,10 +2,10 @@
#include <stdarg.h>
#include "rinterpolate_internal.h"
void rinterpolate_error(rinterpolate_counter_t errnum,
char * RESTRICT format,
struct rinterpolate_data_t * RESTRICT rinterpolate_data,
...)
void No_return Gnu_format_args(2,4) rinterpolate_error(rinterpolate_counter_t errnum,
char * RESTRICT format,
struct rinterpolate_data_t * RESTRICT const rinterpolate_data,
...)
{
/*
* Report an error in librinterpolate and exit
......
......@@ -5,9 +5,9 @@
*
* Given a rinterpolate_data struct, free everything in it.
*/
static void rinterpolate_free_table(struct rinterpolate_table_t * table);
static void rinterpolate_free_table(struct rinterpolate_table_t * const table);
void rinterpolate_free_data(struct rinterpolate_data_t * RESTRICT rinterpolate_data)
void rinterpolate_free_data(struct rinterpolate_data_t * RESTRICT const rinterpolate_data)
{
if(rinterpolate_data)
{
......@@ -22,7 +22,7 @@ void rinterpolate_free_data(struct rinterpolate_data_t * RESTRICT rinterpolate_d
}
}
static void rinterpolate_free_table(struct rinterpolate_table_t * table)
static void rinterpolate_free_table(struct rinterpolate_table_t * const table)
{
#ifdef RINTERPOLATE_CACHE
......
......@@ -5,9 +5,9 @@
* data structure.
*/
rinterpolate_signed_counter_t rinterpolate_id_table(
struct rinterpolate_data_t * RESTRICT rinterpolate_data,
const rinterpolate_float_t * RESTRICT data
rinterpolate_signed_counter_t Pure_function rinterpolate_id_table(
struct rinterpolate_data_t * RESTRICT const rinterpolate_data,
const rinterpolate_float_t * RESTRICT const data
)
{
/* look for data table in the existing table_ids */
......
......@@ -21,34 +21,34 @@
#endif
/* fast bit-shift equivalent to pow(2,A) but for integers */
#define POWER2_INT(A) (1<<(A))
#define Intger_power_of_two(A) (1<<(A))
/* macros to define less and more than operations */
#define LESS_THAN(A,B) ((A)<(B))
#define MORE_THAN(A,B) ((A)>(B))
#define MAX(A,B) ({ \
#define Less_than(A,B) ((A)<(B))
#define More_than(A,B) ((A)>(B))
#define Max(A,B) ({ \
const Autotype(A) _a = (A); \
const Autotype(B) _b = (B); \
MORE_THAN(_a,_b) ? _a : _b; \
More_than(_a,_b) ? _a : _b; \
})
#define MIN(A,B) ({ \
#define Min(A,B) ({ \
const Autotype(A) _a = (A); \
const Autotype(B) _b = (B); \
LESS_THAN(_a,_b) ? _a : _b; \
Less_than(_a,_b) ? _a : _b; \
})
#define FORCE_RANGE(A,B,X) ({ \
#define Force_range(A,B,X) ({ \
const Autotype(A) _a = (A); \
const Autotype(B) _b = (B); \
const Autotype(X) _x = (X); \
(unlikely(LESS_THAN(_x,_a))) ? _a : \
(unlikely(MORE_THAN(_x,_b)) ? _b : _x); \
(unlikely(Less_than(_x,_a))) ? _a : \
(unlikely(More_than(_x,_b)) ? _b : _x); \
})
#ifndef IS_ZERO
#define IS_ZERO(A) (fabs((A))<TINY)
#ifndef Is_zero
#define Is_zero(A) (fabs((A))<TINY)
#endif
#ifndef FEQUAL
#define FEQUAL(A,B) (IS_ZERO((A)-(B)))
#ifndef Fequal
#define Fequal(A,B) (Is_zero((A)-(B)))
#endif
#ifdef RINTERPOLATE_DEBUG
......
......@@ -2,9 +2,9 @@
#include "rinterpolate_internal.h"
void rinterpolate_interpolate(
const struct rinterpolate_table_t * table,
const rinterpolate_float_t * RESTRICT x,
rinterpolate_float_t * RESTRICT r)
const struct rinterpolate_table_t * const table,
const rinterpolate_float_t * RESTRICT const x,
rinterpolate_float_t * RESTRICT const r)
{
rinterpolate_float_t u,v;
rinterpolate_counter_t n = 0;
......
......@@ -2,7 +2,7 @@
#include "rinterpolate_internal.h"
#ifdef RINTERPOLATE_PRESEARCH
void rinterpolate_make_presearch(struct rinterpolate_table_t * RESTRICT table)
void rinterpolate_make_presearch(struct rinterpolate_table_t * RESTRICT const table)
{
/*
* First time with this table: Find the variable presearch
......@@ -10,7 +10,7 @@ void rinterpolate_make_presearch(struct rinterpolate_table_t * RESTRICT table)
/* make table for presearch data for n columns */
table->presearch =
RINTERPOLATE_MALLOC(table->n*sizeof(rinterpolate_float_t *));
Rinterpolate_malloc(table->n*sizeof(rinterpolate_float_t *));
table->presearch_n = table->n;
#ifdef RINTERPOLATE_ALLOC_CHECKS
......@@ -27,7 +27,7 @@ void rinterpolate_make_presearch(struct rinterpolate_table_t * RESTRICT table)
for(j=0;j<table->n;j++)
{
table->presearch[j] =
RINTERPOLATE_MALLOC(table->varcount[j]*
Rinterpolate_malloc(table->varcount[j]*
sizeof(rinterpolate_float_t));
rinterpolate_float_t * pline = table->presearch[j];
......
#include "rinterpolate.h"
#include "rinterpolate_internal.h"
void rinterpolate_make_steps(struct rinterpolate_table_t * RESTRICT table)
void rinterpolate_make_steps(struct rinterpolate_table_t * RESTRICT const table)
{
/*
* First time with this table: Find the variable steps
*/
table->steps = RINTERPOLATE_CALLOC(table->n,sizeof(rinterpolate_counter_t));
table->steps = Rinterpolate_calloc(table->n,sizeof(rinterpolate_counter_t));
#ifdef RINTERPOLATE_ALLOC_CHECKS
if(unlikely(table->steps==NULL))
......@@ -55,7 +55,7 @@ void rinterpolate_make_steps(struct rinterpolate_table_t * RESTRICT table)
* Compare this line to the previous,
* if different, set the step
*/
if(!FEQUAL(table->data[(i-1)*table->line_length + j],
if(!Fequal(table->data[(i-1)*table->line_length + j],
table->data[i *table->line_length + j]))
{
// change
......
......@@ -58,7 +58,7 @@
//else b = c; // if(LESS_OR_EQUAL(v,u)) // obviously!
}
a=MIN(a,b);
a=Min(a,b);
b=a+1;
//printf("QUADRATIC %d %d\n",a,b);
#endif
......@@ -77,7 +77,7 @@
while(c)
{
b = a|c;
w = MIN(b,N);
w = Min(b,N);
#ifdef RINTERPOLATE_POINT_ARITHMETIC_J_LOOP
if(b < N && v >= *(tj+b*i)) a=b;
#else
......
......@@ -5,19 +5,19 @@
#include "rinterpolate.h"
struct rinterpolate_data_t * rinterpolate(
const rinterpolate_float_t * RESTRICT table, // (pointer to) the data table
const rinterpolate_float_t * RESTRICT const table, // (const pointer to) the data table
struct rinterpolate_data_t * rinterpolate_data, // where rinterpolate stores data
const rinterpolate_counter_t n, // the number of parameters (i.e. dimensions)
const rinterpolate_counter_t d, // the number of data items
const rinterpolate_counter_t l, // the number of lines of data
const rinterpolate_float_t * RESTRICT x, // the values of the parameters
rinterpolate_float_t * RESTRICT r, // the result of the interpolation
const rinterpolate_float_t * RESTRICT const x, // the values of the parameters
rinterpolate_float_t * RESTRICT const r, // the result of the interpolation
const rinterpolate_counter_t cache_length // tells us to use the cache, or not
);
void rinterpolate_free_data(struct rinterpolate_data_t * RESTRICT rinterpolate_data);
rinterpolate_counter_t rinterpolate_alloc_dataspace(struct rinterpolate_data_t ** RESTRICT r);
void rinterpolate_build_flags(struct rinterpolate_data_t * RESTRICT rinterpolate_data);
void rinterpolate_free_data(struct rinterpolate_data_t * RESTRICT const rinterpolate_data);
rinterpolate_counter_t rinterpolate_alloc_dataspace(struct rinterpolate_data_t ** RESTRICT const r);
void rinterpolate_build_flags(struct rinterpolate_data_t * RESTRICT const rinterpolate_data);
/*
* Internal functions
......@@ -25,58 +25,54 @@ void rinterpolate_build_flags(struct rinterpolate_data_t * RESTRICT rinterpolate
void rinterpolate_error(rinterpolate_counter_t errnum,
char * RESTRICT format,
struct rinterpolate_data_t * RESTRICT rinterpolate_data,
...);
rinterpolate_signed_counter_t rinterpolate_id_table(
struct rinterpolate_data_t * RESTRICT rinterpolate_data,
const rinterpolate_float_t * RESTRICT data
struct rinterpolate_data_t * RESTRICT const rinterpolate_data,
...) No_return Gnu_format_args(2,4);
rinterpolate_signed_counter_t Pure_function rinterpolate_id_table(
struct rinterpolate_data_t * RESTRICT const rinterpolate_data,
const rinterpolate_float_t * RESTRICT const data
);
rinterpolate_Boolean_t rinterpolate_check_cache(
struct rinterpolate_table_t * RESTRICT table,
const rinterpolate_float_t * RESTRICT x,
rinterpolate_float_t * RESTRICT r);
struct rinterpolate_table_t * RESTRICT const table,
const rinterpolate_float_t * RESTRICT const x,
rinterpolate_float_t * RESTRICT const r);
#ifdef RINTERPOLATE_CACHE
void rinterpolate_alloc_cacheline(struct rinterpolate_table_t * RESTRICT table);
void rinterpolate_alloc_cacheline(struct rinterpolate_table_t * RESTRICT const table);
#endif
void rinterpolate_make_steps(struct rinterpolate_table_t * RESTRICT table);
void rinterpolate_alloc_hypertable(struct rinterpolate_table_t * RESTRICT table);
void rinterpolate_alloc_varcount(struct rinterpolate_table_t * RESTRICT table);
void rinterpolate_make_steps(struct rinterpolate_table_t * RESTRICT const table);
void rinterpolate_alloc_hypertable(struct rinterpolate_table_t * RESTRICT const table);
void rinterpolate_alloc_varcount(struct rinterpolate_table_t * RESTRICT const table);
void rinterpolate_search_table(
struct rinterpolate_table_t * RESTRICT table,
const rinterpolate_float_t * RESTRICT x
struct rinterpolate_table_t * RESTRICT const table,
const rinterpolate_float_t * RESTRICT const x
);
void rinterpolate_construct_hypercube(
struct rinterpolate_table_t * RESTRICT table
struct rinterpolate_table_t * RESTRICT const table
);
void rinterpolate_interpolate(
const struct rinterpolate_table_t * RESTRICT table,
const rinterpolate_float_t * RESTRICT x,
rinterpolate_float_t * RESTRICT r);
const struct rinterpolate_table_t * RESTRICT const table,
const rinterpolate_float_t * RESTRICT const x,
rinterpolate_float_t * RESTRICT const r);
void rinterpolate_store_cache(struct rinterpolate_table_t * RESTRICT table,
const rinterpolate_float_t * RESTRICT x,
const rinterpolate_float_t * RESTRICT r);
void rinterpolate_store_cache(struct rinterpolate_table_t * RESTRICT const table,
const rinterpolate_float_t * RESTRICT const x,
const rinterpolate_float_t * RESTRICT const r);
void rinterpolate_make_presearch(struct rinterpolate_table_t * RESTRICT table);
void rinterpolate_make_presearch(struct rinterpolate_table_t * RESTRICT const table);
#ifdef RINTERPOLATE_CACHE
void rinterpolate_resize_cache(struct rinterpolate_table_t * RESTRICT table,
void rinterpolate_resize_cache(struct rinterpolate_table_t * RESTRICT const table,
const rinterpolate_counter_t cache_length);
#endif
#ifdef RINTERPOLATE_PRESEARCH
void rinterpolate_resize_presearch(struct rinterpolate_data_t * RESTRICT rinterpolate_data,
const size_t n);
#endif
rinterpolate_counter_t rinterpolate_add_new_table(
struct rinterpolate_data_t * RESTRICT rinterpolate_data,
const rinterpolate_float_t * RESTRICT table,
struct rinterpolate_data_t * RESTRICT const rinterpolate_data,
const rinterpolate_float_t * RESTRICT const table,
const rinterpolate_counter_t n,
const rinterpolate_counter_t d,
const rinterpolate_counter_t line_length,
......
......@@ -3,7 +3,7 @@
#ifdef RINTERPOLATE_CACHE
void rinterpolate_resize_cache(struct rinterpolate_table_t * RESTRICT table,
void rinterpolate_resize_cache(struct rinterpolate_table_t * RESTRICT const table,
const rinterpolate_counter_t cache_length)
{
/*
......
......@@ -2,8 +2,8 @@
#include "rinterpolate_internal.h"
void rinterpolate_search_table(
struct rinterpolate_table_t * RESTRICT table,
const rinterpolate_float_t * RESTRICT x
struct rinterpolate_table_t * RESTRICT const table,
const rinterpolate_float_t * RESTRICT const x
)
{
rinterpolate_counter_t j;
......@@ -41,17 +41,17 @@ void rinterpolate_search_table(
#endif
#ifdef RINTERPOLATE_POINTER_ARITHMETIC_J_LOOP
#ifdef RINTERPOLATE_PRESEARCH