|
The Encog Project | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.encog.matrix.Matrix
public class Matrix
This class implements a mathematical matrix. Matrix math is very important to neural network processing. Many of the neural network classes make use of the matrix classes in this package.
| Constructor Summary | |
|---|---|
Matrix(boolean[][] sourceMatrix)
Construct a bipolar matrix from an array of booleans. |
|
Matrix(double[][] sourceMatrix)
Create a matrix from an array of doubles. |
|
Matrix(int rows,
int cols)
Create a blank array with the specified number of rows and columns. |
|
| Method Summary | |
|---|---|
void |
add(int row,
int col,
double value)
Add a value to one cell in the matrix. |
void |
add(Matrix matrix)
Add the specified matrix to this matrix. |
void |
clear()
Set all rows and columns to zero. |
Matrix |
clone()
Create a copy of the matrix. |
static Matrix |
createColumnMatrix(double[] input)
Turn an array of doubles into a column matrix. |
Persistor |
createPersistor()
Create a Persistor for this object. |
static Matrix |
createRowMatrix(double[] input)
Turn an array of doubles into a row matrix. |
boolean |
equals(Matrix matrix)
Check to see if this matrix equals another, using default precision. |
boolean |
equals(Matrix matrix,
int precision)
Compare to matrixes with the specified level of precision. |
int |
fromPackedArray(java.lang.Double[] array,
int index)
Create a matrix from a packed array. |
double |
get(int row,
int col)
Read the specified cell in the matrix. |
Matrix |
getCol(int col)
Read one entire column from the matrix as a sub-matrix. |
int |
getCols()
Get the columns in the matrix. |
java.lang.String |
getDescription()
|
java.lang.String |
getName()
|
Matrix |
getRow(int row)
Get the specified row as a sub-matrix. |
int |
getRows()
Get the number of rows in the matrix. |
int |
hashCode()
Compute a hash code for this matrix. |
boolean |
isVector()
Determine if the matrix is a vector. |
boolean |
isZero()
Return true if every value in the matrix is zero. |
void |
multiply(double value)
Multiply every value in the matrix by the specified value. |
void |
set(double value)
Set every value in the matrix to the specified value. |
void |
set(int row,
int col,
double value)
Set an individual cell in the matrix to the specified value. |
void |
setDescription(java.lang.String description)
Set the description for this object. |
void |
setName(java.lang.String name)
Set the name of this object. |
int |
size()
Get the size of the array. |
double |
sum()
Sum all of the values in the matrix. |
java.lang.Double[] |
toPackedArray()
Convert the matrix into a packed array. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Matrix(boolean[][] sourceMatrix)
sourceMatrix - The booleans to create the matrix from.public Matrix(double[][] sourceMatrix)
sourceMatrix - An array of doubles.
public Matrix(int rows,
int cols)
rows - How many rows in the matrix.cols - How many columns in the matrix.| Method Detail |
|---|
public static Matrix createColumnMatrix(double[] input)
input - A double array.
public static Matrix createRowMatrix(double[] input)
input - A double array.
public void add(int row,
int col,
double value)
row - The row to add to.col - The column to add to.value - The value to add to the matrix.public void add(Matrix matrix)
matrix - The matrix to add.public void clear()
public Matrix clone()
clone in interface EncogPersistedObjectclone in class java.lang.Objectpublic Persistor createPersistor()
createPersistor in interface EncogPersistedObjectpublic boolean equals(Matrix matrix)
matrix - The other matrix to compare.
public boolean equals(Matrix matrix,
int precision)
matrix - The other matrix to compare to.precision - How much precision to use.
public int fromPackedArray(java.lang.Double[] array,
int index)
array - The packed array.index - Where to start in the packed array.
public double get(int row,
int col)
row - The row to read.col - The column to read.
public Matrix getCol(int col)
col - The column to read.
public int getCols()
public java.lang.String getDescription()
getDescription in interface EncogPersistedObjectpublic java.lang.String getName()
getName in interface EncogPersistedObjectpublic Matrix getRow(int row)
row - The row to get.
public int getRows()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean isVector()
public boolean isZero()
public void multiply(double value)
value - The value to multiply the matrix by.public void set(double value)
value - The value to set the matrix to.
public void set(int row,
int col,
double value)
row - The row to set.col - The column to set.value - The value to be set.public void setDescription(java.lang.String description)
setDescription in interface EncogPersistedObjectdescription - the description to setpublic void setName(java.lang.String name)
EncogPersistedObject
setName in interface EncogPersistedObjectname - the name to setpublic int size()
public double sum()
public java.lang.Double[] toPackedArray()
public java.lang.String toString()
toString in class java.lang.Object
|
The Encog Project | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||