public class FECMath
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
char[] |
gf_exp
To speed up computations, we have tables for logarithm, exponent
and inverse of a number.
|
int[] |
gf_log |
char[][] |
gf_mul_table
gf_mul(x,y) multiplies two numbers.
|
int |
gfBits
The following parameter defines how many bits are used for
field elements.
|
int |
gfSize |
char[] |
inverse |
static java.lang.String[] |
prim_polys
Primitive polynomials - see Lin & Costello, Appendix A,
and Lee & Messerschmitt, p. 453.
|
Modifier and Type | Method and Description |
---|---|
void |
addMul(byte[] dst,
int dstPos,
byte[] src,
int srcPos,
byte c,
int len) |
void |
addMul(char[] dst,
int dstPos,
char[] src,
int srcPos,
char c,
int len) |
protected char[] |
createDecodeMatrix(char[] encMatrix,
int[] index,
int k,
int n)
createDecodeMatrix constructs the encoding matrix given the
indexes.
|
char[] |
createEncodeMatrix(int k,
int n) |
static char[] |
createGFMatrix(int rows,
int cols)
Generate GF(2**m) from the irreducible polynomial p(X) in p[0]..p[m]
Lookup tables:
index->polynomial form gf_exp[] contains j= \alpha^i;
polynomial form -> index form gf_log[ j = \alpha^i ] = i
\alpha=x is the primitive element of GF(2^m)
For efficiency, gf_exp[] has size 2*gfSize, so that a simple
multiplication of two numbers can be resolved without calling modnn
|
void |
generateGF() |
void |
initMulTable() |
void |
invertMatrix(char[] src,
int k) |
void |
invertVandermonde(char[] src,
int k) |
static boolean |
isIdentity(char[] m,
int k) |
void |
matMul(char[] a,
char[] b,
char[] c,
int n,
int k,
int m) |
void |
matMul(char[] a,
int aStart,
char[] b,
int bStart,
char[] c,
int cStart,
int n,
int k,
int m) |
char |
modnn(int x)
modnn(x) computes x % gfSize, where gfSize is 2**gfBits - 1,
without a slow divide.
|
char |
mul(char x,
char y) |
public int gfBits
public int gfSize
public static final java.lang.String[] prim_polys
public char[] gf_exp
public int[] gf_log
public char[] inverse
public char[][] gf_mul_table
public final void generateGF()
public final void initMulTable()
public final char modnn(int x)
public final char mul(char x, char y)
public static final char[] createGFMatrix(int rows, int cols)
public final void addMul(char[] dst, int dstPos, char[] src, int srcPos, char c, int len)
public final void addMul(byte[] dst, int dstPos, byte[] src, int srcPos, byte c, int len)
public final void matMul(char[] a, char[] b, char[] c, int n, int k, int m)
public final void matMul(char[] a, int aStart, char[] b, int bStart, char[] c, int cStart, int n, int k, int m)
public static final boolean isIdentity(char[] m, int k)
public final void invertMatrix(char[] src, int k) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public final void invertVandermonde(char[] src, int k)
public final char[] createEncodeMatrix(int k, int n)
protected final char[] createDecodeMatrix(char[] encMatrix, int[] index, int k, int n)
Copyright © 2023. All rights reserved.