Package hlcd.linearCode
Class Code
java.lang.Object
hlcd.linearCode.Code
- All Implemented Interfaces:
CodeOperations,Serializable
The definition of a mathematical linear code. It will contain the
generator matrix of the code as well as the linear combinations. It is a
must to call
startEngine() to start the execution of the
search.
TODO: ensure the multithreading used here is correct (the program doesn't support multithreading yet but it has been implemented).
//minimal example to execute this class:
public static void main(String[] args) {
System.out.println("Running the \"Code\" class...");
byte n = 8;
byte k = 4;
byte d = 4;
byte base = 4;
CodeParameters cp = new CodeParameters(n, k, d, base);
CodeValidatorParameters cvp = new CodeValidatorParameters();
CodeExporterParameters cep = new CodeExporterParameters();
Code code = new Code(cp, cvp);
code.startEngine();
code.printGeneratorMatrix(true, Style.DECIMAL, true);
System.out.println("The run of the \"Code\" class completed.");
}- Since:
- 1.8
- Version:
- 1.0 (February 10th, 2022)
- Author:
- Maysara Al Jumaily
- See Also:
- Serialized Form
-
Constructor Summary
ConstructorsConstructorDescriptionCode(CodeParameters cp, CodeValidatorParameters cvp)The only constructor which accepts the code parameters and the code validator parameters. -
Method Summary
Modifier and TypeMethodDescriptionbytegetBase()Returns the base of the \(\left[n, \, k, \, d\right]_{base}\) code.Returns the code parameters of the code.Returns the code statistics which includes the total time taken, parameters of the code and parameters of the validator used.Returns the code validator parameters of the code.Returns the weight enumerator of the code.The linear combinations of the codewords in the code.bytegetD()Returns the minimum distance of the \(\left[n, \, k, \, d\right]_{base}\) code.Returns the generator matrix \(G\).Returns the matrix \(G\) as a brand-new copy (deep copy).bytegetK()Returns the dimension of the \(\left[n, \, k, \, d\right]_{base}\) code.bytegetN()Returns the length of each codeword in a \(\left[n, \, k, \, d\right]_{ base}\) code.longReturns the number of recursive calls required to arrive to the solution.byteReturns the minimum weight of the right-side of the generator matrix \(G\) that is in standard form, which is \(d - 1\).booleanReturnstrueif a specific form of cut down in the space search has been applied,falseotherwise.booleanisHLCD()Returnstrueif the code is Hermitian linear complementary code,falseotherwise.booleanReturnstrueif the identity matrix is appended to the left-side of the generator matrix,falseotherwise.booleanReturnstrueif multithreading is used when calculating if some vector \(v\) is an appropriate codeword to be added to the generator matrix \(G\),falseotherwise.voidPrints the current code parameters on screen.voidprintCombinations(String delimiter, Style style)Prints the elements in the combination array on screen with the style type specified.voidPrints the current matrix on console with brackets surrounding the matrix, a single space between columns, each digit is written in base 10 as well as the size of the matrix.voidprintGeneratorMatrix(boolean addBrackets, Style style, boolean showSize)Prints the current matrix on console with columns separated by a single space.voidprintGeneratorMatrix(String delimiter, boolean addBrackets, Style style, boolean showSize)Prints the current matrix on console.voidStarts the search of the entire program.
-
Constructor Details
-
Code
The only constructor which accepts the code parameters and the code validator parameters. Both are wrapper classes for primitive type data such as \(n\), \(k\), \(d\), if it is quaternary Hermitian LCD or just quaternary. It also includes what kind of validator tests should be executed.- Parameters:
cp- the code parameters to executecvp- the code validator parameters for ensuring the code generated doesn't have bugs
-
-
Method Details
-
startEngine
public void startEngine()Starts the search of the entire program. -
getCodeWeightEnumerator
Returns the weight enumerator of the code.- Returns:
- the weight enumerator of the code
-
printGeneratorMatrix
public void printGeneratorMatrix()Description copied from interface:CodeOperationsPrints the current matrix on console with brackets surrounding the matrix, a single space between columns, each digit is written in base 10 as well as the size of the matrix.- Specified by:
printGeneratorMatrixin interfaceCodeOperations
-
printGeneratorMatrix
Description copied from interface:CodeOperationsPrints the current matrix on console with columns separated by a single space. The brackets surrounding the matrix will be displayed ifaddBracketsistrue. Each digit is displayed based on the style specified. It will show the size of the matrix in the bottom-right corner ifshowSizeistrue.- Specified by:
printGeneratorMatrixin interfaceCodeOperations- Parameters:
addBrackets- should brackets around the matrix be displayedstyle- the style format which could either be binary, quaternary, decimal or \(\LaTeX\)showSize- should the dimension of the matrix be shown at the bottom-right
-
printGeneratorMatrix
public void printGeneratorMatrix(String delimiter, boolean addBrackets, Style style, boolean showSize)Description copied from interface:CodeOperationsPrints the current matrix on console. The columns will be separated by the delimiter specified. The brackets surrounding the matrix will be displayed ifaddBracketsistrue. Each digit is displayed based on the style specified. It will show the size of the matrix in the bottom-right corner ifshowSizeistrue.- Specified by:
printGeneratorMatrixin interfaceCodeOperations- Parameters:
delimiter- the delimiter between columns of current matrixaddBrackets- should brackets around the matrix be displayedstyle- the style format which could either be binary, quaternary, decimal or \(\LaTeX\)showSize- should the dimension of the matrix be shown at the bottom-right
-
printCombinations
Description copied from interface:CodeOperationsPrints the elements in the combination array on screen with the style type specified.- Specified by:
printCombinationsin interfaceCodeOperations- Parameters:
delimiter- the delimiter between each digitstyle- the style format which could either be binary, quaternary, decimal or \(\LaTeX\)
-
printCodeParameters
public void printCodeParameters()Description copied from interface:CodeOperationsPrints the current code parameters on screen. More precisely, it will print the generator \(n\), \(k\), \(d\), base values, number of linear combinations, the combinations themselves and the vectors used in the generator matrix and other properties.- Specified by:
printCodeParametersin interfaceCodeOperations- See Also:
CodeParameters
-
getCodeParameters
Returns the code parameters of the code.- Returns:
- the code parameters of the code
-
getNumberOfRecursiveCalls
public long getNumberOfRecursiveCalls()Returns the number of recursive calls required to arrive to the solution.- Returns:
- the number of recursive calls required to arrive to the solution
-
getGeneratorMatrix
Description copied from interface:CodeOperationsReturns the generator matrix \(G\).- Specified by:
getGeneratorMatrixin interfaceCodeOperations- Returns:
- the generator matrix \(G\)
- See Also:
CodeOperations.getGeneratorMatrixCopy()
-
getGeneratorMatrixCopy
Description copied from interface:CodeOperationsReturns the matrix \(G\) as a brand-new copy (deep copy).NOT TESTED YET!
- Specified by:
getGeneratorMatrixCopyin interfaceCodeOperations- Returns:
- the matrix \(G\) as a brand-new copy (deep copy)
- See Also:
CodeOperations.getGeneratorMatrix()
-
getCombinations
Description copied from interface:CodeOperationsThe linear combinations of the codewords in the code.- Specified by:
getCombinationsin interfaceCodeOperations- Returns:
- the linear combinations of the codewords in the code
-
getN
public byte getN()Description copied from interface:CodeOperationsReturns the length of each codeword in a \(\left[n, \, k, \, d\right]_{ base}\) code. For a binary code, \(1 \lt n \leq 62\) and for a quaternary code, \(1 \lt n \leq 30\).- Specified by:
getNin interfaceCodeOperations- Returns:
- the length of each codeword in the \(\left[n, \, k, \, d\right]_{base}\) code
-
getK
public byte getK()Description copied from interface:CodeOperationsReturns the dimension of the \(\left[n, \, k, \, d\right]_{base}\) code. For a binary code, \(1 \lt k \leq 62\) and for a quaternary code, \(1 \lt k \leq 30\).- Specified by:
getKin interfaceCodeOperations- Returns:
- the dimension of the \(\left[n, \, k, \, d\right]_{base}\) code
-
getD
public byte getD()Description copied from interface:CodeOperationsReturns the minimum distance of the \(\left[n, \, k, \, d\right]_{base}\) code. It should be less than \(n\).- Specified by:
getDin interfaceCodeOperations- Returns:
- the minimum distance of the \(\left[n, \, k, \, d\right]_{base}\) code
-
getBase
public byte getBase()Description copied from interface:CodeOperationsReturns the base of the \(\left[n, \, k, \, d\right]_{base}\) code. It could either be \(2\) or \(4\).- Specified by:
getBasein interfaceCodeOperations- Returns:
- the base of the \(\left[n, \, k, \, d\right]_{base}\) code which could either be \(2\) or \(4\)
-
getRHSWeight
public byte getRHSWeight()Description copied from interface:CodeOperationsReturns the minimum weight of the right-side of the generator matrix \(G\) that is in standard form, which is \(d - 1\). In the case where it is not in standard form, it should return \(d\).- Specified by:
getRHSWeightin interfaceCodeOperations- Returns:
- returns the minimum weight of the right-side of the generator matrix \(G\) that is in standard form, which is \(d - 1\). In the case where it is not in standard form, it should return \(d\).
-
isHLCD
public boolean isHLCD()Description copied from interface:CodeOperationsReturnstrueif the code is Hermitian linear complementary code,falseotherwise. This property can be true when the code is quaternary. Note that this program dealt with only Hermitian quaternary codes but can be easily extended to traditional quaternary codes.- Specified by:
isHLCDin interfaceCodeOperations- Returns:
- returns
trueif the code is Hermitian linear complementary code,falseotherwise
-
isIdentityAppended
public boolean isIdentityAppended()Description copied from interface:CodeOperationsReturnstrueif the identity matrix is appended to the left-side of the generator matrix,falseotherwise.- Specified by:
isIdentityAppendedin interfaceCodeOperations- Returns:
- returns
trueif the identity matrix is appended to the left-side of the generator matrix,falseotherwise
-
isMultithreaded
public boolean isMultithreaded()Description copied from interface:CodeOperationsReturnstrueif multithreading is used when calculating if some vector \(v\) is an appropriate codeword to be added to the generator matrix \(G\),falseotherwise. This deals with checking and ensuring that \(v\), \(\omega v\) and \(\overline{\omega} v\) are linearly independent with all linear combinations that are currently stored. This is coded but not tested.- Specified by:
isMultithreadedin interfaceCodeOperations- Returns:
- returns
trueif multithreading is used when calculating if some vector \(v\) is an appropriate codeword to be added to the generator matrix \(G\),falseotherwise
-
isCodewordRestrictionApplied
public boolean isCodewordRestrictionApplied()Description copied from interface:CodeOperationsReturnstrueif a specific form of cut down in the space search has been applied,falseotherwise. This should always betrue. The explanation of this form is found on page 91 of the thesis.- Specified by:
isCodewordRestrictionAppliedin interfaceCodeOperations- Returns:
- returns
trueif a specific form of cut down in the space search has been applied,falseotherwise
-
getCodeStatistics
Description copied from interface:CodeOperationsReturns the code statistics which includes the total time taken, parameters of the code and parameters of the validator used.- Specified by:
getCodeStatisticsin interfaceCodeOperations- Returns:
- the statistics of the code
-
getCodeValidatorParameters
Description copied from interface:CodeOperationsReturns the code validator parameters of the code.- Specified by:
getCodeValidatorParametersin interfaceCodeOperations- Returns:
- the code validator parameters of the code
-