|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--HFE.Matrix4
The class Matrix4 provides matrix operations for matrices over the
finite field F_4 which is specified in Field4
.
The class provides only operations which are needed in the
HFE package. The class is based upon the Jama package, which
was produced by The MathWorks, Inc. and the National Institute of Standards and Technology.
Jama can be downloaded from the NIST page
http://math.nist.gov/javanumerics/jama/.
Field Summary | |
private int[][] |
A
Array for internal storage of elements. |
private int |
m
Row (m) and column (n) dimensions. |
private int |
n
Row (m) and column (n) dimensions. |
Constructor Summary | |
Matrix4(int[][] A)
Construct a matrix using the given array with checking. |
|
Matrix4(int[][] A,
int m,
int n)
Construct a matrix using the given array without checking. |
|
Matrix4(int m,
int n)
Construct an m-by-n matrix of zeros. |
|
Matrix4(int m,
int n,
java.util.Random rnd)
Generats an m-by-n random matrix. |
Method Summary | |
Matrix4 |
add(Matrix4 B)
C = A + B |
(package private) void |
addEquals(Matrix4 B)
A += B |
void |
addRowsEquals(int i,
int j)
A[i] += A[j]. |
void |
addRowsEquals(int f,
int i,
int j)
A[i] += f*A[j]. |
private void |
checkMatrixDimensions(Matrix4 B)
Check if size(A) == size(B) |
java.lang.Object |
clone()
Clone the Matrix object. |
Matrix4 |
copy()
Make a deep copy of a matrix Allocates new memory |
int |
get(int i,
int j)
Get a single element. |
int[][] |
getArray()
Returns a pointer to the internal two-dimensional array. |
int[][] |
getArrayCopy()
Copy the internal two-dimensional array. |
int |
getColumnDimension()
Get column dimension. |
int[] |
getColumnPackedCopy()
Make a one-dimensional column packed copy of the internal array. |
Matrix4 |
getMatrix(int[] r,
int[] c)
Get a submatrix. |
Matrix4 |
getMatrix(int[] r,
int j0,
int j1)
Get a submatrix. |
Matrix4 |
getMatrix(int i0,
int i1,
int[] c)
Get a submatrix. |
Matrix4 |
getMatrix(int i0,
int i1,
int j0,
int j1)
Get a submatrix. |
int |
getRowDimension()
Get row dimension. |
int[] |
getRowPackedCopy()
Make a one-dimensional row packed copy of the internal array. |
static Matrix4 |
identity(int m,
int n)
Generate identity matrix |
boolean |
isEqual(Matrix4 B)
Compares two matrices. |
LUDecomposition4 |
lu()
LU Decomposition |
static void |
main(java.lang.String[] args)
Tests everything in this class |
void |
mul(int[] b,
int[] res)
Linear algebraic matrix/vector multiplication, res = A * b. |
Matrix4 |
mul(Matrix4 B)
Linear algebraic matrix multiplication, A * B. |
void |
set(int i,
int j,
int s)
Set a single element. |
void |
set(java.util.Random rnd)
Generats an m-by-n random matrix. |
void |
setMatrix(int[] r,
int[] c,
Matrix4 X)
Set a submatrix. |
void |
setMatrix(int[] r,
int j0,
int j1,
Matrix4 X)
Set a submatrix. |
void |
setMatrix(int i0,
int i1,
int[] c,
Matrix4 X)
Set a submatrix. |
void |
setMatrix(int i0,
int i1,
int j0,
int j1,
Matrix4 X)
Set a submatrix. |
void |
setRowZero(int i)
Set a row elementwise zero. |
Matrix4 |
sub(Matrix4 B)
C = A - B |
(package private) void |
subEquals(Matrix4 B)
A -= B |
static void |
testIt()
Tests the functionality of the whole class. |
Matrix4 |
transpose()
Matrix transpose. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private int[][] A
private int m
private int n
Constructor Detail |
public Matrix4(int m, int n)
m
- Number of rows.n
- Number of colums.public Matrix4(int[][] A)
A
- Elements of the matrix as a 2D array.public Matrix4(int[][] A, int m, int n)
A
- Elements of the matrix as a 2D array.m
- Number of rows.n
- Number of colums.public Matrix4(int m, int n, java.util.Random rnd)
m
- Number of rows.n
- Number of colums.rnd
- number generatorMethod Detail |
public Matrix4 copy()
public java.lang.Object clone()
clone
in class java.lang.Object
public int[][] getArray()
public int[][] getArrayCopy()
public int[] getColumnPackedCopy()
public int[] getRowPackedCopy()
public int getRowDimension()
public int getColumnDimension()
public int get(int i, int j)
i
- Row index.j
- Column index.ArrayIndexOutOfBoundsException
- public Matrix4 getMatrix(int i0, int i1, int j0, int j1)
i0
- Initial row indexi1
- Final row indexj0
- Initial column indexj1
- Final column indexArrayIndexOutOfBoundsException
- Submatrix indicespublic Matrix4 getMatrix(int[] r, int[] c)
r
- Array of row indices.c
- Array of column indices.ArrayIndexOutOfBoundsException
- Submatrix indicespublic Matrix4 getMatrix(int i0, int i1, int[] c)
i0
- Initial row indexi1
- Final row indexc
- Array of column indices.ArrayIndexOutOfBoundsException
- Submatrix indicespublic Matrix4 getMatrix(int[] r, int j0, int j1)
r
- Array of row indices.i0
- Initial column indexi1
- Final column indexArrayIndexOutOfBoundsException
- Submatrix indicespublic void set(int i, int j, int s)
i
- Row index.j
- Column index.s
- A(i,j).ArrayIndexOutOfBoundsException
- public void set(java.util.Random rnd)
rnd
- number generatorpublic void setMatrix(int i0, int i1, int j0, int j1, Matrix4 X)
i0
- Initial row indexi1
- Final row indexj0
- Initial column indexj1
- Final column indexX
- A(i0:i1,j0:j1)ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setMatrix(int[] r, int[] c, Matrix4 X)
r
- Array of row indices.c
- Array of column indices.X
- A(r(:),c(:))ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setMatrix(int[] r, int j0, int j1, Matrix4 X)
r
- Array of row indices.j0
- Initial column indexj1
- Final column indexX
- A(r(:),j0:j1)ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setMatrix(int i0, int i1, int[] c, Matrix4 X)
i0
- Initial row indexi1
- Final row indexc
- Array of column indices.X
- A(i0:i1,c(:))ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setRowZero(int i)
public Matrix4 transpose()
public Matrix4 add(Matrix4 B)
B
- another matrixpublic void addRowsEquals(int i, int j)
public void addRowsEquals(int f, int i, int j)
f
- scalari
- number of the destination rowj
- number of the source rowvoid addEquals(Matrix4 B)
B
- another matrixpublic Matrix4 sub(Matrix4 B)
B
- another matrixvoid subEquals(Matrix4 B)
B
- another matrixpublic Matrix4 mul(Matrix4 B)
B
- another matrix with B.m == A.n (rows equals columns)java.lang.IllegalArgumentException
- Matrix inner dimensions must agree.public void mul(int[] b, int[] res)
b
- a vector with b.length == A.n (rows equals columns)public LUDecomposition4 lu()
LUDecomposition4
public static Matrix4 identity(int m, int n)
m
- Number of rows.n
- Number of colums.public boolean isEqual(Matrix4 B)
B
- another matrixtrue
: Matrices are equal. false
: Matrices are not equal (e.g. different size, different elements)public static void testIt()
public static void main(java.lang.String[] args)
testIt()
private void checkMatrixDimensions(Matrix4 B)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |