Class Matrix

java.lang.Object
hlcd.operations.Matrix
All Implemented Interfaces:
MatrixOperations, Serializable, Cloneable

public class Matrix extends Object implements MatrixOperations, Serializable, Cloneable
Defines a matrix as a 1-D array where there are 62 columns. The two far-left columns (i.e., indices 0 and 1) are not used. The indices 2 and above are used. A vector will start at the appropriate column and span to the right direction \(n\) columns. Using this approach, the columns that will be covered are: x, x+1, ..., 62 and 63 (far-right). For example, consider the following randomly matrix of a \(\left[n, \, k\right]_{base} = \left[7, \,4\right]_{4}\) code: \begin{equation} \begin{bmatrix} \omega & \omega & \omega & 0 & \overline{\omega} & 0 & 0\\ \omega & \overline{\omega} & \omega & 1 & 0 & \overline{\omega} & \overline{\omega}\\ 0 & \omega & \overline{\omega} & 1 & \omega & \overline{\omega} & \omega\\ 1 & \overline{\omega} & 1 & 0 & 0 & 1 &\overline{\omega} \end{bmatrix}. \end{equation} In Java, the binary representation of each of the four vectors is written as: \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 10 & 10 & 10 & 00 & 11 & 00 & 00\\ 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 10 & 11 & 10 & 01 & 00 & 11 & 11\\ 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 10 & 11 & 01 & 10 & 11 & 10\\ 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 01 & 11 & 01 & 00 & 00 & 01 & 11\\ \end{bmatrix}. \end{equation}

It also has the ability to find the transpose of the current matrix, complex conjugation transpose and the determinant. Finding the determinant uses a modified version of Bareiss's Algorithm. A complete pseudocode can be on page 96 of the thesis. The algorithm is implemented in the private method of this class getDeterminantEngine(Matrix).

TODO: create a method to return the parity check matrix when the generator matrix is in standard form.

 //minimal example to execute this class:
 public static void main(String[] args) {
     System.out.println("Running the \"Matrix\" class...");
     //generate a random matrix array
     byte minN = 7;
     byte maxN = 7;
     byte minK = 4;
     byte maxK = 4;
     RandomMatrixGenerator rmg = new RandomMatrixGenerator(
         minN, maxN, minK, maxK, (byte) 4
     );
     //convert matrix array to a Matrix object
     Matrix g = new Matrix(
         rmg.getMatrixArrayClone(), rmg.getN(), rmg.getK(), rmg.getBase()
     );
     //print the matrix using all possible styles
     System.out.println("Printing matrix using binary style:");
     g.printMatrix(" ", false, Style.BINARY, false);
     System.out.println();
     System.out.println("Printing matrix using decimal style:");
     g.printMatrix(" ", false, Style.DECIMAL, true);
     System.out.println();
     System.out.println("Printing matrix using quaternary style:");
     g.printMatrix(" ", true, Style.QUATERNARY, false);
     System.out.println();
     System.out.println("Printing matrix using LaTeX style:");
     g.printMatrix(" ", true, Style.LATEX, true);

     System.out.println("Transposing the top row of the matrix:");
     byte[] col = g.transposeRowToCol((byte) 0);
     for (int i = 0; i < col.length; i++) {
         System.out.println(col[i]);
     }
     System.out.println("Transposing the far-left column of the matrix:");
     long row = g.transposeColToRow((byte) 0);
     System.out.println(MatrixPrinter.vectorAsString(
         row, g.getK(), g.getN(), " ", Style.DECIMAL
     ));
     System.out.println();
     System.out.println("Transposing the matrix:");
     Matrix transpose = g.transpose();
     transpose.printMatrix(" ", true, Style.DECIMAL, true);
     System.out.println();
     System.out.println("Hermitian transposing the matrix:");
     Matrix hermitianTranspose = g.hermitianTranspose();
     hermitianTranspose.printMatrix(" ", true, Style.DECIMAL, true);
     System.out.println("The \"Matrix\" class completed.");
 }
