Package hlcd.operations
Class GF4Operations
java.lang.Object
hlcd.operations.GF4Operations
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
ConstructorsConstructorDescriptionCreates a calculator that perform calculations in \(\mathbb{F}_4\). -
Method Summary
Modifier and TypeMethodDescriptionlongadd(long v1, long v2)Adds two vectors in \(\mathbb{F}_4\).longgetHermitianVector(long v)Returns the Hermitian equivalent of the vector passed.bytehermitianInnerProduct(long v1, long v2)Returns the Hermitian inner product of two vectors.byteinnerProduct(long v1, long v2)Returns the inner product of two vectors.longmultiply(long v1, long v2)Returns the multiplication of two quaternary row vectors.longmultiplyByScalar(long v, byte digit, byte base)Multiplies the vector specified by the digit specified.longmultiplyByScalarOne(long v)Multiplies a vector by \(1\) which yields the vector itself.longmultiplyByScalarThree(long v)Multiplies each element \(x \in \mathbb{F}_4\) in the vector specified by \(\overline{\omega}\).longmultiplyByScalarTwo(long v)Multiplies each element \(x \in \mathbb{F}_4\) in the vector specified by \(\omega\).longmultiplyByScalarZero(long v)Multiplies a vector by \(0\) which yields \(0\).
-
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 operandv2- 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 vectorv1.- Parameters:
v1- the first operand where the Hermitian property is applied onv2- 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 multipliedv2- 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 addedv2- 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 usemultiplyByScalarZero(long),multiplyByScalarOne(long),multiplyByScalarTwo(long)andmultiplyByScalarThree(long)instead of this method.- Parameters:
v- the vector to multiplydigit- the digit to multiply withbase- the base of the vector which could either by \(2\) or \(4\)- Returns:
- the vector multiplied by the digit
-