|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.retro.neural.Matrix
| Field Summary | |
protected FieldElement[][] |
entries
|
protected int |
numOfCols
|
protected int |
numOfRows
|
| Constructor Summary | |
Matrix(FieldElement[][] theEntries)
Constructs a Matrix out of a two dimensional array of FieldElements. |
|
Matrix(FieldElement[][] theEntries,
int rows,
int cols)
Constructs a Matrix out of a two dimensional array of FieldElements. |
|
Matrix(FieldElement[] theEntries,
int numberOfRows)
|
|
Matrix(int numberOfRows,
int numberOfCols)
|
|
Matrix(Vector[] rowVectors)
Constructs a Matrix out of an array of row vectors. |
|
| Method Summary | |
Matrix |
add(FieldElement scalar)
Returns the matrix that is the sum of this Matrix and a scalar. |
Matrix |
add(Matrix matrix)
Returns the matrix that is the sum of this Matrix and another matrix. |
void |
addReplace(FieldElement scalar)
Adds a scalar to this Matrix. |
void |
addReplace(Matrix anotherMatrix)
Adds another matrix to this Matrix. |
Matrix |
and(Matrix anotherMatrix)
Returns the logical AND of this Matrix with another. |
Matrix |
apply(FieldElement scalar,
DyadicOperator fun)
Returns the result of applying a specified function to the elements of a this Matrix a scalar. |
Matrix |
apply(Matrix anotherMatrix,
DyadicOperator fun)
Returns the result of applying a specified function to the elements of this Matrix and another. |
Matrix |
apply(MonadicOperator fun)
Returns the result of applying a specified function to every element of this Matrix. |
void |
applyReplace(FieldElement scalar,
DyadicOperator fun)
Sets this Matrix to the result of applying a specified function to elements of this Matrix and a scalar. |
void |
applyReplace(Matrix anotherMatrix,
DyadicOperator fun)
Sets this Matrix to the result of applying a specified function to elements of this Matrix and another's. |
void |
applyReplace(MonadicOperator fun)
Sets this Matrix to the result of applying a specified function to every element of this Matrix. |
Matrix |
arrayMultiply(Matrix anotherMatrix)
Returns the element-wise product of this Matrix and another. |
Matrix |
copy()
Returns a deep copy of this Matrix. |
FieldElement |
det()
Returns the determinant of this Matrix. |
Matrix |
divide(FieldElement scalar)
Returns a Matrix that is this Matrix divided by a scalar. |
void |
divideReplace(FieldElement scalar)
Divides this Matrix by a scalar. |
void |
divideReplace(Matrix anotherMatrix)
Divides this Matrix by another. |
Matrix |
eq(FieldElement scalar)
Returns a Matrix containing ones where this Matrix's elements are equal to a scalar, and zeros elsewhere. |
Matrix |
eq(Matrix anotherMatrix)
Returns a Matrix containing ones where this Matrix's elements are equal to those of another Matrices, and zeros elsewhere. |
boolean |
equals(Matrix anotherMatrix)
Tests two matrices for equality. |
Matrix |
gausselim()
Returns a matrix that is this Matrix with Gauss-elimination executed on. |
Matrix |
gaussjord()
Returns a matrix that is this Matrix with the Gauss-Jordan algorithm executed on. |
Matrix |
ge(FieldElement scalar)
Returns a Matrix containing ones where this Matrix's elements are greater than or equal to a scalar, and zeros elsewhere. |
Matrix |
ge(Matrix anotherMatrix)
Returns a Matrix containing ones where this Matrix's elements are greater than or equal to those of another Matrices, and zeros elsewhere. |
Vector |
getCol(int colIndex)
Gets the column vector at a certain column index. |
int |
getCols()
Gets the number of columns of this Matrix. |
FieldElement |
getEntry(int rowIndex,
int colIndex)
Gets the entry of this Matrix at a certain row - and col index. |
Vector |
getRow(int rowIndex)
Gets the row vector at a certain row index. |
int |
getRows()
Gets the number of rows of this Matrix. |
Matrix |
gt(FieldElement scalar)
Returns a Matrix containing ones where this Matrix's elements are greater than a scalar, and zeros elsewhere. |
Matrix |
gt(Matrix anotherMatrix)
Returns a Matrix containing ones where this Matrix's elements are greater than those of another Matrices, and zeros elsewhere. |
Matrix |
hermitian()
Returns a matrix that is this Matrix hermitianly transposed. |
Matrix |
insertCol(int colIndex,
Vector vector)
Returns a Matrix with a Vector inserted at specified index as a column. |
Matrix |
insertRow(int rowIndex,
Vector vector)
Returns a Matrix with a Vector inserted at specified index as a row. |
Matrix |
inverse()
Returns the inverse of this Matrix. |
boolean |
isZeroCol(int colIndex)
Returns whether the column at the specified column index is a zero column or not. |
boolean |
isZeroRow(int rowIndex)
Returns whether the row at the specified row index is a zero row or not. |
Matrix |
le(FieldElement scalar)
Returns a Matrix containing ones where this Matrix's elements are less than or equal to a scalar, and zeros elsewhere. |
Matrix |
le(Matrix anotherMatrix)
Returns a Matrix containing ones where this Matrix's elements are less than or equal to those of another Matrices, and zeros elsewhere. |
Matrix |
lt(FieldElement scalar)
Returns a Matrix containing ones where this Matrix's elements are less than a scalar, and zeros elsewhere. |
Matrix |
lt(Matrix anotherMatrix)
Returns a Matrix containing ones where this Matrix's elements are less than those of another Matrices, and zeros elsewhere. |
FieldElement |
max()
Computes the largest value of any element in this Matrix. |
FieldElement |
mean()
Computes the mean over all elements of this Matrix. |
Vector |
meanCols()
Computes the mean over the columns of this Matrix. |
Vector |
meanRows()
Computes the mean over the rows of this Matrix. |
FieldElement |
min()
Computes the smallest value of any element in this Matrix. |
Matrix |
multiply(FieldElement scalar)
Returns a Matrix that is this Matrix multiplied with a scalar. |
Matrix |
multiply(Matrix anotherMatrix)
Returns the matrix that is the product of this Matrix and another matrix. |
Vector |
multiply(Vector vector)
Returns the vector that is the product of this Matrix and a given vector. |
void |
multiplyReplace(FieldElement scalar)
Multiplies this Matrix by a scalar. |
void |
multiplyReplace(Matrix anotherMatrix)
Multiplies this Matrix element-wise by another. |
Matrix |
ne(FieldElement scalar)
Returns a Matrix containing ones where this Matrix's elements are not equal to a scalar, and zeros elsewhere. |
Matrix |
ne(Matrix anotherMatrix)
Returns a Matrix containing ones where this Matrix's elements are not equal to those of another Matrices, and zeros elsewhere. |
Matrix |
not()
Returns the logical negation of this Matrix. |
Matrix |
or(Matrix anotherMatrix)
Returns the logical OR of this Matrix with another. |
int |
rank()
Returns the rank of this Matrix. |
void |
setAll(FieldElement newEntry)
Sets all entries to a FieldElement. |
void |
setCol(int colIndex,
Vector vector)
Sets the column vector at a certain column index of the matrix. |
void |
setEntry(int rowIndex,
int colIndex,
FieldElement newEntry)
Sets the entry of this Matrix at a certain row - and col index. |
void |
setRow(int rowIndex,
Vector vector)
Sets the row vector at a certain index of the matrix. |
Matrix |
subtract(FieldElement scalar)
Returns the matrix that is this this Matrix minus a scalar. |
Matrix |
subtract(Matrix matrix)
Returns the matrix that is this this Matrix minus another one. |
void |
subtractReplace(FieldElement scalar)
Subtracts a scalar from this Matrix. |
void |
subtractReplace(Matrix anotherMatrix)
Subtracts another Matrix from this. |
FieldElement |
sum()
Computes the sum over all elements of this Matrix. |
Vector |
sumCols()
Computes the sum over the columns of this matrix. |
Vector |
sumRows()
Computes the sum over the rows of this matrix. |
void |
swapCols(int colIndex1,
int colIndex2)
Swaps two columns of this Matrix. |
void |
swapRows(int rowIndex1,
int rowIndex2)
Swaps two rows of this Matrix. |
java.lang.String |
toString()
Returns a String representation of this Matrix. |
Vector |
toVector()
Returns a new 1xN Vector made from the N elements of this Matrix. |
Matrix |
transpose()
Returns a matrix that is this Matrix transposed. |
Matrix |
withoutCol(int colIndex)
Returns this Matrix without the column at a certain column index. |
Matrix |
withoutRow(int rowIndex)
Returns this Matrix without the row at a certain row index. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int numOfRows
protected int numOfCols
protected FieldElement[][] entries
| Constructor Detail |
public Matrix(int numberOfRows,
int numberOfCols)
public Matrix(FieldElement[] theEntries,
int numberOfRows)
throws InvalidOperationException
public Matrix(Vector[] rowVectors)
throws InvalidOperationException
rowVectors - as an array of Vectors
InvalidOperationException - if rowVectors is null
InvalidOperationException - if rowVectors contains a null Vector
InvalidOperationException - if rowVectors contains
Vectors of unequal lengths
public Matrix(FieldElement[][] theEntries)
throws InvalidOperationException
theEntries - as a two dimensional FieldElement array.
InvalidOperationException - if theEntries is null
public Matrix(FieldElement[][] theEntries,
int rows,
int cols)
theEntries - rows - cols - | Method Detail |
public int getRows()
public int getCols()
public FieldElement getEntry(int rowIndex,
int colIndex)
rowIndex - colIndex -
public void setEntry(int rowIndex,
int colIndex,
FieldElement newEntry)
throws InvalidOperationException
rowIndex - colIndex - newEntry -
InvalidOperationException - if rowIndex or colIndex is invalidpublic Vector getRow(int rowIndex)
rowIndex - public Vector getCol(int colIndex)
colIndex -
public void setRow(int rowIndex,
Vector vector)
throws InvalidOperationException
rowIndex - vector -
InvalidOperationException - if index out of bounds
public void setCol(int colIndex,
Vector vector)
colIndex - vector - public Matrix withoutRow(int rowIndex)
rowIndex -
public Matrix withoutCol(int colIndex)
colIndex -
public Matrix insertCol(int colIndex,
Vector vector)
throws InvalidOperationException
vector - colIndex -
InvalidOperationException - if index out of bounds
public Matrix insertRow(int rowIndex,
Vector vector)
throws InvalidOperationException
vector - rowIndex -
InvalidOperationException - if index out of boundspublic java.lang.String toString()
public Matrix add(Matrix matrix)
throws InvalidOperationException
InvalidOperationException - if matrices differ in sizepublic Matrix add(FieldElement scalar)
scalar -
public Matrix subtract(Matrix matrix)
throws InvalidOperationException
InvalidOperationException - if matrices differ in sizepublic Matrix subtract(FieldElement scalar)
scalar -
public Matrix multiply(FieldElement scalar)
scalar -
public Matrix divide(FieldElement scalar)
scalar -
public Vector multiply(Vector vector)
throws InvalidOperationException
vector -
InvalidOperationException - if number of columns of this matrix
does not equal number of elements of vector
public Matrix multiply(Matrix anotherMatrix)
throws InvalidOperationException
anotherMatrix -
InvalidOperationException - if number of columns of this matrix
does not equal number of rows of the other matrixpublic Matrix copy()
public FieldElement det()
throws InvalidOperationException
InvalidOperationException - if matrix is not square
public void swapRows(int rowIndex1,
int rowIndex2)
rowIndex1 - index of first swap partner.rowIndex2 - index of second swap partner.
public void swapCols(int colIndex1,
int colIndex2)
colIndex1 - index of first swap partner.colIndex2 - index of second swap partner.public Matrix gaussjord()
public Matrix gausselim()
public boolean isZeroRow(int rowIndex)
rowIndex - index of the row to be tested
public boolean isZeroCol(int colIndex)
colIndex - of the column to be tested
public int rank()
public Matrix transpose()
public Matrix hermitian()
public boolean equals(Matrix anotherMatrix)
anotherMatrix -
public Matrix inverse()
public void divideReplace(FieldElement scalar)
scalar -
public void divideReplace(Matrix anotherMatrix)
throws InvalidOperationException
InvalidOperationException - if the matrices have different sizespublic void multiplyReplace(FieldElement scalar)
scalar -
public void multiplyReplace(Matrix anotherMatrix)
throws InvalidOperationException
InvalidOperationException - if the matrices have different sizespublic void addReplace(FieldElement scalar)
scalar - public void addReplace(Matrix anotherMatrix)
InvalidOperationException - if the matrices have different sizespublic void subtractReplace(FieldElement scalar)
scalar - public void subtractReplace(Matrix anotherMatrix)
InvalidOperationException - if the matrices have different sizespublic Matrix and(Matrix anotherMatrix)
anotherMatrix -
InvalidOperationException - if the matrices have different sizespublic Matrix or(Matrix anotherMatrix)
anotherMatrix -
InvalidOperationException - if the matrices have different sizespublic Matrix not()
public Matrix lt(Matrix anotherMatrix)
anotherMatrix -
InvalidOperationException - if the matrices have different sizespublic Matrix lt(FieldElement scalar)
scalar -
public Matrix le(Matrix anotherMatrix)
anotherMatrix -
InvalidOperationException - if the matrices have different sizespublic Matrix le(FieldElement scalar)
scalar -
public Matrix gt(Matrix anotherMatrix)
anotherMatrix -
InvalidOperationException - if the matrices have different sizespublic Matrix gt(FieldElement scalar)
scalar -
public Matrix ge(Matrix anotherMatrix)
anotherMatrix -
InvalidOperationException - if the matrices have different sizespublic Matrix ge(FieldElement scalar)
scalar -
public Matrix eq(Matrix anotherMatrix)
anotherMatrix -
InvalidOperationException - if the matrices have different sizespublic Matrix eq(FieldElement scalar)
scalar -
public Matrix ne(Matrix anotherMatrix)
anotherMatrix -
InvalidOperationException - if the matrices have different sizespublic Matrix ne(FieldElement scalar)
scalar -
public void applyReplace(MonadicOperator fun)
fun - the function to apply
public Matrix apply(MonadicOperator fun)
fun - the function to apply
public void applyReplace(Matrix anotherMatrix,
DyadicOperator fun)
anotherMatrix - fun - the function to apply
public Matrix apply(Matrix anotherMatrix,
DyadicOperator fun)
anotherMatrix - fun - the function to apply
public void applyReplace(FieldElement scalar,
DyadicOperator fun)
scalar - fun - the function to apply
public Matrix apply(FieldElement scalar,
DyadicOperator fun)
scalar - fun - the function to apply
public Matrix arrayMultiply(Matrix anotherMatrix)
throws InvalidOperationException
anotherMatrix -
InvalidOperationException - if the matrices have different sizespublic void setAll(FieldElement newEntry)
newEntry - the FieldElementpublic FieldElement sum()
public FieldElement mean()
public FieldElement min()
public FieldElement max()
public Vector sumRows()
public Vector sumCols()
public Vector meanRows()
public Vector meanCols()
public Vector toVector()
throws InvalidOperationException
InvalidOperationException - if number of rows not equal to one
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||