Class GF2mMatrix
java.lang.Object
org.bouncycastle.pqc.legacy.math.linearalgebra.Matrix
org.bouncycastle.pqc.legacy.math.linearalgebra.GF2mMatrix
This class describes some operations with matrices over finite field GF(2m)
with small m (1< m <32).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GF2mFieldfinite field GF(2^m)protected int[][]For the matrix representation the array of type int[][] is used, thus every element of the array keeps one element of the matrix (element from finite field GF(2^m))Fields inherited from class org.bouncycastle.pqc.legacy.math.linearalgebra.Matrix
MATRIX_TYPE_RANDOM_LT, MATRIX_TYPE_RANDOM_REGULAR, MATRIX_TYPE_RANDOM_UT, MATRIX_TYPE_UNIT, MATRIX_TYPE_ZERO, numColumns, numRows -
Constructor Summary
ConstructorsModifierConstructorDescriptionGF2mMatrix(GF2mField field, byte[] enc) Constructor.protectedGF2mMatrix(GF2mField field, int[][] matrix) Constructor.GF2mMatrix(GF2mMatrix other) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionCompute the inverse of this matrix.booleanChecks if given object is equal to this matrix.byte[]inthashCode()booleanisZero()Check if this is the zero matrix (i.e., all entries are zero).leftMultiply(Vector vector) Compute the product of a vector and this matrix.Compute the product of this matrix and another matrix.rightMultiply(Permutation perm) Compute the product of this matrix and a permutation.rightMultiply(Vector vector) Compute the product of this matrix and a vector.toString()Methods inherited from class org.bouncycastle.pqc.legacy.math.linearalgebra.Matrix
getNumColumns, getNumRows
-
Field Details
-
field
finite field GF(2^m) -
matrix
protected int[][] matrixFor the matrix representation the array of type int[][] is used, thus every element of the array keeps one element of the matrix (element from finite field GF(2^m))
-
-
Constructor Details
-
GF2mMatrix
Constructor.- Parameters:
field- a finite field GF(2^m)enc- byte[] matrix in byte array form
-
GF2mMatrix
Copy constructor.- Parameters:
other- anotherGF2mMatrix
-
GF2mMatrix
Constructor.- Parameters:
field- a finite field GF(2^m)matrix- the matrix as int array. Only the reference is copied.
-
-
Method Details
-
getEncoded
public byte[] getEncoded()- Specified by:
getEncodedin classMatrix- Returns:
- a byte array encoding of this matrix
-
isZero
public boolean isZero()Check if this is the zero matrix (i.e., all entries are zero). -
computeInverse
Compute the inverse of this matrix.- Specified by:
computeInversein classMatrix- Returns:
- the inverse of this matrix (newly created).
-
rightMultiply
Description copied from class:MatrixCompute the product of this matrix and another matrix.- Specified by:
rightMultiplyin classMatrix- Parameters:
a- the other matrix- Returns:
- this * a (newly created)
-
rightMultiply
Description copied from class:MatrixCompute the product of this matrix and a permutation.- Specified by:
rightMultiplyin classMatrix- Parameters:
perm- the permutation- Returns:
- this * p (newly created)
-
leftMultiply
Description copied from class:MatrixCompute the product of a vector and this matrix. If the length of the vector is greater than the number of rows of this matrix, the matrix is multiplied by each m-bit part of the vector.- Specified by:
leftMultiplyin classMatrix- Parameters:
vector- a vector- Returns:
- vector * this (newly created)
-
rightMultiply
Description copied from class:MatrixCompute the product of this matrix and a vector.- Specified by:
rightMultiplyin classMatrix- Parameters:
vector- a vector- Returns:
- this * vector (newly created)
-
equals
Checks if given object is equal to this matrix. The method returns false whenever the given object is not a matrix over GF(2^m). -
hashCode
public int hashCode() -
toString
-