It is easy to control what algorithms are used by decoding
, for
example if you want to replace unvariate polynomial multiplication
with your own function or if the ring you are implementing has
caracteristic 2.
The file include/decoding/rings/GF17.c
is an example of how to
use macros defined below.
#define R_NAME
R
contains the name NAME
of the ring you are implementing. See
decoding-rings
(3) for details.
#define RING_COMM_CAR2
Tell decoding
that your ring has caracteristic 2. It is not
mandatory to specify it. When defined it activates certain fast
algorithms specific to characteristic 2.
#define RING_MODN_WORD
Tell decoding
that the ring is Z/nZ
where n
holds
within a machine word. It can correspond, for exemple, to the
unsigned char
, unsigned short
, unsigned int
or
unsigned long
C type. The WORD_TYPE
macro must
be defined to the C type that represents the elements of
your ring.
#define CHARACTERISTIC_WORD
Tell decoding
that the characteristic of the ring holds
within a machine word.
#define CHARACTERISTIC_MPZ
Tell decoding
that the characteristic of the ring is stored
within a GMP multiprecision integer.
#define MY_UPOL_MUL myfunc
Replace default univariate polynomial multiplication by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_UPOL_SQUARE myfunc
Replace default univariate polynomial squaring by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_UPOL_SHIFT myfunc
Replace default univariate polynomial shifting by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_DBPOL_MUL myfunc
Replace default dense bivariate polynomial multiplication by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_DBPOL_SHIFT myfunc
Replace default dense bivariate polynomial shfting by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_UPOL_ROOTS myfunc
Replace default univariate root finding by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
Note that decoding
provides no algorithm for univariate root
finding.
#define MY_VEC_ADD myfunc
Replace default vector addition by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_VEC_NEG myfunc
Replace default vector additive inverse computation by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_VEC_SUB myfunc
Replace default vector substraction by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_VEC_SUB_SUB myfunc
Replace default ll_vec_sub_sub
by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_VEC_ADD_MUL myfunc
Replace default ll_vec_add_mul
by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_VEC_MUL_BY_CTE myfunc
Replace default ll_vec_mul_by_cte
by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_VEC_ADD_MUL_BY_CTE myfunc
Replace default ll_vec_add_mul_by_cte
by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
#define MY_VEC_SUB_MUL myfunc
Replace default ll_vec_sub_mul
by myfunc
.
See decoding-lowlevels
(3) for the prototype of myfunc
.
decoding
provides no garbage collectors by default.
The memory is manually allocated and freed with the
standard libc functions stdlib.h
(0P). You can replace
the memory management functions with your own or
use an external garbage collector if you wish with the
MY_*ALLOC
macros.
#define MY_MALLOC myfunc
Replace the malloc
function by myfunc
. By default
the libc malloc
is used. myfunc
must have the same
prototype as malloc
.
See malloc
(3) for more details.
#define MY_REALLOC myfunc
Replace the realloc
function by myfunc
. By default
the libc realloc
is used. myfunc
must have the same
prototype as realloc
.
See realloc
(3) for more details.
#define MY_CALLOC myfunc
Replace the calloc
function by myfunc
. By default
the libc calloc
is used. myfunc
must have the same
prototype as calloc
.
See calloc
(3) for more details.
#define MY_FREE myfunc
Replace the free
function by myfunc
. By default
the libc free
is used. myfunc
must have the same
prototype as free
.
See free
(3) for more details.
Written by Guillaume Quintin (coincoin169g@gmail.com).
decoding-rings
(3),decoding-lowlevels
(3),
MAGMA(http://magma.maths.usyd.edu.au/magma/),
malloc
(3), realloc
(3), calloc
(3), free
(3),
stdlib.h
(0P).