|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cesta.util.LinearEncoder
public class LinearEncoder
Linear encoder encodes numbers according to chosen simplified BCH polynomial code.
CODE_15_7 matrix was constructed from polynomial G(x) = x^8+x^7+x^6+x^4+1 and generates (15,7) linear code, where each two codewords have Hamming distance at least 5. It has only 7 data bits, therefore it can encode only 128 different values.
CODE_15_10 matrix was constructed from polynomial G(x) = x^5+x^3+x+1 and generates (15,10) linear code, where each two codewords have Hamming distance at least 4. It has 10 data bits.
CODE_15_11 is (15,11) code and was constructed from G(x) = x^4+x+1. Hamming distance between codewords is at least 3. 11 data bits.
CODE_15_14 is (15,14) code and was constructed from G(x) = x+1. Hamming distance between codewords is at least 2. 14 data bits.
You can use Richard Tervo's online tool to see how the codes actualy look. http://www.ee.unb.ca/cgi-bin/tervo/polygen.pl
| Field Summary | |
|---|---|
protected int[][] |
code
|
static int[][] |
CODE_15_10
|
static int[][] |
CODE_15_11
|
static int[][] |
CODE_15_14
|
static int[][] |
CODE_15_7
|
| Constructor Summary | |
|---|---|
LinearEncoder(int wordCount)
Creates linear encoder, that can encode specified number of words and guarantee some hamming distance between each of them. |
|
| Method Summary | |
|---|---|
int |
decode(int number)
Decodes provided number. |
int |
encode(int number)
Encodes provided number |
int[][] |
getCode()
Returns currently used code (generator matrix) |
static int |
hammingDistance(int a,
int b)
Returns Hamming distance between two numbers |
static int[][] |
int2matrix(int number,
int bitLength)
Converts number to binary matrix with one row and bitLength columns |
static int |
matrix2int(int[][] matrix)
Converts binary row matrix to number |
static int[][] |
multiplyMatrices(int[][] m1,
int[][] m2)
Multiply general matrices |
void |
setCode(int[][] code)
Sets code for the encoder. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int[][] CODE_15_7
public static final int[][] CODE_15_10
public static final int[][] CODE_15_11
public static final int[][] CODE_15_14
protected int[][] code
| Constructor Detail |
|---|
public LinearEncoder(int wordCount)
wordCount - number of possible words| Method Detail |
|---|
public void setCode(int[][] code)
code - public int[][] getCode()
public int encode(int number)
number -
public int decode(int number)
number -
public static int[][] int2matrix(int number,
int bitLength)
number - number to convertbitLength - how big the matrix should be
public static int matrix2int(int[][] matrix)
matrix - matrix to convert
public static int[][] multiplyMatrices(int[][] m1,
int[][] m2)
m1 - matrix Am2 - matrix B
public static int hammingDistance(int a,
int b)
a - non negative numberb - non negative number
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||