|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcomirva.data.DataMatrix<T>
public class DataMatrix<T>
This class implements a data matrix containing double values. The data structure is created using a Vector of Vectors.
Constructor Summary | |
---|---|
DataMatrix()
Creates an empty DataMatrix-instance and initializes rows- and columns-Vectors. |
|
DataMatrix(int rows,
int cols)
Creates an empty DataMatrix-instance and with rows rows and
cols cols. |
|
DataMatrix(java.lang.String name)
Creates an empty DataMatrix-instance, initializes rows- and columns-Vectors, and sets the name of the DataMatrix to the name argument. |
Method Summary | |
---|---|
void |
addRowValues(java.util.Vector data,
int row)
Adds the values of the Vector data
to the row-values of the matrix indicated by the argument row . |
void |
addValue(T value)
Inserts the Double-instance value into the DataMatrix-instance at the current row. |
void |
addValue(T value,
boolean boolNewRow)
Inserts the Double-instance value into the DataMatrix-instance. |
void |
addValue(T value,
int row)
Inserts the Double-instance value into the DataMatrix-instance
at row row. |
java.lang.Object |
clone()
Implements the clone() function, so we can easily produce copies of DataMatrices. vecColCurrent set to the Vector which represents the first row. |
java.util.Vector |
getColumn(int col)
Returns the Vector of the column given by the argument col . |
java.lang.String |
getName()
Returns the name of the DataMatrix. |
int |
getNumberOfColumns()
Returns the number of columns in the DataMatrix. |
int |
getNumberOfRows()
Returns the number of rows in the DataMatrix. |
java.util.Vector |
getRow(int row)
Returns the Vector of the row given by the argument row . |
java.lang.Double |
getValueAtPos(int row,
int col)
Returns the value of the element that can be found at column col
and row row in the DataMatrix-instance. |
boolean |
isBooleanMatrix()
Checks whether the DataMatrix contains only the values 0 and 1. |
void |
normalize(double lowerBound,
double upperBound)
Normalizes the DataMatrix linearly using the complete data matrix as scope. |
void |
normalize(double lowerBound,
double upperBound,
boolean isLinear)
Normalizes the DataMatrix using the complete data matrix as scope. |
void |
normalize(double lowerBound,
double upperBound,
boolean isLinear,
int scope)
Normalizes the DataMatrix. |
void |
printMatrix()
Prints the DataMatrix-instance to java.lang.System.out . |
void |
removeLastAddedElement()
Removes the latest added Vector in the DataMatrix. |
void |
setName(java.lang.String name)
Sets the name of DataMatrix to the value of the parameter name . |
void |
setRowValues(java.util.Vector data,
int row)
Sets a specific row in the DataMatrix. |
void |
setValueAtPos(java.lang.Double value,
int row,
int col)
Sets the value at a specific position of the DataMatrix-instance. |
void |
startNewRow()
Starts a new row in the DataMatrix. |
void |
startNewRow(int count)
Starts count new rows in the DataMatrix. |
double[][] |
toDoubleArray()
Returns a double[][] representation of the DataMatrix. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataMatrix()
public DataMatrix(java.lang.String name)
name
argument.
name
- a String representing the name of the DataMatrixpublic DataMatrix(int rows, int cols)
rows
rows and
cols
cols. So after the creation of the DataMatrix you can
easily fill the matrix with several setValueAtPos()s.
created by MSt
Method Detail |
---|
public void addValue(T value)
value
into the DataMatrix-instance at the current row.
value
- the Double-instance which should be inserted into the matrixpublic void addValue(T value, boolean boolNewRow)
value
into the DataMatrix-instance.boolNewRow
is true
, a new row is created and value
is inserted
as first element into the new row. If boolNewRow
is false
, value
is inserted into the current row.
value
- the Double-instance which should be inserted into the matrixboolNewRow
- a boolean indicating if value
should be inserted into a new row or into the current rowpublic void addValue(T value, int row)
value
into the DataMatrix-instance
at row row. It is inserted in the Row-Vector.
- Parameters:
row
- the row into which the value is inserted
created by MSt
public void startNewRow()
public void startNewRow(int count)
count
new rows in the DataMatrix.
count
- the number of new rows to be inserted into the DataMatrix
created by MSpublic void removeLastAddedElement()
MatrixDataFileLoaderThread
.
public double[][] toDoubleArray()
public void printMatrix()
java.lang.System.out
.
public java.lang.Double getValueAtPos(int row, int col)
col
and row row
in the DataMatrix-instance.
row
- the row of the requested value in the matrixcol
- the column of the requested value in the matrix
public java.util.Vector getRow(int row)
row
.
row
- the row in the matrix that should be returned as a Vector
public java.util.Vector getColumn(int col)
col
.
col
- the column in the matrix that should be returned as a Vector
public void setValueAtPos(java.lang.Double value, int row, int col) throws SizeMismatchException
value
- a Double representing the valuerow
- the row within the DataMatrix of the value that should be setcol
- the column within the DataMatrix of the value that should be set
SizeMismatchException
public void setRowValues(java.util.Vector data, int row) throws SizeMismatchException
data
is inserted at row row
.
The original data is discarded.
data
- a Vector containing the data to be insertedrow
- the row where the data is inserted
SizeMismatchException
public void addRowValues(java.util.Vector data, int row) throws SizeMismatchException
data
to the row-values of the matrix indicated by the argument row
.
data
- a Vector containing the values to be addedrow
- the row indicating the position where the values are added
SizeMismatchException
public void normalize(double lowerBound, double upperBound)
lowerBound
- the lower bound of the projection rangeupperBound
- the upper bound of the projection rangepublic void normalize(double lowerBound, double upperBound, boolean isLinear)
lowerBound
- the lower bound of the projection rangeupperBound
- the upper bound of the projection rangeisLinear
- linear or logarithmic normalizationpublic void normalize(double lowerBound, double upperBound, boolean isLinear, int scope)
lowerBound
- the lower bound of the projection rangeupperBound
- the upper bound of the projection rangeisLinear
- linear or logarithmic normalizationscope
- indicates whether the normalization scope is the complete data matrix, normalization is performed for every row, or for every column separatelypublic int getNumberOfRows()
public boolean isBooleanMatrix()
true
is returned, if not, false
.
true if the instance of DataMatrix only contains the values 0 and 1,
false otherwise
public int getNumberOfColumns()
public void setName(java.lang.String name)
name
.
name
- the name that is to be given to the matrixpublic java.lang.String getName()
public java.lang.Object clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |