ALPHABETS PROVIDED BY DEFAULT

OVERVIEW

decoding provides some finite fields and finite rings. However these implementations are not optimized. For efficiency it is strongly recommanded to use external library like GMP or MPFQ. To implement your own finite fields or rings or to wrap external libraries see decoding-rings(3).

DESCRIPTION

The following finite fields and rings are provided by decoding. If the wanted ring is implemented by decoding/rings/wanted_ring.c you must do

#include <decoding/rings/wanted_ring.c>
#include <decoding/algos.c>

to use it. All the proposed rings are in the include/decoding/rings directory. If you do not provide any name for your ring, one will be set by default. It is recommended to use a name with the RING_NAME macro.

#define RING_NAME myring
#include <decoding/rings/wanted_ring.c>
#include <decoding/algos.c>

LIST OF FINITE RINGS

GF5.c

Implements GF(5). It is an example of implementation of a finite field and contains the documentation on the making of finite rings for decoding. See decoding-rings(3) for details.

gfp_word.c

Implement all prime fields (Z/pZ) whose characteristic holds within a machine word. Use PRIME to indicate the modulus of the finite field you want to construct.

#define PRIME 101
#include <decoding/rings/gfp_word.c>
#include <decoding/algos.c>

In the example above, the name of the finite field will be gf101. You can of course use several prime fields in the same program.

#define PRIME 7
#include <decoding/rings/gfp_word.c>
#include <decoding/algos.c>

#define PRIME 11
#include <decoding/rings/gfp_word.c>
#include <decoding/algos.c>

It will then generate the code for the two finite fields GF(7) and GF(11). You will then have two types.

The prime number defining the field is accessible with the R_characteristic variable. For exemple we will have the following.

By default, the unsigned int C type is choosen to hold the elements of the field. You can specify a different genuine integer C type like unsigned short or unsigned long if you need with WORD_TYPE. You must choose an unsigned type.

#define WORD_TYPE unsigned long
#define PRIME 101
#include <decoding/rings/gfp_word.c>
#include <decoding/algos.c>
void R_ring_init(void);

Initialize the ring. A call to this function is mandatory before doing anything else.

void R_ring_clear(void);

Free the memory occupied by the ring. A call to this function is recommended when the ring is no more needed.

gfp_word_dynamic.c

Implement all prime fields (Z/pZ) whose characteristic holds within a machine word. The difference with gfp_word.c is that the prime defining the field can be chosen and modified at run time.

#include <decoding/rings/gfp_word_dynamic.c>
#include <decoding/algos.c>

In the example above, the name of the finite field will be gfp. You can of course use several prime fields in the same program as soon as they have different names.

#define RING_NAME fld1
#include <decoding/rings/gfp_word_dynamic.c>
#include <decoding/algos.c>

#define RING_NAME fld2
#include <decoding/rings/gfp_word_dynamic.c>
#include <decoding/algos.c>

The prime number defining the field is accessible with the R_characteristic variable. For exemple we will have access to the following variables:

By default, the unsigned int C type is choosen to hold the elements of the field. You can specify a different genuine integer C type like unsigned short or unsigned long if you need with WORD_TYPE. You must choose an unsigned type.

#define WORD_TYPE unsigned long
#include <decoding/rings/gfp_word_dynamic.c>
#include <decoding/algos.c>
void R_ring_init(R_characteristic p);

Initialize the ring with prime p. A call to this function is mandatory before doing anything else.

void R_ring_clear(void);

Free the memory occupied by the ring. A call to this function is recommended when the ring is no more needed.

You can change the prime of the ring with successive calls to R_ring_clear and R_ring_init.

#include <decoding/decoding.h>
#define RING_NAME fld
#include <decoding/rings/gfp_word_dynamic.c>

...

int main(void) {
  fld_init_ring(101);
  ...
  fld_clear_ring();
  fld_init_ring(67);
  ...
  fld_clear_ring();
  return 0;
}
mpfq_gf2n_wrapper.c

Implement all fields GF(2^n) with 2 <= s <= 255. It is a wrapper to MPFQ. The DEGREE indicates which extension of GF(2) you want to use.

#define DEGREE 8
#include <decoding/rings/mpfq_gf2n_wrapper.c>
#include <decoding/algos.c>

In the example above, the name of the finite field will be gf2_8. You can of course use several MPFQ fields in the same program.

#define DEGREE 8
#include <decoding/rings/mpfq_gf2n_wrapper.c>
#include <decoding/algos.c>

#define DEGREE 64
#include <decoding/rings/mpfq_gf2n_wrapper.c>
#include <decoding/algos.c>

It will then generate the code for the two finite fields GF(2^8) and GF(2^64). You will then have two types.

The degree of the extension is accessible with the R_ext_degree variable. For exemple we will have the following.

AUTHOR

Written by Guillaume Quintin (quintin@lix.polytechnique.fr).

SEE ALSO

decoding-rings(3), MPFQ(http://mpfq.gforge.inria.fr/), GMP(http://gmplib.org/)