|
Bouncy Castle Cryptography 1.50 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.bouncycastle.pqc.math.linearalgebra.Matrix
org.bouncycastle.pqc.math.linearalgebra.GF2Matrix
public class GF2Matrix
This class describes some operations with matrices over finite field GF(2) and is used in ecc and MQ-PKC (also has some specific methods and implementation)
| Field Summary |
|---|
| 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 | |
|---|---|
GF2Matrix(byte[] enc)
Create the matrix from encoded form. |
|
GF2Matrix(GF2Matrix a)
Copy constructor. |
|
GF2Matrix(int n,
char typeOfMatrix)
Create an nxn matrix of the given type. |
|
GF2Matrix(int n,
char typeOfMatrix,
java.security.SecureRandom sr)
Create an nxn matrix of the given type. |
|
GF2Matrix(int numColumns,
int[][] matrix)
Create the matrix with the contents of the given array. |
|
| Method Summary | |
|---|---|
Matrix |
computeInverse()
Compute the inverse of this matrix. |
Matrix |
computeTranspose()
Compute the transpose of this matrix. |
static GF2Matrix[] |
createRandomRegularMatrixAndItsInverse(int n,
java.security.SecureRandom sr)
Create a nxn random regular matrix and its inverse. |
boolean |
equals(java.lang.Object other)
Compare this matrix with another object. |
GF2Matrix |
extendLeftCompactForm()
Compute the full form matrix (this | Id) from this matrix in left compact form, where Id is the k x k identity matrix and k is the number of rows of this matrix. |
GF2Matrix |
extendRightCompactForm()
Compute the full form matrix (Id | this) from this matrix in right compact form, where Id is the k x k identity matrix and k is the number of rows of this matrix. |
byte[] |
getEncoded()
Returns encoded matrix, i.e., this matrix in byte array form |
double |
getHammingWeight()
Returns the percentage of the number of "ones" in this matrix. |
int[][] |
getIntArray()
|
GF2Matrix |
getLeftSubMatrix()
Get the quadratic submatrix of this matrix consisting of the leftmost numRows columns. |
int |
getLength()
|
GF2Matrix |
getRightSubMatrix()
Get the submatrix of this matrix consisting of the rightmost numColumns-numRows columns. |
int[] |
getRow(int index)
Return the row of this matrix with the given index. |
int |
hashCode()
|
boolean |
isZero()
Check if this is the zero matrix (i.e., all entries are zero). |
Matrix |
leftMultiply(Permutation p)
Compute the product of a permutation matrix (which is generated from an n-permutation) and this matrix. |
Vector |
leftMultiply(Vector vec)
compute product a row vector and this matrix |
Vector |
leftMultiplyLeftCompactForm(Vector vec)
Compute the product of the matrix (this | Id) and a column vector, where Id is a (numRows x numRows) unit matrix. |
Matrix |
rightMultiply(Matrix mat)
Compute the product of this matrix and a matrix A over GF(2). |
Matrix |
rightMultiply(Permutation p)
Compute the product of this matrix and a permutation matrix which is generated from an n-permutation. |
Vector |
rightMultiply(Vector vec)
Compute the product of this matrix and the given column vector. |
Vector |
rightMultiplyRightCompactForm(Vector vec)
Compute the product of the matrix (Id | this) and a column vector, where Id is a (numRows x numRows) unit matrix. |
java.lang.String |
toString()
|
| Methods inherited from class org.bouncycastle.pqc.math.linearalgebra.Matrix |
|---|
getNumColumns, getNumRows |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GF2Matrix(byte[] enc)
enc - the encoded matrix
public GF2Matrix(int numColumns,
int[][] matrix)
numColumns - the number of columnsmatrix - the element array
public GF2Matrix(int n,
char typeOfMatrix)
n - the number of rows (and columns)typeOfMatrix - the martix type (see Matrix for predefined
constants)
public GF2Matrix(int n,
char typeOfMatrix,
java.security.SecureRandom sr)
n - the matrix sizetypeOfMatrix - the matrix typesr - the source of randomnesspublic GF2Matrix(GF2Matrix a)
a - another GF2Matrix| Method Detail |
|---|
public static GF2Matrix[] createRandomRegularMatrixAndItsInverse(int n,
java.security.SecureRandom sr)
n - number of rows (and columns)sr - source of randomness
public int[][] getIntArray()
public int getLength()
public int[] getRow(int index)
index - the index
public byte[] getEncoded()
getEncoded in class Matrixpublic double getHammingWeight()
public boolean isZero()
isZero in class Matrixpublic GF2Matrix getLeftSubMatrix()
public GF2Matrix extendLeftCompactForm()
public GF2Matrix getRightSubMatrix()
public GF2Matrix extendRightCompactForm()
public Matrix computeTranspose()
public Matrix computeInverse()
computeInverse in class Matrixjava.lang.ArithmeticException - if this matrix is not invertible.public Matrix leftMultiply(Permutation p)
p - the permutation
GF2Matrix P*thispublic Vector leftMultiply(Vector vec)
leftMultiply in class Matrixvec - a vector over GF(2)
public Vector leftMultiplyLeftCompactForm(Vector vec)
vec - the vector over GF(2)
public Matrix rightMultiply(Matrix mat)
rightMultiply in class Matrixmat - a matrix A over GF(2)
public Matrix rightMultiply(Permutation p)
rightMultiply in class Matrixp - the permutation
GF2Matrix this*Ppublic Vector rightMultiply(Vector vec)
rightMultiply in class Matrixvec - the vector over GF(2)
public Vector rightMultiplyRightCompactForm(Vector vec)
vec - the vector over GF(2)
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectother - another object
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class Matrix
|
Bouncy Castle Cryptography 1.50 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||