Since:
1.8
Version:
1.0 (February 8th, 2022)
Author:
Maysara Al Jumaily
See Also:
Long, M.Sc. thesis, Serialized Form
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a random quaternary matrix with \(1 \leq k \leq 30\) and \(1 \leq n \leq 30\).
    Matrix​(byte n, byte k)
    Creates a random quaternary matrix with the specified dimension.
    Matrix​(byte n, byte k, byte base)
    Creates a matrix based on the specified values of \(n\), \(k\), \(d\) and \(base\).
    Matrix​(long[] matrixArray, byte n, byte k, byte base)
    Creates a matrix based on the specified values of \(n\), \(k\), \(d\), \(base\) and the matrix array.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the current matrix as a brand-new copy.
    boolean
    To check if the matrix contains at least a single row of 0.
    byte
    Returns the base of the current matrix which is equivalent to the base of the code \(\mathsf{C}\).
    byte
    getCell​(byte r, byte c)
    Returns the value of a cell based on the row index and column index specified.
    byte
    getCell​(long[] matrixArray, byte r, byte c, byte n, byte base)
    Returns the value of a cell based on the specified matrix array, row index and column index.
    byte
    getCell​(Matrix m, byte r, byte c)
    Returns the value of a cell based on the specified matrix, row index and column index.
    byte[]
    getColumn​(byte index)
    Returns a column in the current matrix based on the index specified.
    byte[]
    getColumn​(long[] matrixArray, byte n, byte index, byte base)
    Returns a column in the matrix array specified based on the index specified.
    byte[]
    getColumn​(Matrix m, byte index)
    Returns a column in the matrix specified based on the index specified.
    byte
    Uses Bareiss Algorithm to find the determinant of \(G^{\prime}\), which is \(G^{\kern0pt}_{k \times n} \overline{G}^{T}_{n \times k}\).
    byte
    Uses Bareiss Algorithm to find the determinant of the matrix specified.
    Returns the matrix \(G^{\prime}_{k \times k} = G^{\kern0pt}_{k \times n} \overline{G}^{T}_{n \times k}\) without altering the current matrix.
    getGPrime​(byte examiningRow)
    Returns the submatrix of \(G^{\prime}_{sub} = G^{\kern0pt}_{x \times n} \overline{G}^{T}_{n \times x}\), where \(x\) is the largest row index in \(G\) that is nonzero.
    byte
    Returns the number of rows in the current matrix which is equivalent to the dimension \(k\) of the code \(\mathsf{C}\).
    Returns the current matrix but not as a brand-new copy.
    long[]
    Returns the current matrix array but not as a brand-new instance.
    long[]
    Returns a brand-new copy of the current matrix array.
    long[]
    getMatrixArrayCopy​(long[] matrixArray)
    Returns a brand-new copy of the matrix array specified.
    byte
    Returns the number of columns in the current matrix which is equivalent to the length \(n\) of the codeword in the code \(\mathsf{C}\).
    long
    getRow​(byte index)
    Returns a row in the current matrix based on the index specified.
    long
    getRow​(long[] arrayMatrix, byte index)
    Returns a row in the matrix array specified based on the index specified.
    long
    getRow​(Matrix m, byte index)
    Returns a row in the matrix specified based on the index specified.
    Returns a new matrix that is the Hermitian transpose of the current matrix.
    long[]
    hermitianTranspose​(long[] matrixArray, byte n, byte k, byte base)
    Returns a new matrix that is the Hermitian transpose of the matrix array specified.
    Returns a new matrix that is the Hermitian transpose of the specified matrix.
    boolean
    Returns true if the current matrix is invertible (i.e., the determinant of the current matrix is not \(0\)), false if the determinant is \(0\).
    boolean
    Returns true if the specified matrix is invertible (i.e., the determinant of the matrix is not \(0\)), false if the determinant is \(0\).
    multiply​(long[] leftMatrixArray, long[] rightMatrixArray, byte leftMatrixArrayN, byte rightMatrixArrayN, byte leftMatrixArrayK, byte rightMatrixArrayK, byte leftMatrixArrayBase, byte rightMatrixArrayBase)
    Multiplies two specified matrix arrays and returns the result as a new matrix.
    Multiplies two matrices and returns the result as a new matrix.
    multiply​(Matrix left, Matrix right)
    Multiplies two specified matrices and returns the result as a new matrix.
    byte
    multiplyRowByCol​(long[] leftMatrix, long[] rightMatrix, byte leftMatrixArrayN, byte rightMatrixArrayN, byte leftMatrixArrayK, byte rightMatrixArrayK, byte leftMatrixArrayBase, byte rightMatrixArrayBase, byte row, byte column)
    Multiplies a row from matrix array specified by a column from the other specified matrix array which yields a single digit.
    byte
    multiplyRowByCol​(Matrix rightMatrix, byte row, byte column)
    Multiplies a row from current matrix by a column from specified matrix which yields a single digit.
    byte
    multiplyRowByCol​(Matrix leftMatrix, Matrix rightMatrix, byte row, byte column)
    Multiplies a row from matrix specified by a column from the other specified matrix which yields a single digit.
    long
    multiplyRowByDigit​(byte index, byte digit)
    Multiplies the row vector at the index specified in the current matrix by the digit specified.
    long
    multiplyRowByDigit​(long rowVector, byte digit, byte n, byte base)
    Multiplies the row vector specified by the digit 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
    printMatrix​(boolean addBrackets, Style style, boolean showSize)
    Prints the current matrix on console with columns separated by a single space.
    void
    printMatrix​(long[] matrixArray, byte n, byte base, String delimiter, boolean addBrackets, Style style, boolean showSize)
    Prints the specified matrix array on console.
    void
    printMatrix​(String delimiter, boolean addBrackets, Style style, boolean showSize)
    Prints the current matrix on console.
    void
    Prints the parameters (\(n\), \(k\) and \(base\)) of the code on console.
    void
    setCell​(byte row, byte column, byte value)
    Sets the value of a cell based on its row index and column index in the current matrix.
    void
    setCell​(long[] matrixArray, byte r, byte c, byte value, byte n, byte base)
    Sets the value of a cell based on its row index and column index in the current matrix.
    void
    setCell​(Matrix m, byte row, byte column, byte value)
    Sets the value of a cell based on the specified matrix, row index, column index and value.
    void
    setColumn​(byte columnIndex, byte[] newColumn)
    Sets a specific column in the current matrix based on the specified column index and new column vector.
    void
    setColumn​(long[] matrixArray, byte columnIndex, byte[] newColumn, byte base)
    Sets a specific column based on the specified matrix array, column index and new column vector.
    void
    setColumn​(Matrix m, byte index, byte[] newColumn)
    Sets a specific column based on the specified matrix, column index and new column vector.
    void
    setMatrixArray​(long[] matrixArray, byte n, byte k, boolean deepCopy)
    Sets the matrix array of the current matrix to the specified matrix array.
    void
    setRow​(byte index, long newRow)
    Sets a specific row in the current matrix based on the specified row index and new row vector.
    void
    setRow​(long[] matrixArray, byte index, long newRow)
    Sets a specific row based on the specified matrix array, row index and new row vector.
    void
    setRow​(Matrix m, byte index, long newRow)
    Sets a specific row based on the specified matrix, row index and new row vector.
    Returns a new matrix that is the transpose of the current matrix.
    long[]
    transpose​(long[] matrixArray, byte n, byte k, byte base)
    Returns a new matrix that is the transpose of specified matrix array.
    Will return a new matrix that is the transpose of the matrix specified.
    long
    transposeColToRow​(byte columnIndex)
    Returns the transpose of the column vector at the index in the current matrix.
    long
    transposeColToRow​(byte[] columnVector, byte base)
    Returns the transpose of the column vector specified.
    long
    transposeColToRow​(Matrix m, byte columnIndex)
    Returns the transpose of a specific column in the matrix specified matrix.
    byte[]
    transposeRowToCol​(byte index)
    Returns the transpose of the row vector at the index in the current matrix.
    byte[]
    transposeRowToCol​(long rowVector, byte x, byte base)
    Returns the transpose of the row vector specified.
    byte[]
    transposeRowToCol​(Matrix m, byte row)
    Returns the transpose of a specific row in the matrix specified matrix.

    Methods inherited from class java.lang.Object

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

    • Matrix

      public Matrix()
      Creates a random quaternary matrix with \(1 \leq k \leq 30\) and \(1 \leq n \leq 30\). This constructor can be used for testing.
    • Matrix

      public Matrix(byte n, byte k)
      Creates a random quaternary matrix with the specified dimension. This specific constructor can be used for testing.
      Parameters:
      n - the number of columns in the matrix (which should match the length of codewords in the code)
      k - the number of rows in the matrix (which should match the dimension of the code)
    • Matrix

      public Matrix(byte n, byte k, byte base)
      Creates a matrix based on the specified values of \(n\), \(k\), \(d\) and \(base\). A null matrix will be created.
      Parameters:
      n - the number of columns in the matrix (which should match the length of codewords in the code)
      k - the number of rows in the matrix (which should match the dimension of the code)
      base - the base of the code (could be either \(2\) or \(4\))
    • Matrix

      public Matrix(long[] matrixArray, byte n, byte k, byte base)
      Creates a matrix based on the specified values of \(n\), \(k\), \(d\), \(base\) and the matrix array.
      Parameters:
      matrixArray - the default values to assign the cells of the matrix
      n - the number of columns in the matrix (which should match the length of codewords in the code)
      k - the number of rows in the matrix (which should match the dimension of the code)
      base - the base of the code (could be either \(2\) or \(4\))
  • Method Details

    • transposeRowToCol

      public byte[] transposeRowToCol(byte index)
      Description copied from interface: MatrixOperations
      Returns the transpose of the row vector at the index in the current matrix. The current matrix will not be altered. For example, say that the current code is \(\left[n, \, k\right]_{base} = \left[5, \, 1\right]_{4}\). Assume the row specified is \begin{equation} \begin{bmatrix} 01 & 11 & 10 & 01 & 00 \end{bmatrix}, \end{equation} the transpose will be \begin{equation} \begin{bmatrix} 01 \\ 11 \\ 10 \\ 01 \\ 00 \end{bmatrix}. \end{equation} In this example, the row vector is stored as the following in Java: \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 01 & 11 & 10 & 01 & 00 \end{bmatrix}, \end{equation} and the output, which is a byte array will be \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 11\\ 0b & 00 & 00 & 00 & 10\\ 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 00\\ \end{bmatrix}. \end{equation}
      Specified by:
      transposeRowToCol in interface MatrixOperations
      Parameters:
      index - row index of the row in current matrix to be transposed (zero-based)
      Returns:
      a column vector of size \(n \times 1\)
    • transposeRowToCol

      public byte[] transposeRowToCol(long rowVector, byte x, byte base)
      Description copied from interface: MatrixOperations
      Returns the transpose of the row vector specified. For example, say that the current code is \(\left[n, \, k\right]_{base} = \left[5, \, 1\right]_{4}\). Assume the row specified is \begin{equation} \begin{bmatrix} 01 & 11 & 10 & 01 & 00 \end{bmatrix}, \end{equation} the transpose will be \begin{equation} \begin{bmatrix} 01 \\ 11 \\ 10 \\ 01 \\ 00 \end{bmatrix}. \end{equation} In this example, the row vector is stored as the following in Java: \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 01 & 11 & 10 & 01 & 00 \end{bmatrix}, \end{equation} and the output, which is a byte array will be \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 11\\ 0b & 00 & 00 & 00 & 10\\ 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 00\\ \end{bmatrix}. \end{equation}
      Specified by:
      transposeRowToCol in interface MatrixOperations
      Parameters:
      rowVector - the row vector to be transposed
      x - the number of rows in the result
      base - the base of the code (could be either \(2\) or \(4\))
      Returns:
      a column vector of size \(x \times 1\)
    • transposeRowToCol

      public byte[] transposeRowToCol(Matrix m, byte row)
      Description copied from interface: MatrixOperations
      Returns the transpose of a specific row in the matrix specified matrix. The matrix specified will not be altered. For example, say that the current code is \(\left[n, \, k\right]_{base} = \left[5, \, 1\right]_{4}\). Assume the row specified is \begin{equation} \begin{bmatrix} 01 & 11 & 10 & 01 & 00 \end{bmatrix}, \end{equation} the transpose will be \begin{equation} \begin{bmatrix} 01 \\ 11 \\ 10 \\ 01 \\ 00 \end{bmatrix}. \end{equation} In this example, the row vector is stored as the following in Java: \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 01 & 11 & 10 & 01 & 00 \end{bmatrix}, \end{equation} and the output, which is a byte array will be \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 11\\ 0b & 00 & 00 & 00 & 10\\ 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 00\\ \end{bmatrix}. \end{equation}
      Specified by:
      transposeRowToCol in interface MatrixOperations
      Parameters:
      m - the matrix to obtain the row vector from
      row - row index of the row in matrix specified to be transposed (zero-based)
      Returns:
      a column vector of size \(n \times 1\)
    • transposeColToRow

      public long transposeColToRow(byte columnIndex)
      Description copied from interface: MatrixOperations
      Returns the transpose of the column vector at the index in the current matrix. The current matrix will not be altered. For example, say that the current code is \(\left[n, \, k\right]_{base} = \left[1, \, 5\right]_{4}\). Assume the column specified is \begin{equation} \begin{bmatrix} 01 \\ 11 \\ 10 \\ 01 \\ 00 \end{bmatrix}, \end{equation} the transpose will be \begin{equation} \begin{bmatrix} 01 & 11 & 10 & 01 & 00 \end{bmatrix}. \end{equation} In this example, the column vector is stored as the following in Java: \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 11\\ 0b & 00 & 00 & 00 & 10\\ 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 00\\ \end{bmatrix}, \end{equation} and the output stored as \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 01 & 11 & 10 & 01 & 00 \end{bmatrix}. \end{equation}
      Specified by:
      transposeColToRow in interface MatrixOperations
      Parameters:
      columnIndex - column index of the column in current matrix to be transposed (zero-based)
      Returns:
      a row vector of size \(1 \times k\) with non-used entries as zeros
    • transposeColToRow

      public long transposeColToRow(byte[] columnVector, byte base)
      Description copied from interface: MatrixOperations
      Returns the transpose of the column vector specified. For example, say that the current code is \(\left[n, \, k\right]_{base} = \left[1, \, 5\right]_{4}\). Assume the column specified is \begin{equation} \begin{bmatrix} 01 \\ 11 \\ 10 \\ 01 \\ 00 \end{bmatrix}, \end{equation} the transpose will be \begin{equation} \begin{bmatrix} 01 & 11 & 10 & 01 & 00 \end{bmatrix}. \end{equation} In this example, the column vector is stored as the following in Java: \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 11\\ 0b & 00 & 00 & 00 & 10\\ 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 00\\ \end{bmatrix}, \end{equation} and the output stored as \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 01 & 11 & 10 & 01 & 00 \end{bmatrix}. \end{equation}
      Specified by:
      transposeColToRow in interface MatrixOperations
      Parameters:
      columnVector - the column vector to be transposed
      base - the base of the code (could be either \(2\) or \(4\))
      Returns:
      a row vector of size \(1 \times k\) with non-used entries as zeros
    • transposeColToRow

      public long transposeColToRow(Matrix m, byte columnIndex)
      Description copied from interface: MatrixOperations
      Returns the transpose of a specific column in the matrix specified matrix. The matrix specified will not be altered. For example, say that the current code is \(\left[n, \, k\right]_{base} = \left[1, \, 5\right]_{4}\). Assume the column specified is \begin{equation} \begin{bmatrix} 01 \\ 11 \\ 10 \\ 01 \\ 00 \end{bmatrix}, \end{equation} the transpose will be \begin{equation} \begin{bmatrix} 01 & 11 & 10 & 01 & 00 \end{bmatrix}. \end{equation} In this example, the column vector is stored as the following in Java: \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 11\\ 0b & 00 & 00 & 00 & 10\\ 0b & 00 & 00 & 00 & 01\\ 0b & 00 & 00 & 00 & 00\\ \end{bmatrix}, \end{equation} and the output stored as \begin{equation} \begin{bmatrix} 0b & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 00 & 01 & 11 & 10 & 01 & 00 \end{bmatrix}. \end{equation}
      Specified by:
      transposeColToRow in interface MatrixOperations
      Parameters:
      m - the matrix to obtain the column vector from
      columnIndex - column index of the column in matrix specified to be transposed (zero-based)
      Returns:
      a row vector of size \(1 \times k\) with non-used entries as zeros
    • transpose

      public Matrix transpose()
      Description copied from interface: MatrixOperations
      Returns a new matrix that is the transpose of the current matrix. The current matrix will not be altered.
      Specified by:
      transpose in interface MatrixOperations
      Returns:
      a new instance of the matrix transposed
      See Also:
      MatrixOperations.hermitianTranspose()
    • transpose

      public Matrix transpose(Matrix m)
      Description copied from interface: MatrixOperations
      Will return a new matrix that is the transpose of the matrix specified. The matrix specified will not be altered.
      Specified by:
      transpose in interface MatrixOperations
      Parameters:
      m - the matrix to be transposed
      Returns:
      a new instance of the matrix transposed
      See Also:
      MatrixOperations.hermitianTranspose(Matrix)
    • transpose

      public long[] transpose(long[] matrixArray, byte n, byte k, byte base)
      Description copied from interface: MatrixOperations
      Returns a new matrix that is the transpose of specified matrix array. The matrix array specified will not be altered.
      Specified by:
      transpose in interface MatrixOperations
      Parameters:
      matrixArray - the matrix array to be transposed
      n - the number of columns in the matrix array which is the same as the length of code \(\mathsf{C}\)
      k - the number of rows in the matrix array which is the same as the dimension of code \(\mathsf{C}\)
      base - the base of the code (could be either \(2\) or \(4\))
      Returns:
      a new instance of the matrix array transposed
      See Also:
      MatrixOperations.hermitianTranspose(long[], byte, byte, byte)
    • hermitianTranspose

      public Matrix hermitianTranspose()
      Description copied from interface: MatrixOperations
      Returns a new matrix that is the Hermitian transpose of the current matrix. The current matrix will not be altered. Essentially, it will apply the transpose of the current matrix and swap cells containing \(\omega\) with \(\overline{\omega}\) and vice-versa.
      Specified by:
      hermitianTranspose in interface MatrixOperations
      Returns:
      a new instance of the Hermitian transpose of the current matrix
      See Also:
      MatrixOperations.transpose()
    • hermitianTranspose

      public Matrix hermitianTranspose(Matrix m)
      Description copied from interface: MatrixOperations
      Returns a new matrix that is the Hermitian transpose of the specified matrix. The matrix array will not be altered. Essentially, it will apply the transpose of the matrix and swap cells containing \(\omega\) with \(\overline{\omega}\) and vice-versa.
      Specified by:
      hermitianTranspose in interface MatrixOperations
      Parameters:
      m - the matrix to be Hermitian transposed
      Returns:
      a new instance of the Hermitian transpose of specified matrix
      See Also:
      MatrixOperations.transpose(Matrix)
    • hermitianTranspose

      public long[] hermitianTranspose(long[] matrixArray, byte n, byte k, byte base)
      Description copied from interface: MatrixOperations
      Returns a new matrix that is the Hermitian transpose of the matrix array specified. The matrix array will not be altered. Essentially, it will apply the transpose of the matrix array and swap cells containing \(\omega\) with \(\overline{\omega}\) and vice-versa.
      Specified by:
      hermitianTranspose in interface MatrixOperations
      Parameters:
      matrixArray - the matrix array to be Hermitian transposed
      n - the number of columns in the matrix array
      k - the number of rows in the matrix array
      base - the base of the code (could be either \(2\) or \(4\))
      Returns:
      a new instance of the Hermitian transpose of specified matrix array
      See Also:
      MatrixOperations.transpose(long[], byte, byte, byte)
    • clone

      public Matrix clone()
      Returns the current matrix as a brand-new copy.
      Overrides:
      clone in class Object
      Returns:
      the current matrix as a brand-new copy
    • getMatrixArrayCopy

      public long[] getMatrixArrayCopy()
      Description copied from interface: MatrixOperations
      Returns a brand-new copy of the current matrix array.
      Specified by:
      getMatrixArrayCopy in interface MatrixOperations
      Returns:
      the current matrix array as a brand-new copy
      See Also:
      getMatrixArray()
    • getMatrixArrayCopy

      public long[] getMatrixArrayCopy(long[] matrixArray)
      Description copied from interface: MatrixOperations
      Returns a brand-new copy of the matrix array specified.
      Specified by:
      getMatrixArrayCopy in interface MatrixOperations
      Parameters:
      matrixArray - the matrix array to be copy
      Returns:
      a brand-new copy of matrix array specified
    • multiplyRowByCol

      public byte multiplyRowByCol(Matrix rightMatrix, byte row, byte column)
      Description copied from interface: MatrixOperations
      Multiplies a row from current matrix by a column from specified matrix which yields a single digit. The digit can either be a \(0\) or \(1\) in base \(2\) or \(0\), \(1\), \(2\) or \(3\) in base \(4\). The row will be extracted from the current matrix whereas the column will be extracted from the matrix specified.
      Specified by:
      multiplyRowByCol in interface MatrixOperations
      Parameters:
      rightMatrix - The matrix to extract the column from
      row - the row index (zero-based) from current matrix to use for multiplication
      column - the column index (zero-based) from matrix specified to use for multiplication
      Returns:
      the result when the row from current matrix is multiplied by the column from the matrix specified
    • multiplyRowByCol

      public byte multiplyRowByCol(Matrix leftMatrix, Matrix rightMatrix, byte row, byte column)
      Description copied from interface: MatrixOperations
      Multiplies a row from matrix specified by a column from the other specified matrix which yields a single digit. The digit can either be a \(0\) or \(1\) in base \(2\) or \(0\), \(1\), \(2\) or \(3\) in base \(4\). The row will be extracted from the left matrix specified whereas the column will be extracted from the right matrix specified.
      Specified by:
      multiplyRowByCol in interface MatrixOperations
      Parameters:
      leftMatrix - The matrix to extract the row from
      rightMatrix - The matrix to extract the column from
      row - the row index (zero-based) from leftMatrix to use for multiplication
      column - the column index (zero-based) from rightMatrix to use for multiplication
      Returns:
      the result when the row from leftMatrix is multiplied by the column from rightMatrix
    • multiplyRowByCol

      public byte multiplyRowByCol(long[] leftMatrix, long[] rightMatrix, byte leftMatrixArrayN, byte rightMatrixArrayN, byte leftMatrixArrayK, byte rightMatrixArrayK, byte leftMatrixArrayBase, byte rightMatrixArrayBase, byte row, byte column)
      Description copied from interface: MatrixOperations
      Multiplies a row from matrix array specified by a column from the other specified matrix array which yields a single digit. The digit can either be a \(0\) or \(1\) in base \(2\) or \(0\), \(1\), \(2\) or \(3\) in base \(4\). The row will be extracted from the left matrix array specified whereas the column will be extracted from the right matrix specified.
      Specified by:
      multiplyRowByCol in interface MatrixOperations
      Parameters:
      leftMatrix - The matrix to extract the row from
      rightMatrix - The matrix to extract the column from
      leftMatrixArrayN - the number of columns in leftMatrixArray
      rightMatrixArrayN - the number of columns in rightMatrixArray
      leftMatrixArrayK - the number of rows in leftMatrixArray
      rightMatrixArrayK - the number of rows in rightMatrixArray
      leftMatrixArrayBase - the base of leftMatrixArray (could be either \(2\) or \(4\))
      rightMatrixArrayBase - the base of rightMatrixArray (could be either \(2\) or \(4\))
      row - the row index (zero-based) from leftMatrixArray to use for multiplication
      column - the column index (zero-based) from rightMatrixArray to use for multiplication
      Returns:
      the result when the row from leftMatrixArray is multiplied by the column from rightMatrixArray
    • getDeterminant

      public byte getDeterminant()
      Description copied from interface: MatrixOperations
      Uses Bareiss Algorithm to find the determinant of \(G^{\prime}\), which is \(G^{\kern0pt}_{k \times n} \overline{G}^{T}_{n \times k}\). It uses the current matrix stored and multiplies it by its complex conjugation and finds the determinant of that resulting matrix after multiplication. This will not alter any matrices in the program and should be used for quaternary codes.
      Specified by:
      getDeterminant in interface MatrixOperations
      Returns:
      the determinant of \(G^{\prime} = G^{\kern0pt}_{k \times n} \overline{G}^{T}_{n \times k}\), which could either be \(0\), \(1\), \(2\) or \(3\) in base \(4\)
    • getDeterminant

      public byte getDeterminant(Matrix m)
      Description copied from interface: MatrixOperations
      Uses Bareiss Algorithm to find the determinant of the matrix specified. This will not alter the matrix specified and should be used for quaternary codes.
      Specified by:
      getDeterminant in interface MatrixOperations
      Parameters:
      m - the matrix to find the determinant of
      Returns:
      the determinant of the matrix specified
    • multiply

      public Matrix multiply(Matrix m)
      Description copied from interface: MatrixOperations
      Multiplies two matrices and returns the result as a new matrix. The current matrix will be the left-hand-side matrix and the matrix specified will be the right-hand-side matrix. Both matrices will not be altered.

      Note: It is common to have the left-hand-side matrix to be the generator matrix \(G\) of the code \(\mathsf{C}\) whereas the left-hand-side matrix to be \(\overline{G}^{T}_{n \times k}\) or \(G^{T}_{n \times k}\).

      Specified by:
      multiply in interface MatrixOperations
      Parameters:
      m - the right-hand-side matrix
      Returns:
      a new instance of a matrix representing the result when the current matrix (left) multiplied by the matrix specified (right)
    • multiply

      public Matrix multiply(Matrix left, Matrix right)
      Description copied from interface: MatrixOperations
      Multiplies two specified matrices and returns the result as a new matrix. Both matrices will not be altered.
      Specified by:
      multiply in interface MatrixOperations
      Parameters:
      left - the left-hand-side matrix
      right - the right-hand-side matrix
      Returns:
      a new instance of a matrix representing the result when the left matrix specified is multiplied by the right matrix specified
    • multiply

      public Matrix multiply(long[] leftMatrixArray, long[] rightMatrixArray, byte leftMatrixArrayN, byte rightMatrixArrayN, byte leftMatrixArrayK, byte rightMatrixArrayK, byte leftMatrixArrayBase, byte rightMatrixArrayBase)
      Description copied from interface: MatrixOperations
      Multiplies two specified matrix arrays and returns the result as a new matrix. Both matrix arrays will not be altered.
      Specified by:
      multiply in interface MatrixOperations
      Parameters:
      leftMatrixArray - the left-hand-side matrix array
      rightMatrixArray - the right-hand-side matrix array
      leftMatrixArrayN - the number of columns in the left-hand-side matrix array
      rightMatrixArrayN - the number of columns in the right-hand-side matrix array
      leftMatrixArrayK - the number of rows in the left-hand-side matrix array
      rightMatrixArrayK - the number of rows in the right-hand-side matrix array
      leftMatrixArrayBase - the base of leftMatrix (could be either \(2\) or \(4\))
      rightMatrixArrayBase - the base of rightMatrix (could be either \(2\) or \(4\))
      Returns:
      a new instance of a matrix representing the result when the left matrix array specified is multiplied by the right matrix array specified
    • multiplyRowByDigit

      public long multiplyRowByDigit(byte index, byte digit)
      Description copied from interface: MatrixOperations
      Multiplies the row vector at the index specified in the current matrix by the digit specified.
      Specified by:
      multiplyRowByDigit in interface MatrixOperations
      Parameters:
      index - the index of the row vector to be multiplied
      digit - the digit the row vector to be multiplied by. When the base is \(2\), only \(0\) and \(1\) are the valid digits. For base \(4\), only \(0\), \(1\), \(2\) and \(3\) are the valid digits
      Returns:
      the result when the specified digit is multiplied by the specified index of the row vector
    • multiplyRowByDigit

      public long multiplyRowByDigit(long rowVector, byte digit, byte n, byte base)
      Description copied from interface: MatrixOperations
      Multiplies the row vector specified by the digit specified.
      Specified by:
      multiplyRowByDigit in interface MatrixOperations
      Parameters:
      rowVector - the row vector to be multiplied
      digit - the digit the row vector to be multiplied by. When the base is \(2\), only \(0\) and \(1\) are the valid digits. For base \(4\), only \(0\), \(1\), \(2\) and \(3\) are the valid digits.
      n - the number of columns in the row vector
      base - the base of rowVector (could be either \(2\) or \(4\))
      Returns:
      the result when the specified digit is multiplied by the specified row vector
    • getGPrime

      public Matrix getGPrime(byte examiningRow)
      Description copied from interface: MatrixOperations
      Returns the submatrix of \(G^{\prime}_{sub} = G^{\kern0pt}_{x \times n} \overline{G}^{T}_{n \times x}\), where \(x\) is the largest row index in \(G\) that is nonzero. Since the generator matrix might contain zero vectors as it is defined like this by default, only nonzero vectors should be included in order to find \(G^{\prime}\). The single parameter denotes the number of valid codewords in \(G\). We can use this to create a new matrix \(G_{sub}\) with fewer rows, find its transpose \(\overline{G}^{T}_{sub}\), then multiply them together to get the submatrix \(G^{\prime}_{sub}\).
      Specified by:
      getGPrime in interface MatrixOperations
      Parameters:
      examiningRow - the index of the last valid row in the generator matrix (zero-based). The index specified is also included.
      Returns:
      the submatrix of \(G^{\prime}_{sub} = G^{\kern0pt}_{x \times n} \overline{G}^{T}_{n \times x}\)
      See Also:
      MatrixOperations.getGPrime()
    • getGPrime

      public Matrix getGPrime()
      Description copied from interface: MatrixOperations
      Returns the matrix \(G^{\prime}_{k \times k} = G^{\kern0pt}_{k \times n} \overline{G}^{T}_{n \times k}\) without altering the current matrix.
      Specified by:
      getGPrime in interface MatrixOperations
      Returns:
      the matrix \(G^{\prime}_{k \times k} = G^{\kern0pt}_{k \times n} \overline{G}^{T}_{n \times k}\)
      See Also:
      MatrixOperations.getGPrime(byte)
    • printParameters

      public void printParameters()
      Description copied from interface: MatrixOperations
      Prints the parameters (\(n\), \(k\) and \(base\)) of the code on console.
      Specified by:
      printParameters in interface MatrixOperations
    • printMatrix

      public void printMatrix()
      Description copied from interface: MatrixOperations
      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:
      printMatrix in interface MatrixOperations
    • printMatrix

      public void printMatrix(boolean addBrackets, Style style, boolean showSize)
      Description copied from interface: MatrixOperations
      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:
      printMatrix in interface MatrixOperations
      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
    • printMatrix

      public void printMatrix(String delimiter, boolean addBrackets, Style style, boolean showSize)
      Description copied from interface: MatrixOperations
      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:
      printMatrix in interface MatrixOperations
      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
    • printMatrix

      public void printMatrix(long[] matrixArray, byte n, byte base, String delimiter, boolean addBrackets, Style style, boolean showSize)
      Description copied from interface: MatrixOperations
      Prints the specified matrix array 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:
      printMatrix in interface MatrixOperations
      Parameters:
      matrixArray - the matrix array to be displayed on console
      n - the number of columns in the matrix array
      base - the base of the matrix array (could be either \(2\) or \(4\))
      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
    • getMatrixArray

      public long[] getMatrixArray()
      Description copied from interface: MatrixOperations
      Returns the current matrix array but not as a brand-new instance.
      Specified by:
      getMatrixArray in interface MatrixOperations
      Returns:
      the current matrix array
      See Also:
      getMatrixArrayCopy()
    • isInvertible

      public boolean isInvertible(Matrix m)
      Description copied from interface: MatrixOperations
      Returns true if the specified matrix is invertible (i.e., the determinant of the matrix is not \(0\)), false if the determinant is \(0\).
      Specified by:
      isInvertible in interface MatrixOperations
      Parameters:
      m - the matrix to find the determinant of
      Returns:
      true if the specified matrix is invertible (i.e., the determinant of is not \(0\)), false otherwise
    • containsZeroRow

      public boolean containsZeroRow()
      Description copied from interface: MatrixOperations
      To check if the matrix contains at least a single row of 0.
      Specified by:
      containsZeroRow in interface MatrixOperations
      Returns:
      true if there exists a row that is 0, false otherwise
    • isInvertible

      public boolean isInvertible()
      Description copied from interface: MatrixOperations
      Returns true if the current matrix is invertible (i.e., the determinant of the current matrix is not \(0\)), false if the determinant is \(0\).
      Specified by:
      isInvertible in interface MatrixOperations
      Returns:
      true if the current matrix is invertible (i.e., the determinant of is not \(0\)), false otherwise
    • getBase

      public byte getBase()
      Description copied from interface: MatrixOperations
      Returns the base of the current matrix which is equivalent to the base of the code \(\mathsf{C}\). It is either \(2\) or \(4\).
      Specified by:
      getBase in interface MatrixOperations
      Returns:
      the base of the current matrix which is either \(2\) or \(4\)
    • getN

      public byte getN()
      Description copied from interface: MatrixOperations
      Returns the number of columns in the current matrix which is equivalent to the length \(n\) of the codeword in the code \(\mathsf{C}\).
      Specified by:
      getN in interface MatrixOperations
      Returns:
      the number of columns in the current matrix which is equivalent to the length of the codeword in the code
    • getK

      public byte getK()
      Description copied from interface: MatrixOperations
      Returns the number of rows in the current matrix which is equivalent to the dimension \(k\) of the code \(\mathsf{C}\).
      Specified by:
      getK in interface MatrixOperations
      Returns:
      the number of rows in the current matrix which is equivalent to the dimension of the code
    • getMatrix

      public Matrix getMatrix()
      Description copied from interface: MatrixOperations
      Returns the current matrix but not as a brand-new copy.
      Specified by:
      getMatrix in interface MatrixOperations
      Returns:
      the current matrix
      See Also:
      clone()
    • getCell

      public byte getCell(byte r, byte c)
      Description copied from interface: MatrixOperations
      Returns the value of a cell based on the row index and column index specified.
      Specified by:
      getCell in interface MatrixOperations
      Parameters:
      r - the row index of the cell in the current matrix to retrieve from (zero-based)
      c - the column index of the cell in the current matrix to retrieve from (zero-based)
      Returns:
      the value in cell \((r, c)\)
    • getCell

      public byte getCell(long[] matrixArray, byte r, byte c, byte n, byte base)
      Description copied from interface: MatrixOperations
      Returns the value of a cell based on the specified matrix array, row index and column index.
      Specified by:
      getCell in interface MatrixOperations
      Parameters:
      matrixArray - the matrix array to retrieve the cell from
      r - the row index of the cell in the matrix array to retrieve from (zero-based)
      c - the column index of the cell in the matrix array to retrieve from (zero-based)
      n - the number of columns in the matrix array
      base - the base of the matrix array (could be either \(2\) or \(4\))
      Returns:
      the value in cell \((r, c)\) of the matrix array
    • getCell

      public byte getCell(Matrix m, byte r, byte c)
      Description copied from interface: MatrixOperations
      Returns the value of a cell based on the specified matrix, row index and column index.
      Specified by:
      getCell in interface MatrixOperations
      Parameters:
      m - the matrix to retrieve the cell from
      r - the row index of the cell in the matrix to retrieve from (zero-based)
      c - the column index of the cell in the matrix to retrieve from (zero-based)
      Returns:
      the value in cell \((r, c)\) of the matrix
    • getRow

      public long getRow(byte index)
      Description copied from interface: MatrixOperations
      Returns a row in the current matrix based on the index specified.
      Specified by:
      getRow in interface MatrixOperations
      Parameters:
      index - the index of the row (zero-based) in the matrix
      Returns:
      the row in the current matrix based on the index specified
    • getRow

      public long getRow(long[] arrayMatrix, byte index)
      Description copied from interface: MatrixOperations
      Returns a row in the matrix array specified based on the index specified.
      Specified by:
      getRow in interface MatrixOperations
      Parameters:
      arrayMatrix - the matrix array to obtain the row from
      index - the index of the row (zero-based) in the matrix
      Returns:
      the row in the matrix array specified based on the index specified
    • getRow

      public long getRow(Matrix m, byte index)
      Description copied from interface: MatrixOperations
      Returns a row in the matrix specified based on the index specified.
      Specified by:
      getRow in interface MatrixOperations
      Parameters:
      m - the matrix to obtain the row from
      index - the index of the row (zero-based) in the matrix
      Returns:
      the row in the matrix specified based on the index specified
    • getColumn

      public byte[] getColumn(byte index)
      Description copied from interface: MatrixOperations
      Returns a column in the current matrix based on the index specified.
      Specified by:
      getColumn in interface MatrixOperations
      Parameters:
      index - the index of the column (zero-based) in the matrix
      Returns:
      the column in the current matrix based on the index specified
    • getColumn

      public byte[] getColumn(long[] matrixArray, byte n, byte index, byte base)
      Description copied from interface: MatrixOperations
      Returns a column in the matrix array specified based on the index specified.
      Specified by:
      getColumn in interface MatrixOperations
      Parameters:
      matrixArray - the matrix array to obtain the column from
      n - the number of columns in the matrix array which is the same as the length of code \(\mathsf{C}\)
      index - the index of the column (zero-based) in the matrix
      base - the base of the matrix array (could be either \(2\) or \(4\))
      Returns:
      the column in the matrix array specified based on the index specified
    • getColumn

      public byte[] getColumn(Matrix m, byte index)
      Description copied from interface: MatrixOperations
      Returns a column in the matrix specified based on the index specified.
      Specified by:
      getColumn in interface MatrixOperations
      Parameters:
      m - the matrix to obtain the column from
      index - the index of the column (zero-based) in the matrix
      Returns:
      the column in the matrix specified based on the index specified
    • setMatrixArray

      public void setMatrixArray(long[] matrixArray, byte n, byte k, boolean deepCopy)
      Description copied from interface: MatrixOperations
      Sets the matrix array of the current matrix to the specified matrix array. There are two ways to achieve that: either assign the array passed (non-deep copy) or reinitialized the array in the matrix, loop through the specified matrix array and copy each cell individually. The dimension of the specified matrix array must match the current one. Otherwise, the operation will not be applied.
      Specified by:
      setMatrixArray in interface MatrixOperations
      Parameters:
      matrixArray - the new matrix array to set to
      n - the number of columns in the matrix array
      k - the number of rows in the matrix array
      deepCopy - whether a deep copy is desired
    • setRow

      public void setRow(byte index, long newRow)
      Description copied from interface: MatrixOperations
      Sets a specific row in the current matrix based on the specified row index and new row vector.
      Specified by:
      setRow in interface MatrixOperations
      Parameters:
      index - the index of the row in current matrix to be altered (zero-based)
      newRow - the value of the new row to set as
    • setRow

      public void setRow(long[] matrixArray, byte index, long newRow)
      Description copied from interface: MatrixOperations
      Sets a specific row based on the specified matrix array, row index and new row vector.
      Specified by:
      setRow in interface MatrixOperations
      Parameters:
      matrixArray - the matrix array to set the row in
      index - the index of the row in the matrix array to be altered (zero-based)
      newRow - the value of the new row to set as
    • setRow

      public void setRow(Matrix m, byte index, long newRow)
      Description copied from interface: MatrixOperations
      Sets a specific row based on the specified matrix, row index and new row vector.
      Specified by:
      setRow in interface MatrixOperations
      Parameters:
      m - the matrix to set the row in
      index - the index of the row in matrix to be altered (zero-based)
      newRow - the value of the new row to set as
    • setCell

      public void setCell(byte row, byte column, byte value)
      Description copied from interface: MatrixOperations
      Sets the value of a cell based on its row index and column index in the current matrix.
      Specified by:
      setCell in interface MatrixOperations
      Parameters:
      row - the row index of the cell in the current matrix to set (zero-based)
      column - the column index of the cell in the current matrix to set (zero-based)
      value - the value to be set to which can be a \(0\) or \(1\) when the base is \(2\) or \(0\), \(1\), \(2\), or \(3\) in base \(4\)
    • setCell

      public void setCell(long[] matrixArray, byte r, byte c, byte value, byte n, byte base)
      Description copied from interface: MatrixOperations
      Sets the value of a cell based on its row index and column index in the current matrix.
      Specified by:
      setCell in interface MatrixOperations
      Parameters:
      matrixArray - the matrix array to set the cell in
      r - the row index of the cell in the current matrix to set (zero-based)
      c - the column index of the cell in the current matrix to set (zero-based)
      value - the value to be set to which can be a \(0\) or \(1\) when the base is \(2\) or \(0\), \(1\), \(2\), or \(3\) in base \(4\)
      n - the number of columns in the matrix array
      base - the base of matrix array (could be either \(2\) or \(4\))
    • setCell

      public void setCell(Matrix m, byte row, byte column, byte value)
      Description copied from interface: MatrixOperations
      Sets the value of a cell based on the specified matrix, row index, column index and value.
      Specified by:
      setCell in interface MatrixOperations
      Parameters:
      m - the matrix to set the cell in
      row - the row index of the cell in the matrix to set (zero-based)
      column - the column index of the cell in the matrix to set (zero-based)
      value - the value to be set to which can be a \(0\) or \(1\) when the base is \(2\) or \(0\), \(1\), \(2\), or \(3\) in base \(4\)
    • setColumn

      public void setColumn(byte columnIndex, byte[] newColumn)
      Description copied from interface: MatrixOperations
      Sets a specific column in the current matrix based on the specified column index and new column vector.
      Specified by:
      setColumn in interface MatrixOperations
      Parameters:
      columnIndex - the index of the column in current matrix to be altered (zero-based)
      newColumn - the value of the new column to set as
    • setColumn

      public void setColumn(long[] matrixArray, byte columnIndex, byte[] newColumn, byte base)
      Description copied from interface: MatrixOperations
      Sets a specific column based on the specified matrix array, column index and new column vector.
      Specified by:
      setColumn in interface MatrixOperations
      Parameters:
      matrixArray - the matrix array to set the column in
      columnIndex - the index of the column in the matrix array to be altered (zero-based)
      newColumn - the value of the new column to set as
      base - the base of the matrix array (could be either \(2\) or \(4\))
    • setColumn

      public void setColumn(Matrix m, byte index, byte[] newColumn)
      Description copied from interface: MatrixOperations
      Sets a specific column based on the specified matrix, column index and new column vector.
      Specified by:
      setColumn in interface MatrixOperations
      Parameters:
      m - the matrix to set the column in
      index - the index of the column in the matrix to be altered (zero-based)
      newColumn - the value of the new column to set as