Class Matrix
- java.lang.Object
-
- org.bouncycastle.pqc.math.linearalgebra.Matrix
-
- Direct Known Subclasses:
GF2Matrix
,GF2mMatrix
public abstract class Matrix extends java.lang.Object
This abstract class defines matrices. It holds the number of rows and the number of columns of the matrix and defines some basic methods.
-
-
Field Summary
Fields Modifier and Type Field Description static char
MATRIX_TYPE_RANDOM_LT
random lower triangular matrixstatic char
MATRIX_TYPE_RANDOM_REGULAR
random regular matrixstatic char
MATRIX_TYPE_RANDOM_UT
random upper triangular matrixstatic char
MATRIX_TYPE_UNIT
unit matrixstatic char
MATRIX_TYPE_ZERO
zero matrixprotected int
numColumns
number of columnsprotected int
numRows
number of rows
-
Constructor Summary
Constructors Constructor Description Matrix()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Matrix
computeInverse()
Compute the inverse of this matrix.abstract byte[]
getEncoded()
int
getNumColumns()
int
getNumRows()
abstract boolean
isZero()
Check if this is the zero matrix (i.e., all entries are zero).abstract Vector
leftMultiply(Vector vector)
Compute the product of a vector and this matrix.abstract Matrix
rightMultiply(Matrix a)
Compute the product of this matrix and another matrix.abstract Matrix
rightMultiply(Permutation p)
Compute the product of this matrix and a permutation.abstract Vector
rightMultiply(Vector vector)
Compute the product of this matrix and a vector.abstract java.lang.String
toString()
-
-
-
Field Detail
-
numRows
protected int numRows
number of rows
-
numColumns
protected int numColumns
number of columns
-
MATRIX_TYPE_ZERO
public static final char MATRIX_TYPE_ZERO
zero matrix- See Also:
- Constant Field Values
-
MATRIX_TYPE_UNIT
public static final char MATRIX_TYPE_UNIT
unit matrix- See Also:
- Constant Field Values
-
MATRIX_TYPE_RANDOM_LT
public static final char MATRIX_TYPE_RANDOM_LT
random lower triangular matrix- See Also:
- Constant Field Values
-
MATRIX_TYPE_RANDOM_UT
public static final char MATRIX_TYPE_RANDOM_UT
random upper triangular matrix- See Also:
- Constant Field Values
-
MATRIX_TYPE_RANDOM_REGULAR
public static final char MATRIX_TYPE_RANDOM_REGULAR
random regular matrix- See Also:
- Constant Field Values
-
-
Method Detail
-
getNumRows
public int getNumRows()
- Returns:
- the number of rows in the matrix
-
getNumColumns
public int getNumColumns()
- Returns:
- the number of columns in the binary matrix
-
getEncoded
public abstract byte[] getEncoded()
- Returns:
- the encoded matrix, i.e., this matrix in byte array form.
-
computeInverse
public abstract Matrix computeInverse()
Compute the inverse of this matrix.- Returns:
- the inverse of this matrix (newly created).
-
isZero
public abstract boolean isZero()
Check if this is the zero matrix (i.e., all entries are zero).- Returns:
- true if this is the zero matrix
-
rightMultiply
public abstract Matrix rightMultiply(Matrix a)
Compute the product of this matrix and another matrix.- Parameters:
a
- the other matrix- Returns:
- this * a (newly created)
-
rightMultiply
public abstract Matrix rightMultiply(Permutation p)
Compute the product of this matrix and a permutation.- Parameters:
p
- the permutation- Returns:
- this * p (newly created)
-
leftMultiply
public abstract Vector leftMultiply(Vector vector)
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.- Parameters:
vector
- a vector- Returns:
- vector * this (newly created)
-
rightMultiply
public abstract Vector rightMultiply(Vector vector)
Compute the product of this matrix and a vector.- Parameters:
vector
- a vector- Returns:
- this * vector (newly created)
-
toString
public abstract java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a human readable form of the matrix.
-
-