Class WeightEnumerator

java.lang.Object
hlcd.operations.WeightEnumerator

public class WeightEnumerator extends Object
Creates the weight enumerator of the codewords in the code in the form of: \(\operatorname{w}(x)_{\mathsf{C}} = A_{0} + A_{1}x + A_{2}x^2 + \ldots + A_{n- 2}x^{n-2} + A_{n - 1}x^{n-1} + A_nx^n\), where \(A_{i}\) is the number of codewords in \(\mathsf{C}\) whose Hamming weight is \(i\). This form is used for both binary and quaternary codes.
 //minimal example to execute this class:
 public void main(String[] args) {
     System.out.println("Running WeightEnumerator...");
     byte n = 5;
     byte k = 2;
     byte d = 3;
     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();
     //get the combinations array
     LongArray combinations = code.getCombinations();
     WeightEnumerator we = new WeightEnumerator(n, k, d, base, combinations);
     System.out.println(we);
     combinations.print(" ", Style.DECIMAL);
     System.out.println();
     code.printGeneratorMatrix(true, Style.DECIMAL, true);
     System.out.println("WeightEnumerator completed.");
 }
Since:
February 11th, 2022
Version:
1.0
Author:
Maysara Al Jumaily
  • Constructor Details

    • WeightEnumerator

      public WeightEnumerator(byte n, byte k, byte d, byte base, LongArray combinations)
      Constructs a weight enumerator based on the \(n\), \(k\) and \(d\) values as well as the linear combinations of codewords specified.
      Parameters:
      n - the length of code
      k - the dimension of the code
      d - the minimum distance of the code
      base - the base of the code which should be \(2\) or \(4\)
      combinations - the codewords in the code \(\mathsf{C}\)
  • Method Details

    • getWeightEnumerator

      public long[] getWeightEnumerator()
      Returns the weight enumerator result. The array at index \(i\) contains the number of codewords whose weight is \(i\).
      Returns:
      the weight enumerator result
    • toString

      public String toString()
      Overrides:
      toString in class Object