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 GF2mField
field
finite field GF(2^m)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))-
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.protected
GF2mMatrix(GF2mField field, int[][] matrix)
Constructor.GF2mMatrix(GF2mMatrix other)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Matrix
computeInverse()
Compute the inverse of this matrix.boolean
equals(java.lang.Object other)
Checks if given object is equal to this matrix.byte[]
getEncoded()
int
hashCode()
boolean
isZero()
Check if this is the zero matrix (i.e., all entries are zero).Vector
leftMultiply(Vector vector)
Compute the product of a vector and this matrix.Matrix
rightMultiply(Matrix a)
Compute the product of this matrix and another matrix.Matrix
rightMultiply(Permutation perm)
Compute the product of this matrix and a permutation.Vector
rightMultiply(Vector vector)
Compute the product of this matrix and a vector.java.lang.String
toString()
-
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:
getEncoded
in 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:
computeInverse
in classMatrix
- Returns:
- the inverse of this matrix (newly created).
-
rightMultiply
public Matrix rightMultiply(Matrix a)
Description copied from class:Matrix
Compute the product of this matrix and another matrix.- Specified by:
rightMultiply
in classMatrix
- Parameters:
a
- the other matrix- Returns:
- this * a (newly created)
-
rightMultiply
public Matrix rightMultiply(Permutation perm)
Description copied from class:Matrix
Compute the product of this matrix and a permutation.- Specified by:
rightMultiply
in classMatrix
- Parameters:
perm
- the permutation- Returns:
- this * p (newly created)
-
leftMultiply
public Vector leftMultiply(Vector vector)
Description copied from class:Matrix
Compute 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:
leftMultiply
in classMatrix
- Parameters:
vector
- a vector- Returns:
- vector * this (newly created)
-
rightMultiply
public Vector rightMultiply(Vector vector)
Description copied from class:Matrix
Compute the product of this matrix and a vector.- Specified by:
rightMultiply
in 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:
equals
in classjava.lang.Object
- Parameters:
other
- object- Returns:
- true or false
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-