Class Code

java.lang.Object
hlcd.linearCode.Code
All Implemented Interfaces:
CodeOperations, Serializable

public class Code extends Object implements 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

    Constructors
    Constructor
    Description
    The only constructor which accepts the code parameters and the code validator parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte
    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.
    byte
    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).
    byte
    Returns the dimension of the \(\left[n, \, k, \, d\right]_{base}\) code.
    byte
    Returns the length of each codeword in a \(\left[n, \, k, \, d\right]_{ base}\) code.
    long
    Returns the number of recursive calls required to arrive to the solution.
    byte
    Returns the minimum weight of the right-side of the generator matrix \(G\) that is in standard form, which is \(d - 1\).
    boolean
    Returns true if a specific form of cut down in the space search has been applied, false otherwise.
    boolean
    Returns true if the code is Hermitian linear complementary code, false otherwise.
    boolean
    Returns true if the identity matrix is appended to the left-side of the generator matrix, false otherwise.
    boolean
    Returns true if multithreading is used when calculating if some vector \(v\) is an appropriate codeword to be added to the generator matrix \(G\), false otherwise.
    void
    Prints the current code parameters on screen.
    void
    printCombinations​(String delimiter, Style style)
    Prints the elements in the combination array on screen with the style type specified.
    void
    Prints 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.
    void
    printGeneratorMatrix​(boolean addBrackets, Style style, boolean showSize)
    Prints the current matrix on console with columns separated by a single space.
    void
    printGeneratorMatrix​(String delimiter, boolean addBrackets, Style style, boolean showSize)
    Prints the current matrix on console.
    void
    Starts the search of the entire program.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Code

      public Code(CodeParameters cp, CodeValidatorParameters cvp)
      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 execute
      cvp - 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

      public WeightEnumerator getCodeWeightEnumerator()
      Returns the weight enumerator of the code.
      Returns:
      the weight enumerator of the code
    • printGeneratorMatrix

      public void printGeneratorMatrix()
      Description copied from interface: CodeOperations
      Prints 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:
      printGeneratorMatrix in interface CodeOperations
    • printGeneratorMatrix

      public void printGeneratorMatrix(boolean addBrackets, Style style, boolean showSize)
      Description copied from interface: CodeOperations
      Prints the current matrix on console with columns separated by a single space. The brackets surrounding the matrix will be displayed if addBrackets is true. Each digit is displayed based on the style specified. It will show the size of the matrix in the bottom-right corner if showSize is true.
      Specified by:
      printGeneratorMatrix in interface CodeOperations
      Parameters:
      addBrackets - should brackets around the matrix be displayed
      style - 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: CodeOperations
      Prints the current matrix on console. The columns will be separated by the delimiter specified. The brackets surrounding the matrix will be displayed if addBrackets is true. Each digit is displayed based on the style specified. It will show the size of the matrix in the bottom-right corner if showSize is true.
      Specified by:
      printGeneratorMatrix in interface CodeOperations
      Parameters:
      delimiter - the delimiter between columns of current matrix
      addBrackets - should brackets around the matrix be displayed
      style - 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

      public void printCombinations(String delimiter, Style style)
      Description copied from interface: CodeOperations
      Prints the elements in the combination array on screen with the style type specified.
      Specified by:
      printCombinations in interface CodeOperations
      Parameters:
      delimiter - the delimiter between each digit
      style - the style format which could either be binary, quaternary, decimal or \(\LaTeX\)
    • printCodeParameters

      public void printCodeParameters()
      Description copied from interface: CodeOperations
      Prints 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:
      printCodeParameters in interface CodeOperations
      See Also:
      CodeParameters
    • getCodeParameters

      public 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

      public Matrix getGeneratorMatrix()
      Description copied from interface: CodeOperations
      Returns the generator matrix \(G\).
      Specified by:
      getGeneratorMatrix in interface CodeOperations
      Returns:
      the generator matrix \(G\)
      See Also:
      CodeOperations.getGeneratorMatrixCopy()
    • getGeneratorMatrixCopy

      public Matrix getGeneratorMatrixCopy()
      Description copied from interface: CodeOperations
      Returns the matrix \(G\) as a brand-new copy (deep copy).

      NOT TESTED YET!

      Specified by:
      getGeneratorMatrixCopy in interface CodeOperations
      Returns:
      the matrix \(G\) as a brand-new copy (deep copy)
      See Also:
      CodeOperations.getGeneratorMatrix()
    • getCombinations

      public LongArray getCombinations()
      Description copied from interface: CodeOperations
      The linear combinations of the codewords in the code.
      Specified by:
      getCombinations in interface CodeOperations
      Returns:
      the linear combinations of the codewords in the code
    • getN

      public byte getN()
      Description copied from interface: CodeOperations
      Returns 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:
      getN in interface CodeOperations
      Returns:
      the length of each codeword in the \(\left[n, \, k, \, d\right]_{base}\) code
    • getK

      public byte getK()
      Description copied from interface: CodeOperations
      Returns 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:
      getK in interface CodeOperations
      Returns:
      the dimension of the \(\left[n, \, k, \, d\right]_{base}\) code
    • getD

      public byte getD()
      Description copied from interface: CodeOperations
      Returns the minimum distance of the \(\left[n, \, k, \, d\right]_{base}\) code. It should be less than \(n\).
      Specified by:
      getD in interface CodeOperations
      Returns:
      the minimum distance of the \(\left[n, \, k, \, d\right]_{base}\) code
    • getBase

      public byte getBase()
      Description copied from interface: CodeOperations
      Returns the base of the \(\left[n, \, k, \, d\right]_{base}\) code. It could either be \(2\) or \(4\).
      Specified by:
      getBase in interface CodeOperations
      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: CodeOperations
      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\).
      Specified by:
      getRHSWeight in interface CodeOperations
      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: CodeOperations
      Returns true if the code is Hermitian linear complementary code, false otherwise. 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:
      isHLCD in interface CodeOperations
      Returns:
      returns true if the code is Hermitian linear complementary code, false otherwise
    • isIdentityAppended

      public boolean isIdentityAppended()
      Description copied from interface: CodeOperations
      Returns true if the identity matrix is appended to the left-side of the generator matrix, false otherwise.
      Specified by:
      isIdentityAppended in interface CodeOperations
      Returns:
      returns true if the identity matrix is appended to the left-side of the generator matrix, false otherwise
    • isMultithreaded

      public boolean isMultithreaded()
      Description copied from interface: CodeOperations
      Returns true if multithreading is used when calculating if some vector \(v\) is an appropriate codeword to be added to the generator matrix \(G\), false otherwise. 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:
      isMultithreaded in interface CodeOperations
      Returns:
      returns true if multithreading is used when calculating if some vector \(v\) is an appropriate codeword to be added to the generator matrix \(G\), false otherwise
    • isCodewordRestrictionApplied

      public boolean isCodewordRestrictionApplied()
      Description copied from interface: CodeOperations
      Returns true if a specific form of cut down in the space search has been applied, false otherwise. This should always be true. The explanation of this form is found on page 91 of the thesis.
      Specified by:
      isCodewordRestrictionApplied in interface CodeOperations
      Returns:
      returns true if a specific form of cut down in the space search has been applied, false otherwise
    • getCodeStatistics

      public CodeStatistics getCodeStatistics()
      Description copied from interface: CodeOperations
      Returns the code statistics which includes the total time taken, parameters of the code and parameters of the validator used.
      Specified by:
      getCodeStatistics in interface CodeOperations
      Returns:
      the statistics of the code
    • getCodeValidatorParameters

      public CodeValidatorParameters getCodeValidatorParameters()
      Description copied from interface: CodeOperations
      Returns the code validator parameters of the code.
      Specified by:
      getCodeValidatorParameters in interface CodeOperations
      Returns:
      the code validator parameters of the code