Class GF2mMatrix
- java.lang.Object
-
- org.bouncycastle.pqc.math.linearalgebra.Matrix
-
- org.bouncycastle.pqc.math.linearalgebra.GF2mMatrix
-
-
Field Summary
Fields Modifier and Type Field Description protected GF2mFieldfieldfinite field GF(2^m)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))-
Fields inherited from class org.bouncycastle.pqc.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
Constructors Modifier Constructor Description GF2mMatrix(GF2mField field, byte[] enc)Constructor.protectedGF2mMatrix(GF2mField field, int[][] matrix)Constructor.GF2mMatrix(GF2mMatrix other)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MatrixcomputeInverse()Compute the inverse of this matrix.booleanequals(java.lang.Object other)Checks if given object is equal to this matrix.byte[]getEncoded()inthashCode()booleanisZero()Check if this is the zero matrix (i.e., all entries are zero).VectorleftMultiply(Vector vector)Compute the product of a vector and this matrix.MatrixrightMultiply(Matrix a)Compute the product of this matrix and another matrix.MatrixrightMultiply(Permutation perm)Compute the product of this matrix and a permutation.VectorrightMultiply(Vector vector)Compute the product of this matrix and a vector.java.lang.StringtoString()-
Methods inherited from class org.bouncycastle.pqc.math.linearalgebra.Matrix
getNumColumns, getNumRows
-
-
-
-
Field Detail
-
field
protected GF2mField field
finite field GF(2^m)
-
matrix
protected int[][] matrix
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))
-
-
Constructor Detail
-
GF2mMatrix
public GF2mMatrix(GF2mField field, byte[] enc)
Constructor.- Parameters:
field- a finite field GF(2^m)enc- byte[] matrix in byte array form
-
GF2mMatrix
public GF2mMatrix(GF2mMatrix other)
Copy constructor.- Parameters:
other- anotherGF2mMatrix
-
GF2mMatrix
protected GF2mMatrix(GF2mField field, int[][] matrix)
Constructor.- Parameters:
field- a finite field GF(2^m)matrix- the matrix as int array. Only the reference is copied.
-
-
Method Detail
-
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
public Matrix computeInverse()
Compute the inverse of this matrix.- Specified by:
computeInversein classMatrix- Returns:
- the inverse of this matrix (newly created).
-
rightMultiply
public Matrix rightMultiply(Matrix a)
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
public Matrix rightMultiply(Permutation perm)
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
public Vector leftMultiply(Vector vector)
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
public Vector rightMultiply(Vector vector)
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
public boolean equals(java.lang.Object other)
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).- Overrides:
equalsin classjava.lang.Object- Parameters:
other- object- Returns:
- true or false
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-