Class GF4Operations

java.lang.Object
hlcd.operations.GF4Operations

public class GF4Operations extends Object
A way to perform mathematical operations in \(\mathbb{F}_4\). It contains methods for performing basic vector operations such as addition, scalar multiplication, inner product, Hermitian inner product and converting a vector to its Hermitian equivalent.

The Hermitian inner product of two vectors \(a\) and \(b\) is defined as \( \langle a, \, b \rangle_H = a_1^\dagger \cdot b_1 + a_2^\dagger \cdot b_2 + \ldots + a_n^\dagger \cdot b_n \), where \(a_i^\dagger\) is the complex conjugation of \(a_i\).

Since:
1.8
Version:
1.0 (January 24th, 2022)
Author:
Maysara Al Jumaily
See Also:
getHermitianVector(long)
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a calculator that perform calculations in \(\mathbb{F}_4\).
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    add​(long v1, long v2)
    Adds two vectors in \(\mathbb{F}_4\).
    long
    getHermitianVector​(long v)
    Returns the Hermitian equivalent of the vector passed.
    byte
    hermitianInnerProduct​(long v1, long v2)
    Returns the Hermitian inner product of two vectors.
    byte
    innerProduct​(long v1, long v2)
    Returns the inner product of two vectors.
    long
    multiply​(long v1, long v2)
    Returns the multiplication of two quaternary row vectors.
    long
    multiplyByScalar​(long v, byte digit, byte base)
    Multiplies the vector specified by the digit specified.
    long
    Multiplies a vector by \(1\) which yields the vector itself.
    long
    Multiplies each element \(x \in \mathbb{F}_4\) in the vector specified by \(\overline{\omega}\).
    long
    Multiplies each element \(x \in \mathbb{F}_4\) in the vector specified by \(\omega\).
    long
    Multiplies a vector by \(0\) which yields \(0\).

    Methods inherited from class java.lang.Object

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

    • GF4Operations

      public GF4Operations()
      Creates a calculator that perform calculations in \(\mathbb{F}_4\).
  • Method Details

    • innerProduct

      public byte innerProduct(long v1, long v2)
      Returns the inner product of two vectors.
      Parameters:
      v1 - the first operand
      v2 - the second operand
      Returns:
      the inner product between two vectors
    • hermitianInnerProduct

      public byte hermitianInnerProduct(long v1, long v2)
      Returns the Hermitian inner product of two vectors. The Hermitian property will be applied on vector v1.
      Parameters:
      v1 - the first operand where the Hermitian property is applied on
      v2 - the second operand
      Returns:
      the Hermitian inner product between two vectors
      See Also:
      getHermitianVector(long)
    • getHermitianVector

      public long getHermitianVector(long v)
      Returns the Hermitian equivalent of the vector passed. For each element \(x \in \mathbb{F}_4\), the complex conjugation (denoted as \(x^\dagger\)) is defined as:
      Complex conjugation of \(\mathbb{F}_4\) elements
      \(x\) \(x^\dagger\)
      \(0\) \(0\)
      \(1\) \(1\)
      \(\omega\) \(\overline{\omega}\)
      \(\overline{\omega}\) \(\omega\)
      Parameters:
      v - the vector to find its Hermitian equivalent
      Returns:
      the Hermitian equivalent of the vector passed
    • multiply

      public long multiply(long v1, long v2)
      Returns the multiplication of two quaternary row vectors. The multiplication is done element-wise.
      Parameters:
      v1 - the first operand to be multiplied
      v2 - the second operand to be multiplied
      Returns:
      the two vectors multiplied
    • multiplyByScalarZero

      public long multiplyByScalarZero(long v)
      Multiplies a vector by \(0\) which yields \(0\).
      Parameters:
      v - the vector that will be multiplied
      Returns:
      the vector multiplied by \(0\)
    • multiplyByScalarOne

      public long multiplyByScalarOne(long v)
      Multiplies a vector by \(1\) which yields the vector itself.
      Parameters:
      v - the vector that will be multiplied
      Returns:
      the vector multiplied by \(1\)
    • multiplyByScalarTwo

      public long multiplyByScalarTwo(long v)
      Multiplies each element \(x \in \mathbb{F}_4\) in the vector specified by \(\omega\). It will transform each digit to the following:
      Multiplying \(\mathbb{F}_4\) elements by \(\omega\)
      \(x\) \(x \cdot \omega\)
      \(0\) \(0\)
      \(1\) \(\omega\)
      \(\omega\) \(\overline{\omega}\)
      \(\overline{\omega}\) \(1\)
      Parameters:
      v - the vector that will be multiplied
      Returns:
      the vector multiplied by \(\omega\)
    • multiplyByScalarThree

      public long multiplyByScalarThree(long v)
      Multiplies each element \(x \in \mathbb{F}_4\) in the vector specified by \(\overline{\omega}\). It will transform each digit to the following:
      Multiplying \(\mathbb{F}_4\) elements by \(\overline{\omega}\)
      \(x\) \(x \cdot \overline{\omega}\)
      \(0\) \(0\)
      \(1\) \(\overline{\omega}\)
      \(\omega\) \(1\)
      \(\overline{\omega}\) \(\omega\)
      Parameters:
      v - the vector that will be multiplied
      Returns:
      the vector multiplied by \(\omega\)
    • add

      public long add(long v1, long v2)
      Adds two vectors in \(\mathbb{F}_4\).
      Parameters:
      v1 - the first operand to be added
      v2 - the second operand to be added
      Returns:
      the result of adding two vectors in \(\mathbb{F}_4\)
    • multiplyByScalar

      public long multiplyByScalar(long v, byte digit, byte base)
      Multiplies the vector specified by the digit specified. It is suggested to use multiplyByScalarZero(long), multiplyByScalarOne(long), multiplyByScalarTwo(long) and multiplyByScalarThree(long) instead of this method.
      Parameters:
      v - the vector to multiply
      digit - the digit to multiply with
      base - the base of the vector which could either by \(2\) or \(4\)
      Returns:
      the vector multiplied by the digit